Goal: Build a local-first hybrid code-memory system for coding agents. Symbols, occurrences, and relations are the semantic spine. Chunks are retrieval/context-packing projections only.
Architecture rules:
symbol_uidis the primary semantic identity. It is a deterministic declaration key derived fromlanguage,kind,canonical_name,signature_norm, andcontainer_uid. It is stable across re-parses of the same declaration but is NOT refactor-durable — it changes when the canonical name, signature, container, or kind changes. Usecode_index update --rename-map file.jsonto migrate identity across explicit refactors (preservessymbol_pkand downstream FK references).chunk_uidis secondary.- Prefer semantic source order:
- native semantic indexer / SCIP emitter / compiler or language-server-backed source
- Tree-sitter
- Universal Ctags JSON
- heuristic text chunker
- SQLite is the local control plane, not the only search path.
- For literal/path/regex search, use a lexical fast path first.
- Structural search is first-class.
- Tree-sitter is for syntax, AST querying, chunking, and fallback, not the highest-authority semantic source when better sources exist.
- Keep v1 lineage focused on files, types, functions, and methods.
- Use one shared pipeline for init/update/watch.
- JSON-first CLI output.
Working rules:
- Inspect the actual repo before locking runtime, parser, or dependency choices.
- Prefer the existing repo's dominant language/tooling unless there is a strong reason not to.
- Implement thin vertical slices, not a big-bang rewrite.
- Run targeted verification before claiming completion.
- Update docs when commands, schema, or workflow change.
- Be explicit about unsupported languages or partial implementations.
Expected CLI surface:
code_index initcode_index update [--files ...]code_index watchcode_index grepcode_index symbolcode_index querycode_index impactcode_index testscode_index doctorcode_index mcp-servecode_index branch {list,diff,files,impact,compare}— git branch comparison with index cross-referencecode_index workspace {init,add,remove,list,status,query,graph}— multi-repo workspace management
Architecture notes:
- Command modules can export
register_parser(subparsers)socli_parser.pystays slim as the surface grows.branch_cmdandworkspace_cmdalready use this pattern; older commands will migrate over time. - The graph HTTP server uses a lightweight
Router/Routeabstraction (commands/graph_server_router.py) instead of long if/else chains. Routes match method + path with{param}extraction and are resolved in registration order.
Issues and PRDs are tracked in GitHub Issues for mfethe1/memory-network. See docs/agents/issue-tracker.md.
The canonical triage label strings are used unchanged. See docs/agents/triage-labels.md.
This is a single-context repo with CONTEXT.md at the root. See docs/agents/domain.md.