-
Notifications
You must be signed in to change notification settings - Fork 1
systems context packs
Bryan edited this page Jun 13, 2026
·
1 revision
Active contributors: Bryan
Context packs are compact bundles of code references for agents. src/lode/context.py searches indexed nodes, ranks them, budgets must-read items, and attaches graph neighbors for the strongest hits.
src/lode/context.py # context pack construction
src/lode/storage.py # search and neighbor queries
tests/test_lode.py # context command tests
| Name | File | Description |
|---|---|---|
build_context_pack() |
src/lode/context.py |
Builds the response object for a query. |
context_item() |
src/lode/context.py |
Converts a node into a must-read item. |
compact_neighbors() |
src/lode/context.py |
Converts neighbor rows into compact edge summaries. |
context_rank() |
src/lode/context.py |
Pushes external placeholders below local code. |
summarize_hits() |
src/lode/context.py |
Produces a short result summary. |
graph LR
Query --> Search[search_nodes]
Search --> Rank[context_rank]
Rank --> Budget[budget must_read]
Rank --> Related[get_neighbors]
Budget --> Pack[context pack JSON]
Related --> Pack
build_context_pack() uses repo_filter() and search_nodes() from src/lode/storage.py, then sorts by context_rank(). It builds must_read entries until the token budget is used and includes related incoming/outgoing graph summaries for the top five hits.
- The CLI exposes this as
lode contextfromsrc/lode/cli.py. - The daemon exposes this as
POST /contextfromsrc/lode/daemon.py. - Storage provides FTS search and graph neighbors through
src/lode/storage.py.
Tune ranking in context_rank() or budget estimation in estimate_item_cost() in src/lode/context.py. If the response shape changes, update tests in tests/test_lode.py and downstream API docs in docs/api/loded.md if daemon responses change.
| File | Purpose |
|---|---|
src/lode/context.py |
Context pack assembly. |
src/lode/storage.py |
Search and neighbor helpers. |
src/lode/cli.py |
CLI command handler. |
src/lode/daemon.py |
HTTP endpoint. |