Skip to content

Commit c167bea

Browse files
committed
fix: improve token usage with new full mode
1 parent 8b19c54 commit c167bea

6 files changed

Lines changed: 330 additions & 194 deletions

.archcore/.sync-state.json

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -563,36 +563,6 @@
563563
"target": "mcp/tags-implementation.plan.md",
564564
"type": "related"
565565
},
566-
{
567-
"source": "mcp/search-documents-implementation.plan.md",
568-
"target": "mcp/mcp-server-starts-without-archcore-dir.adr.md",
569-
"type": "related"
570-
},
571-
{
572-
"source": "mcp/search-documents-implementation.plan.md",
573-
"target": "mcp/no-absolute-paths-in-mcp-errors.rule.md",
574-
"type": "related"
575-
},
576-
{
577-
"source": "mcp/search-documents-implementation.plan.md",
578-
"target": "mcp/no-list-tags-tool.adr.md",
579-
"type": "related"
580-
},
581-
{
582-
"source": "mcp/search-documents-implementation.plan.md",
583-
"target": "mcp/search-documents.spec.md",
584-
"type": "related"
585-
},
586-
{
587-
"source": "mcp/search-documents-implementation.plan.md",
588-
"target": "mcp/tag-update-semantics.rule.md",
589-
"type": "related"
590-
},
591-
{
592-
"source": "mcp/search-documents-implementation.plan.md",
593-
"target": "mcp/tags-implementation.plan.md",
594-
"type": "related"
595-
},
596566
{
597567
"source": "mcp/search-documents-matching-not-presentation.adr.md",
598568
"target": "mcp/mcp-server-starts-without-archcore-dir.adr.md",
@@ -608,11 +578,6 @@
608578
"target": "mcp/no-list-tags-tool.adr.md",
609579
"type": "related"
610580
},
611-
{
612-
"source": "mcp/search-documents-matching-not-presentation.adr.md",
613-
"target": "mcp/search-documents-implementation.plan.md",
614-
"type": "related"
615-
},
616581
{
617582
"source": "mcp/search-documents-matching-not-presentation.adr.md",
618583
"target": "mcp/search-documents.spec.md",
@@ -628,11 +593,6 @@
628593
"target": "mcp/tags-implementation.plan.md",
629594
"type": "related"
630595
},
631-
{
632-
"source": "mcp/search-documents.spec.md",
633-
"target": "mcp/search-documents-implementation.plan.md",
634-
"type": "implements"
635-
},
636596
{
637597
"source": "code-quality/in-process-mcp-integration-tests.adr.md",
638598
"target": "code-quality/e2e-testing-for-cli.idea.md",

.archcore/mcp/search-documents-implementation.plan.md

Lines changed: 0 additions & 117 deletions
This file was deleted.

.archcore/mcp/search-documents-matching-not-presentation.adr.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,23 @@ Split at an even finer grain: the first tool does search, the second tool takes
103103

104104
## Implementation Notes
105105

106-
- Delivered in Sprint 1 per `.archcore/mcp/search-documents-implementation.plan.md`.
106+
- Delivered in the initial `search_documents` implementation sprint.
107107
- Ranking is computed in Go via the `sort="relevance"` / `sort="mtime"` parameter. Callers MUST NOT re-sort; the tool's order is authoritative.
108108
- Relations enrichment (`incoming_relations` / `outgoing_relations`) is in-tool so callers avoid N extra `list_relations` calls when traversing relation graphs.
109109
- UTF-8 safety and lazy body loading were added post-review based on code-review feedback; both have regression tests.
110110

111+
### Addendum (2026-06): `mode=full` does not cross the matching/presentation line
112+
113+
A later change added a `mode` parameter (`snippets` default / `full`). In `full` mode each result inlines the matched document's body (frontmatter stripped) so a caller can read the doc without a follow-up `get_document`; full mode carries smaller limit bounds (default 3, max 20) to keep one response token-bounded. This decision is unchanged by that addition, and the boundary is worth restating explicitly:
114+
115+
- **`mode=full` returns raw data, not opinionated layout.** It does none of the things this ADR forbids — no category grouping, no top-N-per-category, no type-to-section mapping, no markdown rendering, no empty-state copy, no guide routing. It simply attaches the unmodified body. "Presentation" here means *opinionated, product-evolving layout decisions*; inlining a raw body is neither opinionated nor likely to churn.
116+
- **It does overlap `get_document` — deliberately.** The "Current State" framing above treated matching (`search_documents`) and single-doc fetch (`get_document`) as cleanly separate. `mode=full` softens that line: discover-and-read can now happen in one call, and the tool description steers callers toward `search_documents(mode=full)` over `search + get_document` when the goal is to read the matches. This was accepted as a token-efficiency convenience (one round-trip instead of N+1), not a re-architecture — `get_document` remains the right tool when the caller already knows the exact path and needs the relation graph for a single doc.
117+
- **Bounds protect the primitive's character.** The small full-mode limits keep the tool from becoming a bulk-export surface; it stays a *matching* tool that can optionally hand back the matched bodies, not a documents dump.
118+
119+
If full mode ever grows opinionated formatting (sectioning, rendering, summarization), that WOULD cross this ADR's line and should be revisited as a new decision.
120+
111121
## References
112122

113123
- Tool contract: `.archcore/mcp/search-documents.spec.md`
114-
- Implementation plan: `.archcore/mcp/search-documents-implementation.plan.md`
115124
- Implementation: @internal/mcp/tools/search_documents.go
116125
- Related MCP decisions: `.archcore/mcp/no-list-tags-tool.adr.md`, `.archcore/mcp/mcp-server-starts-without-archcore-dir.adr.md`

0 commit comments

Comments
 (0)