software-brain-engine

Stop Sending Entire Codebases To AI

AI coding tools are useful, but they often waste context before they understand the actual change.

You ask for something focused:

Fix the middleware behavior around createUser.

The assistant starts by reading broad folders:

controllers/
services/
dto/
middleware/
routes/
tests/

Some of that context is useful. A lot of it is not.

That is the problem I am trying to solve with Software Brain Engine, or SBE.

SBE is an open-source Rust CLI that turns TypeScript/TSX repositories into semantic graphs. The goal is to retrieve the code that matters before an LLM reads source.

The Basic Idea

Instead of sending the full repository, ask the codebase for graph context:

sbe scan ./repo
sbe graph createUser --json
sbe impact createUser --json

SBE returns:

This is not magic compression. It is graph-guided context selection.

Why This Matters

LLMs have limited context and limited architectural awareness. When a coding assistant reads unrelated files, three things happen:

  1. Tokens are wasted.
  2. The model has more irrelevant context to reason over.
  3. Real dependencies can still be missed.

For focused changes, the better workflow is:

query graph -> retrieve relevant ranges -> send focused context -> edit code

Example Demo: Hono Middleware

I added a realistic demo based on honojs/hono, a TypeScript web framework.

The simulated issue:

Middleware post-processing after await next() should still mutate an error response created by onError.

Normal assistant flow:

Search middleware
Search next
Search onError
Open context, dispatch, router, helper, tests
Infer lifecycle manually

Estimated broad context:

12-16 files
~22k-30k tokens

SBE flow:

sbe scan ./hono
sbe graph compose --json
sbe impact compose --json

Focused context:

src/compose.ts:18-102
src/hono-base.ts:210-275
src/context.ts:120-175
src/types.ts:40-88
src/helper/factory/index.ts:12-44
src/compose.test.ts:1-90
src/hono-base.test.ts:300-370

Estimated focused context:

5-7 files
~5k-7k tokens

That is roughly a 68-78% context reduction for this demo shape.

Important: this is a simulated reproducible-concept demo, not a claim that Hono has this bug. Before opening an upstream issue or PR, the test must be reproduced against a real Hono commit.

What SBE Does Today

Current alpha scope:

It skips common unwanted folders by default:

node_modules
.git
.sbe
dist
build
target
.next
coverage

What SBE Does Not Do Yet

SBE is production-alpha, not a finished static analysis platform.

Current limitations:

I want the benchmark to show misses honestly. Small projects can show 0% savings if metadata overhead is larger than the focused code slice.

Why Rust?

SBE is a CLI and local indexer. Rust is a good fit because it gives:

The project is organized as a Cargo workspace:

scanner -> parser -> storage -> graph -> impact -> query -> cli

Feedback Wanted

I am looking for feedback from:

The most useful feedback:

I tried SBE on this repo, and the graph was wrong here.

GitHub:

https://github.com/sarathkumar1207/software-brain-engine

Website:

https://sarathkumar1207.github.io/software-brain-engine/

Downloads:

https://github.com/sarathkumar1207/software-brain-engine/releases/latest

Platform artifacts:

Windows x64 : sbe-0.2.0-windows-x64.msi
Linux x64   : sbe-linux-x64.tar.gz
macOS ARM64 : sbe-macos-arm64.tar.gz