Comment directives → context graph

Cut the tree. Keep the point.

Lucider reads ai-context comments in JavaScript and TypeScript and builds a drift-aware graph. You query a symbol; Claude or Codex gets a pack — not a 150k-token dump.

RAW DUMP 153 215 tok
src/hono-base.ts
export class Hono {
  fetch = (request, …) => { … }
  #dispatch(request, …) {
    const result = this.router.match(…)
src/compose.ts
export const compose = (middleware, …) => {
  return (context, next) => { … }
src/router.ts
export type Result<T> = [[ … ], …]
// plus 120 other files
Hono pipeline · quality 16/16 · whole corpus
LUCIDER PACK 2 156 tok
dispatch / #dispatch body on · matchResult + compose skip
ComposeStack ai-context: onion in-then-out
Result ParamIndexMap vs Params map
Same task · quality 16/16 · ~70× smaller

Four comments. A graph.

grammar 1.1.0

// ai-context: Issues a session token after password verify
// ai-body: off
// ai-deps: hashPassword, issueToken
function login(email, password) { … }
// ai-ignore — drop secrets and noise from the graph

Tied quality. Smaller packs.

cl100k_base · isolated agents · 2026-08-30

Zod helper

parseWithDefault — don’t throw, return a default.

1 406 vs 4 399 vs 145 633 · 13/13

Zod graph walk

listConstraints — cycle-safe checks, abort, format.

4 520 vs 13 183 vs 145 941 · 16/16

Hono pipeline

Flatten match, onion order, HEAD rewrite.

2 156 vs 7 124 vs 153 215 · 16/16

Method, index-dump trap, and limitations are below. Canonical write-up: performance.md.

Frozen run · 2026-08-30

Performance analysis

Tokenizer cl100k_base · isolated Cursor agents · Aider 0.86.2 as a repo-map baseline only.

On three coding tasks, correctness was tied. Every arm hit the full rubric. Lucider query packs were about 3× smaller than Aider chat+map and 30–100× smaller than concatenating the corpus.

Task Raw Aider Lucider pack Quality
Zod parseWithDefault 145 633 4 399 1 406 13/13
Zod listConstraints 145 941 13 183 4 520 16/16
Hono pipeline 153 215 7 124 2 156 16/16

Do not dump the index

The catalog belongs on disk. Pasting a full Lucider index into the model loses to a small repo map on unlabeled trees:

Corpus Raw Aider map Lucider body-off Lucider body-on
Shop (annotated) 613 603 300 901
Zod v4/core (unlabeled) 145 259 2 138 37 086 138 762
Lucider src/ 11 151 2 032 2 147 11 960

--default-body on is right for a query slice. It is wrong for “paste the whole digest.” Use lucider src --query login --depth 1.

Method

Each agent received one context file. Same hidden rubric. Raw = concatenated production sources. Aider = focus files plus --show-repo-map --map-tokens 1024. Lucider = annotated index slices plus --query / --depth — never the full unlabeled graph.

Corpora: Zod @93f3ab3 v4/core (21 files); Hono @e2740d5 production src/ (123 files).

Limitations

Install from npm

Node 18+ · lucider

npm install -g lucider
# or: npx lucider …

lucider src --query login --depth 1
# catalog on disk — do not paste this into the model
lucider src --out-dir .lucider --default-body off

# pack for Claude / Codex
lucider src --query login --depth 1 --md pack.md