Browse the documentation
CAP-18: Symbol outline for packed context
- ID:
CAP-18 - Title: Symbol outline for packed context
- Lead:
capillary - Touches:
drosera,bloom - Horizon: later
- Milestone: M8
- CLI phase: none
- Status:
proposed - Claim:
planned - Depends on:
CAP-05
Why
When exploring a large workspace under tight token budgets, reading whole files wastes packet capacity on implementation details when callers only need structural navigation: exported bindings, functions, classes, document headings, or JSON object keys with line ranges.
Adding a zero-dependency symbol outline extractor inside capillary keeps packed context compact while obeying retrieval honesty: any file format outside the supported parser set stays explicitly unknown instead of emitting an empty symbol list.
What it does
- Zero-dependency parsers in
capillary: Extracts structural outlines from caller-supplied relative path, format hint, and UTF-8 source text without external parser dependencies:- JavaScript (
.js,.mjs,.cjs): extractsexports(named, default, re-exports),functions(declarations and top-level function bindings), andclasses, each with symbol name, kind, and 1-based{ startLine, endLine }range. - Markdown (
.md): extracts headings with level (1to6), heading text, and 1-based line range. - JSON (
.json): validates structure and extracts top-level (and optionally depth-bounded) keys with 1-based line ranges; malformed JSON reportsunknown(read-failedorparse-failed), never an empty key list.
- JavaScript (
- Packet outline section: Attaches extracted outlines as a structured section inside
CAP-05packed context outputs (markdown,tagged, andjsonrenderers), keeping relative paths only, source SHA-256 digests, and the untrusted-content boundary around extracted names and headings. - Explicit
unknownfallback: For any file language or format outside JavaScript, Markdown, and JSON (or for binary/unparseable content), returnsstatus: 'unknown'with an explicit reason instead of an empty outline array. - Drosera tool face: Defines
workspace.file.outline.read(effect: 'read',ownerGate: false) indroserawithCAP-03input and output schemas. - Bloom executor: Reads workspace file bytes inside the workspace root (no symlink follow by default) and passes content to
capillary’s outline extractor for direct tool calls and outline-mode context packing.
Contract touchpoints
docs/contracts/retrieval.md: ExtendsCAP-05packet output additively with an optionaloutlinessection carrying relativeoriginRef, 64-hex SHA-256 source digest,untrusted: trueframing, and explicitunknownrecords whenever a file cannot be parsed or its language is unsupported.
Tool IDs and events
Tool IDs
| Tool ID | Effect | Owner gate | Purpose |
|---|---|---|---|
workspace.file.outline.read |
read |
false |
Extract JS exports, functions, and classes, Markdown headings, or JSON keys with line ranges, or return unknown |
Events
| Event | Emitted by | Payload summary |
|---|---|---|
| (none added) | bloom |
Reuses CAP-05 context.packet event digests and counts when outlines are included in a pack |
Acceptance tests
js-outline-extracts-exports-functions-classes-with-line-ranges: Extracts exports, functions, and classes with accurate 1-based line ranges from JavaScript text with zero runtime dependencies.markdown-outline-extracts-headings-with-levels-and-lines: Extracts Markdown headings with heading levels and 1-based line numbers.json-outline-extracts-keys-with-line-ranges: Extracts JSON keys with line ranges and reportsunknownwhen JSON input is malformed.unsupported-language-reports-unknown-never-empty: Any non-JS, non-Markdown, non-JSON format or binary payload reportsstatus: 'unknown'with reason and never returns an empty symbol outline as success.outline-section-uses-relative-paths-and-untrusted-envelope: Packed outline sections emit relative paths only, record source digests, and sit inside the untrusted-content envelope.workspace-file-outline-read-validates-and-executes:workspace.file.outline.readvalidates underseedgrammar, registers indrosera, and executes insidebloom’s workspace root guard.
Slices
CAP-18.1(capillary,M8,proposed): Zero-dependency JS, Markdown, and JSON symbol outline parser and unknown fallback.CAP-18.2(drosera,M8,proposed): Outline reader tool face definition and schema.CAP-18.3(bloom,M8,proposed): Symbol outline executor and packer wiring.
Non-goals
- Runtime dependencies on AST or tree-sitter parser packages.
- Supporting languages beyond JavaScript, Markdown, and JSON in this capability (unsupported formats stay
unknown). - Cross-file type resolution, semantic symbol linking, or code indexing.
- Filesystem traversal inside
capillary.
Family rules and conflicts
- Zero runtime dependencies: Outlines are parsed solely with zero-dependency JavaScript in
capillary. - Unknown stays unknown: Unsupported file extensions and malformed files never masquerade as empty outlines.
- Province separation:
capillaryperforms pure parsing and packet assembly;droseraowns theworkspace.file.outline.readface;bloomperforms workspace reads and invokes the packer;seedvalidates the tool ID andCAP-03schemas.
Open owner decisions
None new for CAP-18; inherits CAP-05 packer decisions (D5, D6, D9, D10, D14) and CAP-03 schema parity (D4).
Evidence
None yet (status: proposed, claim: planned). Code, test receipts, and commit SHAs will be recorded here as slices CAP-18.1 through CAP-18.3 land.
Changes
2026-11-23: Initial capability specification drafted forCAP-01timeline scaffold.2026-11-23: StandardizedHorizon: later, addedM8slice milestones, and aligned inheritedCAP-05decision references (CAP-01, review fixes).