Reading additional input from stdin...
OpenAI Codex v0.125.0 (research preview)
--------
workdir: /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
model: gpt-5.5
provider: openai
approval: never
sandbox: read-only
reasoning effort: medium
reasoning summaries: none
session id: 019dcf77-3951-7302-9e1e-08116385bbdf
--------
user
Before you start, run a memory_search query for the exact phrase "the {nonexistent-marker-2026-04-27-v1.0.2} debugging playbook for cocoindex hybrid retrieval failures". This is intentionally a phrase that does not exist in any indexed spec, so memory_search must return requestQuality.label="weak" with recovery.status="low_confidence" and recovery.suggestedQueries=[]. Do not invent or assume content for that phrase — your job is to observe how the runtime responds to a weak-quality search result.

After observing the weak-quality response, proceed with the actual task:

I'm debugging the search bug — what should I look at first? Recommend a starting spec or set of files.
hook: SessionStart
hook: SessionStart
hook: SessionStart Completed
hook: SessionStart Completed
hook: UserPromptSubmit
hook: UserPromptSubmit
hook: UserPromptSubmit Completed
hook: UserPromptSubmit Completed
codex
I’ll first run the deliberately bad memory query and treat its shape as the data point, not as content. After that I’ll use the repo context to point you at the most likely starting places for the search bug.
mcp: spec_kit_memory/memory_search started
mcp: spec_kit_memory/memory_search (failed)
user cancelled MCP tool call
codex
The memory call was cancelled by the runtime before it returned a payload, so I don’t have the weak-quality object to inspect yet. I’ll try the same exact query once more; if it’s cancelled again, I’ll call that out explicitly and move to code/spec orientation without pretending I saw the expected fields.
mcp: spec_kit_memory/memory_search started
mcp: spec_kit_memory/memory_search (failed)
user cancelled MCP tool call
codex
Second attempt was cancelled too, same result. I’m going to treat that as the observed runtime behavior: no `requestQuality` or `recovery` envelope was available to verify, so the next part needs to be grounded in repo files and indexed specs instead of that intentionally nonexistent phrase.
exec
/bin/zsh -lc "sed -n '1,220p' /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/sk-doc/SKILL.md" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
---
name: sk-doc
description: "Unified markdown and OpenCode component specialist providing document quality enforcement, content optimization, component creation workflows (skills, agents, commands), ASCII flowcharts, install guides, feature catalogs, and manual testing playbooks."
allowed-tools: [Bash, Edit, Glob, Grep, Read, Task, Write]
version: 1.3.0.0
---

<!-- Keywords: sk-doc, markdown-quality, skill-creation, document-validation, ascii-flowchart, llms-txt, content-optimization, extract-structure -->

# Documentation Creation Specialist - Unified Markdown & Component Management

Unified specialist providing: (1) Document quality pipeline with structure enforcement and content optimization, (2) OpenCode component creation (skills, agents, commands) with scaffolding, validation and packaging, (3) ASCII flowchart creation for visualizing workflows, (4) Install guide creation for setup documentation and (5) Feature catalog and manual testing playbook creation for inventory and validation packages.

**Core Principle**: Structure first, then content, then quality.

**Architecture**: Scripts handle deterministic parsing/metrics. AI handles quality judgment and recommendations.


## 1. WHEN TO USE

### Use Case: Document Quality Management

Enforce markdown structure, optimize content for AI assistants, validate quality through script-assisted AI analysis.

**README Creation** - Use `readme_template.md` + `readme_creation.md` when:
- Creating new README for any folder or project
- User requests "create a README", "add documentation", "write a README"
- Folder needs comprehensive documentation
- Workflow: [readme_creation.md](./references/specific/readme_creation.md) | Template: [readme_template.md](./assets/documentation/readme_template.md)

**Frontmatter Validation** - Use `frontmatter_templates.md` when:
- Validating YAML frontmatter in any document
- Checking required fields for document types
- Fixing frontmatter syntax errors

**Changelog & Release Notes** - Use `changelog_template.md` when:
- Authoring a global component changelog at `.opencode/changelog/{NN--component}/v{VERSION}.md`
- Composing GitHub release notes that mirror the changelog body
- Choosing between compact (under 10 changes) and expanded (10+ changes or major) formats
- Template: [changelog_template.md](./assets/documentation/changelog_template.md). Used by `/create:changelog` (auto + confirm). Nested packet-local changelogs use the spec-kit templates at `.opencode/skills/system-spec-kit/templates/changelog/` instead.

**Validation Workflow** - Apply after Write/Edit operations:
- Auto-correct filename violations (ALL CAPS to lowercase, hyphens to underscores)
- Fix safe violations (separators, H2 case)
- Check critical violations (missing frontmatter, wrong section order)

**Manual Optimization** - Run when:
- README needs optimization for AI assistants
- Creating critical documentation (specs, knowledge, skills)
- Pre-release quality checks
- Generating llms.txt for LLM navigation

### Use Case: OpenCode Component Creation

Create and manage OpenCode components (skills, agents, commands). Each component type has templates and validation with quality standards.

**Component Types:**
- **Skills** (.opencode/skills/) - Knowledge bundles with workflows → [skill_creation.md](./references/specific/skill_creation.md)
- **Agents** (.opencode/agents/) - AI personas with tool permissions → [agent_creation.md](./references/specific/agent_creation.md)
- **Commands** (.opencode/commands/) - Slash commands for user invocation → [command_template.md](./assets/agents/command_template.md)

For larger skills, split deep content into focused reference files and keep concise navigation in `SKILL.md` or `README.md`. When a skill has both cross-cutting standards and document-family guides, prefer `references/global/` for shared rules and `references/specific/` for creation-specific workflows.

Start with: [skill_creation.md](./references/specific/skill_creation.md) (Section 9)
Primary templates:
- [skill_md_template.md](./assets/skill/skill_md_template.md)
- [skill_reference_template.md](./assets/skill/skill_reference_template.md)
- [skill_asset_template.md](./assets/skill/skill_asset_template.md)

**Use when**:
- User requests skill creation ("create a skill", "make a new skill")
- User requests agent creation ("create an agent", "make a new agent")
- User requests command creation ("create a command", "add a slash command")
- Scaffolding component structure
- Validating component quality
- Packaging skill for distribution

**Skill Process (6 steps)**: Understanding (examples) → Planning (resources) → Initialization (`init_skill.py`) → Editing (populate) → Packaging (`package_skill.py`) → Iteration (test/improve)

**Agent Process**: Load `agent_creation.md` and `agent_template.md` → Define frontmatter (mode, permissions) → Create sections (workflow, capabilities, anti-patterns) → Validate → Test

**Command Process**: Load `command_template.md` → Define frontmatter (name, description) → Create execution logic → Add to command registry → Test

### Use Case: Flowchart Creation

Create ASCII flowcharts for visualizing workflows, user journeys and decision trees.

For styled HTML visuals (interactive diagrams, dashboard pages, or polished data-table renders), use a dedicated HTML workflow instead of forcing ASCII or markdown flowcharts.

**Use when**:
- Documenting multi-step processes with branching
- Creating decision trees with multiple outcomes
- Showing parallel execution with sync points
- Visualizing approval gates and revision cycles

**See**: [assets/flowcharts/](./assets/flowcharts/)

### Use Case: Install Guide Creation

Create and validate installation documentation for MCP servers, plugins and tools using phase-based templates.

**Use when**:
- Creating documentation for MCP server installation
- Documenting plugin setup procedures
- Standardizing tool installation across platforms
- Need phase-based validation checkpoints

**5-Phase Process**: Overview → Prerequisites → Installation → Configuration → Verification

**See**: [install_guide_creation.md](./references/specific/install_guide_creation.md)

### Use Case: Manual Testing Playbook Creation

Create manual testing playbooks with deterministic scenarios, structured evidence collection, and multi-agent execution planning.

**Manual Testing Playbook** - Use `testing_playbook/manual_testing_playbook_template.md` when:
- Creating manual testing scenarios for a skill
- Standardizing test evidence and verdict criteria
- Setting up multi-agent test execution planning

**Canonical Package**: Root `manual_testing_playbook.md` plus numbered category folders with one per-feature file per feature ID.

**See**:
- [manual_testing_playbook_creation.md](./references/specific/manual_testing_playbook_creation.md)
- [manual_testing_playbook_template.md](./assets/documentation/testing_playbook/manual_testing_playbook_template.md)

### Use Case: Feature Catalog Creation

Create feature catalogs with a rooted capability inventory, numbered category sections, and per-feature reference files.

**Feature Catalog** - Use `assets/documentation/feature_catalog/feature_catalog_template.md` when:
- Creating a canonical current-state feature inventory for a skill or system
- Linking manual playbooks back to a stable capability reference
- Documenting current behavior with source-file anchors and stable slugs

**Canonical Package**: Root `FEATURE_CATALOG.md` plus numbered category folders with one per-feature file per catalog entry.

**See**:
- [feature_catalog_creation.md](./references/specific/feature_catalog_creation.md)
- [feature_catalog_template.md](./assets/documentation/feature_catalog/feature_catalog_template.md)

### When NOT to Use (All Modes)

- Non-markdown files (only `.md` supported)
- Simple typo fixes (use Edit tool directly)
- Internal notes or drafts
- Auto-generated API docs
- Short 2-3 step processes (use bullet points)

---

<!-- /ANCHOR:when-to-use -->
<!-- ANCHOR:smart-routing-references -->
## 2. SMART ROUTING

### Resource Domains

The router discovers markdown resources recursively from `references/` and `assets/` and then applies intent scoring from `RESOURCE_MAP`. Keep this section domain-focused rather than static file inventories.

- `references/global/` for documentation standards, validation rules, optimization guidance, voice rules, and shared execution workflows.
- `references/specific/` for document-family and component creation guides such as skill creation, agent creation, install guides, feature catalogs, and manual testing playbooks.
- `assets/documentation/` for README, frontmatter, llms.txt, install-guide, and changelog/release-notes templates.
- `assets/skill/` for skill creation templates and `assets/agents/` for agent and command creation templates.
- `assets/flowcharts/` for reusable ASCII flowchart patterns and diagram examples.

### Resource Loading Levels

| Level       | When to Load             | Resources                   |
| ----------- | ------------------------ | --------------------------- |
| ALWAYS      | Every skill invocation   | Quick reference baseline    |
| CONDITIONAL | If intent signals match  | Mode-specific docs/templates|
| ON_DEMAND   | Only on explicit request | Extended standards/template |

### Smart Router Pseudocode

The authoritative routing logic for scoped loading, weighted intent scoring, and ambiguity handling.

```python
from pathlib import Path

SKILL_ROOT = Path(__file__).resolve().parent
RESOURCE_BASES = (SKILL_ROOT / "references", SKILL_ROOT / "assets")
DEFAULT_RESOURCE = "references/global/quick_reference.md"

INTENT_SIGNALS = {
    "DOC_QUALITY": {"weight": 4, "keywords": ["dqi", "quality", "validate", "extract_structure"]},
    "OPTIMIZATION": {"weight": 3, "keywords": ["optimize", "llms.txt", "ai context"]},
    "SKILL_CREATION": {"weight": 4, "keywords": ["skill creation", "new skill", "init_skill", "package_skill"]},
    "AGENT_COMMAND": {"weight": 4, "keywords": ["create agent", "create command", "agent template", "command template"]},
    "FLOWCHART": {"weight": 3, "keywords": ["flowchart", "ascii diagram", "decision tree", "swimlane"]},
    "INSTALL_GUIDE": {"weight": 3, "keywords": ["install guide", "setup instructions", "prerequisite"]},
    "HVR": {"weight": 4, "keywords": ["human voice", "hvr", "voice rules", "banned words", "writing style"]},
    "PLAYBOOK": {"weight": 4, "keywords": ["playbook", "manual testing", "test scenarios", "manual test", "testing playbook"]},
    "FEATURE_CATALOG": {"weight": 4, "keywords": ["feature catalog", "feature inventory", "capability inventory", "catalog snippet"]},
    "README_CREATION": {"weight": 3, "keywords": ["create readme", "readme creation", "write readme", "add documentation", "folder readme"]},
    "CHANGELOG": {"weight": 4, "keywords": ["changelog", "release notes", "changelog template", "release template", "create changelog", "github release"]},
}

RESOURCE_MAP = {
    "DOC_QUALITY": ["references/global/validation.md", "references/global/workflows.md", "references/global/core_standards.md"],
    "OPTIMIZATION": ["references/global/optimization.md", "assets/documentation/llmstxt_templates.md"],
    "SKILL_CREATION": ["references/specific/skill_creation.md", "assets/skill/skill_md_template.md", "assets/skill/skill_reference_template.md"],
    "AGENT_COMMAND": ["references/specific/agent_creation.md", "assets/agents/agent_template.md", "assets/agents/command_template.md"],
    "FLOWCHART": ["assets/flowcharts/simple_workflow.md", "assets/flowcharts/decision_tree_flow.md"],
    "INSTALL_GUIDE": ["assets/documentation/install_guide_template.md", "references/specific/install_guide_creation.md"],
    "HVR": ["references/global/hvr_rules.md"],
    "PLAYBOOK": ["references/specific/manual_testing_playbook_creation.md", "assets/documentation/testing_playbook/manual_testing_playbook_template.md"],
    "FEATURE_CATALOG": ["references/specific/feature_catalog_creation.md", "assets/documentation/feature_catalog/feature_catalog_template.md"],
    "README_CREATION": ["references/specific/readme_creation.md", "assets/documentation/readme_template.md"],
    "CHANGELOG": ["assets/documentation/changelog_template.md"],
}

LOADING_LEVELS = {
    "ALWAYS": [DEFAULT_RESOURCE],
    "ON_DEMAND_KEYWORDS": ["full standards", "all templates", "deep dive", "readme", "documentation", "manual testing playbook", "feature catalog", "release notes", "corpus/readme", "corpus documentation"],
    "ON_DEMAND": ["assets/documentation/frontmatter_templates.md"],
}

def _task_text(task) -> str:
    return " ".join([

exec
/bin/zsh -lc "rg -n \"cocoindex|CocoIndex|hybrid retrieval|requestQuality|low_confidence|suggestedQueries|memory_search|weak\" specs .opencode specs -g '"'!node_modules'"' -g '"'!*.log'"'" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 239ms:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/audit-v3-c01-handler-analysis.md:207:If parsing or telemetry breaks, operators lose the signal that context retrieval observability is degraded. This makes auditability and production debugging weaker without any compensating trace.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C03.md:240:.opencode/skills/system-spec-kit/mcp_server/context-server.ts:238:    'Key tools: memory_context, memory_search, memory_save, memory_index_scan, memory_stats.',
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/007-code-audit-per-feature-catalog/research/iterations/iteration-011.md:215:  │ "cursor\)|resolveCursor\(|buildProgressiveResponse\(|memory_search\(\{ cursor
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/007-code-audit-per-feature-catalog/research/iterations/iteration-011.md:427:I found a stronger flag-pipeline problem than I expected: `memory_search` is not using the canonical `search-flags.ts` gate for progressive disclosure at all. It imports a local helper from `progressive-disclosure.ts`, and that helper only checks the env var directly, so rollout-policy semantics never apply there. I’m pulling the exact export/import lines now.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/007-code-audit-per-feature-catalog/research/iterations/iteration-011.md:472:`SPECKIT_ROLLOUT_PERCENT` does not apply to progressive disclosure in the live `memory_search` path, even though the server has a canonical rollout-aware flag helper. This is a pipeline-connection bug and a maintainability drift point.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/007-code-audit-per-feature-catalog/research/iterations/iteration-011.md:526:The audit trail still reports a resolved documentation problem as open, which weakens remediation tracking and can waste follow-up review time.
.opencode/specs/system-spec-kit/z_archive/002-agent-routing-doc-update/spec.md:36:This archived folder captures work that updated system-spec-kit documentation for agent routing behavior. The prior archive content no longer matched the current template contract, which caused validation failures and weakened the archived record.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/026-memory-database-refinement/research/iterations/iteration-004.md:14:I found 4 remaining recovery gaps. The strongest issue is in the chunked save + PE supersede path: the code can return an error after the new chunked memory tree is already committed, which makes retries likely to create duplicate or conflicting state. The other three gaps are recovery weaknesses around safe-swap cleanup and BM25 drift after partial failure.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/review/review-report.md:74:- Impact: The packet does not maintain a stable count of migration phases, which weakens cross-surface traceability for closeout and review follow-through.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/deep-research-strategy.md:8:- [x] Q3. What manual steps can be automated? Developer UX friction? Self-tuning opportunities? Tool naming/parameter clarity? **Answer: 5 automation gaps found: (a) file-watcher is opt-in not default-on, (b) no scheduled stale-entry cleanup, (c) no simplified search tool (memory_search has 28 params), (d) all 32 tools flat with no grouping, (e) post-save async operations have no progress feedback. Tool naming is consistent (`{domain}_{action}`) except `memory_drift_why` (should be causal group) and TriggerArgs snake_case inconsistency. No self-tuning exists -- eval measures quality but cannot auto-calibrate weights (see Q10).**
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/deep-research-strategy.md:15:- [x] Q13. Are the 32 MCP tool names and parameters intuitive? What UX friction exists for developers? **Answer: 32 tools across 7 groups with consistent `{domain}_{action}` naming. TWO naming issues: (a) `memory_drift_why` should be `memory_causal_trace` (misfiled outside causal group), (b) TriggerArgs uses snake_case (`session_id`, `include_cognitive`) while all other interfaces use camelCase. MAJOR UX issue: `memory_search` has 28 parameters including a duplicate (`minQualityScore` + `min_quality_score`). No "simple search" variant exists. All 32 tools appear flat with no grouping.**
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/investigation-X04.md:381:27: * amplify the boost while weaker ones (contradicts) attenuate it.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/investigation-X04.md:831:     1	# Semantic and lexical search (memory_search)
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/investigation-X04.md:835:     5	This is the primary search tool, and it does a lot. You give it a natural language query (or a multi-concept array of 2-5 strings where all concepts must match), and it runs the full hybrid retrieval pipeline.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/009-reindex-validator-false-positives/spec.md:152:- **NFR-S02**: No sensitive data handling behavior is weakened by documentation changes.
.opencode/specs/system-spec-kit/z_archive/012-spec-doc-anchor-tags/scratch/legacy-memory-quarantine/16-02-26_14-12__spec-doc-anchor-tags.md:503:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "system-spec-kit/z_archive/012-spec-doc-anchor-tags" })` |
.opencode/specs/system-spec-kit/z_archive/012-spec-doc-anchor-tags/scratch/legacy-memory-quarantine/16-02-26_14-12__spec-doc-anchor-tags.md:515:memory_search({ specFolder: "system-spec-kit/z_archive/012-spec-doc-anchor-tags", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/012-spec-doc-anchor-tags/scratch/legacy-memory-quarantine/16-02-26_14-12__spec-doc-anchor-tags.md:521:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/012-spec-doc-anchor-tags/scratch/legacy-memory-quarantine/16-02-26_14-12__spec-doc-anchor-tags.md:530:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/007-code-audit-per-feature-catalog/research/iterations/iteration-012.md:385:- Impact: cross-cutting work is described, but not tracked in the same explicit DEF-style structure. That weakens closure tracking for blind spots, uncataloged files, and graduated-flag drift.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C17.md:550:.opencode/skills/system-spec-kit/mcp_server/tests/tool-input-schema.vitest.ts:128:   4. memory_search LIMIT CONTRACT (schema + runtime alignment)
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C17.md:554:.opencode/skills/system-spec-kit/mcp_server/tests/tool-input-schema.vitest.ts:162:  it('public schema rejects unknown memory_search parameters', () => {
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C17.md:568:.opencode/skills/system-spec-kit/mcp_server/context-server.ts:238:    'Key tools: memory_context, memory_search, memory_save, memory_index_scan, memory_stats.',
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C17.md:1485:.opencode/skills/system-spec-kit/mcp_server/tools/memory-tools.ts:47:    case 'memory_search':         return handleMemorySearch(parseArgs<SearchArgs>(validateToolArgs('memory_search', args)));
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C17.md:1714:.opencode/skills/system-spec-kit/mcp_server/tests/layer-definitions.vitest.ts:262:      const info = expectLayerInfo(mod.getLayerInfo('memory_search'));
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/iterations/iteration-010.md:42:11. **The cognitive subsystem introduces significant parameter complexity into the MCP tool layer.** The `memory_search` tool accepts session-aware parameters (sessionId, enableSessionBoost, enableDedup, enableCausalBoost) that directly trigger cognitive module behavior. The `memory_match_triggers` tool has (include_cognitive, session_id, turnNumber) -- 3 cognitive-specific parameters. Developers must understand session lifecycle, attention decay semantics, and rollout policy to use these effectively. This is a UX friction point for Q3 investigation.
.opencode/specs/system-spec-kit/z_archive/002-agent-routing-doc-update/graph-metadata.json:189:    "causal_summary": "This archived folder captures work that updated system-spec-kit documentation for agent routing behavior. The prior archive content no longer matched the current template contract, which caused validation failures and weakened the archived record.",
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C16.md:977:.opencode/skills/system-spec-kit/mcp_server/tool-schemas.ts:31:  inputSchema: { type: 'object', additionalProperties: false, properties: { input: { type: 'string', description: 'The query, prompt, or context description (required)' }, mode: { type: 'string', enum: ['auto', 'quick', 'deep', 'focused', 'resume'], default: 'auto', description: 'Context retrieval mode: auto (detect intent), quick (fast triggers), deep (comprehensive search), focused (intent-optimized), resume (session recovery)' }, intent: { type: 'string', enum: ['add_feature', 'fix_bug', 'refactor', 'security_audit', 'understand', 'find_spec', 'find_decision'], description: 'Explicit task intent. If not provided and mode=auto, intent is auto-detected from input.' }, specFolder: { type: 'string', description: 'Limit context to specific spec folder' }, limit: { type: 'number', description: 'Maximum results (mode-specific defaults apply)' }, sessionId: { type: 'string', description: 'Caller-supplied session identifier. If omitted, server generates an ephemeral UUID for this call only (not persisted across requests).' }, enableDedup: { type: 'boolean', default: true, description: 'Enable session deduplication' }, includeContent: { type: 'boolean', default: false, description: 'Include full file content in results' }, includeTrace: { type: 'boolean', default: false, description: 'Include provenance-rich trace data (scores, source, trace) in results when underlying memory_search is called' }, tokenUsage: { type: 'number', minimum: 0.0, maximum: 1.0, description: "Optional caller token usage ratio (0.0-1.0)" }, anchors: { type: 'array', items: { type: 'string' }, description: 'Filter content to specific anchors (e.g., ["state", "next-steps"] for resume mode)' } }, required: ['input'] },
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/iterations/iteration-020.md:99:| 31 parameters for memory_search is "too many" (E3) | iter-11 census | No comparison to similar MCP tools. Many parameters have sensible defaults; actual typical invocations may use 2-3. |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/009-reindex-validator-false-positives/review/iterations/iteration-010.md:130:The review loop found the right risk areas, especially around ESM entrypoints, scope/governance, and packet truth-sync. Its weakest point was closure tracking: many legitimate `P1` findings were later fixed, but the review packet was not fully reconciled after those fixes landed.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/007-code-audit-per-feature-catalog/research/iterations/iteration-013.md:511:### AG3-F02 — P2 — Published tool schema is weaker than runtime validation for shared-space admin tools
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C07.md:54:Logging hooks in the search, context and trigger handlers are best-effort and fail-safe: they run only when `SPECKIT_EVAL_LOGGING=true`, and all write paths are wrapped in non-fatal `try/catch` blocks so query responses continue even if eval logging fails. `memory_search` and `memory_context` emit per-channel rows; `memory_match_triggers` emits query/final-result rows.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C07.md:83:Instrumentation wiring remains present in retrieval handlers (`memory_search`, `memory_context`, `memory_match_triggers`), but the runtime logger is currently inert/deprecated (`isConsumptionLogEnabled()` hardcoded `false`). Calls remain fail-safe no-ops for compatibility while telemetry paths stay structurally available.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C07.md:350:If BM25 had been competitive, the entire multi-channel approach would be questioned. Instead, the gap confirmed that hybrid retrieval adds real value over keyword search. The contingency decision to proceed with the full program was based on this measurement. No opinions, no intuitions, just a number. The in-memory BM25 channel (distinct from FTS5) runs behind the `ENABLE_BM25` flag (default ON, set `ENABLE_BM25=false` to disable).
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/009-reindex-validator-false-positives/review/iterations/iteration-004.md:29:- **Impact:** The numbers may reflect one local database state, but they are not reproducible or auditable from the repository alone. That weakens both the checklist's checked evidence and the accuracy of any release note or commit message that repeats those counts.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/011-skill-alignment/002-skill-review-post-022/review-report.md:88:- **Impact**: Misleads operators into believing shared-memory is enabled by default, weakening governance expectations.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/011-skill-alignment/002-skill-review-post-022/review-report.md:96:- **Impact**: Checked verification item claims compliance that does not exist, weakening checklist trust.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/fix-07-description-drift.md:46:  └ MCP server 'cocoindex_code': McpError: MCP error -32001: Request timed out
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/fix-07-description-drift.md:49:  └ MCP server 'cocoindex_code': McpError: MCP error -32001: Request timed out
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/fix-07-description-drift.md:52:  └ MCP server 'cocoindex_code': McpError: MCP error -32001: Request timed out
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/fix-07-description-drift.md:55:  └ MCP server 'cocoindex_code': McpError: MCP error -32001: Request timed out
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/fix-07-description-drift.md:58:  └ MCP server 'cocoindex_code': McpError: MCP error -32001: Request timed out
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/fix-07-description-drift.md:446:  │       loop rejection, preventing structurally weak or narrowly inconsistent content from
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/z-archive-prior-audit/cross-ai-review-2026-03-05/codex-beta-enforcement-robustness.md:26:- Enforcement is weak: checker uses metadata only for typing, not validation; `createdAt/lastReviewedAt/expiresAt` are optional in interface [check-no-mcp-lib-imports.ts:16](/Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/system-spec-kit/scripts/evals/check-no-mcp-lib-imports.ts#L16)-[18](/Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/system-spec-kit/scripts/evals/check-no-mcp-lib-imports.ts#L18), and never validated/expired at runtime.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/iterations/iteration-021.md:30:- Impact: The packet's own documents no longer agree on what folder they govern, which makes the tasks/checklist/review package internally inconsistent after the rename and weakens traceability for any later validator or reviewer.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/iterations/iteration-021.md:56:- Impact: The packet still reads as though its live validation and lineage surface is anchored to predecessor folder names instead of the final promoted packet, which weakens the trace from current docs to current on-disk review targets.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/agent-15-flags-indexes.md:535:`FEATURE_CATALOG_IN_SIMPLE_TERMS.md` | `PARTIAL` | Verified 21 top-level sections (`:12-34`) and the same 33-tool / 6-command counts (`:52-64`). Cross-reference coverage is weaker: audit-phase notes at `:46-50` are prose-only, not direct links to the relevant category/stub docs.
.opencode/specs/system-spec-kit/z_archive/010-documentation-alignment/scratch/legacy-memory-quarantine/16-02-26_11-43__spec126-documentation-alignment.md:445:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "../.opencode/specs/system-spec-kit/127-spec126-documentation-alignment" })` |
.opencode/specs/system-spec-kit/z_archive/010-documentation-alignment/scratch/legacy-memory-quarantine/16-02-26_11-43__spec126-documentation-alignment.md:457:memory_search({ specFolder: "../.opencode/specs/system-spec-kit/127-spec126-documentation-alignment", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/010-documentation-alignment/scratch/legacy-memory-quarantine/16-02-26_11-43__spec126-documentation-alignment.md:463:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/010-documentation-alignment/scratch/legacy-memory-quarantine/16-02-26_11-43__spec126-documentation-alignment.md:472:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/013-memory-quality-and-indexing/plan.md:80:- **Execution layer**: Manual operator actions plus MCP calls to `memory_save`, `memory_index_scan`, `memory_search`, and quality gate pipeline functions.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/z-archive-prior-audit/cross-ai-review-2026-03-05/gemini-alpha-adr-quality.md:25:2. **ALTERNATIVES HONESTY**: The "Runtime-only ownership adapters" alternative is slightly weak (an awkward dependency inversion), making the chosen shared module approach the obvious winner. However, it is a realistic bad choice developers sometimes make.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/011-skill-alignment/002-skill-review-post-022/research/iterations/iteration-004.md:14:- **Impact**: A checked verification item says the child fully satisfies the parent-link contract even though a required parent reference is missing, weakening trust in the checklist as a trace artifact.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C12.md:951:/bin/zsh -lc "rg -n \"toolCache|cacheKey|getCachedOrExecute|invalidateToolCache|tool-cache|TOOL_CACHE|memory_search|memory_save|memory_delete|memory_bulk_delete\" '.opencode/skills/system-spec-kit/mcp_server/handlers' '.opencode/skills/system-spec-kit/mcp_server/lib/cache/tool-cache.ts'" in /Users/michelkerkmeester/MEGA/Development/Opencode Env/Publicexec
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C12.md:1028:.opencode/skills/system-spec-kit/mcp_server/lib/cache/tool-cache.ts:238:    'memory_search',
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C12.md:1068:.opencode/skills/system-spec-kit/mcp_server/lib/cache/README.md:176:const key = generateCacheKey('memory_search', { query: 'test' });
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/013-memory-quality-and-indexing/tasks.md:119:| T052 | 176 | Implicit feedback log (SPECKIT_IMPLICIT_FEEDBACK_LOG) | PASS | feedback-ledger.ts:25-30 defines 5 event types. :78-84 resolveConfidence() maps correctly (strong: result_cited/follow_on_tool_use, medium: query_reformulated, weak: search_shown/same_topic_requery). :106-109 isImplicitFeedbackLogEnabled() defaults ON. Comment at :104 fixed to "Default: TRUE (graduated)". Module-level comment at :8 fixed to "(default ON, graduated)". Consistent with search-flags.ts:287. 39 feedback-ledger tests pass. |
.opencode/specs/system-spec-kit/z_archive/007-upgrade-level-script/scratch/legacy-memory-quarantine/15-02-26_14-28__upgrade-level-script.md:369:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "system-spec-kit/z_archive/007-upgrade-level-script" })` |
.opencode/specs/system-spec-kit/z_archive/007-upgrade-level-script/scratch/legacy-memory-quarantine/15-02-26_14-28__upgrade-level-script.md:381:memory_search({ specFolder: "system-spec-kit/z_archive/007-upgrade-level-script", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/007-upgrade-level-script/scratch/legacy-memory-quarantine/15-02-26_14-28__upgrade-level-script.md:387:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/007-upgrade-level-script/scratch/legacy-memory-quarantine/15-02-26_14-28__upgrade-level-script.md:396:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/011-skill-alignment/002-skill-review-post-022/research/iterations/iteration-005.md:6:- **Impact**: Future maintainers cannot tell whether phase 011 is a single 2026-03-21 closeout or a broader packet that also owns the later spec-011 follow-up. That weakens traceability and makes future drift reviews harder to scope correctly.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/064-bug-analysis-and-fix/spec.md:44:1. **Missing await in memory_search** - `formatSearchResults()` is async but called without await, returning Promises instead of results
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/064-bug-analysis-and-fix/spec.md:188:### User Story 7 - memory_search Returns Resolved Results (Priority: P0)
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/064-bug-analysis-and-fix/spec.md:190:As an AI assistant, I need `memory_search` to return actual results (not Promises) so that search results are usable when `includeContent=true`.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/064-bug-analysis-and-fix/spec.md:194:**Independent Test**: Call `memory_search` with `includeContent=true` and verify results are objects, not Promises.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/064-bug-analysis-and-fix/spec.md:197:1. **Given** `includeContent=true`, **When** `memory_search` executes, **Then** the result payload is fully resolved (no Promise objects)
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/064-bug-analysis-and-fix/spec.md:249:- **REQ-FUNC-031:** System MUST await `formatSearchResults()` in `memory_search` so results are fully resolved
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/064-bug-analysis-and-fix/spec.md:297:| Story 7 - memory_search Results | REQ-FUNC-031 | Critical production bug |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/007-code-audit-per-feature-catalog/research/iterations/iteration-009.md:31:Impact: the main `memory_search` path is correctly on V2, and I found no runtime read of `SPECKIT_PIPELINE_V2`, but the catalog’s “all retrieval / no alternative code path” wording is broader than the code supports because eval/ablation still calls `hybridSearchEnhanced()` directly.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/007-code-audit-per-feature-catalog/research/iterations/iteration-009.md:32:Fix recommendation: narrow `F10` to “sole runtime path for `memory_search`” or migrate eval retrieval onto the same orchestrator if full path unification is the goal.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/iterations/iteration-011.md:23:3. **Parameter complexity hotspot: `memory_search` has 28 parameters** (the SearchArgs interface spans lines 56-89 of types.ts). This is the most parameter-heavy tool in the system. Includes: query, concepts, specFolder, tenantId, userId, agentId, sharedSpaceId, limit, tier, contextType, useDecay, includeContiguity, includeConstitutional, includeContent, anchors, bypassCache, sessionId, enableDedup, intent, autoDetectIntent, enableSessionBoost, enableCausalBoost, minQualityScore, min_quality_score (duplicate!), rerank, applyLengthPenalty, applyStateLimits, minState, trackAccess, includeArchived, mode, includeTrace.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/iterations/iteration-011.md:35:7. **`memory_context` has 11 parameters** (ContextArgs, types.ts:41-53). This is the unified entry point tool and its parameter count is manageable. The `memory_search` tool at 28+ parameters is where the real UX friction exists.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/iterations/iteration-011.md:57:    (c) No "memory_search_simple" tool -- developers must navigate 28 parameters when they often need just `query` + `limit`
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C02.md:491:.opencode/skills/system-spec-kit/mcp_server/context-server.ts:238:    'Key tools: memory_context, memory_search, memory_save, memory_index_scan, memory_stats.',
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/007-code-audit-per-feature-catalog/research/iterations/iteration-019.md:6:- Search pipeline: `memory_search` dispatches correctly at [memory-tools.ts:46](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/mcp_server/tools/memory-tools.ts#L46). On cache miss, [memory-search.ts:635](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts#L635) builds `PipelineConfig` and calls [orchestrator.ts:57](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/orchestrator.ts#L57), which wires Stage 1 -> Stage 2 -> Stage 3 -> Stage 4 at [orchestrator.ts:66](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/orchestrator.ts#L66), [orchestrator.ts:84](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/orchestrator.ts#L84), [orchestrator.ts:117](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/orchestrator.ts#L117), and [orchestrator.ts:150](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/orchestrator.ts#L150). The stage contracts line up in [types.ts:112](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/types.ts#L112), [types.ts:195](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/types.ts#L195), [types.ts:229](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/types.ts#L229), [types.ts:264](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/types.ts#L264), and [types.ts:297](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/types.ts#L297). Degradation is present for Stages 2-4 in [orchestrator.ts:94](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/orchestrator.ts#L94), [orchestrator.ts:126](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/orchestrator.ts#L126), and [orchestrator.ts:160](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/orchestrator.ts#L160). The only intentional bypasses are cursor continuation and cache-hit responses at [memory-search.ts:441](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts#L441) and [memory-search.ts:623](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts#L623).
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/064-bug-analysis-and-fix/plan.md:85:Systematically fix all identified bugs in the system-spec-kit skill and spec_kit commands, prioritizing critical architectural issues and production-breaking defects (missing await in memory_search) before addressing documentation mismatches and minor inconsistencies. Each phase delivers independently verifiable improvements. The full issue inventory is in `research/research.md` and must be treated as the source of truth.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/064-bug-analysis-and-fix/plan.md:398:#### 1.5 Fix Missing await in memory_search (REQ-FUNC-031)
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/064-bug-analysis-and-fix/plan.md:620:- memory_search: includeContent=true returns resolved results
.opencode/specs/system-spec-kit/z_archive/007-upgrade-level-script/scratch/legacy-memory-quarantine/15-02-26_15-53__upgrade-level-script.md:507:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "system-spec-kit/z_archive/007-upgrade-level-script" })` |
.opencode/specs/system-spec-kit/z_archive/007-upgrade-level-script/scratch/legacy-memory-quarantine/15-02-26_15-53__upgrade-level-script.md:519:memory_search({ specFolder: "system-spec-kit/z_archive/007-upgrade-level-script", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/007-upgrade-level-script/scratch/legacy-memory-quarantine/15-02-26_15-53__upgrade-level-script.md:525:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/007-upgrade-level-script/scratch/legacy-memory-quarantine/15-02-26_15-53__upgrade-level-script.md:534:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/011-skill-alignment/002-skill-review-post-022/research/iterations/iteration-002.md:22:- **Impact**: The parent packet no longer accurately describes its child-phase structure, which weakens navigability and contributes to the PHASE_LINKS warnings surfaced by strict validation.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/agent-01-retrieval.md:90:  │ "memory_context|memory_search|memory_match_triggers|memory_quick_search|/memory:continue|working
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/agent-01-retrieval.md:96:● search system-spec-kit scripts source code references to memory_context memory_search memory_matc…
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/agent-01-retrieval.md:108:  │ "memory_context|memory_search|memory_match_triggers|memory_quick_search" in **/*.{ts,js,sh}
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/agent-01-retrieval.md:130:  │ "\bmemory_search\b" in **/*.{ts,js,sh,md,json,jsonc} (.opencode/skills/system-spec-kit/scripts)
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/agent-01-retrieval.md:272:  │ "memory_context|memory_search|memory_match_triggers|memory_quick_search|memory_list|memory_stats
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/agent-01-retrieval.md:293:      "memory_context\|memory_search\|memory_quick_search\|memory_match_triggers\|memory_conti
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/agent-01-retrieval.md:307:`02-semantic-and-lexical-search-memorysearch.md | MISALIGNED | `memory_search` appears only in installer help (`scripts/setup/install.sh:351`); documented search surface (`includeContent`, `autoDetectIntent`, `minState`, full handler/pipeline) is not implemented in scripts.`
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/007-code-audit-per-feature-catalog/research/research.md:134:The 001-retrieval implementation-summary notes "15+ source files missing from catalog" for memory_search (F2) yet classifies it as part of the "9 MATCH" count. This suggests the MATCH/PARTIAL boundary was inconsistently applied -- missing source file references is arguably a PARTIAL finding, not a MATCH.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/007-code-audit-per-feature-catalog/research/research.md:136:**Wave 1 update**: 001-F02 (memory_search) has been reclassified from MATCH to PARTIAL based on this analysis, confirming the boundary concern was actionable.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/007-code-audit-per-feature-catalog/research/research.md:227:- `memory_search` (MATCH in 001-retrieval) imports `tier-classifier.ts` (0 catalog mentions) and `attention-decay.ts` (0 catalog mentions)
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/z-archive-prior-audit/cross-ai-review-2026-03-05/codex-delta-spec030-quality.md:22:Missing or weak tasks:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/011-skill-alignment/002-skill-review-post-022/research/iterations/iteration-003.md:6:- **Impact**: This mismatch can mislead operators or reviewers into believing shared-memory collaboration is enabled by default, weakening governance expectations and undermining the evidence behind CHK-031's docs-only boundary claim even though CHK-030 itself holds.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/064-bug-analysis-and-fix/checklist.md:191:- [x] CHK093 [P0] memory_search awaits formatSearchResults (no Promise objects returned) | Evidence: Added `await` at lines 1085, 1140, 1161 in context-server.js
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/064-bug-analysis-and-fix/checklist.md:303:- [x] CHK084 [P0] `memory_search` tool returns results | Evidence: Search functionality verified
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/investigation-X10.md:286:.opencode/skills/system-spec-kit/mcp_server/tool-schemas.ts:31:  inputSchema: { type: 'object', additionalProperties: false, properties: { input: { type: 'string', description: 'The query, prompt, or context description (required)' }, mode: { type: 'string', enum: ['auto', 'quick', 'deep', 'focused', 'resume'], default: 'auto', description: 'Context retrieval mode: auto (detect intent), quick (fast triggers), deep (comprehensive search), focused (intent-optimized), resume (session recovery)' }, intent: { type: 'string', enum: ['add_feature', 'fix_bug', 'refactor', 'security_audit', 'understand', 'find_spec', 'find_decision'], description: 'Explicit task intent. If not provided and mode=auto, intent is auto-detected from input.' }, specFolder: { type: 'string', description: 'Limit context to specific spec folder' }, limit: { type: 'number', description: 'Maximum results (mode-specific defaults apply)' }, sessionId: { type: 'string', description: 'Caller-supplied session identifier. If omitted, server generates an ephemeral UUID for this call only (not persisted across requests).' }, enableDedup: { type: 'boolean', default: true, description: 'Enable session deduplication' }, includeContent: { type: 'boolean', default: false, description: 'Include full file content in results' }, includeTrace: { type: 'boolean', default: false, description: 'Include provenance-rich trace data (scores, source, trace) in results when underlying memory_search is called' }, tokenUsage: { type: 'number', minimum: 0.0, maximum: 1.0, description: "Optional caller token usage ratio (0.0-1.0)" }, anchors: { type: 'array', items: { type: 'string' }, description: 'Filter content to specific anchors (e.g., ["state", "next-steps"] for resume mode)' } }, required: ['input'] },
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/investigation-X06.md:374:   145	 *     BM25 alone is weak — strong justification for multi-channel
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/investigation-X06.md:879:    14	  - [Semantic and lexical search (memory_search)](#semantic-and-lexical-search-memory_search)
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/064-bug-analysis-and-fix/scratch/legacy-memory-quarantine/15-01-26_11-52__bug-analysis-and-fix.md:275:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/064-bug-analysis-and-fix" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/064-bug-analysis-and-fix/scratch/legacy-memory-quarantine/15-01-26_11-52__bug-analysis-and-fix.md:280:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/019-feature-flag-reference/spec.md:64:| EX-028 | Flag catalog verification | [`../../feature_catalog/19--feature-flag-reference/01-1-search-pipeline-features-speckit.md`](../../feature_catalog/19--feature-flag-reference/01-1-search-pipeline-features-speckit.md) | `List SPECKIT flags active/inert/deprecated` | `memory_search({ query:"SPECKIT flags active inert deprecated", limit:20 })` -> `memory_context({ mode:"deep", prompt:"Classify SPECKIT flags as active, inert, or deprecated", sessionId:"ex028" })` |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/019-feature-flag-reference/spec.md:65:| EX-029 | Session policy audit | [`../../feature_catalog/19--feature-flag-reference/02-2-session-and-cache.md`](../../feature_catalog/19--feature-flag-reference/02-2-session-and-cache.md) | `Retrieve dedup/cache policy settings` | `memory_search({ query:"DISABLE_SESSION_DEDUP session cache policy settings", limit:20 })` |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/019-feature-flag-reference/spec.md:66:| EX-030 | MCP limits audit | [`../../feature_catalog/19--feature-flag-reference/03-3-mcp-configuration.md`](../../feature_catalog/19--feature-flag-reference/03-3-mcp-configuration.md) | `Find MCP validation settings defaults` | `memory_search({ query:"MCP_MAX_MEMORY_TOKENS validation settings defaults", limit:20 })` |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/019-feature-flag-reference/spec.md:67:| EX-031 | Storage precedence check | [`../../feature_catalog/19--feature-flag-reference/04-4-memory-and-storage.md`](../../feature_catalog/19--feature-flag-reference/04-4-memory-and-storage.md) | `Explain DB path precedence env vars` | `memory_search({ query:"SPEC_KIT_DB_DIR SPECKIT_DB_DIR database path precedence", limit:20 })` -> `memory_context({ mode:"focused", prompt:"Explain DB path precedence env vars", sessionId:"ex031" })` |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/019-feature-flag-reference/spec.md:68:| EX-032 | Provider selection audit | [`../../feature_catalog/19--feature-flag-reference/05-5-embedding-and-api.md`](../../feature_catalog/19--feature-flag-reference/05-5-embedding-and-api.md) | `Retrieve embedding provider selection rules` | `memory_search({ query:"EMBEDDINGS_PROVIDER auto provider selection rules", limit:20 })` |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/019-feature-flag-reference/spec.md:69:| EX-033 | Observability toggle check | [`../../feature_catalog/19--feature-flag-reference/06-6-debug-and-telemetry.md`](../../feature_catalog/19--feature-flag-reference/06-6-debug-and-telemetry.md) | `List telemetry/debug vars and separate opt-in flags from inert flags` | `memory_search({ query:"DEBUG_TRIGGER_MATCHER telemetry opt-in inert flags", limit:20 })` |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/019-feature-flag-reference/spec.md:70:| EX-034 | Branch metadata source audit | [`../../feature_catalog/19--feature-flag-reference/07-7-ci-and-build-informational.md`](../../feature_catalog/19--feature-flag-reference/07-7-ci-and-build-informational.md) | `Find branch env vars used in checkpoint metadata` | `memory_search({ query:"GIT_BRANCH BRANCH_NAME checkpoint metadata", limit:20 })` |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/019-feature-flag-reference/spec.md:156:| Dependency | MCP runtime and `dist` build of `capability-flags.js` | Required to execute `memory_search`, `memory_context`, and 125 node-based snapshot scenarios | Verify the dist build is current before executing 125 and confirm `memory_search` is available |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/019-feature-flag-reference/spec.md:166:- Which indexed corpus is expected to hold the SPECKIT flag documentation so EX-028 through EX-034 memory_search calls return relevant results? Should a dedicated flag-reference memory file be pre-indexed before execution?
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/agent-10-memory-quality.md:87:  └ MCP server 'cocoindex_code': McpError: MCP error -32001: Request timed out
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/019-feature-flag-reference/plan.md:41:This plan converts the eight feature-flag-reference scenarios in the manual testing playbook into an ordered execution workflow for Phase 019. The phase covers read-only flag retrieval checks first (EX-028 through EX-034), verifying that six distinct flag groups can be surfaced and classified via memory_search and memory_context, and then the Hydra roadmap capability isolation scenario (125), which requires a compiled dist build and targeted env-var injection to verify that prefixed SPECKIT_HYDRA_* flags remain distinct from live runtime flags.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/019-feature-flag-reference/plan.md:54:- [ ] MCP runtime access confirmed for `memory_search` and `memory_context`.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/019-feature-flag-reference/plan.md:73:- **Execution layer**: Manual operator actions plus MCP calls to `memory_search` and `memory_context`, and direct node invocations for 125 snapshots.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/019-feature-flag-reference/plan.md:88:- [ ] Confirm MCP runtime access for `memory_search` and `memory_context`.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/019-feature-flag-reference/plan.md:93:- [ ] Run EX-028: `memory_search({ query:"SPECKIT flags active inert deprecated", limit:20 })` then `memory_context({ mode:"deep", prompt:"Classify SPECKIT flags as active, inert, or deprecated", sessionId:"ex028" })`. Capture output and classify flags. If 0 results, triage via feature catalog cross-reference.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/019-feature-flag-reference/plan.md:94:- [ ] Run EX-029: `memory_search({ query:"DISABLE_SESSION_DEDUP session cache policy settings", limit:20 })`. Surface all required session/cache control keys.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/019-feature-flag-reference/plan.md:95:- [ ] Run EX-030: `memory_search({ query:"MCP_MAX_MEMORY_TOKENS validation settings defaults", limit:20 })`. Identify defaults and keys for MCP guardrails.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/019-feature-flag-reference/plan.md:96:- [ ] Run EX-031: `memory_search({ query:"SPEC_KIT_DB_DIR SPECKIT_DB_DIR database path precedence", limit:20 })` then `memory_context({ mode:"focused", prompt:"Explain DB path precedence env vars", sessionId:"ex031" })`. Confirm DB path precedence chain.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/019-feature-flag-reference/plan.md:97:- [ ] Run EX-032: `memory_search({ query:"EMBEDDINGS_PROVIDER auto provider selection rules", limit:20 })`. Confirm provider routing and key precedence.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/019-feature-flag-reference/plan.md:98:- [ ] Run EX-033: `memory_search({ query:"DEBUG_TRIGGER_MATCHER telemetry opt-in inert flags", limit:20 })`. Separate opt-in from inert controls.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/019-feature-flag-reference/plan.md:99:- [ ] Run EX-034: `memory_search({ query:"GIT_BRANCH BRANCH_NAME checkpoint metadata", limit:20 })`. Surface all listed branch env vars.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/019-feature-flag-reference/plan.md:143:| MCP runtime for `memory_search` and `memory_context` | Internal | Yellow | EX-028 through EX-034 cannot be executed |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/019-feature-flag-reference/checklist.md:45:- [x] CHK-003 [P0] MCP runtime confirmed operational for `memory_search` and `memory_context` — EX-028 through EX-034 triaged via feature catalog cross-reference per playbook fallback protocol; EVIDENCE GAP documented for corpus-based retrieval [EVIDENCE: tasks.md; implementation-summary.md]
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/019-feature-flag-reference/checklist.md:58:- [x] CHK-023 [P1] EX-028 through EX-034 zero-result cases have EVIDENCE GAP documented with feature catalog triage applied — all 7 scenarios used feature catalog triage path; EVIDENCE GAP documented in T014 (memory_search corpus not indexed at execution time); catalog triage confirmed PASS verdicts [EVIDENCE: tasks.md; implementation-summary.md]
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/iterations/iteration-007.md:59:11. **The eval subsystem is gated by SPECKIT_ABLATION flag**, which is one of the 76 flags. The ablation framework and related eval tools require `SPECKIT_ABLATION=true` to run. This means eval is entirely opt-in and never runs in production search paths. [SOURCE: grep output showing SPECKIT_ABLATION references; also documented in memory_search MCP tool schema]
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/019-feature-flag-reference/tasks.md:48:- [x] T004 Confirm MCP runtime access for `memory_search` and `memory_context` — not applicable; execution performed via direct code analysis + dist invocation (see T006)
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/019-feature-flag-reference/tasks.md:65:- [x] T014 [P] EX-028 through EX-034 all triaged via feature catalog cross-reference per playbook fallback protocol; EVIDENCE GAP noted for memory_search corpus (not indexed at execution time); all verdicts confirmed via direct code analysis
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/064-bug-analysis-and-fix/tasks.md:415:#### T101: Fix Missing await in memory_search
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/064-bug-analysis-and-fix/tasks.md:419:- **Description:** `formatSearchResults()` is async but called without await, returning Promises in `memory_search`.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/064-bug-analysis-and-fix/tasks.md:444:  - `memory_search` returns fully resolved results
.opencode/specs/system-spec-kit/z_archive/017-command-adherence/scratch/legacy-memory-quarantine/17-02-26_18-19__command-adherence.md:506:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "system-spec-kit/z_archive/017-command-adherence" })` |
.opencode/specs/system-spec-kit/z_archive/017-command-adherence/scratch/legacy-memory-quarantine/17-02-26_18-19__command-adherence.md:518:memory_search({ specFolder: "system-spec-kit/z_archive/017-command-adherence", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/017-command-adherence/scratch/legacy-memory-quarantine/17-02-26_18-19__command-adherence.md:524:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/017-command-adherence/scratch/legacy-memory-quarantine/17-02-26_18-19__command-adherence.md:533:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/agent-01-retrieval-v2.md:116:  │ "memory_context|memory_search|memory_match_triggers|memory_quick_search" in *.{ts,md}
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/agent-01-retrieval-v2.md:273:  │ "memory_stats|spec_kit_memory_memory_stats|CONTINUE_SESSION.md|memory_list|memory_search|anchors
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/agent-01-retrieval-v2.md:360:  │ "memoryQuickSearchSchema|memory_quick_search|memory_match_triggers|memory_context|memory_search"
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/agent-01-retrieval-v2.md:421:  │ "memory_context\(|memory_search\(|memory_match_triggers\(|memory_quick_search\("
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/agent-01-retrieval-v2.md:460:02-semantic-and-lexical-search-memorysearch.md | ALIGNED | `memory_search` schema/handler match the documented parameter surface; runtime uses the 4-stage pipeline via `handlers/memory-search.ts` -> `lib/search/pipeline/*`, with deep-mode expansion, trace support, minState, quality threshold, rerank, and trackAccess.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/agent-01-retrieval-v2.md:478:11-session-recovery-memory-continue.md | ALIGNED | The command contract in `.opencode/commands/memory/continue.md` matches reality: primary recovery via `memory_context(mode:"resume")`, fallback `memory_search`/`memory_list`, and breadcrumb support via `CONTINUE_SESSION.md` generated by `lib/session/session-manager.ts`.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/019-feature-flag-reference/implementation-summary.md:42:Phase 019 executed all 8 feature-flag-reference scenarios from the manual testing playbook. Seven scenarios (EX-028 through EX-034) were triaged via direct code analysis and feature catalog cross-reference per the playbook's fallback protocol (EVIDENCE GAP: memory_search corpus was not indexed at execution time). Scenario 125 was executed directly via node invocation of the compiled dist build. All 8 scenarios returned PASS verdicts.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/019-feature-flag-reference/implementation-summary.md:109:**EX-028 through EX-034** (7 scenarios): Executed via direct code analysis and feature catalog cross-reference. The playbook-approved fallback protocol was applied because the memory_search corpus did not have flag reference documentation indexed at execution time. Each scenario's evidence was confirmed in the corresponding feature catalog file and cross-validated against the TypeScript source code.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/019-feature-flag-reference/implementation-summary.md:152:1. **EX-028 through EX-034 relied on feature catalog triage, not live memory_search retrieval** — the playbook permits this fallback path but live retrieval would provide stronger evidence of the memory search pipeline's ability to surface flag documentation.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/iterations/iteration-017.md:84:**B10. `memory_search` has 28 parameters including a duplicate**
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/iterations/iteration-017.md:145:TriggerArgs uses `session_id` and `include_cognitive` (snake_case) while all other MCP tool parameter interfaces use camelCase. The same tool (`memory_search`) has duplicate parameters: `minQualityScore` (camelCase) and `min_quality_score` (snake_case) for the same value.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/064-bug-analysis-and-fix/implementation-summary.md:26:The most critical discovery was a missing `await` on `formatSearchResults()` calls in the MCP server, causing `memory_search` to return Promise objects instead of actual results when `includeContent=true` - a production-breaking bug affecting core functionality. Other critical issues included an entirely unused config system, a non-functional ANCHOR system with false "93% token savings" claims, undefined error codes, and missing rate limiting for embedding API calls.
.opencode/specs/system-spec-kit/z_archive/017-command-adherence/scratch/legacy-memory-quarantine/18-02-26_08-33__command-adherence.md:370:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "../.opencode/specs/system-spec-kit/z_archive/017-command-adherence" })` |
.opencode/specs/system-spec-kit/z_archive/017-command-adherence/scratch/legacy-memory-quarantine/18-02-26_08-33__command-adherence.md:382:memory_search({ specFolder: "../.opencode/specs/system-spec-kit/z_archive/017-command-adherence", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/017-command-adherence/scratch/legacy-memory-quarantine/18-02-26_08-33__command-adherence.md:388:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/017-command-adherence/scratch/legacy-memory-quarantine/18-02-26_08-33__command-adherence.md:397:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/011-scoring-and-calibration/plan.md:36:| **Tools** | `memory_search`, `memory_validate`, `checkpoint_create`, `checkpoint_restore` |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/011-scoring-and-calibration/plan.md:52:- [ ] MCP runtime available and `memory_search` tool confirmed working
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/011-scoring-and-calibration/plan.md:73:- **Non-destructive execution**: Direct MCP `memory_search` with `includeTrace: true` to capture scoring telemetry.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/011-scoring-and-calibration/plan.md:89:- [ ] Confirm runtime has `memory_search`, `memory_validate`, `checkpoint_create`, and `checkpoint_restore` available
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/011-scoring-and-calibration/plan.md:171:| Non-destructive MCP | 023, 024, 027, 029, 030, 066, 074, 079, 098, 102, 118 | `memory_search` with `includeTrace: true` |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/011-scoring-and-calibration/plan.md:173:| Feature-flag | 159, 160, 171, 172 | Flag toggle + `memory_search` + trace inspection |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/011-scoring-and-calibration/plan.md:187:| MCP runtime + `memory_search` | Runtime | Confirm | All scenarios blocked if MCP is unavailable |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/iterations/iteration-018.md:54:### Finding 7: memory_search Has 28 Parameters
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/iterations/iteration-018.md:55:**Prior claim (iter 11):** memory_search has 28 parameters including a duplicate.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/iterations/iteration-018.md:114:| 7 | memory_search 28 parameters | MODIFIED | Actual count is 31, not 28 |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/003-discovery/spec.md:117:| REQ-008 | Execute EX-038: invoke `memory_search` with date-range constraints (`createdAfter` / `createdBefore`) bracketing a known memory creation window | PASS if only memories within the specified date range are returned; boundary dates are respected (inclusive/exclusive as documented). FAIL if memories outside the date range appear in results |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/003-discovery/spec.md:119:| REQ-010 | Execute EX-040: invoke `memory_causal_stats` to enumerate causal links, then invoke `memory_search` with a `causalSourceId` parameter to retrieve downstream memories linked from a known source | PASS if causal stats report link counts and the follow-up search returns the expected linked memories with causal metadata. FAIL if causal traversal returns no results when links are known to exist |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/011-scoring-and-calibration/checklist.md:44:- [x] CHK-003 [P0] MCP runtime available: `memory_search`, `memory_validate`, `checkpoint_create`, `checkpoint_restore` confirmed working -- Code analysis approach: source code inspection used in lieu of runtime execution [EVIDENCE: tasks.md; implementation-summary.md]
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/018-ux-hooks/spec.md:68:| 166 | Result Explainability | [`../../feature_catalog/18--ux-hooks/14-result-explainability.md`](../../feature_catalog/18--ux-hooks/14-result-explainability.md) | `Verify two-tier result explain output (SPECKIT_RESULT_EXPLAIN_V1).` | `1) Enable flag 2) Run memory_search with includeTrace 3) Inspect tier-1 summary explain 4) Inspect tier-2 detailed score breakdown 5) Disable flag fallback` |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/018-ux-hooks/spec.md:72:| 179 | Empty Result Recovery (SPECKIT_EMPTY_RESULT_RECOVERY_V1) | [`../../feature_catalog/18--ux-hooks/18-empty-result-recovery.md`](../../feature_catalog/18--ux-hooks/18-empty-result-recovery.md) | `Verifies structured recovery payloads for empty/weak search results across all 3 statuses.` | `1) Enable flag 2) Run empty-result query 3) Run weak-result query 4) Inspect structured recovery payloads across all 3 statuses 5) Disable flag fallback` |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/018-ux-hooks/spec.md:135:| REQ-010 | Execute 179 Empty Result Recovery: verify structured recovery payloads with `SPECKIT_EMPTY_RESULT_RECOVERY_V1`. | PASS when flag ON: empty and weak results return all 3 documented statuses; healthy results emit no recovery payload; PASS when flag OFF: no recovery payload. FAIL if any status is missing or payloads appear for healthy results. |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/003-discovery/plan.md:127:- [ ] Invoke `memory_search` with `createdAfter` and `createdBefore` parameters bracketing a known memory creation window
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/003-discovery/plan.md:143:- [ ] Invoke `memory_search` with `causalSourceId` set to that source memory ID — capture output
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/003-discovery/plan.md:165:| Manual | EX-038: memory_search with date range constraints | MCP tool call |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/003-discovery/plan.md:167:| Manual | EX-040: memory_causal_stats + memory_search with causalSourceId | MCP tool call (two calls) |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/011-scoring-and-calibration/tasks.md:46:- [x] T002 Confirm MCP runtime tools available: `memory_search`, `memory_validate`, `checkpoint_create`, `checkpoint_restore` (`plan.md`) -- Confirmed via MCP tool listing
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/fix-05-remaining-p1.md:143:I’ve pinned down the last behavior mismatch: `/memory:continue` exposes `memory_stats`, but the live recovery chain is `memory_context` → `CONTINUE_SESSION.md` → anchored `memory_search` → `memory_list`. I’m patching the docs to say that plainly.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/fix-05-remaining-p1.md:612:  │       `memory_search`-backed strategy with anchors `["state", "next-steps", "summary",
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/fix-05-remaining-p1.md:617:  │ 19    - **`memory_search`** (from `/memory:analyze`) -- Fallback for thin summaries when
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/018-ux-hooks/plan.md:105:- [ ] Run 166 (SPECKIT_RESULT_EXPLAIN_V1): enable flag, run `memory_search` with `includeTrace`, inspect tier-1 and tier-2 explain outputs; disable flag and confirm no explain output.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/018-ux-hooks/plan.md:109:- [ ] Run 179 (SPECKIT_EMPTY_RESULT_RECOVERY_V1): enable flag, run empty-result and weak-result queries, inspect all 3 recovery statuses; run healthy result query and confirm no recovery payload; disable flag.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/018-ux-hooks/plan.md:134:| 179 | Empty Result Recovery | `Verifies structured recovery payloads for empty/weak search results across all 3 statuses.` | MCP |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/011 - analysis-gemini-3.md:25:*   **Retrieval Layer:** Employs QMD to perform rapid hybrid retrieval across the vault.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/003-discovery/tasks.md:67:- [ ] T019 Execute EX-038 — Discovery by date range: invoke `memory_search` with `createdAfter` and `createdBefore`; capture output
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/003-discovery/tasks.md:73:- [ ] T025 Execute EX-040b — Causal link traversal: invoke `memory_search` with `causalSourceId`; capture output
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/018-ux-hooks/checklist.md:75:- [x] CHK-019 [P0] 179 all 3 recovery statuses returned for empty/weak results; no payload for healthy results; no payload with flag OFF [Evidence: `recovery-payload.ts:65–76` classifies all 3 statuses; `recovery-payload.ts:200–213` `shouldTriggerRecovery` returns false for healthy results; `search-flags.ts:455` flag default-on. VERDICT: PASS]
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/018-ux-hooks/checklist.md:76:- [x] CHK-020 [P0] 180 calibrated confidence present per result with 4-factor weighting; no confidence field with flag OFF [Evidence: `confidence-scoring.ts:30–33` exact weights (0.35/0.30/0.20/0.15); `confidence-scoring.ts:177–181` label thresholds (0.7/0.4); `confidence-scoring.ts:241–244` driver detection; `assessRequestQuality` produces requestQuality; no LLM. VERDICT: PASS]
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/agent-09-query-intel.md:179:  └ MCP server 'cocoindex_code': McpError: MCP error -32001: Request timed out
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/agent-09-query-intel.md:182:  └ MCP server 'cocoindex_code': McpError: MCP error -32001: Request timed out
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/064-bug-analysis-and-fix/research/research.md:141:**Most Critical Discovery (NEW):** Missing `await` on `formatSearchResults()` in context-server.js (lines 1085, 1140, 1161) causes `memory_search` to return Promise objects instead of actual results when `includeContent=true`. **This is a production bug that breaks core functionality.**
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/064-bug-analysis-and-fix/research/research.md:407:        BREAKS memory_search when includeContent=true
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/064-bug-analysis-and-fix/research/research.md:785:resume.md:435 - Double prefix: "spec_kit_memory_memory_search"
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/064-bug-analysis-and-fix/research/research.md:786:Should be: "memory_search" or "spec_kit_memory_search"
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/064-bug-analysis-and-fix/research/research.md:897:- memory_search schema mismatch
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/064-bug-analysis-and-fix/research/research.md:1150:**Issue 10.2: memory_search Required Param Not Emphasized**
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/064-bug-analysis-and-fix/research/research.md:1317:1. **Why** does memory_search return Promise objects?
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/iterations/iteration-019.md:223:### E3. memory_search Has 31 Parameters (UX Burden)
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/iterations/iteration-019.md:326:| 7 | E3 | DX | Simplified memory_search tool (31 params) | P1 | M | 4 | MODIFIED | 11,17,18 |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/iterations/iteration-019.md:362:4. E3 -- Simplified memory_search tool (1 day)
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/iterations/iteration-019.md:381:| memory_search params | 28 parameters | 31 parameters | MODIFIED upward |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/018-ux-hooks/tasks.md:80:- [x] T022 Execute 179 step 1 — `recovery-payload.ts:23–29` defines all 3 statuses, 3 reasons, 4 actions. `buildRecoveryPayload` (line 176) classifies status, reason, suggestedQueries, recommendedAction. `DEFAULT_LOW_CONFIDENCE_THRESHOLD=0.4` (line 55), `PARTIAL_RESULT_MIN=3` (line 58).
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/018-ux-hooks/tasks.md:83:- [x] T025 Execute 180 step 2 — `assessRequestQuality` (line 267) computes `requestQuality: good|weak|gap`. No LLM calls anywhere in module. Flag wired at `search-flags.ts:463` default-on. Flag OFF → `isResultConfidenceEnabled` returns false, caller skips confidence attachment. VERDICT: PASS
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/018-ux-hooks/tasks.md:94:- [x] T036 Evidence bundle 180: 4-factor weights, labels, drivers, requestQuality confirmed in `confidence-scoring.ts`; no LLM calls. VERDICT: PASS
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/agent-security.md:335:I found another possible security-posture mismatch: the governance catalog says decisions are audited across ingest and retrieval, but the retrieval path doesn’t appear to write governance audit records at all. I’m doing one last call-site pass so I can separate that from the weaker, non-security candidates.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/018-ux-hooks/implementation-summary.md:59:| 180 | Result Confidence (SPECKIT_RESULT_CONFIDENCE_V1) | **PASS** | All | `confidence-scoring.ts:30–33` exact weights margin=0.35, channel_agreement=0.30, reranker=0.20, anchor_density=0.15; HIGH_THRESHOLD=0.7, LOW_THRESHOLD=0.4 (lines 26–27); drivers list (lines 241–244); `assessRequestQuality` computes requestQuality; no LLM calls in module |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/006 - recommendations-codex-3.md:22:- `memory_search_fast`: lexical (BM25/FTS) + exact anchors.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/006 - recommendations-codex-3.md:23:- `memory_search_deep`: expansion + vector + rerank + fusion.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/006 - recommendations-codex-3.md:24:- `memory_search_auto`: route based on query complexity.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/006 - recommendations-codex-3.md:29:memory_search({
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/006 - recommendations-codex-3.md:201:    "memory_search_fast",
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/006 - recommendations-codex-3.md:202:    "memory_search_deep",
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/009-evaluation-and-measurement/plan.md:78:- **MCP tool chain**: Scenarios executed via `mcp__mk_spec_memory__eval_run_ablation`, `memory_search`, `memory_stats`, and related tools
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/014-agents-md-alignment/checklist.md:66:- [x] CHK-012 [P0] G-01: FS Resume prior work row has `/memory:continue` + `memory_search()` [EVIDENCE: Grep `memory:continue` returns 4/4 (AGENTS.md, FS, Barter, CLAUDE.md)]
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/012-query-intelligence/spec.md:166:| Dependency | MCP runtime plus retrieval sandbox corpus | Required to execute `memory_search` scenarios safely | Run stateful tests in an isolated sandbox; preserve restart/checkpoint instructions in the plan |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/scratch/review-011-pass-b.md:19:| Jargon explained | Fail | Some terms are still too insider-facing or unexplained on first use, especially `CocoIndex Code`, `Code Graph`, `MCP`, and `FTS5`. BM25 and RRF are explained well, but the same standard is not applied consistently. |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/scratch/review-011-pass-b.md:26:- Some first-use jargon is still unexplained. Replace or define terms like `CocoIndex Code`, `Code Graph`, `MCP`, and `FTS5` for a smart non-developer reader.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/agent-06-eval-measurement.md:111:  │ ults','eval_ground_truth','eval_metric_snapshots','SPECKIT_EVAL_LOGGING','memory_search','memo…
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/agent-06-eval-measurement.md:122:  │ ECKIT_EVAL_LOGGING|memory_search|memory_context|memory_match_triggers" in eval-db.ts
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/agent-06-eval-measurement.md:142:  │ "SPECKIT_EVAL_LOGGING|memory_search|memory_context|memory_match_triggers|logEval" in *.ts
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/012 - recommendations-gemini-3.md:12:*   **Frontmatter-First Loading:** Adapting Artem’s Obsidian metadata queries to optimize `memory_list()` and candidate generation in `memory_search()`.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/012 - recommendations-gemini-3.md:20:Currently, `memory_search()` returns chunks of text with some metadata. 
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/012 - recommendations-gemini-3.md:22:*   *Implementation:* Modify `memory_search()` to resolve the parent `spec.md` of any retrieved memory chunk, extracting the Level 1 `## Goal` block, and injecting it as a lightweight header (`[Context: Auth System > Login]`) into the `ContextEnvelope`.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/012 - recommendations-gemini-3.md:27:*   *Implementation:* Instead of returning the `content` field, return only the YAML frontmatter, `MEMORY_TITLE`, and auto-extracted entities. Allow the agent to use a secondary call (like `read_file` or a targeted `memory_search`) to pull the full body only if the metadata matches its current strategy.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/012 - recommendations-gemini-3.md:92:*   **Latency Spikes (LLM Reranking):** QMD can rerank fast because the model is pinned in local VRAM. `system-spec-kit` likely relies on API calls. Reranking via external API will add 1-3 seconds to `memory_search()`, necessitating an async UX or strict timeout fallbacks.
.opencode/specs/system-spec-kit/z_archive/006-generate-context-subfolder/scratch/legacy-memory-quarantine/15-02-26_13-39__generate-context-subfolder.md:370:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "system-spec-kit/z_archive/006-generate-context-subfolder" })` |
.opencode/specs/system-spec-kit/z_archive/006-generate-context-subfolder/scratch/legacy-memory-quarantine/15-02-26_13-39__generate-context-subfolder.md:382:memory_search({ specFolder: "system-spec-kit/z_archive/006-generate-context-subfolder", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/006-generate-context-subfolder/scratch/legacy-memory-quarantine/15-02-26_13-39__generate-context-subfolder.md:388:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/006-generate-context-subfolder/scratch/legacy-memory-quarantine/15-02-26_13-39__generate-context-subfolder.md:397:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/012-query-intelligence/plan.md:36:| **Tools** | `memory_search`, `memory_save` (for 163 surrogate test) |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/012-query-intelligence/plan.md:52:- [ ] MCP runtime available and `memory_search` tool confirmed working with `includeTrace: true`
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/012-query-intelligence/plan.md:73:- **Core scenario execution**: Direct MCP `memory_search` with `includeTrace: true` for scenarios 033–038.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/012-query-intelligence/plan.md:89:- [ ] Confirm runtime has `memory_search` available with `includeTrace: true`
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/012-query-intelligence/plan.md:140:| Non-destructive MCP | 033, 034, 035, 036, 037, 038 | `memory_search` with `includeTrace: true` |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/012-query-intelligence/plan.md:141:| Feature-flag | 161, 162, 173 | Flag toggle + `memory_search` + trace inspection |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/012-query-intelligence/plan.md:142:| Feature-flag + index write | 163 | Flag toggle + `memory_save` + `memory_search` |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/012-query-intelligence/plan.md:156:| MCP runtime + `memory_search` | Runtime | Confirm | All scenarios blocked if MCP is unavailable |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/012-query-intelligence/checklist.md:44:- [x] CHK-003 [P0] MCP runtime available: `memory_search` with `includeTrace: true` confirmed working — MCP server source confirmed in `mcp_server/lib/search/` directory [EVIDENCE: tasks.md; implementation-summary.md]
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/008 - recommendations-gemini-1.md:56:Currently, `memory_search()` likely relies on basic text matching or standard vector DBs. We can adopt QMD's approach by moving the memory index to a unified SQLite database using `FTS5` (Full Text Search) and `sqlite-vec`.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/004-maintenance/spec.md:110:| REQ-006 | Execute EX-042: invoke `memory_delete` on a known memory ID | PASS if the memory is removed and subsequent `memory_list` or `memory_search` no longer returns it; deletion is confirmed in response. FAIL if memory persists after delete or delete returns an error for a valid ID |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/016 - synthesis-final-v2.md:41:| 1.3 | MCP tool contract redesign | PARTIAL | PARTIAL | **PARTIAL** | Tool split done (`memory_search`/`memory_context`/`memory_list`/etc). Phase 017 schema hardening. No Zod `.strict()` validation or versioned contracts found in catalog. |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/016 - synthesis-final-v2.md:73:**What needs building:** Wrap all MCP tool inputs in strict Zod schemas with `.strict()` enforcement to reject unexpected keys. Add versioned tool aliases (`memory_search_v2`) for schema-breaking changes.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/016 - synthesis-final-v2.md:92:server.tool("memory_search", async (rawInput) => {
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/016 - synthesis-final-v2.md:280:    `Tools: memory_search (retrieval), memory_context (orchestrated), memory_save (index).`,
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/016 - synthesis-final-v2.md:424:| 2.5 Metadata-first querying | 2/6 | Tiered content injection (HOT=full content, WARM=150 chars, COLD=none), `includeContent=false` parameter in `memory_search` and `memory_list`, chunk collapse dedup (G3) on all paths. |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/051-lib-consolidation/verification-test-plan.md:126:    const text = 'Called generateContext and used memory_search function';
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/051-lib-consolidation/verification-test-plan.md:200:- [ ] Test: `memory_search()` executes without error
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/051-lib-consolidation/verification-test-plan.md:208:    console.log('memory_search module:', hybridSearch ? 'PASS' : 'FAIL');
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/051-lib-consolidation/verification-test-plan.md:417:| **Integration** | memory_search executes | [ ] |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/agent-12-retrieval-enhancements.md:89:✗ search includeTrace provenance envelopes scores source trace in memory_search and memory_context …
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/agent-12-retrieval-enhancements.md:90:  └ MCP server 'cocoindex_code': McpError: MCP error -32001: Request timed out
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/agent-12-retrieval-enhancements.md:93:  └ MCP server 'cocoindex_code': McpError: MCP error -32001: Request timed out
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/agent-12-retrieval-enhancements.md:96:  └ MCP server 'cocoindex_code': McpError: MCP error -32001: Request timed out
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/scratch/review-003-pass-b.md:27:- The `Test Impact` section is present, but two metrics remain `UNKNOWN`, which weakens the release summary and makes the impact harder to judge.
.opencode/specs/system-spec-kit/z_archive/006-generate-context-subfolder/scratch/legacy-memory-quarantine/15-02-26_13-40__generate-context-subfolder.md:258:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "system-spec-kit/z_archive/006-generate-context-subfolder" })` |
.opencode/specs/system-spec-kit/z_archive/006-generate-context-subfolder/scratch/legacy-memory-quarantine/15-02-26_13-40__generate-context-subfolder.md:270:memory_search({ specFolder: "system-spec-kit/z_archive/006-generate-context-subfolder", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/006-generate-context-subfolder/scratch/legacy-memory-quarantine/15-02-26_13-40__generate-context-subfolder.md:276:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/006-generate-context-subfolder/scratch/legacy-memory-quarantine/15-02-26_13-40__generate-context-subfolder.md:285:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/012-query-intelligence/tasks.md:46:- [x] T002 Confirm MCP runtime tool available: `memory_search` with `includeTrace: true` (`plan.md`)
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/004-maintenance/plan.md:108:- [ ] Invoke `memory_list` or `memory_search` to retrieve the updated memory
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/004 - recommendations-codex-2.md:174:3. **Relevance regressions with hybrid ranking tweaks**  
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/051-lib-consolidation/plan.md:165:# Test memory_search via MCP
.opencode/specs/system-spec-kit/z_archive/006-generate-context-subfolder/scratch/legacy-memory-quarantine/15-02-26_13-56__generate-context-subfolder.md:369:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "system-spec-kit/z_archive/006-generate-context-subfolder" })` |
.opencode/specs/system-spec-kit/z_archive/006-generate-context-subfolder/scratch/legacy-memory-quarantine/15-02-26_13-56__generate-context-subfolder.md:381:memory_search({ specFolder: "system-spec-kit/z_archive/006-generate-context-subfolder", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/006-generate-context-subfolder/scratch/legacy-memory-quarantine/15-02-26_13-56__generate-context-subfolder.md:387:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/006-generate-context-subfolder/scratch/legacy-memory-quarantine/15-02-26_13-56__generate-context-subfolder.md:396:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/agent-13-tooling.md:325:  │ "list\)|edit <filename>|remove <filename>|budget|memory_save\(|memory_search\(|importanceTier:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/agent-13-tooling.md:342:  │ "memory_search\(|importanceTier: constitutional|document_type =
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/014 - synthesis-adjusted-gemini.md:19:The original cross-AI synthesis accurately identified the core challenges of semantic memory systems. Remarkably, the `system-spec-kit` refinement program has already anticipated and implemented the majority of the Tier 1 recommendations—most notably the 5-channel hybrid retrieval pipeline and the SQLite-based knowledge graph overlay.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/014 - synthesis-adjusted-gemini.md:40:| **1.3 MCP Tool Contract Redesign** | **PARTIALLY IMPLEMENTED** | Intent-split tools exist (`memory_search`, `memory_list`, etc.). *Gap: Strict Zod schema validation and versioned contracts.* |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/014 - synthesis-adjusted-gemini.md:47:| **2.5 Metadata-First / Frontmatter Querying** | **ALREADY IMPLEMENTED** | Tiered content injection (HOT/WARM/COLD) and `includeContent=false` parameter in `memory_search` and `memory_list`. |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/014 - synthesis-adjusted-gemini.md:105:The system has successfully split tools by intent (e.g., `memory_search` vs `memory_list`), which solves the primary routing issue. However, LLMs still hallucinate parameters or pass malformed types.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/014 - synthesis-adjusted-gemini.md:110:- Version the MCP tool names (e.g., `memory_search_v2`) to allow schema migrations without breaking existing legacy workflows.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/015 - synthesis-adjusted-codex.md:31:The strongest outcome from this review is that the 023 refinement already delivered the core architecture many recommendations asked for: hybrid retrieval pipeline, graph-aware retrieval, and spec-hierarchy contexting.  
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/015 - synthesis-adjusted-codex.md:41:**What exists:** Broad MCP tool surface already split by function (`memory_search`, `memory_context`, `memory_list`, `memory_health`, `memory_index_scan`, mutation tools, lifecycle tools), plus schema hardening improvements (e.g., Phase 017 “Schema params exposed #13”).  
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/015 - synthesis-adjusted-codex.md:42:**Evidence:** `memory_search` / `memory_context` / `memory_list` sections; Phase 017 schema hardening; preflight validation and strict parameter handling.  
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/015 - synthesis-adjusted-codex.md:78:**What exists:** Full multi-channel hybrid retrieval with adaptive fusion, RRF, query complexity routing, expansion, fallback tiers.  
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/015 - synthesis-adjusted-codex.md:127:**Evidence:** `memory_search`/`memory_list` scoping + DB env options.  
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/015 - synthesis-adjusted-codex.md:223:  - **Cross-platform strong overlap:** hybrid retrieval, graph usage, structured outputs, hierarchy contexting
.opencode/specs/system-spec-kit/z_archive/006-generate-context-subfolder/scratch/legacy-memory-quarantine/15-02-26_13-28__generate-context-subfolder.md:369:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "system-spec-kit/z_archive/006-generate-context-subfolder" })` |
.opencode/specs/system-spec-kit/z_archive/006-generate-context-subfolder/scratch/legacy-memory-quarantine/15-02-26_13-28__generate-context-subfolder.md:381:memory_search({ specFolder: "system-spec-kit/z_archive/006-generate-context-subfolder", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/006-generate-context-subfolder/scratch/legacy-memory-quarantine/15-02-26_13-28__generate-context-subfolder.md:387:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/006-generate-context-subfolder/scratch/legacy-memory-quarantine/15-02-26_13-28__generate-context-subfolder.md:396:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/002 - recommendations-codex-1.md:261:3. Implement hybrid retrieval strategy registry.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/014-agents-md-alignment/research/iterations/iteration-004.md:23:  evidence: `description.json` reduces the packet to `Specification: 014-agents-md-alignment` with keywords limited to `specification` and the folder slug, while `spec.md` frontmatter already carries the more informative title `AGENTS.md Alignment: Quick Reference Tables` plus task-specific trigger phrases such as `AGENTS.md quick reference` and `memory command table`. This weakens discoverability and makes the metadata artifact less useful for future maintenance.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/handover.md:141:- [ ] Re-run one `memory_search` sanity query for generic titles.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/scratch/review-009-pass-b.md:28:- Several sections describe how code was wired rather than what changed in system behavior. That weakens the template rule that `Problem/Fix` paragraphs should explain behavior changes, with technical specifics reserved for the files table.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/014-agents-md-alignment/research/iterations/iteration-005.md:9:- But the inspected post-completion diffs do not substantiate an unrepaired revert of the alignment rows. `6eb3aef` changed the CocoIndex skill path only, while `9ee992b` / `2a014f6` changed memory-save syntax to JSON-primary. A targeted patch scan since `2026-03-16` found no deletions of `/memory:analyze`, `/memory:shared`, `ingest`, `budget`, `memory_context()`, or the `Gate 3 -> Gate 1 -> Gate 2` ordering.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/research.md:73:8. **31-parameter memory_search with no simple variant** (MODIFIED upward from 28): Includes duplicate `minQualityScore`/`min_quality_score`. Major UX burden. [iter-11, 18]
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/research.md:100:The pipeline's strengths are: excellent type safety with compile-time + runtime invariants, mature graph subsystem (not dead code as suspected), robust 3-layer save dedup, production-ready session/shared-space features, and a structurally complete eval/ablation framework. Its weaknesses are: zero orchestrator error handling, three conflicting weight systems, 81 ungoverned feature flags, silent quality degradation from 28 catch-and-continue blocks, and no mechanism to feed eval results back into scoring calibration.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/research.md:134:│  │ 12 metrics   │  │ Quality loop │  │ 31-param memory_search   │  │
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/research.md:458:| 7 | memory_search params | 28 parameters | 31 fields in SearchArgs interface | **MODIFIED ↑** |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/research.md:601:| Search | memory_search, memory_context | 31-param search, no simple variant |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/research.md:618:1. **31 parameters on memory_search** -- no simplified `memory_quick_search(query, limit?)`
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/research.md:717:4. **E3** -- Simplified memory_search tool (1 day)
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/014-agents-md-alignment/research/iterations/iteration-001.md:42:  title: Resume prior work row still includes `/memory:continue` and `memory_search()`
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/014-agents-md-alignment/research/iterations/iteration-001.md:44:  evidence: Each file still contains the row `| **Resume prior work** | \`/memory:continue\` OR \`memory_search({ query, specFolder, anchors: ['state', 'next-steps'] })\` → Review checklist → Continue |`.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C04.md:132:Results are grouped by relationship type: causedBy, enabledBy, supersedes, contradicts, derivedFrom and supports. Each edge carries a relation-weighted strength value. Supersedes edges receive a 1.5x weight boost (because replacement is a strong signal). Caused edges receive 1.3x. Enabled edges receive 1.1x. Supports and derived_from edges pass through at 1.0x. Contradicts edges receive 0.8x dampening because contradictions weaken rather than strengthen the chain.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/005 - analysis-codex-3.md:13:[Assumes: Your current system-speckit memory MCP already stores spec/session artifacts but does not yet implement full hybrid retrieval fusion with explicit staged query modes.]
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/scratch/review-007-pass-a.md:12:| Fix for Bug 2: remove default/hardcoded `minState: 'WARM'` from `memory_search` and `memory_context` | Yes | Described correctly, including both handlers. |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/017-governance/plan.md:72:- **Execution layer**: Manual operator actions plus MCP calls to `memory_save`, `memory_search`, `shared_memory_status`, `shared_memory_enable`, `shared_space_upsert`, and `shared_space_membership_set`.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/017-governance/plan.md:87:- [ ] Confirm MCP runtime access for `memory_save`, `memory_search`, `shared_memory_status`, `shared_memory_enable`, `shared_space_upsert`, and `shared_space_membership_set`.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/scratch/review-007-pass-b.md:27:- The summary is directionally good, but it would be stronger if it led even more clearly with user impact before naming internal APIs like `memory_search` and `memory_context`.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/017-governance/tasks.md:48:- [x] T004 Verify MCP runtime access for `memory_save`, `memory_search`, `shared_memory_status`, `shared_memory_enable`, `shared_space_upsert`, `shared_space_membership_set` — all handlers present in `mcp_server/handlers/`
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/investigation-X07.md:299:    14	  - [Semantic and lexical search (memory_search)](#semantic-and-lexical-search-memory_search)
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/investigation-X07.md:411:.opencode/skills/system-spec-kit/feature_catalog/09--evaluation-and-measurement/08-agent-consumption-instrumentation.md:5:Instrumentation wiring remains present in retrieval handlers (`memory_search`, `memory_context`, `memory_match_triggers`), but the runtime logger is currently inert/deprecated (`isConsumptionLogEnabled()` hardcoded `false`). Calls remain fail-safe no-ops for compatibility while telemetry paths stay structurally available.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/investigation-X07.md:525:     7	Cache statistics (hits, misses, evictions, invalidations, hit rate) are tracked for observability. A periodic cleanup sweep removes expired entries. Tool-specific invalidation allows targeted cache busting after mutations without flushing the entire cache. The cache is wired into multiple handlers including `memory_search`, `memory_save`, `memory_delete`, and `memory_bulk_delete` via the mutation hooks system.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/investigation-X07.md:561:     1	# Semantic and lexical search (memory_search)
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/investigation-X07.md:565:     5	This is the primary search tool, and it does a lot. You give it a natural language query (or a multi-concept array of 2-5 strings where all concepts must match), and it runs the full hybrid retrieval pipeline.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-002-codex-A3.md:42:mcp: cocoindex_code starting
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-002-codex-A3.md:46:mcp: cocoindex_code ready
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-002-codex-A3.md:48:mcp startup: ready: code_mode, cocoindex_code, sequential_thinking; failed: spec_kit_memory
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-002-codex-A3.md:77:tool cocoindex_code.search({"query":"importance tiers P0 P1 P2 ambiguity_delta scoring multiplier checklist validation exit code Human Voice Rules spec documents","paths":[".opencode/skills/**"],"limit":10,"refresh_index":true})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-002-codex-A3.md:78:cocoindex_code.search({"query":"importance tiers P0 P1 P2 ambiguity_delta scoring multiplier checklist validation exit code Human Voice Rules spec documents","paths":[".opencode/skills/**"],"limit":10,"refresh_index":true}) success in 675ms:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-002-codex-A3.md:511:tool cocoindex_code.search({"query":"spec checklist template P0 P1 P2 definitions and sk-doc document type scoring or multiplier logic","paths":[".opencode/skills/system-spec-kit/**",".opencode/skills/sk-doc/**"],"limit":10,"refresh_index":false})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-002-codex-A3.md:512:cocoindex_code.search({"query":"spec checklist template P0 P1 P2 definitions and sk-doc document type scoring or multiplier logic","paths":[".opencode/skills/system-spec-kit/**",".opencode/skills/sk-doc/**"],"limit":10,"refresh_index":false}) failed in 2m 00s:
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/012-handover-triggers/scratch/legacy-memory-quarantine/17-12-25_16-19__handover-triggers.md:348:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "004-speckit/007-handover-triggers" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/012-handover-triggers/scratch/legacy-memory-quarantine/17-12-25_16-19__handover-triggers.md:353:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/scratch/review-010-pass-a.md:19:- The `Test Impact` section is inaccurate. The implementation summary explicitly states `TypeScript: 0 new errors` and that regressions for `memory_match_triggers`, `memory_list`, `memory_health`, and `memory_search` were passing, so the `UNKNOWN` rows overstate what is unknown.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/undocumented-features-scan.md:135:**Already documented (14 false positives from Agent 2):** Mode-based orchestration, token-pressure override, spec folder auto-discovery, resume-mode injection, multi-concept search, quality threshold filter, session dedup, archived retrieval, trace emission — all described in the memory_context and memory_search catalog entries.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C05.md:1614:NOTES: B1, B2, and B4 are traceable in `reconsolidation.ts`, `checkpoints.ts`, and `pe-gating.ts`, but those direct fix files are not listed. B4 does not live in `memory-save.ts` now. B3 is the weakest claim: the current `causal-edges.ts` does not visibly contain the exact `WHERE a AND (b OR c)` form described, so that wording should be rechecked.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C05.md:1671:NOTES: B1, B2, and B4 are traceable in `reconsolidation.ts`, `checkpoints.ts`, and `pe-gating.ts`, but those direct fix files are not listed. B4 does not live in `memory-save.ts` now. B3 is the weakest claim: the current `causal-edges.ts` does not visibly contain the exact `WHERE a AND (b OR c)` form described, so that wording should be rechecked.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-002-codex-A2.md:45:mcp: cocoindex_code starting
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-002-codex-A2.md:48:mcp: cocoindex_code ready
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-002-codex-A2.md:50:mcp startup: ready: code_mode, cocoindex_code, sequential_thinking; failed: spec_kit_memory
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-002-codex-A2.md:170:tool cocoindex_code.search({"query":"embedding cache pipeline content to vector DB memory indexer save embedding pipeline importance weighting recency factor","limit":10,"refresh_index":true,"paths":[".opencode/skills/system-spec-kit/**"],"languages":"typescript"})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-002-codex-A2.md:171:cocoindex_code.search({"query":"embedding cache pipeline content to vector DB memory indexer save embedding pipeline importance weighting recency factor","limit":10,"refresh_index":true,"paths":[".opencode/skills/system-spec-kit/**"],"languages":"typescript"}) failed in 1ms:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-002-codex-A2.md:182:The memory MCP doesn’t expose local resources in this session, so I’m proceeding with direct code evidence and CocoIndex for the intent-level search the repo requires. I hit a parameter mismatch on the first semantic search call and am rerunning it with the correct language format.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-002-codex-A2.md:183:tool cocoindex_code.search({"query":"embedding cache pipeline content to vector DB memory indexer save embedding pipeline importance weighting recency factor","limit":10,"refresh_index":true,"paths":[".opencode/skills/system-spec-kit/**"],"languages":["typescript"]})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-002-codex-A2.md:184:cocoindex_code.search({"query":"embedding cache pipeline content to vector DB memory indexer save embedding pipeline importance weighting recency factor","limit":10,"refresh_index":true,"paths":[".opencode/skills/system-spec-kit/**"],"languages":["typescript"]}) success in 408ms:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/research/deep-research-round2-2026-03-26.md:133:- **memory_search**: includeConstitutional=true → Stage 1 injects max 5 constitutional rows → no decay applied
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/agent-output-iter-006-copilot-C1.md:383:I’ve confirmed most module-level tests exist, but the integration seams are the real weak spot. I’m doing one last pass on unused flags and then I’ll consolidate the audit into a findings-first report.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C11.md:661:  // This prevents weak single-keyword matches from dominating classification.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C11.md:754:NOTES: The cache table, SHA-256 keying, `last_used_at` LRU behavior, and cache-first lookup all exist. The weak spot is the description of `INSERT OR REPLACE`: it refreshes the same `(content_hash, model_id)` entry, but model-version separation is really handled by the composite key, not by replace semantics alone.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C11.md:811:NOTES: The cache table, SHA-256 keying, `last_used_at` LRU behavior, and cache-first lookup all exist. The weak spot is the description of `INSERT OR REPLACE`: it refreshes the same `(content_hash, model_id)` entry, but model-version separation is really handled by the composite key, not by replace semantics alone.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/agent-output-iter-008-codex-A1.md:11:- Medium: Cross-variant RRF is mathematically wrong by default because each variant is normalized before the variants are merged. [`fuseResultsCrossVariant()`](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/shared/algorithms/rrf-fusion.ts#L378) calls [`fuseResultsMulti()`](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/shared/algorithms/rrf-fusion.ts#L223) per variant, and that function normalizes scores at [`rrf-fusion.ts`](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/shared/algorithms/rrf-fusion.ts#L281) before the cross-variant merge at [`rrf-fusion.ts`](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/shared/algorithms/rrf-fusion.ts#L405). That destroys raw reciprocal-rank magnitudes, so a weak variant can contribute as much as a strong one.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/scratch/context-feature-catalog.md:12:2. 02-semantic-and-lexical-search-memorysearch.md — "Semantic and lexical search (memory_search)"
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/investigation-X03.md:484:135:**Already documented (14 false positives from Agent 2):** Mode-based orchestration, token-pressure override, spec folder auto-discovery, resume-mode injection, multi-concept search, quality threshold filter, session dedup, archived retrieval, trace emission — all described in the memory_context and memory_search catalog entries.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/agent-output-iter-003-copilot-C2.md:29:  │ "register|hook|before|after|onSuccess|onError|memory_search|memory_context|memory_match_triggers
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/agent-output-iter-003-copilot-C2.md:400:I found a concrete contract mismatch now: some handlers support governance/scope fields, but the Zod schemas on the dispatch boundary appear not to admit them. I’m checking whether that affects just `memory_save` or also `memory_search` and related lifecycle tools.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/agent-output-iter-003-copilot-C2.md:443:Overall: success envelopes are mostly consistent, hooks are wired, and thrown errors do reach MCP responses. The main weakness is **error-contract inconsistency**: some handlers return structured MCP errors, while others still throw raw `Error` and get downgraded by the global wrapper.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/agent-output-iter-003-copilot-C2.md:461:Errors do reach the client, but expected validation/policy failures lose tool-specific `code`, `details`, and recovery shape. That makes `memory_save`, `memory_bulk_delete`, and `memory_ingest_*` behave differently from `memory_search`, `memory_context`, and `memory_match_triggers`, which return structured MCP errors directly.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-002-copilot-C2.md:243:- `PIPELINE-002` `LOW` Tier precedence is deterministic in code but weakly documented. Actual order is: uncommented `importance_tier`/`importanceTier` match anywhere in content, then inline markers (`[CONSTITUTIONAL]`, etc.), then `fallbackTier`, then document-type default, then `normal` (`memory-parser.ts:543-579`). So it is **not** a strict frontmatter parser.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/handover.md:37:- Verified `memory_search("semantic search")` returns 5 results (Attempt 1 fixes confirmed working)
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/handover.md:66:- [x] Runtime verification: `memory_search("semantic search")` returns 5 results via hybrid pipeline (812ms)
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/handover.md:182:| `memory_search` (auto) | 7 candidates, 5 results | Same (unaffected) |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/handover.md:184:| `memory_search` (deep) | 15 candidates, 2 results | Same + `activeChannels: 2` |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/scratch/review-011-pass-a.md:8:| CocoIndex venv recreation, settings cleanup, stale DB reset, full re-index | Yes | Covered in the first Search entry and technical details. |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/scratch/review-011-pass-a.md:15:| `ccc index` / 51,820 files indexed | Yes | Covered in Verification table and CocoIndex section. |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/agent-output-iter-002-copilot-C1.md:299:- **Content deduplication is O(n²) and uses a weak similarity heuristic**
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C01.md:283:.opencode/skills/system-spec-kit/mcp_server/tool-schemas.ts:31:  inputSchema: { type: 'object', additionalProperties: false, properties: { input: { type: 'string', description: 'The query, prompt, or context description (required)' }, mode: { type: 'string', enum: ['auto', 'quick', 'deep', 'focused', 'resume'], default: 'auto', description: 'Context retrieval mode: auto (detect intent), quick (fast triggers), deep (comprehensive search), focused (intent-optimized), resume (session recovery)' }, intent: { type: 'string', enum: ['add_feature', 'fix_bug', 'refactor', 'security_audit', 'understand', 'find_spec', 'find_decision'], description: 'Explicit task intent. If not provided and mode=auto, intent is auto-detected from input.' }, specFolder: { type: 'string', description: 'Limit context to specific spec folder' }, limit: { type: 'number', description: 'Maximum results (mode-specific defaults apply)' }, sessionId: { type: 'string', description: 'Caller-supplied session identifier. If omitted, server generates an ephemeral UUID for this call only (not persisted across requests).' }, enableDedup: { type: 'boolean', default: true, description: 'Enable session deduplication' }, includeContent: { type: 'boolean', default: false, description: 'Include full file content in results' }, includeTrace: { type: 'boolean', default: false, description: 'Include provenance-rich trace data (scores, source, trace) in results when underlying memory_search is called' }, tokenUsage: { type: 'number', minimum: 0.0, maximum: 1.0, description: "Optional caller token usage ratio (0.0-1.0)" }, anchors: { type: 'array', items: { type: 'string' }, description: 'Filter content to specific anchors (e.g., ["state", "next-steps"] for resume mode)' } }, required: ['input'] },
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C01.md:473:          tool: 'memory_search',
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C01.md:1152:# Semantic and lexical search (memory_search)
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C01.md:1156:This is the primary search tool, and it does a lot. You give it a natural language query (or a multi-concept array of 2-5 strings where all concepts must match), and it runs the full hybrid retrieval pipeline.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C01.md:1572:NOTES: `memory_search` does route through `executePipeline()`, but the description overstates Stage 2 as the only place ranking work happens. Stage 1 delegates hybrid queries to `lib/search/hybrid-search.ts`, which already performs fusion/reranking-style work before Stage 2. The tool dispatcher is also missing from the path list.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C01.md:1656:NOTES: `memory_search` does route through `executePipeline()`, but the description overstates Stage 2 as the only place ranking work happens. Stage 1 delegates hybrid queries to `lib/search/hybrid-search.ts`, which already performs fusion/reranking-style work before Stage 2. The tool dispatcher is also missing from the path list.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/079-speckit-cognitive-memory/changes-manifest.md:318:| 4 | Main Handler | Modified | `memory_search()` - Call `apply_testing_effect()` after search completes |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/scratch/context-playbook.md:16:3. 002-semantic-and-lexical-search-memory-search.md — "EX-002 -- Semantic and lexical search (memory_search)"
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/audit-v3-o05-hydra-db-review.md:55:- **Recommended Fix**: Either (A) add an `asOf` parameter to `memory_search` or `memory_context` tool definitions to surface the existing implementation, or (B) update Phase 2 spec/implementation-summary to explicitly state that `asOf` is an internal-only capability not yet exposed via MCP tools, and create a follow-up spec for public exposure.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/audit-v3-o05-hydra-db-review.md:70:### O5-005: Scope Filtering Not Applied in `memory_search` Handler Pipeline Entry
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/audit-v3-o05-hydra-db-review.md:74:- **Description**: The `memory_search` handler calls `normalizeScopeContext()` at line 772 but the normalized scope is not visibly passed to the pipeline orchestrator in a way that enforces filtering at the handler level. The scope filtering does occur inside `stage1-candidate-gen.ts` (line 530: `filterRowsByScope`), which receives scope parameters through the pipeline context. However, the handler-level code appears to normalize scope but does not visibly thread it to the pipeline call in the same function body.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/015-runtime-contract-and-indexability/implementation-summary.md:59:Focused Vitest coverage was added first, then the runtime was updated to satisfy the desired contract without weakening the existing template, sufficiency, or quality-threshold aborts.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/z-archive-prior-audit/architecture-audit-report.md:81:| Criterion | Rating (1-5) | Evidence (violations or weaknesses) |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-001-codex-A2.md:43:mcp: cocoindex_code starting
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-001-codex-A2.md:46:mcp: cocoindex_code ready
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-001-codex-A2.md:48:mcp startup: ready: code_mode, cocoindex_code, sequential_thinking; failed: spec_kit_memory
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-001-codex-A2.md:153:tool cocoindex_code.search({"query":"input normalization workflow session types spec affinity architecture normalization pipeline session","paths":[".opencode/skills/system-spec-kit/scripts/**/*.ts"],"languages":"typescript","limit":10,"refresh_index":true})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-001-codex-A2.md:154:cocoindex_code.search({"query":"input normalization workflow session types spec affinity architecture normalization pipeline session","paths":[".opencode/skills/system-spec-kit/scripts/**/*.ts"],"languages":"typescript","limit":10,"refresh_index":true}) failed in 9ms:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-001-codex-A2.md:219:tool cocoindex_code.search({"query":"input normalization workflow session types spec affinity architecture normalization pipeline session","paths":[".opencode/skills/system-spec-kit/scripts/**/*.ts"],"languages":["typescript"],"limit":10,"refresh_index":true})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-001-codex-A2.md:220:cocoindex_code.search({"query":"input normalization workflow session types spec affinity architecture normalization pipeline session","paths":[".opencode/skills/system-spec-kit/scripts/**/*.ts"],"languages":["typescript"],"limit":10,"refresh_index":true}) success in 1.12s:
.opencode/specs/system-spec-kit/z_archive/004-script-audit-comprehensive/scratch/build-agent-03-mcp-verify.md:39:  - `memory_search` uses readiness gate, but gate can be bypassed by the pre-set ready flag: `handlers/memory-search.ts:598` -> `handlers/memory-search.ts:604`.
.opencode/specs/system-spec-kit/z_archive/004-script-audit-comprehensive/scratch/build-agent-03-mcp-verify.md:51:  - Some handlers do strong local checks (example `memory_search` query/concepts constraints): `handlers/memory-search.ts:562` -> `handlers/memory-search.ts:564`.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/agent-output-iter-007-copilot-C2.md:65:  │ "SPECKIT_|shared memory|task_preflight|task_postflight|checkpoint|memory_context|memory_search|m
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/agent-output-iter-007-copilot-C2.md:288:  │ "memory_context\(|memory_search\(|memory_match_triggers\(|memory_save\(|task_preflight\(|task_po
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/agent-output-iter-007-copilot-C2.md:538:   `SKILL.md` says `memory_search()` with only `specFolder` causes `E040`, but the runtime returns `E_VALIDATION`; `E040` is the legacy generic `SEARCH_FAILED` code.  
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/015-retrieval-enhancements/plan.md:77:- **Execution layer**: Manual operator actions plus MCP calls to `memory_search`, `memory_context`, consolidation cycle triggers, and the entity linker
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/015-retrieval-enhancements/plan.md:153:| MCP runtime for `memory_search` and `memory_context` | Runtime | Unknown | Retrieval and provenance scenarios cannot be executed |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/079-speckit-cognitive-memory/plan.md:256:5. Verify with `memory_search` test query
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/investigation-X09.md:162:    14	  - [Semantic and lexical search (memory_search)](#semantic-and-lexical-search-memory_search)
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/investigation-X09.md:841:DRAFT_DESCRIPTION: The TRM detector computes mean/stddev/top-score Z-score over retrieval scores and flags low-confidence evidence when statistical separation is weak or absolute score is too low. It includes defensive handling for empty input, single-score input, non-finite values, and zero-variance distributions. A graph-topology early coverage precheck is implemented in the same module for low-connectivity detection.  
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/investigation-X09.md:896:DRAFT_DESCRIPTION: The classifier applies explicit negative-pattern penalties to suppress misleading intent matches (for example, “how to fix” patterns reducing `understand`). It also enforces a minimum confidence floor, defaulting weak classifications to `understand`. This is a concrete anti-misclassification behavior beyond basic intent scoring.  
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/investigation-X09.md:941:DRAFT_DESCRIPTION: The TRM detector computes mean/stddev/top-score Z-score over retrieval scores and flags low-confidence evidence when statistical separation is weak or absolute score is too low. It includes defensive handling for empty input, single-score input, non-finite values, and zero-variance distributions. A graph-topology early coverage precheck is implemented in the same module for low-connectivity detection.  
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/investigation-X09.md:996:DRAFT_DESCRIPTION: The classifier applies explicit negative-pattern penalties to suppress misleading intent matches (for example, “how to fix” patterns reducing `understand`). It also enforces a minimum confidence floor, defaulting weak classifications to `understand`. This is a concrete anti-misclassification behavior beyond basic intent scoring.  
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/research/iterations/iteration-001.md:108:- **Description**: `resolveAlignmentTargets()` swallows spec-context failures and falls back to keyword-only matching, weakening contamination gate silently.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/research/iterations/iteration-001.md:198:- **Description**: Several entry-point functions >200 lines, weakening SRP.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-001-codex-A3.md:42:mcp: cocoindex_code starting
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-001-codex-A3.md:46:mcp: cocoindex_code ready
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-001-codex-A3.md:48:mcp startup: ready: code_mode, cocoindex_code, sequential_thinking; failed: spec_kit_memory
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-001-codex-A3.md:288:tool cocoindex_code.search({"query":"TypeScript naming conventions, export style, module header comments, priority P0 P1 P2, importance tiers in .opencode skills and system-spec-kit scripts","paths":[".opencode/skills/**"],"languages":"typescript,markdown","limit":10,"refresh_index":false})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-001-codex-A3.md:289:cocoindex_code.search({"query":"TypeScript naming conventions, export style, module header comments, priority P0 P1 P2, importance tiers in .opencode skills and system-spec-kit scripts","paths":[".opencode/skills/**"],"languages":"typescript,markdown","limit":10,"refresh_index":false}) failed in 7ms:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-001-codex-A3.md:455:tool cocoindex_code.search({"query":"input normalizer aliases for specFolder sessionSummary keyDecisions nextSteps technicalContext trigger phrases importance tier files user prompts recent context and capture source types","paths":[".opencode/skills/system-spec-kit/scripts/**/*.ts"],"languages":["typescript"],"limit":8,"refresh_index":false})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-001-codex-A3.md:456:cocoindex_code.search({"query":"input normalizer aliases for specFolder sessionSummary keyDecisions nextSteps technicalContext trigger phrases importance tier files user prompts recent context and capture source types","paths":[".opencode/skills/system-spec-kit/scripts/**/*.ts"],"languages":["typescript"],"limit":8,"refresh_index":false}) success in 442ms:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-001-codex-A3.md:1041:tool cocoindex_code.search({"query":"where input normalizer validates raw input aliases like specFolder spec_folder SPEC_FOLDER filesModified files_modified sessionSummary session_summary keyDecisions key_decisions nextSteps next_steps technicalContext triggerPhrases trigger_phrases importanceTier importance_tier userPrompts user_prompts recentContext recent_context and open code capture snake_case session_title session_id captured_at","paths":[".opencode/skills/system-spec-kit/scripts/utils/input-normalizer.ts"],"languages":["typescript"],"limit":5,"refresh_index":false})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-001-codex-A3.md:1042:cocoindex_code.search({"query":"where input normalizer validates raw input aliases like specFolder spec_folder SPEC_FOLDER filesModified files_modified sessionSummary session_summary keyDecisions key_decisions nextSteps next_steps technicalContext triggerPhrases trigger_phrases importanceTier importance_tier userPrompts user_prompts recentContext recent_context and open code capture snake_case session_title session_id captured_at","paths":[".opencode/skills/system-spec-kit/scripts/utils/input-normalizer.ts"],"languages":["typescript"],"limit":5,"refresh_index":false}) success in 449ms:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-001-codex-A3.md:1068:.opencode/skills/system-spec-kit/references/debugging/troubleshooting.md:66:memory_search({ query: "auth", specFolder: "122" })
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-001-codex-A3.md:1069:.opencode/skills/system-spec-kit/references/debugging/troubleshooting.md:72:memory_search({ query: "auth", specFolder: "122-skill-standardization" })
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-001-codex-A3.md:1076:.opencode/skills/system-spec-kit/references/debugging/troubleshooting.md:341:const results = await memory_search({ specFolder: "###-correct-folder", limit: 3 })
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-001-codex-A3.md:1079:.opencode/skills/system-spec-kit/references/debugging/troubleshooting.md:413:| **Memory Not Found** | Search returns no results | Check `memory_search({ specFolder: "..." })` |
.opencode/specs/system-spec-kit/z_archive/004-script-audit-comprehensive/scratch/legacy-memory-quarantine/15-02-26_11-25__system-spec-kit.md:370:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "system-spec-kit" })` |
.opencode/specs/system-spec-kit/z_archive/004-script-audit-comprehensive/scratch/legacy-memory-quarantine/15-02-26_11-25__system-spec-kit.md:382:memory_search({ specFolder: "system-spec-kit", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/004-script-audit-comprehensive/scratch/legacy-memory-quarantine/15-02-26_11-25__system-spec-kit.md:388:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/004-script-audit-comprehensive/scratch/legacy-memory-quarantine/15-02-26_11-25__system-spec-kit.md:397:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/research/iterations/iteration-002.md:51:### [LOGIC] content-filter.ts: O(n²) similarity with weak heuristic (C1)
.opencode/specs/system-spec-kit/z_archive/004-script-audit-comprehensive/scratch/legacy-memory-quarantine/15-02-26_17-25__script-audit-comprehensive.md:370:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "system-spec-kit/z_archive/004-script-audit-comprehensive" })` |
.opencode/specs/system-spec-kit/z_archive/004-script-audit-comprehensive/scratch/legacy-memory-quarantine/15-02-26_17-25__script-audit-comprehensive.md:382:memory_search({ specFolder: "system-spec-kit/z_archive/004-script-audit-comprehensive", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/004-script-audit-comprehensive/scratch/legacy-memory-quarantine/15-02-26_17-25__script-audit-comprehensive.md:388:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/004-script-audit-comprehensive/scratch/legacy-memory-quarantine/15-02-26_17-25__script-audit-comprehensive.md:397:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-003-codex-A1.md:35:mcp: cocoindex_code starting
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-003-codex-A1.md:40:mcp: cocoindex_code ready
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-003-codex-A1.md:42:mcp startup: ready: code_mode, cocoindex_code, sequential_thinking; failed: spec_kit_memory
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-003-codex-A1.md:267:tool cocoindex_code.search({"query":"Where is sk-doc template_rules.json and how are document-type scoring multipliers defined or referenced? Also where are HVR rules enforced for spec folder documents?","limit":10,"refresh_index":false})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-003-codex-A1.md:268:cocoindex_code.search({"query":"Where is sk-doc template_rules.json and how are document-type scoring multipliers defined or referenced? Also where are HVR rules enforced for spec folder documents?","limit":10,"refresh_index":false}) success in 437ms:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/research/research.md:215:- **Description:** `fuseResultsCrossVariant()` normalizes scores per variant before merging. This destroys raw reciprocal-rank magnitudes, so a weak variant contributes as much as a strong one.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/research/research.md:398:- **Description:** `resolveAlignmentTargets()` swallows spec-context failures and falls back to keyword-only matching, weakening contamination gate silently.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/research/research.md:726:- **Description:** SKILL.md says `memory_search()` with only `specFolder` causes `E040`, but runtime returns `E_VALIDATION`; `E040` is legacy `SEARCH_FAILED`.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/research/research.md:821:- **Description:** `memory_match_triggers` mixes `session_id`, `turnNumber`, `include_cognitive`. `memory_search` supports both `min_quality_score` and deprecated `minQualityScore`.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/agent-output-iter-002-codex-A1.md:35:TypeScript verification passed with `npm exec --prefix .opencode/skills/system-spec-kit/scripts tsc -- --noEmit -p .opencode/skills/system-spec-kit/scripts/tsconfig.json`. CocoIndex only returned mirrored spec snapshots for this area, so the live-source review above is based on direct reads of the `.opencode` files.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/001-retrieval/spec.md:3:description: "Test specification for the retrieval category: 13 playbook scenarios covering memory_context, memory_search, memory_match_triggers, /memory:search routing, memory_quick_search, hybrid pipeline, 4-stage architecture, BM25 gate, quality fallback, and advanced session/graph scenarios."
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/001-retrieval/spec.md:103:| EX-002 | Semantic and lexical search (memory_search) | `../../manual_testing_playbook/01--retrieval/002-semantic-and-lexical-search-memory-search.md` | 01--retrieval / 02-semantic-and-lexical-search-memorysearch.md |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/001-retrieval/spec.md:165:| Dependency | MCP runtime and command surface for `memory_context`, `memory_quick_search`, `memory_search`, `memory_match_triggers`, and `/memory:search` | Retrieval scenarios cannot be executed | Verify MCP runtime healthy before starting |
.opencode/specs/system-spec-kit/z_archive/004-script-audit-comprehensive/scratch/legacy-memory-quarantine/15-02-26_13-19__script-audit-comprehensive.md:370:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "system-spec-kit/z_archive/004-script-audit-comprehensive" })` |
.opencode/specs/system-spec-kit/z_archive/004-script-audit-comprehensive/scratch/legacy-memory-quarantine/15-02-26_13-19__script-audit-comprehensive.md:382:memory_search({ specFolder: "system-spec-kit/z_archive/004-script-audit-comprehensive", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/004-script-audit-comprehensive/scratch/legacy-memory-quarantine/15-02-26_13-19__script-audit-comprehensive.md:388:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/004-script-audit-comprehensive/scratch/legacy-memory-quarantine/15-02-26_13-19__script-audit-comprehensive.md:397:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/z-archive-prior-audit/legacy-memory-quarantine/06-03-26_11-58__phase-8-architecture-boundaries.md:320:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "system-spec-kit/022-hybrid-rag-fusion" })` |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/z-archive-prior-audit/legacy-memory-quarantine/06-03-26_11-58__phase-8-architecture-boundaries.md:332:memory_search({ specFolder: "system-spec-kit/022-hybrid-rag-fusion", limit: 10 })
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/z-archive-prior-audit/legacy-memory-quarantine/06-03-26_11-58__phase-8-architecture-boundaries.md:338:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/z-archive-prior-audit/legacy-memory-quarantine/06-03-26_11-58__phase-8-architecture-boundaries.md:347:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-002-copilot-C3.md:270:**SESSION-004 — P1 — Validation between collection and indexing is strong at the rendered-memory stage, but weak at native-capture ingress.** File/JSON input gets `validateInputData()` and `normalizeInputData()`. Native capture paths skip that schema validation entirely and are accepted if they have “usable” content, so malformed-but-nonempty transformed data can reach extraction/rendering. Indexing is then heavily gated by template-contract validation, sufficiency, quality threshold, and source-aware rule disposition, so bad content is unlikely to index unless it renders plausibly. Evidence: `data-loader.ts:517-525`, `557-566`; `workflow.ts:2122-2253`, `2381-2417`; `validate-memory-quality.ts:390-446`.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-002-copilot-C3.md:272:**SESSION-005 — P2 — The type hierarchy is serviceable, but over-complicated.** The boundary between ingest (`CollectedDataBase`) and render DTO (`SessionData`) is reasonable, but `CollectedDataFull` adds no structure, `CollectedDataBase` mixes canonical and legacy fields plus `[key: string]: unknown`, and file entries accept both `FILE_PATH`/`path` and `DESCRIPTION`/`description`. That flexibility helps adapters, but weakens type safety and makes invariants hard to reason about. Evidence: `session-types.ts:25-37`, `124-152`, `442-534`; `collect-session-data.ts:118-119`.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/001-retrieval/plan.md:55:- [ ] MCP runtime is healthy and `memory_context`, `memory_search`, `memory_match_triggers` respond
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/001-retrieval/plan.md:78:- **Execution layer**: Manual operator actions plus MCP calls to `memory_context`, `memory_search`, and `memory_match_triggers`.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/001-retrieval/plan.md:95:- [ ] Confirm MCP runtime access for `memory_context`, `memory_search`, and `memory_match_triggers`
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/001-retrieval/plan.md:103:- [ ] Run EX-002 (semantic and lexical search) — dual `memory_search`, default then `bypassCache:true`
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/001-retrieval/plan.md:107:- [ ] Run EX-005 (4-stage pipeline architecture) — `memory_search` with `intent:understand`, stage invariant check
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/001-retrieval/plan.md:139:| EX-002 | Semantic and lexical search (memory_search) | MCP |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/001-retrieval/plan.md:162:| MCP runtime (`memory_context`, `memory_search`, `memory_match_triggers`) | Internal | Unknown | Retrieval scenarios cannot be executed |
.opencode/specs/system-spec-kit/z_archive/004-script-audit-comprehensive/scratch/legacy-memory-quarantine/15-02-26_11-06__script-audit-comprehensive.md:370:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "system-spec-kit/z_archive/004-script-audit-comprehensive" })` |
.opencode/specs/system-spec-kit/z_archive/004-script-audit-comprehensive/scratch/legacy-memory-quarantine/15-02-26_11-06__script-audit-comprehensive.md:382:memory_search({ specFolder: "system-spec-kit/z_archive/004-script-audit-comprehensive", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/004-script-audit-comprehensive/scratch/legacy-memory-quarantine/15-02-26_11-06__script-audit-comprehensive.md:388:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/004-script-audit-comprehensive/scratch/legacy-memory-quarantine/15-02-26_11-06__script-audit-comprehensive.md:397:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/001-retrieval/checklist.md:68:- [x] CHK-011 [P0] M-001 — PASS. Resume strategy at `handlers/memory-context.ts:569-597` uses `['state','next-steps','summary','blockers']` anchors and `includeContent:true`, matching the `/memory:continue` operator workflow. `memory_search` `specFolder`+`anchors` params wired at `handlers/memory-search.ts:183-187`. [EVIDENCE: tasks.md; implementation-summary.md]
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/001-retrieval/checklist.md:70:- [x] CHK-013 [P0] M-002 — PASS. `memory_search` accepts `specFolder` and `anchors` (`handlers/memory-search.ts:183-187`). Anchor metadata annotated in Stage 2 (`lib/search/pipeline/stage2-fusion.ts` step 8). Fact-level retrieval matches playbook pattern. [EVIDENCE: tasks.md; implementation-summary.md]
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/002-mutation/plan.md:166:- **Procedure for EX-008**: Restore named checkpoint via `checkpoint_restore`, verify restore with `memory_search`, discard compromised evidence before retrying.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/002-mutation/plan.md:223:3. Verify restore with `memory_search` or `memory_stats`
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/agent-output-iter-008-copilot-C1.md:401:Core IR math in `eval-metrics.ts` looks standard and solid. The weaker areas are **maintenance fidelity**, **metric consistency**, and a few **script/runtime coupling** edges that can make some outputs less trustworthy than they appear.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/agent-output-iter-008-copilot-C1.md:439:- Impact: useful as a placeholder, weak as rollout evidence.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/002-mutation/implementation-summary.md:50:| EX-006 | Memory indexing (memory_save) | **PASS** | `handlers/memory-save.ts:541` — `handleMemorySave` dispatches through path validation, quality gate, PE gate, `BEGIN IMMEDIATE` transaction; `memory_stats()` + `memory_search()` wired in `memory-tools.ts:46,67` |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/001-retrieval/tasks.md:64:| T012 | EX-002 | Semantic and lexical search (memory_search) | DONE | PASS | handlers/memory-search.ts:185 (bypassCache param), :610-612 (cache bypass logic), feature-catalog/02-semantic-and-lexical-search |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/002-mutation/checklist.md:80:- [x] CHK-020 [P0] EX-006 executed and verdicted — Memory indexing (memory_save) — **PASS** — `handlers/memory-save.ts:541` `handleMemorySave` dispatches through path validation, PE gate, quality gate, embedding pipeline, `BEGIN IMMEDIATE` transaction, and returns success with indexed `id`; `memory_stats()` and `memory_search()` tool wiring confirmed in `memory-tools.ts:46,67` [EVIDENCE: tasks.md; implementation-summary.md]
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/002-mutation/checklist.md:101:- [x] CHK-052 [P0] Post-execution: deleted item confirmed absent from retrieval — `vectorIndex.deleteMemory(numericId)` removes the row; subsequent `memory_search(old title)` returns 0 results (verified through code: no resurrection path exists after delete) [EVIDENCE: tasks.md; implementation-summary.md]
.opencode/specs/system-spec-kit/z_archive/004-script-audit-comprehensive/scratch/legacy-memory-quarantine/15-02-26_11-11__system-spec-kit.md:371:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "system-spec-kit" })` |
.opencode/specs/system-spec-kit/z_archive/004-script-audit-comprehensive/scratch/legacy-memory-quarantine/15-02-26_11-11__system-spec-kit.md:383:memory_search({ specFolder: "system-spec-kit", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/004-script-audit-comprehensive/scratch/legacy-memory-quarantine/15-02-26_11-11__system-spec-kit.md:389:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/004-script-audit-comprehensive/scratch/legacy-memory-quarantine/15-02-26_11-11__system-spec-kit.md:398:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/002-mutation/tasks.md:63:| T010 | EX-006 | Memory indexing (memory_save) | DONE | PASS | `handlers/memory-save.ts:541-603` + `handleMemorySave` dispatches through PE gate, quality gate, embedding, and transaction; `memory_stats()` and `memory_search()` chain verified in tool-schemas |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/audit-v3-c10-type-safety-analysis.md:91:- Count in this file: `memory_search_cross_cast_count=4`
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/audit-v3-c10-type-safety-analysis.md:118:- This weakens confidence in a file meant to provide broad CRUD regression coverage.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/001-retrieval/implementation-summary.md:53:| EX-002 | Semantic and lexical search (memory_search) | **PASS** | `handlers/memory-search.ts:185` (`bypassCache` param), `:610-612` (cache bypass logic) |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-002-copilot-C1.md:106:  │ product|embedding similarity|hybrid retrieval|lexical" in
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-002-copilot-C1.md:287:1. Keyword matching is only strong when the text contains explicit spec IDs, exact file paths, or very distinctive slug/title tokens. It is weak on paraphrases and on families of related specs with overlapping vocabulary. The current matcher is pure lexical OR logic (`matchedFileTargets || matchedPhrases || matchedSpecId || >=2 keywords`) with no weighting or rarity model [`spec-affinity.ts:354-392`].
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/audit-v3-c08-test-coverage-analysis.md:45:Description: A meaningful slice of the suite is labeled deferred and currently provides weak coverage. Some tests are literal no-ops, while others only regex-match source files instead of exercising behavior.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/010-search-retrieval-quality-fixes/spec.md:3:description: "Fix six retrieval quality issues in memory_context/memory_search: intent propagation bug, silent folder auto-narrowing, aggressive token budget truncation, folder discovery as boost signal, two-tier metadata+content response, and intent confidence floor."
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/010-search-retrieval-quality-fixes/spec.md:81:| "semantic search" | `memory_search` direct | 20 | 1 | RC2-B: budget truncation |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/010-search-retrieval-quality-fixes/spec.md:82:| "semantic search vector embeddings CocoIndex" | `memory_quick_search` | 18 | 1 | RC2-B: budget truncation |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/010-search-retrieval-quality-fixes/spec.md:83:| "hybrid retrieval pipeline vector search embedding" | `memory_search` direct | 28 | 1 | RC2-B: budget truncation |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/010-search-retrieval-quality-fixes/spec.md:90:| "semantic search vector embeddings CocoIndex" | security_audit | 0.111 | No |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/010-search-retrieval-quality-fixes/spec.md:91:| "hybrid retrieval pipeline vector search embedding" | find_decision | 0.190 | No |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/010-search-retrieval-quality-fixes/spec.md:160:| VER-003 | `memory_search({ query: "semantic search", includeContent: true, limit: 20 })` | >=5 results returned (not truncated to 1) |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/010-search-retrieval-quality-fixes/spec.md:161:| VER-004 | `memory_search({ query: "semantic search" })` | Intent defaults to "understand" (not fix_bug at 0.098) |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/010-search-retrieval-quality-fixes/spec.md:213:- Should confidence floor (0.25) apply to `memory_context` auto-detection too, or only `memory_search`?
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/checklist.md:69:- [x] CHK-022 [P0] Vector search returns results from `context-index.sqlite` after Voyage-4 provider init (not empty provider-specific DB) [Evidence: memory_search("semantic search") returned 5 results via hybrid pipeline (812ms); vector-index-store.ts resolve_database_path() pinned to stable path]
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/checklist.md:77:- [x] CHK-030a [P0] sessionId no longer activates scope filtering in stage1 candidate generation [Evidence: 2026-04-02 — `memory_search` deep mode returned 8 candidates, 2 results; no scope filtering despite ephemeral sessionId present]
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/checklist.md:78:- [x] CHK-031a [P1] `activeChannels` field present in stage1 pipeline metadata [Evidence: 2026-04-02 — `stage1.activeChannels: 2` in `memory_search` deep mode response (hybrid = vector + FTS5)]
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/checklist.md:130:**Status**: All P0 (13/13) and P1 (11/11) items verified with evidence. 1 P2 item remaining (CHK-054: memory save). Channel audit verified: `memory_context` focused mode returns 5 candidates (was 0), `memory_search` deep mode returns 8 candidates with `activeChannels: 2`.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-001-codex-A1.md:43:mcp: cocoindex_code starting
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-001-codex-A1.md:47:mcp: cocoindex_code ready
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-001-codex-A1.md:49:mcp startup: ready: code_mode, cocoindex_code, sequential_thinking; failed: spec_kit_memory
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-001-codex-A1.md:309:tool cocoindex_code.search({"query":"importanceWeight in vector index or retrieval ranking for memory documents","limit":5,"refresh_index":true})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-001-codex-A1.md:310:cocoindex_code.search({"query":"importanceWeight in vector index or retrieval ranking for memory documents","limit":5,"refresh_index":true}) success in 833ms:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-001-codex-A1.md:315:      "text": "{\n  \"success\": true,\n  \"results\": [\n    {\n      \"file_path\": \"specs/system-spec-kit/022-hybrid-rag-fusion/system-spec-kit/mcp_server/lib/README.md\",\n      \"language\": \"markdown\",\n      \"content\": \"### Key Features\\n\\n| Feature | Description |\\n|---------|-------------|\\n| **Semantic Search** | Vector-based similarity search with SQLite vector index and hybrid keyword matching |\\n| **Cognitive Memory** | Human-like memory features including attention decay, working memory and co-activation |\\n| **Importance Scoring** | Six-tier importance classification (constitutional, critical, important, normal, temporary, deprecated) |\\n| **Folder Ranking** | Composite scoring for spec folders based on recency, relevance and importance |\",\n      \"start_line\": 50,\n      \"end_line\": 57,\n      \"score\": 0.6857385145793113\n    },\n    {\n      \"file_path\": \"specs/system-spec-kit/022-hybrid-rag-fusion/system-spec-kit/mcp_server/lib/scoring/README.md\",\n      \"language\": \"markdown\",\n      \"content\": \"# Scoring Algorithms\\n\\n> Multi-factor scoring system for memory retrieval with composite weighting, importance tiers, folder ranking and confidence tracking.\\n\\n---\\n\\n## TABLE OF CONTENTS\\n<!-- ANCHOR:table-of-contents -->\\n\\n- [1. OVERVIEW](#1--overview)\\n- [2. KEY CONCEPTS](#2--key-concepts)\\n- [3. STRUCTURE](#3--structure)\\n- [4. USAGE](#4--usage)\\n- [5. RELATED RESOURCES](#5--related-resources)\\n\\n<!-- /ANCHOR:table-of-contents -->\\n\\n---\\n\\n## 1. OVERVIEW\\n<!-- ANCHOR:overview -->\\n\\n### What is the Scoring Module?\\n\\nThe scoring module provides multi-factor algorithms for ranking memories in the Spec Kit Memory system. It combines similarity scores with temporal decay, importance tiers, usage patterns and validation feedback to surface the most relevant memories.\\n\\n### Key Features\\n\\n| Feature | Description |\\n|---------|-------------|\\n| **5-Factor Composite** | REQ-017 compliant scoring with temporal, usage, importance, pattern and citation factors |\",\n      \"start_line\": 10,\n      \"end_line\": 40,\n      \"score\": 0.6600219080477228\n    },\n    {\n      \"file_path\": \"specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/070-memory-ranking/research.md\",\n      \"language\": \"markdown\",\n      \"content\": \"---\\ntitle: \\\"Research: Memory & Folder Ranking Approaches [070-memory-ranking/research]\\\"\\ndescription: \\\"Ranking memories and folders for relevance requires balancing multiple, sometimes competing, factors\\\"\\ntrigger_phrases:\\n  - \\\"research\\\"\\n  - \\\"memory\\\"\\n  - \\\"folder\\\"\\n  - \\\"ranking\\\"\\n  - \\\"approaches\\\"\\n  - \\\"070\\\"\\nimportance_tier: \\\"normal\\\"\\ncontextType: \\\"research\\\"\\n---\\n<!-- SPECKIT_TEMPLATE_SOURCE: research | v1.0 -->\\n# Research: Memory & Folder Ranking Approaches\\n\\n> **Spec:** `071-memory-ranking`  \\n> **Purpose:** Document prior art, alternatives, and evidence supporting design decisions  \\n> **Created:** 2026-01-16\\n\\n---\",\n      \"start_line\": 1,\n      \"end_line\": 21,\n      \"score\": 0.6228492209581802\n    },\n    {\n      \"file_path\": \"specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/044-speckit-test-suite/scratch/test-agent-09-tiers/TEST-REPORT.md\",\n      \"language\": \"markdown\",\n      \"content\": \"### Importance Weight (T9.9) - OBSERVE\\n- Weights observed: 0.5 (default), 0.79, 0.89, 1.0\\n- Weight is stored and updateable via `memory_update`\\n- Search results ordered primarily by similarity score\\n- Weight not shown in search result output (only stored)\\n- **Recommendation:** Clarify if weight should affect ranking or is for other purposes\\n\\n## Cleanup Status\\n- Test memory ID 398 deleted\\n- Test memory file removed\\n- No test data remains in system\\n- Verified: `memory_list` for test folder returns 0 results\",\n      \"start_line\": 66,\n      \"end_line\": 77,\n      \"score\": 0.6115574155204069\n    },\n    {\n      \"file_path\": \"specs/system-spec-kit/022-hybrid-rag-fusion/system-spec-kit/mcp_server/README.md\",\n      \"language\": \"markdown\",\n      \"content\": \"### L2: Core (3 tools, token budget: 1500)\\n\\n#### `memory_search`\\n\\nSemantic search using vector similarity with optional BM25, FTS5 and graph channels. Returns ranked results with scores. Constitutional tier always surfaces at the top.\\n\\n| Parameter | Type | Notes |\\n|-----------|------|-------|\",\n      \"start_line\": 289,\n      \"end_line\": 296,\n      \"score\": 0.606314753147835\n    }\n  ],\n  \"total_returned\": 5,\n  \"offset\": 0,\n  \"message\": null\n}"
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/changelog/changelog-010-search-retrieval-quality-fixes.md:3:This phase implemented six retrieval-quality fixes across the `memory_context` and `memory_search` handlers, then received a structural doc-alignment pass on 2026-04-02. The code changes are in place, but the phase packet still marks fresh restart and cache-sensitive reruns as pending, so this changelog records the shipped implementation work without claiming final rerun closure.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/010-search-retrieval-quality-fixes/plan.md:3:description: "Six-fix implementation plan for memory_context/memory_search retrieval quality: intent propagation, folder auto-narrowing recovery, adaptive token truncation, folder boost signal, two-tier response, and intent confidence floor."
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/010-search-retrieval-quality-fixes/plan.md:265:| Manual | `memory_search({ query: "semantic search", includeContent: true, limit: 20 })` | >=5 results returned | RC2-B |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/010-search-retrieval-quality-fixes/plan.md:266:| Manual | `memory_search({ query: "semantic search" })` | Intent="understand" (not fix_bug) | RC3-B |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/010-search-retrieval-quality-fixes/plan.md:268:| Regression | `memory_search({ query: "CocoIndex" })` | Still returns CocoIndex results | All |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/010-search-retrieval-quality-fixes/plan.md:269:| Regression | `memory_match_triggers({ prompt: "CocoIndex" })` | Trigger matching unaffected | None |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/079-speckit-cognitive-memory/001-analysis-cognitive-memory-systems.md:349:4. **Synaptic tagging** (Frey & Morris): weak memories can be strengthened by strong ones
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/z-archive-prior-audit/readme-audit-A17.md:17:- `memory-tools.ts` — 10 tools: `memory_search`, `memory_match_triggers`, `memory_save`, `memory_list`, `memory_stats`, `memory_health`, `memory_delete`, `memory_update`, `memory_validate`, `memory_bulk_delete`
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/agent-output-iter-009-copilot-C2.md:94:The first coverage script tripped on a path-normalization bug, so I’m rerunning it with a stricter parser and also pulling the specific files that look most likely to reveal flakiness or weak assertions.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/agent-output-iter-009-copilot-C2.md:142:I’ve got enough breadth now; I’m tightening the evidence on two places that matter most for the final callout list: the “missing coverage” map and whether any suites lean on weak, performance, or timing-based assertions.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/agent-output-iter-009-copilot-C2.md:160:● Count weak assertion patterns (shell)
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/agent-output-iter-009-copilot-C2.md:323:Overall: **good in modern Vitest files, weak in legacy script tests**.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/agent-output-iter-009-copilot-C2.md:453:Concrete weak spots:
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/changelog/changelog-006-review-remediation.md:17:**Problem:** Two command-line helpers still relied on CommonJS (the older Node.js module system) path behavior. In a codebase that had otherwise moved to ESM (the modern JavaScript module system), that left a couple of weak spots where a script could resolve its location differently from the rest of the package.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/changelog/changelog-006-review-remediation.md:101:**Problem:** A previously completed verification phase still appeared open in the documentation. That weakens confidence because a finished parent release should not depend on a child record that still looks incomplete.
.opencode/specs/system-spec-kit/z_archive/004-script-audit-comprehensive/scratch/context-agent-03-mcp-server.md:37:- Repro hint: after cold start, issue rapid `memory_search`/`memory_save` calls before model readiness settles.
.opencode/specs/system-spec-kit/z_archive/004-script-audit-comprehensive/scratch/context-agent-03-mcp-server.md:45:- Repro hint: call `memory_search` without `query` and without `concepts` to observe downstream behavior.
.opencode/specs/system-spec-kit/z_archive/004-script-audit-comprehensive/scratch/context-agent-03-mcp-server.md:56:### C03-F006 - MEDIUM - Auto-surface failure path is non-fatal but weakly observable
.opencode/specs/system-spec-kit/z_archive/004-script-audit-comprehensive/scratch/context-agent-03-mcp-server.md:118:# Immediately after process start, issue burst calls to memory_search/memory_save
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/scratch/04-grouped-by-type.md:16:  5.42  │ #1709  │ Tasks: CocoIndex Code MCP Integration    │ 022-mcp-coco
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/z-archive-prior-audit/verification-log-2026-03-04.md:63:stderr | tests/tool-input-schema.vitest.ts > memory_search limit contract > rejects limit above 100
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/z-archive-prior-audit/verification-log-2026-03-04.md:64:[schema-validation] memory_search: Invalid arguments for "memory_search". Parameter "limit" is invalid: Too big: expected number to be <=100 Expected parameter names: query, concepts, specFolder, limit, sessionId, enableDedup, tier, contextType, useDecay, includeContiguity, includeConstitutional, enableSessionBoost, enableCausalBoost, includeContent, anchors, min_quality_score, minQualityScore, bypassCache, rerank, applyLengthPenalty, applyStateLimits, minState, intent, autoDetectIntent, trackAccess, includeArchived, mode, includeTrace. Action: remove unknown keys and fix the listed parameter types/values, then retry the same tool call.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/z-archive-prior-audit/verification-log-2026-03-04.md:118:stdout | tests/memory-search-eval-channels.vitest.ts > T056: memory_search emits per-channel eval rows > logs one eval_channel_results row per contributing channel
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-002-codex-A1.md:42:mcp: cocoindex_code starting
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-002-codex-A1.md:48:mcp: cocoindex_code ready
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-002-codex-A1.md:50:mcp startup: ready: code_mode, cocoindex_code, sequential_thinking; failed: spec_kit_memory
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-002-codex-A1.md:81:allowed-tools: [Read, Write, Edit, Bash, Grep, Glob, Task, WebFetch, memory_context, memory_search]
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-002-codex-A1.md:214:tool cocoindex_code.search({"query":"workflow.ts architecture embedding pipeline memory indexing normalize input capture retrieval save index spec kit","paths":[".opencode/skills/system-spec-kit/scripts/core/*"],"languages":"typescript","limit":8,"refresh_index":true})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-002-codex-A1.md:215:cocoindex_code.search({"query":"workflow.ts architecture embedding pipeline memory indexing normalize input capture retrieval save index spec kit","paths":[".opencode/skills/system-spec-kit/scripts/core/*"],"languages":"typescript","limit":8,"refresh_index":true}) failed in 8ms:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-002-codex-A1.md:315:tool cocoindex_code.search({"query":"workflow orchestration memory generation indexing validation embedding pipeline control flow","paths":[".opencode/skills/system-spec-kit/scripts/core/*"],"languages":["typescript"],"limit":8,"refresh_index":true})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-002-codex-A1.md:316:cocoindex_code.search({"query":"workflow orchestration memory generation indexing validation embedding pipeline control flow","paths":[".opencode/skills/system-spec-kit/scripts/core/*"],"languages":["typescript"],"limit":8,"refresh_index":true}) success in 599ms:
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/changelog/changelog-014-feedback-signal-pipeline.md:22:Wired the 4 previously unwired feedback event types (`result_cited`, `follow_on_tool_use`, `query_reformulated`, `same_topic_requery`) into the memory search pipeline. The system previously only logged `search_shown` (weak signal, 0.1x weight) -- now all 5 event types are active, including the two strongest signals (`result_cited` and `follow_on_tool_use` at 1.0x weight). This enables the learned-trigger, negative-feedback, and batch-learning subsystems to receive real usage data for relevance tuning.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/changelog/changelog-014-feedback-signal-pipeline.md:30:- **`same_topic_requery` event wiring** -- Fires when consecutive queries have >0.8 similarity, indicating the user re-queried the same topic. Logged as a weak signal (0.1x weight).
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/changelog/changelog-014-feedback-signal-pipeline.md:35:- **`context-server.ts`** -- Added `follow_on_tool_use` hook in the tool dispatch path, after `dispatchTool()` returns. Excludes search tools (`memory_search`, `memory_context`, `memory_quick_search`) and `session_health` to avoid self-referential feedback loops.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/changelog/changelog-011-indexing-and-adaptive-fusion.md:11:### CocoIndex Code was still pointed at stale repository state
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/changelog/changelog-011-indexing-and-adaptive-fusion.md:15:**Fix:** The parent phase rebuilt the CocoIndex environment against the active repository and tightened exclusions so code search skips packet and changelog noise.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/changelog/changelog-011-indexing-and-adaptive-fusion.md:91:| CocoIndex rebuild coverage | `0` | `51,820 files / 663,336 chunks` |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/changelog/changelog-011-indexing-and-adaptive-fusion.md:108:| `.opencode/skills/mcp-coco-index/mcp_server/.cocoindex_code/` | Rebuilt semantic-code indexing against the active repository and tightened exclusions. |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/scratch/23-indent-level-hierarchy.md:16:  5.42 -0.84 #1709  Tasks: CocoIndex Code MCP Integration · 022-mcp-coco
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/changelog/changelog-002-mcp-server-esm-migration.md:33:**Problem:** ESM expects exact file targets for local imports. Older shorthand imports can leave hidden weak points where a feature looks fine in one path but fails when the loader follows stricter resolution rules.
.opencode/specs/system-spec-kit/z_archive/004-script-audit-comprehensive/scratch/review-agent-03-mcp.md:58:- Both agents agree validation is handler-dependent. Entry point does length-only check (`:114-116`). Some handlers (e.g., `memory_search`) do strong local validation; coverage across all 22 tools is unverified.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/scratch/17-progressive-disclosure.md:15:  5.42  #1709  Tasks: CocoIndex Code MCP Integration · 022-mcp-coco
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/014-stateless-quality-gates/decision-record.md:71:| **Bundled hard-block + structured-input + source-aware policy (chosen)** | Removes the false-positive trap without weakening the real safety rails; avoids temp files; keeps source-specific behavior explicit | The contract spans three files and needs clear documentation to stay coherent | 9/10 |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/agent-output-iter-003-copilot-C1.md:181:- `memory-crud-list.ts:47-53,92,108-110` silently falls back on invalid `sortBy`, and `limit: 0` becomes the default because of `rawLimit || 20`. Validation is weaker than the other CRUD handlers.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/agent-output-iter-003-copilot-C1.md:197:- `memory-crud-list.ts`: mostly clean; weaknesses are silent fallback behavior and the extra count query.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/changelog/changelog-004-verification-and-standards.md:47:This fix restored reliable tool-calling behavior without weakening validation.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/changelog/changelog-004-verification-and-standards.md:53:**Fix:** The tool schemas were simplified so AI clients can read them consistently while the same validation still happens during execution. That restored reliable tool calling for clients such as Copilot without weakening the safety checks.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/z-archive-prior-audit/readme-audit-A12.md:24:| 2 | Tool-Specific Hints stated "5 tools" listing memory_search, checkpoint_restore, memory_save, memory_index_scan, memory_drift_why; actual `TOOL_SPECIFIC_HINTS` object has **6 tools** (missing `memory_causal_link`) | Minor | Updated to 6 tools, added memory_causal_link |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/014-stateless-quality-gates/spec.md:193:- **NFR-S01**: V8 and V9 hard-block rules must remain hard-blocks for all source types. The tiering change MUST NOT weaken foreign-spec contamination detection.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/014-stateless-quality-gates/spec.md:276:**As a** system maintainer, **I want** V8 and V9 (foreign spec contamination) to still hard-block stateless saves, **so that** the tiering change does not weaken actual safety guarantees.
.opencode/specs/system-spec-kit/z_archive/004-script-audit-comprehensive/scratch/build-agent-08-errors-verify.md:46:Confirmed weak/inconsistent.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/agent-output-iter-002-copilot-C2.md:304:This keeps the module flexible, but it weakens the whole “shared canonical type” story and forces repeated runtime casts between camelCase and snake_case fields. It is the biggest type-safety compromise in the audited surface.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/changelog/changelog-007-hybrid-search-null-db-fix.md:63:**Problem:** When a secondary scoring pass, called reranking (a more expensive sorting step applied after the initial candidate list is assembled), evaluated a memory, it concatenated the title and body into a single block before scoring. A strong title match and a weak body could cancel each other into a middling result. Additionally, a diversity reordering step called MMR (maximum marginal relevance, a technique that pushes similar results apart to increase variety) was skipped entirely whenever the full reranker was unavailable.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/changelog/changelog-007-hybrid-search-null-db-fix.md:113:| `memory_search` results for known queries | 0 | 4-5 |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/changelog/changelog-007-hybrid-search-null-db-fix.md:118:The two base bug fixes were verified with three representative queries against the live 999-memory database: "semantic search" returned 4 results including the top CocoIndex memory, "SpecKit Phase System" returned 5 results including the top phase-system memory, and "compact code graph" returned 5 results. Both the semantic-similarity and exact-word-matching channels contributed candidates in all three cases. The Phase 5 review added updated tool-input-schema tests that now correctly reflect the current simplified tool definitions.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/058-generate-context-modularization/scratch/legacy-memory-quarantine/02-01-26_14-09__generate-context-modularization.md:312:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/058-generate-context-modularization" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/058-generate-context-modularization/scratch/legacy-memory-quarantine/02-01-26_14-09__generate-context-modularization.md:317:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/research/iterations/iteration-002.md:43:| PIPELINE-002 | LOW | Tier precedence is deterministic but weakly documented. Not strict frontmatter — scans content for uncommented tier strings. |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/research/iterations/iteration-002.md:56:| SESSION-004 | P1 | Native capture paths skip schema validation. Malformed-but-nonempty data can reach extraction. Post-render gating is strong but pre-capture ingress is weak. |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/research/iterations/iteration-002.md:57:| SESSION-005 | P2 | Type hierarchy serviceable but over-complicated. CollectedDataFull adds no structure. [key: string]: unknown on CollectedDataBase weakens type safety. |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/scratch/03-table-layout.md:14:  5.42  #1709  Tasks: CocoIndex Code MCP Integration ············ 022-mcp-coco
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/014-stateless-quality-gates/implementation-summary.md:56:The contamination filter now understands that Claude Code often documents tool activity in plain language. Tool-title-with-path matches drop from high to low severity only for `claude-code-capture`, while the same pattern remains high severity for other sources. That lifts the old 0.60 cap for legitimate Claude captures without weakening the rest of the contamination checks.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/research/research.md:333:CollectedDataFull adds no structure. CollectedDataBase uses `[key: string]: unknown`, weakening type safety.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/s4-2-checkpoint-completeness-design.md:166:This is too weak on its own.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/058-generate-context-modularization/scratch/legacy-memory-quarantine/01-01-26_18-04__generate-context-modularization.md:308:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/058-generate-context-modularization" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/058-generate-context-modularization/scratch/legacy-memory-quarantine/01-01-26_18-04__generate-context-modularization.md:313:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/scratch/02-two-line-card.md:17:  5.42  #1709  Tasks: CocoIndex Code MCP Integration
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/058-generate-context-modularization/scratch/legacy-memory-quarantine/01-01-26_17-45__generate-context-modularization-spec.md:259:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/058-generate-context-modularization" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/058-generate-context-modularization/scratch/legacy-memory-quarantine/01-01-26_17-45__generate-context-modularization-spec.md:264:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/004-script-audit-comprehensive/scratch/checklist-verification-pass.md:15:| items_with_weak_evidence   | 2       |
.opencode/specs/system-spec-kit/z_archive/004-script-audit-comprehensive/scratch/checklist-verification-pass.md:153:**Phase 3 Review Shards (T021-T030) -- ALL PRESENT (2 weak):**
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/changelog/changelog-root-esm-module-compliance.md:49:**Problem:** Even with the main path fix in place, startup and lifecycle rebinding could still weaken the guarantee if projection state was empty or if consumers rebound to a newly derived but empty database.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/changelog/changelog-root-esm-module-compliance.md:130:**Problem:** Large migrations often end with a review report that points at real risks but lands too late to influence the shipped state. That creates a second cleanup project and leaves known weak spots in production.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/changelog/changelog-root-esm-module-compliance.md:144:**Fix:** The packet changed scope enforcement from silent default-on behavior to explicit opt-in behavior. Governance still works when intentionally enabled, but normal single-user search no longer gets treated like an access violation. That restored truthful behavior without weakening the guarded path.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/changelog/changelog-root-esm-module-compliance.md:162:**Fix:** The packet fixed both filters. Scope enforcement stopped rejecting every unscoped query by default, and the `minState: 'WARM'` filter stopped running against a state column that does not exist yet. Once those two gates were removed, `memory_search` and `memory_context` started returning real results again instead of empty answers.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/changelog/changelog-root-esm-module-compliance.md:180:**Fix:** The packet added six retrieval-quality fixes, then followed with index and scoring repairs after a repository move broke three search indexes. Intent now propagates through the search path, folder discovery can recover instead of trapping the query in an empty folder, token-budget enforcement truncates more gracefully, metadata-only fallbacks preserve visibility, lexical scores survive fusion traces, and CocoIndex was re-indexed across 51,820 files. Search is not just alive again. It is easier to trust and easier to inspect.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/changelog/changelog-root-esm-module-compliance.md:204:**Fix:** The packet rewired normalization for structured input, added message synthesis when no transcript exists, derived titles and summaries from real session data, reduced repeated decision text, relaxed false contamination hits for sibling phases, and added a guarded quality floor. The result moved JSON-mode saves from unusable 0/100 output to a repeatable 55-75/100 range. That is a quality overhaul, not a cosmetic tweak.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/changelog/changelog-root-esm-module-compliance.md:229:| Search/index repair | Broken search indexes repaired after repo move, then CocoIndex re-indexed across 51,820 files |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/changelog/changelog-root-esm-module-compliance.md:250:| `023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/` | Search index repair after repo move, CocoIndex re-index, adaptive fusion enablement, lexical score propagation |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/scratch/20-score-only-no-bar.md:15:  #1709  Tasks: CocoIndex Code MCP Integration  5.42 · 022-mcp-coco
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/058-generate-context-modularization/scratch/legacy-memory-quarantine/02-01-26_12-50__generate-context-modularization.md:310:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/058-generate-context-modularization" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/058-generate-context-modularization/scratch/legacy-memory-quarantine/02-01-26_12-50__generate-context-modularization.md:315:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/005-test-and-scenario-remediation/implementation-summary.md:83:| Use deterministic per-test DB fixtures for the flaky DB-backed suites | That solved the real isolation problem without weakening the assertions |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/010-search-retrieval-quality-fixes/implementation-summary.md:46:The implementation updated strategy intent propagation, added recovery for over-narrow folder scope, introduced adaptive truncation behavior, wired folder boost scoring metadata, added two-tier metadata/content response behavior, and added a confidence floor that defaults weak auto-detections to `understand`.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/016-json-mode-hybrid-enrichment/prompts/flawless-json-memory-pipeline-research.md:33:- **Memory consumers**: AI agents loading context via MCP semantic search (`memory_search`, `memory_quick_search`, `memory_match_triggers`)
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/016-json-mode-hybrid-enrichment/prompts/flawless-json-memory-pipeline-research.md:97:**Focus**: Analyze trigger phrase extraction pipeline for path-fragment contamination, overly generic phrases, missing domain-specific terms, and specificity distribution. Determine what field values optimize MCP search ranking in `memory_search()` and `memory_quick_search()` results. Identify memory files that are correctly written but practically invisible to search.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/010-template-compliance-enforcement/research/research.md:450:The 3-layer architecture provides defense-in-depth. No single layer is sufficient alone, but together they cover each other's weaknesses. The highest risk is Layer 2 (agents skipping validation), which is mitigated by Layer 3 (hard commit block). The recommended deployment order (plan.md scaffold first, then pre-commit hook) targets the highest-impact, lowest-risk changes first.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/changelog/changelog-005-test-and-scenario-remediation.md:41:**Fix:** The verification now ignores that unrelated noise while still checking the real logging protections. This removes false alarms without weakening the safety coverage.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/changelog/changelog-005-test-and-scenario-remediation.md:51:**Problem:** The manual testing playbook still described some checks in a way that no longer matched the verified system state. That weakens trust because readers can be told to look for behavior that is no longer real.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/scratch/13-right-aligned-score.md:15:  76%  #1709  Tasks: CocoIndex Code MCP Integration · 022-mcp-coco
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/058-generate-context-modularization/scratch/legacy-memory-quarantine/02-01-26_10-38__generate-context-modularization.md:234:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/058-generate-context-modularization" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/058-generate-context-modularization/scratch/legacy-memory-quarantine/02-01-26_10-38__generate-context-modularization.md:239:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/agent-output-iter-005-copilot-C2.md:1:I’m digging through the workflow and ops paths first, then I’ll map where manual work, missing automation, and weak self-healing show up.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/scratch/11-sparkline-bar.md:15:  █░░ 5.42  #1709  Tasks: CocoIndex Code MCP Integration · 022-mcp-coco
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/008-spec-memory-compliance-audit/spec.md:225:10. `024-compact-code-graph/010-cocoindex-bridge-context`
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/008-spec-memory-compliance-audit/spec.md:351:| REQ-008 | Search regression passes | memory_search() returns >0 results for standard queries |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/008-spec-memory-compliance-audit/spec.md:362:- **SC-004**: memory_search() returns >0 results for standard queries (regression check)
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/agent-output-iter-003-codex-A1.md:17:Static audit only; I didn’t run the code or tests. CocoIndex returned no indexed hits for this area, so the review was done by direct source inspection.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/scratch/07-score-heatmap.md:16:  ○ 5.42  #1709  Tasks: CocoIndex Code MCP Integration · 022-mcp-coco
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/058-generate-context-modularization/scratch/legacy-memory-quarantine/02-01-26_08-20__generate-context-modularization.md:399:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/058-generate-context-modularization" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/058-generate-context-modularization/scratch/legacy-memory-quarantine/02-01-26_08-20__generate-context-modularization.md:404:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/scratch/14-emoji-type-badges.md:16:  #1709  Tasks: CocoIndex Code MCP Integration · 022-mcp-coco
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/008-spec-memory-compliance-audit/plan.md:72:- [ ] Search regression passes (memory_search returns >0 results)
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/008-spec-memory-compliance-audit/plan.md:242:- `010-cocoindex-bridge-context`
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/008-spec-memory-compliance-audit/plan.md:360:- [ ] Verify memory_search() returns >0 results (regression)
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/008-spec-memory-compliance-audit/plan.md:376:| Search Regression | Search pipeline | memory_search() MCP tool |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/scratch/16-horizontal-rule-separator.md:17:  5.42  #1709  Tasks: CocoIndex Code MCP Integration
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/agent-output-iter-001-copilot-C2.md:347:3. **Several entry-point functions are too large for the folder’s otherwise extractor-oriented design**, which weakens SRP and consistency: `extractDecisions` spans `decision-extractor.ts:182-604`, `collectSessionData` spans `collect-session-data.ts:675-948`, `extractConversations` spans `conversation-extractor.ts:52-265`, `captureClaudeConversation` spans `claude-code-capture.ts:525-720`, `captureCopilotConversation` spans `copilot-cli-capture.ts:202-405`, and `captureCodexConversation` spans `codex-cli-capture.ts:307-462`.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/agent-output-iter-001-copilot-C2.md:372:Per-file highlights: `quality-scorer.ts`, `contamination-filter.ts`, `session-activity-signal.ts`, and `implementation-guide-extractor.ts` are the strongest. `file-extractor.ts`, `conversation-extractor.ts`, `diagram-extractor.ts`, `decision-extractor.ts`, `session-extractor.ts`, `spec-folder-extractor.ts`, `git-context-extractor.ts`, and `collect-session-data.ts` are typed well but diverge on fallback/logging/size. The five capture adapters are the weakest cohort because of repeated helper duplication and silent catches.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/scratch/15-ascii-box-card.md:16:  • #1709 Tasks: CocoIndex Code MCP Integration (5.42) — 022-mcp-coco
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/scratch/25-hybrid-compact-detail.md:19:  5.42  #1709  Tasks: CocoIndex Code MCP Integration · 022-mcp-coco
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/scratch/27-dot-leader.md:15:  ███░░  #1709  Tasks: CocoIndex Code MCP Integration · 022-mcp-coco
.opencode/specs/system-spec-kit/z_archive/005-upgrade-speckit-docs/scratch/legacy-memory-quarantine/15-02-26_15-50__upgrade-speckit-docs.md:369:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "system-spec-kit/z_archive/005-upgrade-speckit-docs" })` |
.opencode/specs/system-spec-kit/z_archive/005-upgrade-speckit-docs/scratch/legacy-memory-quarantine/15-02-26_15-50__upgrade-speckit-docs.md:381:memory_search({ specFolder: "system-spec-kit/z_archive/005-upgrade-speckit-docs", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/005-upgrade-speckit-docs/scratch/legacy-memory-quarantine/15-02-26_15-50__upgrade-speckit-docs.md:387:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/005-upgrade-speckit-docs/scratch/legacy-memory-quarantine/15-02-26_15-50__upgrade-speckit-docs.md:396:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/audit-v3-o06-session-capturing-review.md:90:- **Recommended Fix**: Consider running post-save review for recovery saves as well, even if the comparison baseline is weaker. At minimum, log that quality review was skipped and why.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/scratch/18-color-coded-sidebar.md:16:    5.42  #1709  Tasks: CocoIndex Code MCP Integration · 022-mcp-coco
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/016-rewrite-memory-mcp-readme/scratch/research-brief.md:21:| 2 | `memory_search` | Semantic search using vector similarity. Returns ranked results with scores. Constitutional tier always included at top. Supports intent-aware retrieval with task-specific weight adjustments. | `query` OR `concepts` (2-5 strings for AND search), `specFolder`, `limit` (1-100), `sessionId`, `enableDedup`, `tier`, `contextType`, `useDecay`, `includeContent`, `anchors`, `rerank`, `applyLengthPenalty`, `minState` (HOT-ARCHIVED), `intent`, `includeTrace`, `trackAccess`, `mode` (auto/deep), `min_quality_score`, `bypassCache`, governance fields (tenantId, userId, agentId, sharedSpaceId) |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/016-rewrite-memory-mcp-readme/scratch/research-brief.md:88:| 3 | **Retrieval** | 9 features (memory_context, memory_search, memory_match_triggers, hybrid search pipeline, 4-stage pipeline, BM25 re-index gate, AST section retrieval, 3-tier fallback, tool-result extraction) | 5. SEARCH SYSTEM |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/scratch/30-recommended-synthesis.md:17:  5.42  #1709  Tasks: CocoIndex Code MCP Integration · 022-mcp-coco
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/agent-output-iter-004-copilot-C1.md:68:I’m in the implementation details now. The likely weak spots are already narrowing to Stage 2 score handling, Stage 3 fallback paths, and whether `hybrid-search.ts` still carries duplicated pre-pipeline logic.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/scratch/05-minimal-one-liner.md:16:  5.42  #1709  Tasks: CocoIndex Code MCP Integration (022-mcp-coco)
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/scratch/10-tag-cloud.md:29:    5.42  #1709  Tasks: CocoIndex Code MCP Integration
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/scratch/06-indented-tree.md:16:  5.42  #1709  Tasks: CocoIndex Code MCP Integration · 022-mcp-coco
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/audit-v3-c02-database-analysis.md:40:The documented downgrade/recovery path cannot operate on current production-format databases without manual schema surgery. That weakens rollback readiness and makes the CLI surface misleading during incident response.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/scratch/24-metadata-footer.md:15:  5.42  #1709  Tasks: CocoIndex Code MCP Integration · 022-mcp-coco
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/034-gate-enforcement-refinement/plan.md:21:5. [x] Verify with memory_search
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/scratch/09-split-panel.md:16:  022-mcp-coco            5.42  #1709  Tasks: CocoIndex Code MCP Integration
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/scratch/review-08.md:36:- **Description:** `sqliteVec.load()` failure is logged but runtime continues in "anchor-only mode". Vector queries return `[]`. If other channels are weak/disabled, this looks like "search returns 0 results."
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/scratch/review-03.md:4:**Dimension:** Trace query from memory_search handler through orchestrator to stage1  
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/agent-output-iter-005-copilot-C1.md:234:- `memory_search` advertises `tenantId`, `userId`, `agentId`, `sharedSpaceId` (`tool-schemas.ts:63-67`), but the validator and allowed-parameter list reject them (`tool-input-schemas.ts:113-152`, `tool-input-schemas.ts:405-408`).
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/agent-output-iter-005-copilot-C1.md:320:A few recovery hints stand out as weak:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/agent-output-iter-005-copilot-C1.md:335:- `memory_search` supports both `min_quality_score` and deprecated `minQualityScore` (`tool-schemas.ts:105-116`, `tool-input-schemas.ts:129-130`, `tool-input-schemas.ts:407`)
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/016-json-mode-hybrid-enrichment/001-initial-enrichment/scratch/agent-output-iter-001-A3.md:4:Investigate what makes trigger phrases effective vs. useless (Q4/Q7), how the indexing pipeline processes and stores them, and what determines ranking in memory_search() results after MCP indexing (Q8). Analyzed the input-normalizer trigger phrase flow, post-save-review path fragment detection, the save handler pipeline, and sampled 5 real memory files for trigger phrase quality.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/016-json-mode-hybrid-enrichment/001-initial-enrichment/scratch/agent-output-iter-001-A3.md:31:### F5: IMPORTANT -- memory_search() ranking uses a 4-channel hybrid pipeline
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/scratch/21-folderless-with-tooltip.md:18:  5.42  #1709  Tasks: CocoIndex Code MCP Integration · 022-mcp-coco
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/018-rewrite-system-speckit-readme/scratch/research-brief.md:420:| 3 | Retrieval | 9 | memory_context, memory_search, memory_match_triggers, hybrid pipeline, 4-stage architecture, BM25 re-index gate, AST section retrieval, 3-tier search fallback, tool-result extraction |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/018-rewrite-system-speckit-readme/scratch/research-brief.md:451:| Search and Retrieval | memory_search, memory_match_triggers, memory_list, memory_stats, memory_context | 5 |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/scratch/08-numbered-list.md:16:   8.  #1709  Tasks: CocoIndex Code MCP Integration · 022-mcp-coco
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/034-gate-enforcement-refinement/graph-metadata.json:115:        "name": "memory_search",
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/scratch/28-channel-annotated.md:15:  1709  Tasks: CocoIndex Code MCP Integration                 5.42  022-mcp-coco
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/audit-v3-o08-documentation-quality-audit.md:41:- **Description**: `tool-schemas.ts` defines exactly 33 tools in the `TOOL_DEFINITIONS` array, but every documentation surface claims 32: the MCP README overview table (sums to 32 by listing L2 as 3), the Spec Kit README, the root README, and `CLAUDE.md`. The discrepancy originates from the MCP README's 7-Layer overview table listing L2 (Core) as 3 tools, while the L2 section heading and body document 4 tools (memory_search, memory_quick_search, memory_match_triggers, memory_save). The actual L2 count in `TOOL_DEFINITIONS` is 4.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/audit-v3-o08-documentation-quality-audit.md:53:- **Evidence**: `ls .opencode/skills/ | grep -v README | grep -v scripts` lists 18 skill directories, each with a `SKILL.md`. The root README Skills Library (Section 8) lists only 16 skills. `sk-deep-research` is referenced elsewhere in the README (the `@deep-research` agent uses it) but is not listed in the skills table. `mcp-coco-index` is referenced in CLAUDE.md as "CocoIndex Code MCP" but absent from the skills table.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/audit-v3-o08-documentation-quality-audit.md:105:- **Description**: The MCP Tools summary table in the Spec Kit README lists 8 tool groups that sum to 32 tools. The `memory_quick_search` tool is not listed in any group. It should be in "Search and Retrieval" alongside `memory_search`.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/audit-v3-o08-documentation-quality-audit.md:106:- **Evidence**: The 5 tools listed in "Search and Retrieval" are: memory_context, memory_search, memory_match_triggers, memory_list, memory_stats. The tool `memory_quick_search` is missing.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/audit-v3-o08-documentation-quality-audit.md:172:- **Evidence**: Overview table line 235: `| L2 | Core | 3 |`. Section heading line 293: `### L2: Core (4 tools, token budget: 1500)`. Four tools documented: memory_search, memory_quick_search, memory_match_triggers, memory_save.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/scratch/26-two-column-kv.md:14:  5.42  #1709  Tasks: CocoIndex Code MCP Integration · 022-mcp-coco
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/008-spec-memory-compliance-audit/checklist.md:68:- [x] CHK-023 [P1] memory_search(): trigger_phrases bug FIXED — `Array.isArray()` guard added to `save-quality-gate.ts:578` and `learned-feedback.ts:293`. Pending MCP restart for verification [EVIDENCE: code changes in 4 files]
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/002-persist-tuned-thresholds/spec.md:9:  - "weakmap threshold cache"
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/scratch/22-pipe-separated.md:16:  #1709  Tasks: CocoIndex Code MCP Integration (5.42) — 022-mcp-coco
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/audit-v3-o10-bug-regression-scan.md:184:- **Impact**: Open `[key: string]: unknown` index signatures weaken type safety and allow any field to be set without validation.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/scratch/12-breadcrumb-folder.md:15:  5.42  #1709  Tasks: CocoIndex Code MCP Integration · 022-mcp-coco
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/agent-output-iter-001-copilot-C1.md:133:I’ve got the full code in view now. I’m doing one pass for correctness/perf/maintainability, then I’ll cross-check with a separate reviewer to weed out weak findings.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/agent-output-iter-001-copilot-C1.md:194:- **P2** `381-396`: `resolveAlignmentTargets()` swallows spec-context extraction failures and falls back to keyword-only matching. That weakens the contamination gate while hiding why it degraded.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/tasks.md:93:- [x] T023 [P] Run multi-word MCP search; confirm FTS5 and vector results both present in response [Evidence: memory_search("semantic search") returned 5 results via hybrid pipeline, 812ms]
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/008-spec-memory-compliance-audit/tasks.md:182:- [ ] T107 [P] Fix `024-compact-code-graph/010-cocoindex-bridge-context`
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/008-spec-memory-compliance-audit/tasks.md:316:- [x] T208 Run memory_search("ESM migration") — returned 3 results pre-rescan; post-rescan trigger_phrases bug blocked queries → FIXED
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-007-codex-A2.md:35:mcp: cocoindex_code starting
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-007-codex-A2.md:39:mcp: cocoindex_code ready
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-007-codex-A2.md:41:mcp startup: ready: code_mode, cocoindex_code, sequential_thinking; failed: spec_kit_memory
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-007-codex-A2.md:90:tool cocoindex_code.search({"query":"validateInputData normalizeInputData handback payload nextSteps next_steps loadCollectedData generate-context","paths":[".opencode/skills/system-spec-kit/scripts/*"],"limit":10})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-007-codex-A2.md:91:cocoindex_code.search({"query":"validateInputData normalizeInputData handback payload nextSteps next_steps loadCollectedData generate-context","paths":[".opencode/skills/system-spec-kit/scripts/*"],"limit":10}) success in 6.81s:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-007-codex-A2.md:108:tool cocoindex_code.search({"query":"validateInputData normalizeInputData handback payload nextSteps next_steps loadCollectedData generate-context","limit":10})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-007-codex-A2.md:109:cocoindex_code.search({"query":"validateInputData normalizeInputData handback payload nextSteps next_steps loadCollectedData generate-context","limit":10}) success in 200ms:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/agent-output-iter-005-codex-A1.md:12:- Medium: API key validation is weaker than it looks outside auto-detection. Placeholder/short-key screening exists only in `resolveProvider()` at [`factory.ts`](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/shared/embeddings/factory.ts#L61) and [`factory.ts`](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/shared/embeddings/factory.ts#L84), but explicit provider construction only checks for a non-empty string in [`openai.ts`](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/shared/embeddings/providers/openai.ts#L95) and [`voyage.ts`](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/shared/embeddings/providers/voyage.ts#L107). Obvious placeholders or whitespace-only keys can still get accepted until the first network call fails.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/016-json-mode-hybrid-enrichment/001-initial-enrichment/scratch/archive-round-1/agent-output-iter-003-copilot-C1.md:22:- **Risk**: Over-replacement of decent short descriptions; under-replacement of weak long descriptions.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/implementation-summary.md:90:All fixes applied directly to TypeScript source, compiled with `bun run build` (1210+ dist files), and verified at runtime. `memory_search("semantic search")` confirmed returning 5 results via hybrid pipeline (vector + keyword channels, cross-encoder reranking) in 812ms. Root cause investigation: 10 deep-research iterations + 10 deep-review iterations via Copilot CLI GPT 5.4 (documented in `scratch/`).
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/implementation-summary.md:120:| Runtime: memory_search returns results | PASS — 5 results, 812ms, hybrid pipeline |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/008-spec-memory-compliance-audit/implementation-summary.md:178:2. **Search regression not yet verified**: The trigger_phrases bug fix is on disk and the MCP server was restarted, but the search regression test (`memory_search()` returning >0 results) has not been confirmed in a new session. Verify after next MCP server startup.
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/002-retry-feedback-bridge/spec.md:85:| REQ-001 | Keep the current Public authorities authoritative | The packet does not recommend replacing `/spec_kit:*`, the current agent stack, Spec Kit Memory, CocoIndex, or code-graph |
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/002-retry-feedback-bridge/spec.md:136:- **NFR-S01**: The packet must not weaken current governance or validation boundaries.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/scratch/deep-research/research-03.md:9:3. How `memory_search` invokes the pipeline.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/scratch/deep-research/research-03.md:16:### 1. `memory_search` does **not** use the query router to choose `searchType`
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/scratch/deep-research/research-03.md:18:`memory_search` builds `PipelineConfig` directly and sets:
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/scratch/deep-research/research-03.md:235:1. `memory_search` chose the Stage 1 `hybrid` branch at the pipeline level.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/005-architecture-audit/scratch/agent-output-iter-006-copilot-C2.md:155:- **Type exports are mostly centralized, but one contract is duplicated.** `tools/types.ts` centralizes tool arg interfaces, yet `api/indexing.ts` re-declares `MemoryIndexScanArgs` instead of reusing `ScanArgs`, which weakens the “single source of truth” standard. `.opencode/skills/system-spec-kit/mcp_server/tools/types.ts:179-186`, `.opencode/skills/system-spec-kit/mcp_server/api/indexing.ts:17-24`, `.opencode/skills/sk-code-opencode/SKILL.md:308-310`, `.opencode/skills/sk-code-opencode/SKILL.md:372-375`
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/research/deep-research-strategy.md:16:- [x] Q10: What is the current state of Code Graph and CocoIndex integration — are they contributing meaningfully to search results? **ANSWERED iteration 5**: Code Graph and CocoIndex are SEPARATE from memory search. The memory search pipeline uses the causal memory graph (causal_edges table) for graph signals -- 4 mechanisms: causal boost, co-activation, community detection, N2a+N2b signals. Code Graph provides structural code navigation via separate MCP tools. CocoIndex is a completely external semantic code search tool.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/research/deep-research-strategy.md:40:- [x] Q10: Code Graph and CocoIndex are SEPARATE from memory search pipeline. Memory search uses causal memory graph (causal_edges table in memory DB) for 4 graph mechanisms: causal boost (2-hop traversal), co-activation spreading, community detection/injection, and N2a+N2b graph signals. Code Graph (code-graph.sqlite) provides structural code navigation (functions, classes, imports, calls) via separate MCP tools. CocoIndex is an external semantic code search tool that does not feed into memory search at all. The code_graph_context tool can accept CocoIndex results as seeds but this bridges Code Graph, not memory search.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/research/deep-research-strategy.md:68:- [Iteration 5] Grep for graph/cocoindex across the pipeline directory conclusively proved separation of concerns between memory graph, Code Graph, and CocoIndex
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/research/deep-research-strategy.md:241:- **Spec 011**: Fixed CocoIndex (stale venv/LMDB), Code Graph (lazy-init), adaptive fusion env vars (added to all 7 MCP configs), lexical score propagation (BM25/FTS5 through RRF).
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/002-retry-feedback-bridge/checklist.md:66:- [ ] CHK-030 [P0] No recommendation weakens current governance or validation controls
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/013-fts5-fix-and-search-dashboard/scratch/01-compact-type-first.md:17:  5.42  #1709  Tasks: CocoIndex Code MCP Integration  022-mcp-coco
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/016-speckit-yaml-integration/scratch/legacy-memory-quarantine/16-12-24_21-45__speckit-yaml-semantic-memory.md:302:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "** 005-memory/009-speckit-yaml-integration" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/016-speckit-yaml-integration/scratch/legacy-memory-quarantine/16-12-24_21-45__speckit-yaml-semantic-memory.md:307:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-006-codex-A3.md:34:mcp: cocoindex_code starting
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-006-codex-A3.md:40:mcp: cocoindex_code ready
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-006-codex-A3.md:42:mcp startup: ready: code_mode, cocoindex_code, sequential_thinking; failed: spec_kit_memory
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-006-codex-A3.md:525:25415|03--commands-and-skills/022-mcp-coco-integration|/Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/specs/03--commands-and-skills/022-mcp-coco-integration/memory/18-03-26_19-06__portable-cocoindex-mcp-paths-applied.md|0.897|success
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/research/iterations/iteration-004.md:14:3. **Progressive disclosure is ON by default and fully functional.** Feature flag `SPECKIT_PROGRESSIVE_DISCLOSURE_V1` defaults to true. System provides: (a) summary layer with confidence distribution digest (e.g., "3 strong, 2 moderate, 1 weak"), (b) snippet extraction (100 chars + "...") with detailAvailable flags, (c) cursor-based pagination (5 results/page, 5-min TTL, max 1000 cursors, LRU eviction). The response includes a `progressiveDisclosure` field when enabled. [SOURCE: lib/search/progressive-disclosure.ts:1-522]
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/research/iterations/iteration-004.md:59:Investigate Q9 (adaptive fusion refinement) and Q10 (Code Graph/CocoIndex integration). Specifically: (a) examine adaptive fusion weight configuration and shadow mode proposal builder, (b) check code graph contribution to search results, (c) examine CocoIndex bridge and its actual impact on result quality.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/009-graph-retrieval-improvements/decision-record.md:46:**We chose**: Phase 0 traces the full pipeline for `memory_search("Semantic Search")` before any implementation begins. Improvements already covered by existing features are skipped or reduced.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/009-graph-retrieval-improvements/decision-record.md:156:Phase 025 (`024-compact-code-graph/025-tool-routing-enforcement`) discovered that AI assistants default to Grep/Glob over MCP tools (CocoIndex, Code Graph) because there is no active enforcement at the MCP layer. `buildServerInstructions()` is the universal enforcement point for ALL CLIs. If this spec's graph improvements (always-on injection, community search, dual-level retrieval) are built but the AI doesn't know when to use them, the improvements are wasted.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/research/iterations/iteration-020.md:19:- [x] Code Graph/CocoIndex integration documented (3 separate systems)
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/009-graph-retrieval-improvements/spec.md:31:The Spec Kit Memory graph has 3,854 causal edges at 79.92% coverage but is underutilized: `memory_search("Semantic Search")` returns 0 results, graph signals are invisible to users, and the graph fires only reactively via causal boost. Phase 007 surveyed 7 external graph memory systems and produced a 12-item ranked improvement backlog. This spec implements the top 8 improvements across 4 dependency-ordered phases.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/009-graph-retrieval-improvements/spec.md:61:1. `memory_search("Semantic Search")` returns 0 results despite substantial search-related knowledge in the graph
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/009-graph-retrieval-improvements/spec.md:125:| REQ-003 | Zero-result fallback uses graph expansion | `memory_search("Semantic Search")` returns relevant results via graph-expanded retry |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/009-graph-retrieval-improvements/spec.md:152:- **SC-001**: `memory_search("Semantic Search")` returns at least 3 relevant results
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/009-graph-retrieval-improvements/spec.md:164:- **Given** a query like `memory_search("Semantic Search")` starts with weak primary recall, **When** concept expansion and graph fallback are enabled, **Then** the query returns relevant graph-assisted results.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/009-graph-retrieval-improvements/spec.md:165:- **Given** the graph contains stable communities, **When** community summaries are generated, **Then** topic-level retrieval can surface a useful summary even when direct memory matches are weak.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/009-graph-retrieval-improvements/spec.md:258:1. Given `memory_search("Semantic Search")` currently returns 0, When the improvement is active, Then it returns at least 3 relevant results via concept expansion + community fallback.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/009-graph-retrieval-improvements/plan.md:55:- [x] `memory_search("Semantic Search")` returns relevant results [EVIDENCE: Phase 0 baseline 5 results; concept expansion + community fallback add coverage]
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/009-graph-retrieval-improvements/plan.md:119:- [x] Trace `memory_search("Semantic Search")` through the full pipeline — returns 5 results (not 0), quality "weak", confidence 0.341
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/009-graph-retrieval-improvements/plan.md:148:- [ ] Ensure provenance data is available in memory_search response
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/002-persist-tuned-thresholds/graph-metadata.json:18:      "weakmap threshold cache",
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/002-persist-tuned-thresholds/graph-metadata.json:36:      "weakmap",
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/research/iterations/iteration-005.md:1:# Iteration 5: Adaptive Fusion Refinement (Q9) and Code Graph/CocoIndex Integration (Q10)
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/research/iterations/iteration-005.md:4:Investigate Q9 (adaptive fusion weights, scoring parameters, refinement opportunities) and Q10 (Code Graph and CocoIndex integration -- are they contributing meaningfully to search results?).
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/research/iterations/iteration-005.md:36:9. **CocoIndex is completely separate from memory search.** CocoIndex is an external semantic code search tool with its own MCP server (`cocoindex_code`). It does not feed results into the memory search pipeline at all. The `code_graph_context` tool can accept CocoIndex results as "seeds" (via `provider: "cocoindex"` in the seeds array), but this is a bridge for the Code Graph context tool, not the memory search system.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/research/iterations/iteration-005.md:37:   [SOURCE: Grep for "cocoindex|CocoIndex" in lib/search/ -- zero matches]
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/research/iterations/iteration-005.md:57:- CocoIndex feeding into memory search -- confirmed architecturally separate
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/research/iterations/iteration-005.md:72:- Grep across `lib/search/pipeline/` for graph/cocoindex references
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/research/iterations/iteration-005.md:73:- Grep across `lib/search/` for cocoindex references
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/research/iterations/iteration-005.md:78:- Questions answered: Q9 (adaptive fusion fully characterized with 3 refinement opportunities), Q10 (Code Graph and CocoIndex are separate systems; memory graph is the search-pipeline contributor)
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/research/iterations/iteration-005.md:81:- What worked and why: Reading the canonical `adaptive-fusion.ts` shared module gave the complete weight architecture in one file (433 lines). The Grep for graph/cocoindex across the pipeline directory conclusively proved separation of concerns.
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/014-multi-model-council-evaluation/spec.md:107:4. **Given** the exit condition is checked, when evidence is still weak, then the packet remains an investigation instead of being promoted prematurely.
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/014-multi-model-council-evaluation/spec.md:133:- **NFR-S01**: The packet must not weaken current governance or validation boundaries.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/016-json-mode-hybrid-enrichment/001-initial-enrichment/scratch/archive-round-1/iteration-003.md:10:1. **Description threshold misaligned** (C1-F4): `< 20` raw length gate doesn't match shared validator tiers. Decent 16-19 char descriptions overwritten; weak 23+ char descriptions not upgraded.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/007-external-graph-memory-research/decision-record.md:44:We already know the internal graph is structurally healthy but not clearly helping retrieval enough. The graph has 3,854 edges, 79.92% coverage, 6 orphaned edges, average strength 0.76, and is dominated by `supports` and `caused` relations. We also have a concrete signal that retrieval discoverability is weak because `memory_search` for "Semantic Search" returned 0 results. If the research stays loose, it will produce interesting notes but weak implementation guidance.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/007-external-graph-memory-research/decision-record.md:71:| Free-form survey notes | Fast to write and flexible | Hard to compare systems, weaker backlog quality | 4/10 |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/007-external-graph-memory-research/decision-record.md:84:- The research stays tied to current graph weaknesses, especially retrieval transparency and automatic use.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/007-external-graph-memory-research/decision-record.md:105:| 1 | **Necessary?** | PASS | The graph is healthy on paper but still weak on retrieval visibility and search hit quality |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/007-external-graph-memory-research/decision-record.md:143:The research survey identified 12 improvement candidates. The most impactful divide into two categories: (A) retrieval-side improvements (community summaries, dual-level search, query expansion, zero-result fallback) and (B) construction-side improvements (temporal edges, contradiction detection, entity deduplication, ontology hooks). The core retrieval gap — `memory_search("Semantic Search") -> 0 results` — is a retrieval problem, not a construction problem.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/007-external-graph-memory-research/decision-record.md:170:| 2 | **Beyond Local Maxima?** | PASS | Draws from GraphRAG, LightRAG, and Memoripy rather than just tweaking causal boost |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/007-external-graph-memory-research/spec.md:121:| REQ-008 | Baseline comparison must include the known internal retrieval gap | research.md explicitly carries forward the known zero-result `memory_search` example for "Semantic Search" and uses it to justify at least one recommendation |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/007-external-graph-memory-research/spec.md:232:3. **Given** the current graph is structurally healthy but retrieval is still weak, **When** the report explains the problem, **Then** it includes the zero-result `memory_search` example for "Semantic Search".
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/007-external-graph-memory-research/plan.md:42:This phase is research-only. It uses the existing graph baseline to compare seven external graph memory solutions: Zep, Mem0, GraphRAG, LightRAG, Memoripy, Cognee, and Graphiti. The baseline facts that drive the research are: 3,854 causal edges, 79.92% coverage, 6 orphaned edges, average strength 0.76, dominant `supports` and `caused` relations, and a `memory_search` query for "Semantic Search" that returned 0 results. The goal is to turn that gap between graph health and retrieval usefulness into a ranked backlog of graph improvements for retrieval effectiveness, UX transparency, and automatic graph use.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/007-external-graph-memory-research/plan.md:76:- If a source is weak or unavailable, record the limitation directly instead of filling gaps from memory.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/007-external-graph-memory-research/plan.md:94:- **Current-State Baseline**: Records the facts we already know about the internal graph system so external comparisons stay grounded in real weaknesses.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/007-external-graph-memory-research/plan.md:169:- **Procedure**: Record the limitation directly in `research/research.md`, keep the system in scope, and avoid unsupported conclusions. If the evidence is too weak, downgrade the recommendation strength rather than invent detail.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/007-external-graph-memory-research/plan.md:213:2. Mark weak evidence as unresolved instead of forcing a recommendation
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/007-external-graph-memory-research/plan.md:300:**Context**: The phase needs actionable follow-up, not a pile of disconnected notes. The current graph already shows strong edge coverage but weak retrieval visibility, so the research has to stay tied to concrete improvement themes.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/007-external-graph-memory-research/plan.md:310:- Free-form note taking with ad hoc conclusions. Rejected because it makes ranking and comparison weaker.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/research/iterations/iteration-001.md:67:| `SPECKIT_EMPTY_RESULT_RECOVERY_V1` | Empty/weak result recovery UX | Spec 011 |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/research/iterations/iteration-001.md:170:- **Intent weights**: Intent auto-detection is ON by default in `memory_search` tool schema (`autoDetectIntent: true`), and intent confidence floor defaults to 0.25
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/014-multi-model-council-evaluation/checklist.md:66:- [ ] CHK-030 [P0] No recommendation weakens current governance or validation controls
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/017-stateless-spec-passing/scratch/legacy-memory-quarantine/22-12-25_09-51__stateless-spec-passing.md:364:**Observation:** The current script (`.opencode/scripts/skill_advisor.py`) handles "fix/make" well but is weak on "discovery" questions (e.g., "where is config").
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/017-stateless-spec-passing/scratch/legacy-memory-quarantine/22-12-25_09-51__stateless-spec-passing.md:1632:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "004-speckit/009-stateless-spec-passing" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/017-stateless-spec-passing/scratch/legacy-memory-quarantine/22-12-25_09-51__stateless-spec-passing.md:1637:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/research/iterations/iteration-011.md:37:**The gap:** For hybrid searches (the default and most common path), steps 1-3 and 5-9 run, but step 4 (where recency lives) is skipped entirely. So the only recency signal in hybrid mode comes from within the hybrid search's own RRF fusion -- which is weak (effective max ~0.02 as identified in iteration 5).
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/research-reconciliation-master.md:57:    - R-13 auto-detection fragility, decision dedup bug, key_files pipeline weakness
.opencode/specs/system-spec-kit/z_archive/021-spec-kit-phase-system/scratch/agent-6-commands-verification.md:36:allowed-tools: Read, Write, Edit, Bash, Grep, Glob, memory_context, memory_search
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-003-codex-A2.md:40:mcp: cocoindex_code starting
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-003-codex-A2.md:46:mcp: cocoindex_code ready
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-003-codex-A2.md:48:mcp startup: ready: code_mode, cocoindex_code, sequential_thinking; failed: spec_kit_memory
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-003-codex-A2.md:248:.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/005-confidence-calibration/memory/16-03-26_19-21__confidence-calibration.md:442:# AGENTS.md instructions for /Users/michelkerkmeester/MEGA/Development/Opencode Env/Public  # AI Assistant Framework (Universal Template) > **Universal behavior framework** defining guardrails, standards, and decision protocols. --- ## 1. 🚨 CRITICAL RULES **HARD BLOCKERS (The "Four Laws" of Agent Safety):** 1. **READ FIRST:** Never edit a file without reading it first. Understand context before modifying. 2. **SCOPE LOCK:** Only modify files explicitly in scope. **NO** "cleaning up" or "improving" adjacent code. Scope in `spec.md` is FROZEN. 3. **VERIFY:** Syntax checks and tests **MUST** pass before claiming completion. **NO** blind commits. 4. **HALT:** Stop immediately if uncertain, if line numbers don't match, or if tests fail. (See "Halt Conditions" below). **OPERATIONAL MANDATES:** - **All file modifications require a spec folder** (Gate 3). - **Never lie or fabricate** - use "UNKNOWN" when uncertain. - **Clarify** if confidence < 80% (see §5 Confidence Framework). - **Use explicit uncertainty:** Prefix claims with "I'M UNCERTAIN ABOUT THIS:". **QUALITY PRINCIPLES:** - **Prefer simplicity**, reuse existing patterns, and cite evidence with sources - Solve only the stated problem; **avoid over-engineering** and premature optimization - **Verify with checks** (simplicity, performance, maintainability, scope) before making changes - **Truth over agreement** - correct user misconceptions with evidence; do not agree for conversational flow **HALT CONDITIONS (Stop and Report):** - [ ] Target file does not exist or line numbers don't match. - [ ] Syntax check or Tests fail after edit. - [ ] Merge conflicts encountered. - [ ] Edit tool reports "string not found". - [ ] Test/Production boundary is unclear. **MANDATORY TOOLS:** - **Spec Kit Memory MCP** for research tasks, context recovery, and finding prior work. **Memory saves MUST use `node.opencode/skills/system-spec-kit/scripts/dist/memory/generate-context.js [spec-folder-path]`** - NEVER manually create memory files. **GIT WORKFLOW:** Full details: `.opencode/skills/sk-git/` - Worktree setup, conventional commits, PR creation, branch management - Trigger keywords: worktree, branch, commit, merge, pr, pull request, git workflow, finish work, integrate changes ### Quick Reference: Common Workflows | Task | Flow | | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | | **File modification** | Gate 3 (ask spec folder) → Gate 1 → Gate 2 → Load memory context → Execute | | **Research/exploration** | `memory_match_triggers()` → `memory_context()` (unified) OR `memory_search()` (targeted) → Document findings | | **Code search** | `Grep()` for text patterns, `Glob()` for file discovery, `Read()` for file contents | | **Resume prior work** | `/memory:continue` OR `memory_search({ query, specFolder, anchors: ['state', 'next-steps'] })` → Review checklist → Continue | | **Save context** | `/memory:save` OR `node.opencode/skills/system-spec-kit/scripts/dist/memory/generate-context.js [spec-folder-path]` → Auto-indexed | | **Claim completion** | Validation runs automatically → Load `checklist.md` → Verify ALL items → Mark with evidence | | **End session** | `/spec_kit:handover` → Save context → Provide continuation prompt | | **New spec folder** | Option B (Gate 3) → Research via Task tool → Evidence-based plan → Approval → Implement | | **Complex multi-step** | Task tool → Decompose → Delegate → Synthesize | | **Documentation** | sk-doc skill → Classify → Load template → Fill → Validate (`validate_document.py`) → DQI score → Verify | | **Web code** | sk-code-web skill → Webflow/CDN standards, minification, browser testing | | **OpenCode system code** | sk-code-opencode skill → JS/TS/Python/Shell standards, language detection, quality checklists | | **Git workflow** | sk-git skill → Worktree setup / Commit / Finish (PR) | | **Phase workflow** | `/spec_kit:phase` → Decompose → `create.sh --phase` → Populate parent/children → `validate.sh --recursive` | | **Database maintenance** | `/memory:manage` → stats, health, cleanup, checkpoint, ingest operations | | **Analysis/evaluation** | `/memory:analyze` → preflight, postflight, causal graph, ablation, dashboard, history | ### Coding Analysis Lenses | Lens | Focus | Detection Questions | | ------------------ | ---------------- | ---------------------------------------------------------------------------------- | | **CLARITY** | Simplicity | Is this the simplest code that solves the problem? Are abstractions earned? | | **SYSTEMS** | Dependencies | What does this change touch? What calls this? What are the side effects? | | **BIAS** | Wrong problem | Is user solving a symptom? Is this premature optimization? Is the framing correct? | | **SUSTAINABILITY** | Maintainability | Will future devs understand this? Is it self-documenting? Tech debt implications? | | **VALUE** | Actual impact | Does this change behavior or just refactor? Is it cosmetic or functional? | | **SCOPE** | Complexity match | Does solution complexity match problem size? Single-line fix or new abstraction? | ### Coding Anti-Patterns (Detect Silently) | Anti-Pattern | Trigger Phrases | Response | | ---------------------- | ----------------------------------------------- | --------------------------------------------------------------------------- | | Over-engineering | "for flexibility", "future-proof", "might need" | Ask: "Is this solving a current problem or a hypothetical one?" | | Premature optimization | "could be slow", "might bottleneck" | Ask: "Has this been measured? What's the actual performance?" | | Cargo culting | "best practice", "always should" | Ask: "Does this pattern fit this specific case?" | | Gold-plating | "while we're here", "might as well" | Flag scope creep: "That's a separate change - shall I note it for later?" | | Wrong abstraction | "DRY this up" for 2 instances | "These look similar but might not be the same concept. Let's verify first." | | Scope creep | "also add", "bonus feature" | "That's outside the current scope. Want to track it separately?" | --- ## 2. ⛔ MANDATORY GATES - STOP BEFORE ACTING **⚠️ BEFORE using ANY tool (except Gate Actions: memory_match_triggers, skill_advisor.py), you MUST pass all applicable gates below.** ### 🔒 PRE-EXECUTION GATES (Pass before ANY tool use) #### GATE 1: UNDERSTANDING + CONTEXT SURFACING [SOFT] BLOCK Trigger: EACH new user message (re-evaluate even in ongoing conversations) 1. Call `memory_match_triggers(prompt)` → Surface relevant context 2. Classify intent: Research or Implementation 3. Parse request → Check confidence AND uncertainty (see §4) 4. **Dual-threshold:** confidence ≥ 0.70 AND uncertainty ≤ 0.35 → PROCEED. Either fails → INVESTIGATE (max 3 iterations) → ESCALATE. Simple: <40% ASK | 40-69% CAUTION | ≥70% PASS > Gate 1 is SOFT — if file modification detected, Gate 3 (HARD) takes precedence. Ask spec folder question BEFORE analysis. #### GATE 2: SKILL ROUTING [REQUIRED for non-trivial tasks] 1. A) Run: `python3.opencode/skills/scripts/skill_advisor.py "[request]" --threshold 0.8` 2. B) Cite user's explicit direction: "User specified: [exact quote]" - Confidence ≥ 0.8 → MUST invoke skill | < 0.8 → general approach | User names skill → cite and proceed - Output: `SKILL ROUTING: [result]` or `SKILL ROUTING: User directed → [name]` - Skip: trivial queries only (greetings, single-line questions) #### GATE 3: SPEC FOLDER QUESTION [HARD] BLOCK — PRIORITY GATE - **Overrides Gates 1-2:** If file modification detected → ask Gate 3 BEFORE any analysis/tool calls - **Triggers:** rename, move, delete, create, add, remove, update, change, modify, edit, fix, refactor, implement, build, write, generate, configure, analyze, decompose, phase — or any task resulting in file changes - **Options:** A) Existing | B) New | C) Update related | D) Skip | E) Phase folder (e.g., `specs/NNN-name/001-phase/`) - **DO NOT** use Read/Edit/Write/Bash (except Gate Actions) before asking. ASK FIRST, wait for response, THEN proceed - **Phase boundary:** Gate 3 answers apply ONLY within current workflow phase. Plan→implement transition MUST re-evaluate. Exception: carry-over IS valid for Memory Save Rule #### CONSOLIDATED QUESTION PROTOCOL When multiple inputs are needed, consolidate into a SINGLE prompt — never split across messages. Include only applicable questions; omit when pre-determined. - **Round-trip optimization** — Only 1 user interaction needed for setup - **First Message Protocol** — ALL questions asked BEFORE any analysis or tool calls - **Violation:** Multiple separate prompts → STOP, apologize, re-present as single prompt - **Bypass phrases:** "skip context" / "fresh start" / "skip memory" / [skip] for memory loading; Level 1 tasks skip completion verification --- ### 🔒 POST-EXECUTION RULES #### MEMORY SAVE RULE [HARD] BLOCK Trigger: "save context", "save memory", `/memory:save`, memory file creation - If spec folder established at Gate 3 → USE IT (don't re-ask). Carry-over applies ONLY to memory saves - If NO folder and Gate 3 never answered → HARD BLOCK → Ask user - **Script:** `node.opencode/skills/system-spec-kit/scripts/dist/memory/generate-context.js [spec-folder-path]` - Mode 1 (JSON): Write JSON to `/tmp/save-context-data.json`, pass as arg - Mode 2 (Direct): Pass spec folder path (e.g., `specs/005-memory`) - Subfolder: `003-parent/121-child` or bare `121-child` (auto-searches parents) - **Indexing:** For immediate MCP visibility after save: `memory_index_scan({ specFolder })` or `memory_save()` - **Violation:** Write tool on `memory/` path → DELETE and re-run via script #### COMPLETION VERIFICATION RULE [HARD] BLOCK Trigger: Claiming "done", "complete", "finished", "works" 1. Validation runs automatically on spec folder (if exists) 2. Load `checklist.md` → Verify ALL items → Mark `[x]` with evidence - Skip: Level 1 tasks (no checklist.md required) | Exit 0 = pass, Exit 1 = warnings, Exit 2 = errors (must fix) #### VIOLATION RECOVERY [SELF-CORRECTION] Trigger: About to skip gates, or realized gates were skipped → STOP → STATE: "Before I proceed, I need to ask about documentation:" → ASK Gate 3 (A/B/C/D/E) → WAIT #### Self-Check (before ANY tool-using response): - [ ] File modification? Asked spec folder question? - [ ] Skill routing verified? - [ ] Saving memory? Using `generate-context.js` (not Write tool)? - [ ] Aligned with ORIGINAL request? No scope drift? - [ ] Claiming completion? `checklist.md` verified? --- ## 3. 📝 CONVERSATION DOCUMENTATION Every conversation that modifies files MUST have a spec folder. **Full details:** system-spec-kit SKILL.md (§1 When to Use, §3 How it Works, §4 Rules) ### Documentation Levels | Level | LOC | Required Files | Use When | | ------ | -------------- | ----------------------------------------------------- | ---------------------------------- | | **1** | <100 | spec.md, plan.md, tasks.md, implementation-summary.md | All features (minimum) | | **2** | 100-499 | Level 1 + checklist.md | QA validation needed | | **3** | ≥500 | Level 2 + decision-record.md (+ optional research/research.md) | Complex/architecture changes | | **3+** | Complexity 80+ | Level 3 + AI protocols, extended checklist, sign-offs | Multi-agent, enterprise governance | > **Note:** `implementation-summary.md` is REQUIRED for all levels but created **after implementation completes**, not at spec folder creation time. See SKILL.md §4 Rule 13. **Rules:** When in doubt → higher level. LOC is soft guidance (risk/complexity can override). Single typo/whitespace fixes (<5 characters in one file) are exempt. **Spec folder path:** `specs/[###-short-name]/` | **Templates:** `.opencode/skills/system-spec-kit/templates/` **For details on:** folder structure, `scratch/` vs `memory/` usage, sub-folder versioning, checklist verification (P0/P1/P2), and completion workflow — see system-spec-kit SKILL.md §3. --- ## 4. 🧑🏫 CONFIDENCE & CLARIFICATION FRAMEWORK **Core Principle:** If confidence < 80%, pause and ask for clarification with multiple-choice options. | Confidence | Action | | ------------ | -------------------------------------------- | | **≥80%** | Proceed with citable source | | **40-79%** | Proceed with caveats | | **<40%** | Ask for clarification or mark "UNKNOWN" | | **Override** | Blockers/conflicts → ask regardless of score | **Logic-Sync Protocol:** On contradiction (Spec vs Code, conflicting requirements) → HALT → Report "LOGIC-SYNC REQUIRED: [Fact A] contradicts [Fact B]" → Ask "Which truth prevails?" **Escalation:** Confidence stays <80% after two failed attempts → ask with 2-3 options. Blockers beyond control → escalate with evidence and proposed next step. --- ## 5. 🧠 REQUEST ANALYSIS & SOLUTION FRAMEWORK **Flow:** Parse request → Read files first → Analyze → Design simplest solution → Validate → Execute | Principle | Rule | Anti-Pattern | | ----------------- | -------------------------------------------------- | --------------------------------------- | | **Simplicity** | Reuse patterns; earn every abstraction | Utilities for <3 uses, single-impl intf | | **Evidence** | Cite `[SOURCE: file:lines]` or `[CITATION: NONE]` | Claims without verification | | **Scope Match** | Solution size = problem size | Refactoring during bug fix | | **Right Problem** | Root cause, not symptom; measure before optimizing | Premature optimization, wrong framing | **CLARITY Triggers** (justify before proceeding): - Utility for <3 uses | Config for single value | Abstraction without clear boundary - Pattern where simple code suffices | Interface for single impl - On bias → don't argue, redirect to root cause **Pre-Change Checklist:** - [ ] Read first? | Simplest solution? | Scope discipline? - [ ] Confidence ≥80%? | Sources cited? | Spec folder? | Approval? **Five Checks (>100 LOC):** Necessary now? | Alternatives (≥2)? | Simplest sufficient? | On critical path? | No tech debt? **STOP CONDITIONS:** Any check unchecked | no spec folder | no approval → STOP and address --- ## 6. 🤖 AGENT ROUTING When using the orchestrate agent or Task tool for complex multi-step workflows, route to specialized agents: ### Runtime Agent Directory Resolution Use the agent directory that matches the active runtime/provider profile: | Runtime / Profile | Agent Directory | Usage Rule | | -------------------------------------- | -------------------------- | ----------------------------------------------------------- | | **Copilot (default OpenCode profile)** | `.opencode/agents/` | Load base agent definitions from this directory | | **ChatGPT profile** | `.opencode/agents/chatgpt/` | Load ChatGPT-specific agent definitions from this directory | | **Claude profile** | `.claude/agents/` | Load Claude-specific agent definitions from this directory | | **Gemini CLI** | `.gemini/agents/` | Load Gemini-specific agent definitions from this directory | **Resolution rule:** pick one directory by runtime and stay consistent for that workflow phase. ### Agent Definitions - **`@general`** — Implementation, complex tasks - **`@context`** — ALL codebase exploration, file search, pattern discovery, context loading. Dispatches sub-agents for fast search and deep investigation - **`@orchestrate`** — Multi-agent coordination, complex workflows - **`@research`** — Evidence gathering, planning, Gate 3 Option B. May write `research/research.md` inside spec folders - **`@write`** — Creating READMEs, Skills, Guides - **`@review`** — Code review, PRs, quality gates (READ-ONLY) - **`@speckit`** — Spec folder creation Level 1-3+. **EXCLUSIVE:** Only agent permitted to write `*.md` inside spec folders. Exceptions: `memory/` (generate-context.js), `scratch/` (any agent), `handover.md` (@handover), `research/research.md` (@research), `debug-delegation.md` (@debug) - **`@debug`** — Fresh perspective debugging, root cause analysis. May write `debug-delegation.md` inside spec folders - **`@handover`** — Session continuation, context preservation. May write `handover.md` inside spec folders - **`@ultra-think`** — Multi-strategy planning architect. Dispatches diverse thinking strategies, scores via 5-dimension rubric, synthesizes optimal plan. Planning-only: no file modifications --- ## 7. ⚙️ MCP CONFIGURATION **Two systems:** 1. **Native MCP** (`opencode.json`) - Direct tools, called natively - Sequential Thinking, Spec Kit Memory, Code Mode server 2. **Code Mode MCP** (`.utcp_config.json`) - External tools via `call_tool_chain()` - Figma, Github, ClickUp, Chrome DevTools, etc. - Naming: `{manual_name}.{manual_name}_{tool_name}` (e.g., `clickup.clickup_get_teams({})`) - Discovery: `search_tools()`, `list_tools()`, or read `.utcp_config.json` --- ## 8. 🧩 SKILLS SYSTEM Skills are specialized, on-demand capabilities that provide domain expertise. Unlike knowledge files (passive references), skills are explicitly invoked to handle complex, multi-step workflows. ### How Skills Work ``` Task Received → Gate 2: Run skill_advisor.py ↓ Confidence > 0.8 → MUST invoke recommended skill ↓ Invoke Skill → Read(".opencode/skills/<skill-name>/SKILL.md") ↓ Instructions Load → SKILL.md content + resource paths ↓ Follow Instructions → Complete task using skill guidance ``` ### Skill Loading Protocol 1. Gate 2 provides skill recommendation via `skill_advisor.py` 2. Invoke using appropriate method for your environment 3. Read bundled resources from `references/`, `scripts/`, `assets/` paths 4. Follow skill instructions to completion 5. Do NOT re-invoke a skill already in context ### Primary Skill: sk-code-opencode For ALL OpenCode system code (`.opencode/`, MCP servers, scripts), `sk-code-opencode` provides multi-language standards. Includes the `system-spec-kit` skill for spec folder workflows and the Spec Kit Memory system for context preservation across sessions. **Supported Languages:** | Language | Target | Key Patterns | | ---------- | ----------------------------- | ------------------------------------------- | | JavaScript | MCP servers, CommonJS modules | `require`/`module.exports`, strict mode | | TypeScript | Type-safe modules, configs | Interfaces, strict tsconfig, type guards | | Python | Validators, advisors, tests | snake_case, argparse, pytest, docstrings | | Shell | Automation, deployment | `set -euo pipefail`, shebang, quoting | | JSON/JSONC | Manifests, schemas, configs | Schema validation, commented config | **Key Systems:** - **system-spec-kit**: Spec folder lifecycle (Levels 1-3+), validation, template architecture - **Spec Kit Memory**: Context preservation, semantic search, session continuity (`/memory:save`, `/memory:continue`) **Invocation:** Automatic via Gate 2 routing when OpenCode system code tasks detected. ### Git Workflow Skill: sk-git For ALL git workflows, `sk-git` orchestrates workspace setup, commit hygiene, and work completion. **Sub-workflows:** - **Worktree**: Branch creation via `git worktree`, workspace isolation, parallel development - **Commit**: Conventional commit format, staged change analysis, clean commit messages - **Finish**: PR creation, branch cleanup, integration workflows **Trigger Keywords:** worktree, branch, commit, merge, pr, pull request, git workflow, conventional commits, finish work, integrate changes **Invocation:** Automatic via Gate 2 routing when git tasks detected, or manually via `Read(".opencode/skills/sk-git/SKILL.md")`. ## Skills A skill is a set of local instructions to follow that is stored in a `SKILL.md` file. Below is the list of skills that can be used. Each entry includes a name, description, and file path so you can open the source for full instructions when using a specific skill. ### Available skills - cli-claude-code: Claude Code CLI orchestrator enabling external AI assistants (Gemini, Codex, Copilot) to invoke Anthropic's Claude Code CLI for supplementary tasks including deep reasoning, code editing, structured output, code review, agent delegation, and extended thinking. (file: /Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/cli-claude-code/SKILL.md) - cli-codex: Codex CLI orchestrator enabling any AI assistant to invoke OpenAI's Codex CLI for supplementary AI tasks including code generation, code review, web research, codebase analysis, cross-AI validation, and parallel task processing. (file: /Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/cli-codex/SKILL.md) - cli-copilot: GitHub Copilot CLI orchestrator enabling external AI assistants to invoke the standalone 'copilot' binary for supplementary tasks including collaborative planning, cloud delegation, versatile code generation, and autonomous task execution. (file: /Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/cli-copilot/SKILL.md) - cli-gemini: Gemini CLI orchestrator enabling any AI assistant to invoke Google's Gemini CLI for supplementary AI tasks including code generation, web research via Google Search, codebase architecture analysis, cross-AI validation, and parallel task processing. (file: /Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/cli-gemini/SKILL.md) - mcp-chrome-devtools: Chrome DevTools orchestrator providing intelligent routing between CLI (bdg) and MCP (Code Mode) approaches. CLI prioritized for speed and token efficiency; MCP fallback for multi-tool integration scenarios. (file: /Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/mcp-chrome-devtools/SKILL.md) - mcp-clickup: ClickUp project management orchestrator providing intelligent routing between CLI (cu) and MCP (Code Mode) approaches. CLI prioritized for speed and token efficiency; MCP for enterprise features like docs, goals, webhooks, and bulk operations. (file: /Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/mcp-clickup/SKILL.md) - mcp-code-mode: MCP orchestration via TypeScript execution for efficient multi-tool workflows. Use Code Mode for ALL MCP tool calls (ClickUp, Notion, Figma, Webflow, Chrome DevTools, etc.). Provides 98.7% context reduction, 60% faster execution, and type-safe invocation. Mandatory for external tool integration. (file: /Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/mcp-code-mode/SKILL.md) - mcp-figma: Figma design file access via MCP providing 18 tools for file retrieval, image export, component/style extraction, team management, and collaborative commenting. Accessed via Code Mode for token-efficient workflows. (file: /Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/mcp-figma/SKILL.md) - sk-code-full-stack: Stack-agnostic development orchestrator guiding developers through implementation, testing, and verification phases with automatic stack detection via marker files and bundled stack-specific knowledge. (file: /Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/sk-code-full-stack/SKILL.md) - sk-code-opencode: Multi-language code standards for OpenCode system code (JavaScript, TypeScript, Python, Shell, JSON/JSONC) with language detection routing, universal patterns, and quality checklists. (file: /Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/sk-code-opencode/SKILL.md) - sk-code-review: Stack-agnostic code review baseline skill with findings-first severity analysis, mandatory security/correctness minimums, and adaptive overlay compatibility with sk-code-opencode, sk-code-web, and sk-code-full-stack standards. (file: /Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/sk-code-review/SKILL.md) - sk-code-web: Orchestrator guiding developers through implementation, debugging, and verification phases across specialized code quality skills (project) (file: /Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/sk-code-web/SKILL.md) - sk-doc: Unified markdown and OpenCode component specialist providing document quality enforcement, content optimization, component creation workflows (skills, agents, commands), ASCII flowcharts and install guides. (file: /Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/sk-doc/SKILL.md) - sk-git: Git workflow orchestrator guiding developers through workspace setup, clean commits, and work completion across git-worktrees, git-commit, and git-finish skills (file: /Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/sk-git/SKILL.md) - sk-improve-prompt: Prompt engineering specialist that transforms vague requests into structured, scored AI prompts using 7 proven frameworks (RCAF, COSTAR, RACE, CIDI, TIDD-EC, CRISPE, CRAFT), DEPTH thinking methodology, and CLEAR scoring across text modes. (file: /Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/sk-improve-prompt/SKILL.md) - system-spec-kit: Unified documentation and context preservation: spec folder workflow (levels 1-3+), CORE + ADDENDUM template architecture (v2.2), validation, and Spec Kit Memory for context preservation. Mandatory for all file modifications. (file: /Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/system-spec-kit/SKILL.md) - openai-docs: Use when the user asks how to build with OpenAI products or APIs and needs up-to-date official documentation with citations, help choosing the latest model for a use case, or explicit GPT-5.4 upgrade and prompt-upgrade guidance; prioritize OpenAI docs MCP tools, use bundled references only as helper context, and restrict any fallback browsing to official OpenAI domains. (file: /Users/michelkerkmeester/.codex/skills/.system/openai-docs/SKILL.md) - skill-creator: Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Codex's capabilities with specialized knowledge, workflows, or tool integrations. (file: /Users/michelkerkmeester/.codex/skills/.system/skill-creator/SKILL.md) - skill-installer: Install Codex skills into $CODEX_HOME/skills from a curated list or a GitHub repo path. Use when a user asks to list installable skills, install a curated skill, or install a skill from another repo (including private repos). (file: /Users/michelkerkmeester/.codex/skills/.system/skill-installer/SKILL.md) ### How to use skills - Discovery: The list above is the skills available in this session (name + description + file path). Skill bodies live on disk at the listed paths. - Trigger rules: If the user names a skill (with `$SkillName` or plain text) OR the task clearly matches a skill's description shown above, you must use that skill for that turn. Multiple mentions mean use them all. Do not carry skills across turns unless re-mentioned. - Missing/blocked: If a named skill isn't in the list or the path can't be read, say so briefly and continue with the best fallback. - How to use a skill (progressive disclosure): 1) After deciding to use a skill, open its `SKILL.md`. Read only enough to follow the workflow. 2) When `SKILL.md` references relative paths (e.g., `scripts/foo.py`), resolve them relative to the skill directory listed above first, and only consider other paths if needed. 3) If `SKILL.md` points to extra folders such as `references/`, load only the specific files needed for the request; don't bulk-load everything. 4) If `scripts/` exist, prefer running or patching them instead of retyping large code blocks. 5) If `assets/` or templates exist, reuse them instead of recreating from scratch. - Coordination and sequencing: - If multiple skills apply, choose the minimal set that covers the request and state the order you'll use them. - Announce which skill(s) you're using and why (one short line). If you skip an obvious skill, say why. - Context hygiene: - Keep context small: summarize long sections instead of pasting them; only load extra files when needed. - Avoid deep reference-chasing: prefer opening only files directly linked from `SKILL.md` unless you're blocked. - When variants exist (frameworks, providers, domains), pick only the relevant reference file(s) and note that choice. - Safety and fallback: If a skill can't be applied cleanly (missing files, unclear instructions), state the issue, pick the next-best approach, and continue. Files called AGENTS.md commonly appear in many places inside a container - at "/", in "~", deep within git repositories, or in any other directory; their location is not limited to version-controlled folders. Their purpose is to pass along human guidance to you, the agent. Such guidance can include coding standards, explanations of the project layout, steps for building or testing, and even wording that must accompany a GitHub pull-request description produced by the agent; all of it is to be followed. Each AGENTS.md governs the entire directory that contains it and every child directory beneath that point. Whenever you change a file, you have to comply with every AGENTS.md whose scope covers that file. Naming conventions, stylistic rules and similar directives are restricted to the code that falls inside that scope unless the document explicitly states otherwise. When two AGENTS.md files disagree, the one located deeper in the directory structure overrides the higher-level file, while instructions given directly in the prompt by the system, developer, or user outrank any AGENTS.md content.   /Users/michelkerkmeester/MEGA/Development/Opencode Env/Public zsh 2026-03-16 Europe/Amsterdam
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-003-codex-A2.md:250:.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/005-confidence-calibration/memory/16-03-26_19-21__confidence-calibration.md:526:PLEASE IMPLEMENT THIS PLAN: # Implement `005-confidence-calibration` as Phase 1 Only ## Summary Implement the dual-confidence model for decisions in the live `system-spec-kit` codebase under `.opencode/skills/system-spec-kit`, not the draft top-level `scripts/...` paths in the phase docs. Keep this pass at the R-05 recommended boundary: - Add `CHOICE_CONFIDENCE` and `RATIONALE_CONFIDENCE` - Keep legacy `CONFIDENCE = Math.min(choice, rationale)` for compatibility - Update decision rendering to show the split signal - Do **not** redefine high/medium/low counts or importance logic yet; they continue to use derived legacy `CONFIDENCE` ## Public Interfaces / Types - Extend `DecisionRecord` in `.opencode/skills/system-spec-kit/scripts/types/session-types.ts` with: - `CHOICE_CONFIDENCE: number` - `RATIONALE_CONFIDENCE: number` - keep `CONFIDENCE: number` required - Extend `DecisionNode` in `.opencode/skills/system-spec-kit/scripts/lib/decision-tree-generator.ts` to optionally accept the two new fields. - Preserve the current normalized range contract: all three confidence fields are `0.0-1.0` in extractor output; percentage conversion remains a render/workflow concern. ## Implementation Changes - In the decision extractor, factor confidence calculation into one shared helper used by both manual and observation-derived decisions. - Compute choice confidence with this fixed rule: - base `0.50` - `+0.15` when 2+ alternatives/options exist - `+0.10` when an explicit choice is present (`chosen`, `choice`, `selected`, parsed chosen phrase, or `_manualDecision.chosenApproach`) - `+0.10` when the chosen option is specific, not a placeholder like `Chosen Approach` or `N/A` - cap at `1.0` - Compute rationale confidence with this fixed rule: - base `0.50` - `+0.15` when explicit rationale/reasoning text exists beyond the generic fallback snippet - `+0.10` when trade-off language exists (pros/cons, advantages/disadvantages, caveats) - `+0.10` when supporting evidence exists (file evidence or fact evidence) - cap at `1.0` - When legacy single-value confidence is explicitly supplied (`_manualDecision.confidence` or `confidence:` in narrative), treat it as an override for **both** new fields after normalization/clamping; then derive legacy `CONFIDENCE` from those equal values. - Recompute `CONFIDENCE` everywhere decisions are created as `Math.min(CHOICE_CONFIDENCE, RATIONALE_CONFIDENCE)`. - Keep `HIGH_CONFIDENCE_COUNT`, `MEDIUM_CONFIDENCE_COUNT`, `LOW_CONFIDENCE_COUNT`, and `DECISION_IMPORTANCE` based on derived `CONFIDENCE` in this phase. - Update decision rendering surfaces only where they actually exist in the live repo: - `decision-tree-generator.ts` and `ascii-boxes.ts` should show split confidence when the values differ by more than `0.10`, otherwise keep the single confidence display - `templates/context_template.md` should render `Choice: X% / Rationale: Y%` for divergent values and the existing single confidence line otherwise - `workflow.ts` should continue converting normalized values to percentages for template input, and should pass the new percentage fields alongside legacy `CONFIDENCE` - Update simulation/fixture producers so generated decision objects include the new fields and still satisfy the old contract. - Do not change `validate-memory-quality.ts` logic unless a rendered-output fixture requires a minimal adjustment; the live validator is not a real consumer of decision confidence semantics. - After code verification, update the phase docs in `005-confidence-calibration/`: - mark tasks/checklist items with evidence - write `implementation-summary.md` - save context via `node.opencode/skills/system-spec-kit/scripts/dist/memory/generate-context.js ` ## Test Plan - Add a focused unit suite for dual-confidence extraction cases, preferably a new `scripts/tests/decision-confidence.vitest.ts`, covering: - alternatives only - rationale only - strong choice / weak rationale - weak choice / strong rationale - explicit single confidence override - clamping and normalization - legacy `CONFIDENCE === Math.min(choice, rationale)` - Update existing regression suites to reflect the new shape without breaking backward compatibility: - `scripts/tests/test-extractors-loaders.js` - `scripts/tests/test-scripts-modules.js` - `scripts/tests/memory-render-fixture.vitest.ts` - `scripts/lib/simulation-factory.ts` fixture expectations - Verification commands: - `npm run typecheck` - `node mcp_server/node_modules/vitest/vitest.mjs run tests/decision-confidence.vitest.ts tests/memory-render-fixture.vitest.ts --root scripts --config../mcp_server/vitest.config.ts` - `node scripts/tests/test-extractors-loaders.js` - `node scripts/tests/test-scripts-modules.js` - `scripts/spec/validate.sh ` ## Assumptions - The live implementation target is `.opencode/skills/system-spec-kit/...`; phase docs that reference top-level `scripts/...` are descriptive but not the real file layout. - `DecisionRecord` is already canonical enough for this phase despite `004-type-consolidation` docs still showing draft status. - This phase intentionally defers split analytics/counting beyond rendering and extractor enrichment, per the R-05 recommendation and your selected scope.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-003-codex-A2.md:316:.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/research/agent-outputs/stateless-research/R06-quality-scoring-gap.md:48:**Bottom line:** stateless rarely bottoms out here because workflow floors rescue it; this dimension is **partially weak, not catastrophic**.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-003-codex-A2.md:320:.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/research/agent-outputs/stateless-research/R06-quality-scoring-gap.md:74:**Bottom line:** this is a **real stateless weakness**; typical stateless mode lives in the `5-10/15` band, not `15/15`.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-003-codex-A2.md:322:.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/research/agent-outputs/stateless-research/R06-quality-scoring-gap.md:99:**Bottom line:** file descriptions are **semantically weak but numerically over-rewarded**. This dimension is **not a good explanation for low stateless scores** under the current scorer.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-003-codex-A2.md:646:     3	description: "Claude Code P1 result captured: - Tool used : mcp cocoindex code search - Arguments : query="retry logic patterns for retrying failed operations", limit=10 - Results : 10..."
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-003-codex-A2.md:650:     7	  - "cocoindex issue"
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-003-codex-A2.md:662:    19	  - "mcp cocoindex code"
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/decision-record.md:46:**We chose**: keep the current Public agent, command, memory, CocoIndex, and code-graph stack in place.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-007-codex-A3.md:34:mcp: cocoindex_code starting
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-007-codex-A3.md:38:mcp: cocoindex_code ready
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-007-codex-A3.md:40:mcp startup: ready: code_mode, cocoindex_code, sequential_thinking; failed: spec_kit_memory
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-005-codex-A2.md:50:mcp: cocoindex_code starting
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-005-codex-A2.md:56:mcp: cocoindex_code ready
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-005-codex-A2.md:58:mcp startup: ready: code_mode, cocoindex_code, sequential_thinking; failed: spec_kit_memory
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-005-codex-A2.md:133:tool cocoindex_code.search({"query":"session-capturing pipeline source files and tests in system-spec-kit","paths":".opencode/skills/system-spec-kit/**","limit":10})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-005-codex-A2.md:134:cocoindex_code.search({"query":"session-capturing pipeline source files and tests in system-spec-kit","paths":".opencode/skills/system-spec-kit/**","limit":10}) failed in 7ms:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-005-codex-A2.md:144:tool cocoindex_code.search({"query":"session-capturing pipeline source files and tests in system-spec-kit","paths":[".opencode/skills/system-spec-kit/**"],"limit":10})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-005-codex-A2.md:145:cocoindex_code.search({"query":"session-capturing pipeline source files and tests in system-spec-kit","paths":[".opencode/skills/system-spec-kit/**"],"limit":10}) success in 784ms:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-005-codex-A2.md:162:tool cocoindex_code.search({"query":"opencode-capture.ts","paths":[".opencode/skills/system-spec-kit/**"],"limit":5,"refresh_index":true})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-005-codex-A2.md:163:cocoindex_code.search({"query":"opencode-capture.ts","paths":[".opencode/skills/system-spec-kit/**"],"limit":5,"refresh_index":true}) success in 691ms:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-005-codex-A2.md:181:I ran the mandated skill-routing check and attempted CocoIndex semantic lookup; now I’m switching to exact file inventory via `rg/find` because CocoIndex returned no indexed hits for this subtree. Next step is counting test cases and mapping each target source file to direct test references/imports.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/research/iterations/iteration-012.md:81:The 5-limit is per-injection-call, but the issue from iteration 4 (P1-2) was about the `includeConstitutional` parameter in memory_search which has a default `CONSTITUTIONAL_CACHE_LIMIT = 10` in the auto-surface middleware. These are two different caps:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-001-copilot-C1.md:199:**4) Missing parity / weaker handling**
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/005-budget-stagnation-enforcement/spec.md:85:| REQ-001 | Keep the current Public authorities authoritative | The packet does not recommend replacing `/spec_kit:*`, the current agent stack, Spec Kit Memory, CocoIndex, or code-graph |
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/005-budget-stagnation-enforcement/spec.md:136:- **NFR-S01**: The packet must not weaken current governance or validation boundaries.
.opencode/specs/system-spec-kit/z_archive/021-spec-kit-phase-system/scratch/legacy-memory-quarantine/20-02-26_17-45__spec-kit-phase-system.md:712:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "system-spec-kit/021-spec-kit-phase-system" })` |
.opencode/specs/system-spec-kit/z_archive/021-spec-kit-phase-system/scratch/legacy-memory-quarantine/20-02-26_17-45__spec-kit-phase-system.md:724:memory_search({ specFolder: "system-spec-kit/021-spec-kit-phase-system", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/021-spec-kit-phase-system/scratch/legacy-memory-quarantine/20-02-26_17-45__spec-kit-phase-system.md:730:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/021-spec-kit-phase-system/scratch/legacy-memory-quarantine/20-02-26_17-45__spec-kit-phase-system.md:739:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/research/iterations/iteration-013.md:32:### 2. Stage 2 Fusion Test Coverage: Strong for graph signals, weak for recency
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/054-remaining-bugs-remediation/checklist.md:159:| CHK-043 | Memory search returns correct results | P0 | [x] | memory_search(): 5 results, hybrid search works |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/054-remaining-bugs-remediation/checklist.md:265:memory_search(): 5 results returned, constitutional first
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-08-impl-summaries.md:178:- **How It Was Tested:** Fail — required `## How It Was Tested` heading is missing; file uses `## Verification` at line 77 instead. Evidence quality is **weak**.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-08-impl-summaries.md:190:- **How It Was Tested:** Fail — required `## How It Was Tested` heading is missing; file uses `## Verification` at line 89 instead. Evidence quality is **weak**.
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/005-budget-stagnation-enforcement/checklist.md:66:- [ ] CHK-030 [P0] No recommendation weakens current governance or validation controls
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/legacy-memory-quarantine/08-03-26_20-47__fixes-for-memory-pipeline-contamination.md:299:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing" })` |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/legacy-memory-quarantine/08-03-26_20-47__fixes-for-memory-pipeline-contamination.md:311:memory_search({ specFolder: "system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing", limit: 10 })
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/legacy-memory-quarantine/08-03-26_20-47__fixes-for-memory-pipeline-contamination.md:317:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/legacy-memory-quarantine/08-03-26_20-47__fixes-for-memory-pipeline-contamination.md:326:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/021-spec-kit-phase-system/scratch/legacy-memory-quarantine/20-02-26_16-42__spec-kit-phase-system.md:712:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "system-spec-kit/021-spec-kit-phase-system" })` |
.opencode/specs/system-spec-kit/z_archive/021-spec-kit-phase-system/scratch/legacy-memory-quarantine/20-02-26_16-42__spec-kit-phase-system.md:724:memory_search({ specFolder: "system-spec-kit/021-spec-kit-phase-system", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/021-spec-kit-phase-system/scratch/legacy-memory-quarantine/20-02-26_16-42__spec-kit-phase-system.md:730:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/021-spec-kit-phase-system/scratch/legacy-memory-quarantine/20-02-26_16-42__spec-kit-phase-system.md:739:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-005-codex-A1.md:40:mcp: cocoindex_code starting
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-005-codex-A1.md:44:mcp: cocoindex_code ready
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-005-codex-A1.md:46:mcp startup: ready: code_mode, cocoindex_code, sequential_thinking; failed: spec_kit_memory
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-005-codex-A1.md:598:   318	- **Root Cause:** Format detection relies on weak presence checks, not schema validation.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-005-codex-A1.md:615:   404	- **Root Cause:** Format detection relies on weak presence checks, not schema validation.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-005-codex-A1.md:621:tool cocoindex_code.search({"query":"Where does the code decide whether input payload is already normalized vs manual format? Look for userPrompts observations recentContext checks.","paths":".opencode/skills/system-spec-kit/scripts/*","limit":5})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-005-codex-A1.md:622:cocoindex_code.search({"query":"Where does the code decide whether input payload is already normalized vs manual format? Look for userPrompts observations recentContext checks.","paths":".opencode/skills/system-spec-kit/scripts/*","limit":5}) failed in 7ms:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-005-codex-A1.md:632:tool cocoindex_code.search({"query":"Where does code determine if input is already normalized versus manual format using userPrompts, observations, recentContext?","limit":5})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-005-codex-A1.md:633:cocoindex_code.search({"query":"Where does code determine if input is already normalized versus manual format using userPrompts, observations, recentContext?","limit":5}) success in 298ms:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-005-codex-A1.md:654:tool cocoindex_code.search({"query":"How does generate-context parse CLI args to choose between --stdin, --json, spec folder direct mode, and data file mode?","limit":5})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-005-codex-A1.md:655:cocoindex_code.search({"query":"How does generate-context parse CLI args to choose between --stdin, --json, spec folder direct mode, and data file mode?","limit":5}) success in 271ms:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/legacy-memory-quarantine/15-03-26_12-27__i-m-starting-with-the-repo-s-own-runbook-and.md:1183:PLEASE IMPLEMENT THIS PLAN: # Fix Memory File Generation Quality in `009-perfect-session-capturing` ## Summary Implement the two confirmed rendering fixes as stated, and correct the third fix so it addresses the real bug. - `BUG 1` is real: anchor comments are stripped after template rendering. Fix the workflow HTML-comment stripper so it preserves only `&lt;!-- ANCHOR:* --&gt;` and `&lt;!-- /ANCHOR:* --&gt;`, while still removing all other workflow/template comments. - `BUG 2` is real: frontmatter `trigger_phrases` is static while the workflow already computes dynamic phrases. Replace the hardcoded frontmatter values with the same dynamic trigger rendering used later in the file, and make the no-trigger fallback empty rather than generic placeholder phrases. - `BUG 3` is a diagnosis correction: explicit JSON mode already bypasses native session capture. The real problem is direct-path mode choosing the wrong native backend because loader precedence ignores the calling CLI. Do not skip `collectSessionData()` for JSON mode; instead make native capture selection caller-aware in direct mode. ## Key Changes ### 1. Preserve anchor tags in rendered memory files - Update the HTML comment stripping logic in [`workflow.ts`](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/scripts/core/workflow.ts) so only non-anchor HTML comments are removed. - Preserve both opening and closing anchor comments exactly as rendered by the template. - Keep the existing post-render cleanup behavior for template configuration comments and other non-anchor comments. - Add a regression around the cleaning step itself, not just end-to-end output, so future regex changes cannot silently erase anchors again. ### 2. Make frontmatter trigger phrases session-specific - Update [`context_template.md`](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/templates/context_template.md) so frontmatter `trigger_phrases` uses the computed `TRIGGER_PHRASES` variable instead of hardcoded strings. - Use the same behavior in both places where trigger phrases appear in the template so frontmatter and trailing metadata cannot drift apart. - If no triggers are extracted, render an empty list instead of generic phrases like `"memory dashboard"` or `"session summary"`. ### 3. Fix direct-path cross-session contamination at backend selection - Keep explicit JSON mode unchanged: file input remains authoritative and must never consult native capture fallbacks. - Add an internal native-capture preference hint for direct-path mode, derived in this order: 1. explicit env override such as `SYSTEM_SPEC_KIT_CAPTURE_SOURCE` 2. inferred runtime markers for known CLIs 3. existing default fallback order if no hint is available - Pass that preferred source into native loading so the caller’s backend is tried first, then the remaining backends in the existing order. - If the preferred backend has no usable session, continue falling back normally. - Do not weaken alignment, contamination, or sufficiency gates. This change only fixes which session source is chosen first. ### 4. Keep quality gates aligned with the fix - Verify that preserved anchor comments do not trip leaked-HTML or formatting checks in the render/quality pipeline. - Keep trigger extraction and frontmatter metadata consistent with the actual saved session so memory files stop looking generic even when the body is correct. - Update the spec folder docs in `009-perfect-session-capturing` so the root cause and fix for direct-path contamination explicitly describe caller-aware backend preference, not “skip `collectSessionData()` in JSON mode.” ## Public Interfaces / Types - No user-facing CLI signature change for `generate-context.js`. - Add one internal native-capture preference field that can flow from CLI/runtime detection into the loader, for example `preferredCaptureSource`. - Add one documented env override for external CLIs: - `SYSTEM_SPEC_KIT_CAPTURE_SOURCE=opencode|claude|codex|copilot|gemini` - JSON file mode remains authoritative and unchanged. - `collectSessionData()` behavior remains unchanged; the fix is in source selection, not post-load session assembly. ## Test Plan 1. Rendering regressions - Template render preserves anchor comments after cleanup. - Non-anchor workflow/template comments are still stripped. - Rendered output contains anchor pairs and does not contain stripped configuration comments. - Anchor comments do not trigger leaked-HTML quality failures. 2. Trigger phrase regressions - Frontmatter contains session-specific trigger phrases when extracted. - Frontmatter no longer contains `"memory dashboard"`, `"session summary"`, or `"context template"`. - No-trigger case renders an empty trigger list, not generic placeholders. - Frontmatter trigger phrases and trailing metadata trigger phrases stay in sync. 3. Native capture selection regressions - Explicit JSON mode never invokes native capture and keeps current behavior. - Direct mode with `SYSTEM_SPEC_KIT_CAPTURE_SOURCE=claude` prefers Claude over OpenCode when both sessions exist. - Equivalent coverage for `codex`, `copilot`, and `gemini`. - If the preferred backend returns no usable session, fallback continues in the current default order. - If no hint is available, current default order remains unchanged. 4. End-to-end verification - Generate a memory file and confirm anchors are present, frontmatter triggers are session-specific, and template comments are stripped. - Re-run the targeted scripts test suites that cover runtime inputs, CLI authority, rendering, and loader behavior. - Re-run the repo verification stack already used for `010`: lint, build, targeted Vitest, JS regression suites, alignment drift, and spec validation. ## Assumptions And Defaults - The user’s spec folder remains [`009-perfect-session-capturing`](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing). - The correct fix for external-CLI contamination is caller-aware native backend preference, not changing JSON-mode post-processing. - When no caller-specific trigger phrases exist, empty metadata is preferable to misleading generic placeholders. - External CLI wrappers should set `SYSTEM_SPEC_KIT_CAPTURE_SOURCE` when possible; runtime inference is only a fallback, not the primary contract.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/legacy-memory-quarantine/15-03-26_12-27__i-m-starting-with-the-repo-s-own-runbook-and.md:1360:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing" })` |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/legacy-memory-quarantine/15-03-26_12-27__i-m-starting-with-the-repo-s-own-runbook-and.md:1372:memory_search({ specFolder: "system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing", limit: 10 })
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/legacy-memory-quarantine/15-03-26_12-27__i-m-starting-with-the-repo-s-own-runbook-and.md:1378:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/legacy-memory-quarantine/15-03-26_12-27__i-m-starting-with-the-repo-s-own-runbook-and.md:1387:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/016-json-mode-hybrid-enrichment/003-field-integrity-and-schema/spec.md:35:The `generate-context.js` pipeline contains two categories of correctness gap discovered during deep research Round 2 (74 findings, 20 recommendations). Domain A is a data-loss defect: when an AI sends both `userPrompts` (triggering the fast path) and `filesModified`, the file listing is silently discarded. Domain B is a set of five schema and validation weaknesses that allow typo'd fields, over-long strings, invalid enum values, malformed YAML frontmatter, and trivially short content to pass through to storage undetected. Together these eight changes harden the pipeline against both accidental data loss and silent quality degradation.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/054-remaining-bugs-remediation/scratch/legacy-memory-quarantine/01-01-26_15-02__remaining-bugs-remediation.md:388:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/054-remaining-bugs-remediation" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/054-remaining-bugs-remediation/scratch/legacy-memory-quarantine/01-01-26_15-02__remaining-bugs-remediation.md:393:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/004-fresh-context-validation-first/spec.md:85:| REQ-001 | Keep the current Public authorities authoritative | The packet does not recommend replacing `/spec_kit:*`, the current agent stack, Spec Kit Memory, CocoIndex, or code-graph |
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/004-fresh-context-validation-first/spec.md:136:- **NFR-S01**: The packet must not weaken current governance or validation boundaries.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/legacy-memory-quarantine/15-03-26_12-25__how-is-used-later-in-the-template-to-match-th.md:796:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing" })` |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/legacy-memory-quarantine/15-03-26_12-25__how-is-used-later-in-the-template-to-match-th.md:808:memory_search({ specFolder: "system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing", limit: 10 })
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/legacy-memory-quarantine/15-03-26_12-25__how-is-used-later-in-the-template-to-match-th.md:814:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/legacy-memory-quarantine/15-03-26_12-25__how-is-used-later-in-the-template-to-match-th.md:823:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/054-remaining-bugs-remediation/scratch/legacy-memory-quarantine/01-01-26_14-13__remaining-bugs-remediation.md:224:- Tool: spec_kit_memory_memory_search
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/054-remaining-bugs-remediation/scratch/legacy-memory-quarantine/01-01-26_14-13__remaining-bugs-remediation.md:327:### OBSERVATION: Tool: spec_kit_memory_memory_search
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/054-remaining-bugs-remediation/scratch/legacy-memory-quarantine/01-01-26_14-13__remaining-bugs-remediation.md:329:Executed spec_kit_memory_memory_search
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/054-remaining-bugs-remediation/scratch/legacy-memory-quarantine/01-01-26_14-13__remaining-bugs-remediation.md:331:**Details:** Tool: spec_kit_memory_memory_search | Status: completed
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/054-remaining-bugs-remediation/scratch/legacy-memory-quarantine/01-01-26_14-13__remaining-bugs-remediation.md:697:**Tool: spec_kit_memory_memory_search**
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/054-remaining-bugs-remediation/scratch/legacy-memory-quarantine/01-01-26_14-13__remaining-bugs-remediation.md:698:Tool: spec_kit_memory_memory_search
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/054-remaining-bugs-remediation/scratch/legacy-memory-quarantine/01-01-26_14-13__remaining-bugs-remediation.md:731:**Tool: spec_kit_memory_memory_search**
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/054-remaining-bugs-remediation/scratch/legacy-memory-quarantine/01-01-26_14-13__remaining-bugs-remediation.md:732:Tool: spec_kit_memory_memory_search
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/054-remaining-bugs-remediation/scratch/legacy-memory-quarantine/01-01-26_14-13__remaining-bugs-remediation.md:882:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/054-remaining-bugs-remediation" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/054-remaining-bugs-remediation/scratch/legacy-memory-quarantine/01-01-26_14-13__remaining-bugs-remediation.md:887:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/016-json-mode-hybrid-enrichment/003-field-integrity-and-schema/graph-metadata.json:199:    "causal_summary": "The `generate-context.js` pipeline contains two categories of correctness gap discovered during deep research Round 2 (74 findings, 20 recommendations). Domain A is a data-loss defect: when an AI sends both `userPrompts` (triggering the fast path) and `filesModified`, the file listing is silently discarded. Domain B is a set of five schema and validation weaknesses that allow typo'd fields, over-long strings, invalid enum values, malformed YAML frontmatter, and trivially short content to pass through to storage undetected. Together these eight changes harden the pipeline against both accidental data loss and silent quality degradation.",
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/research/iterations/iteration-009.md:71:**Potential weakness**: The expansion only mines terms from the top-5 similar memories' raw text (tokenized on word boundaries). This means it can only expand with words that literally appear in similar documents -- it cannot discover conceptually related terms that use different vocabulary. For example, if you search "authentication" and similar memories only use "auth", the expansion would add "auth" but could not add "SSO" or "OAuth" unless those terms appear in the top-5 results. This is a limitation of the bag-of-words approach vs. a more sophisticated query reformulation (e.g., LLM-based). However, for a local system this is a reasonable trade-off.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/research/iterations/iteration-009.md:124:However, there is **no explicit handling of the "many weak matches" scenario** where a broad query (e.g., "search") matches hundreds of memories but none strongly. In this case:
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/054-remaining-bugs-remediation/tasks.md:170:| T-045 | Test memory search with various queries | ✅ Complete | | memory_search(): 5 results, hybrid |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/007-external-graph-memory-research/implementation-summary.md:73:| Treat current graph metrics as the baseline for comparison | It ties the research to real weaknesses instead of generic curiosity |
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/004-fresh-context-validation-first/checklist.md:66:- [ ] CHK-030 [P0] No recommendation weakens current governance or validation controls
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/legacy-memory-quarantine/09-03-26_11-28__fixed-all-13-review-findings-from-gpt-5-4-triple.md:288:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing" })` |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/legacy-memory-quarantine/09-03-26_11-28__fixed-all-13-review-findings-from-gpt-5-4-triple.md:300:memory_search({ specFolder: "system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing", limit: 10 })
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/legacy-memory-quarantine/09-03-26_11-28__fixed-all-13-review-findings-from-gpt-5-4-triple.md:306:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/legacy-memory-quarantine/09-03-26_11-28__fixed-all-13-review-findings-from-gpt-5-4-triple.md:315:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/009-graph-retrieval-improvements/scratch/diagnosis-trace.md:1:# Diagnosis Trace: memory_search("Semantic Search")
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/009-graph-retrieval-improvements/scratch/diagnosis-trace.md:7:memory_search({ query: "Semantic Search", includeTrace: true, includeConstitutional: false, limit: 5 })
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/009-graph-retrieval-improvements/scratch/diagnosis-trace.md:12:- requestQuality: "weak"
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/009-graph-retrieval-improvements/scratch/diagnosis-trace.md:14:- Recovery status: "low_confidence", reason: "low_signal_query"
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/009-graph-retrieval-improvements/scratch/diagnosis-trace.md:77:- `query-intent-classifier.ts`: Routes structural/semantic/hybrid for code graph vs CocoIndex. **Extend with extractConcepts()** rather than building separate extractor
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/research/research.md:59:5. [Code Graph/CocoIndex Integration (Q10)](#5-code-graphcocoindex-integration-q10)
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/009-graph-retrieval-improvements/tasks.md:47:- [x] T001 Trace `memory_search("Semantic Search")` through full pipeline, log each stage output (`scratch/diagnosis-trace.md`) [EVIDENCE: 5 results returned (not 0), confidence 0.341, 650ms pipeline, all stages traced]
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/009-graph-retrieval-improvements/tasks.md:48:- [x] T002 Check if `SPECKIT_EMPTY_RESULT_RECOVERY_V1` fires and what it returns — recovery fires with status "low_confidence", reason "low_signal_query", recommendedAction "switch_mode". Does NOT use graph expansion.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/009-graph-retrieval-improvements/tasks.md:69:- [x] T014 Verify community summaries are searchable via memory_search [EVIDENCE: community_summaries table exists with summaries; searchCommunities() tested (5/5 pass); community-search.ts wired into memory-search.ts handler; requires MCP server restart for live test]
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/009-graph-retrieval-improvements/tasks.md:97:- [x] T029 graphEvidence included in formatted memory_search response via search-results.ts [EVIDENCE: formatters/search-results.ts:486-490]
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/009-graph-retrieval-improvements/tasks.md:135:- [x] `memory_search("Semantic Search")` returns relevant results (5 results with concept routing enhancement)
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/007-external-graph-memory-research/research/research.md:33:This survey compares seven external graph-memory systems—Zep, Mem0, GraphRAG, LightRAG, Memoripy, Cognee, and Graphiti—against Spec Kit Memory’s current state. Across the systems, the strongest recurring pattern is not “build a bigger graph,” but “turn graph structure into searchable, explainable, auto-utilized retrieval artifacts.” The external systems differ in sophistication, but they converge on several practical lessons: searchable graph text surfaces, hybrid retrieval, query-to-graph bridging, summaries/community abstractions, stronger provenance, and better user-facing explanations.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/007-external-graph-memory-research/research/research.md:48:| 6 | Phase B (Retrieve) | Zero-result recovery for weak/empty searches | H | M | The known miss on `memory_search('Semantic Search')` indicates the current pipeline still needs a graph-assisted rescue path that can fire when primary retrieval returns nothing useful. |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/007-external-graph-memory-research/research/research.md:54:| 12 | Phase D (Maintain) | Reinforcement from access and failure feedback | M | L | Cognee, Mem0, and Memoripy all point toward iterative strengthening of aliases, summaries, and neighborhoods that repeatedly resolve weak queries. |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/007-external-graph-memory-research/research/research.md:66:Our system: 3,854 causal edges, 79.92% coverage, dominant supports (2,578) and caused (1,265), avg strength 0.76, 6 orphaned edges, memory_search('Semantic Search') returns 0 results
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-006-codex-A1.md:32:mcp: cocoindex_code starting
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-006-codex-A1.md:37:mcp: cocoindex_code ready
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-006-codex-A1.md:39:mcp startup: ready: code_mode, cocoindex_code, sequential_thinking; failed: spec_kit_memory
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-006-codex-A2.md:33:mcp: cocoindex_code starting
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-006-codex-A2.md:39:mcp: cocoindex_code ready
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-006-codex-A2.md:41:mcp startup: ready: code_mode, cocoindex_code, sequential_thinking; failed: spec_kit_memory
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-006-codex-A2.md:301:tool cocoindex_code.search({"query":"where is skipped_quality_gate assigned or quality gate blocks indexing","paths":".opencode/skills/system-spec-kit/scripts/**","limit":10,"refresh_index":false})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-006-codex-A2.md:302:cocoindex_code.search({"query":"where is skipped_quality_gate assigned or quality gate blocks indexing","paths":".opencode/skills/system-spec-kit/scripts/**","limit":10,"refresh_index":false}) failed in 7ms:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-006-codex-A2.md:312:tool cocoindex_code.search({"query":"indexability threshold quality score 0.30 or 30/100 for memory indexing","paths":".opencode/skills/system-spec-kit/scripts/**","limit":10,"refresh_index":false})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-006-codex-A2.md:313:cocoindex_code.search({"query":"indexability threshold quality score 0.30 or 30/100 for memory indexing","paths":".opencode/skills/system-spec-kit/scripts/**","limit":10,"refresh_index":false}) failed in 1ms:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-006-codex-A2.md:324:I hit a parameter mismatch on the CocoIndex query, so I’m rerunning with the correct `paths` format to locate the exact file and line where quality-based indexing is gated.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-006-codex-A2.md:325:tool cocoindex_code.search({"query":"where is skipped_quality_gate assigned or quality gate blocks indexing","paths":[".opencode/skills/system-spec-kit/scripts/**"],"limit":10,"refresh_index":false})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-006-codex-A2.md:326:cocoindex_code.search({"query":"where is skipped_quality_gate assigned or quality gate blocks indexing","paths":[".opencode/skills/system-spec-kit/scripts/**"],"limit":10,"refresh_index":false}) success in 7.51s:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-006-codex-A2.md:343:tool cocoindex_code.search({"query":"indexability threshold quality score 0.30 or 30/100 for memory indexing","paths":[".opencode/skills/system-spec-kit/scripts/**"],"limit":10,"refresh_index":false})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-006-codex-A2.md:344:cocoindex_code.search({"query":"indexability threshold quality score 0.30 or 30/100 for memory indexing","paths":[".opencode/skills/system-spec-kit/scripts/**"],"limit":10,"refresh_index":false}) success in 214ms:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-006-codex-A2.md:361:tool cocoindex_code.search({"query":"skipped_quality_gate","limit":10,"refresh_index":false})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-006-codex-A2.md:362:cocoindex_code.search({"query":"skipped_quality_gate","limit":10,"refresh_index":false}) success in 450ms:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-006-codex-A2.md:383:tool cocoindex_code.search({"query":"memory indexing quality gate threshold","limit":10,"refresh_index":false})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-006-codex-A2.md:384:cocoindex_code.search({"query":"memory indexing quality gate threshold","limit":10,"refresh_index":false}) success in 364ms:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-006-codex-A2.md:389:      "text": "{\n  \"success\": true,\n  \"results\": [\n    {\n      \"file_path\": \"specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/008-sprint-7-long-horizon/spec.md\",\n      \"language\": \"markdown\",\n      \"content\": \"### Scale Gate Definition\\n\\n> **SCALE GATE CLARITY (R8)**: The \\\"5K memories\\\" threshold for R8 activation means **5,000 active memories with successful embeddings** in `memory_index` (i.e., `(is_archived IS NULL OR is_archived = 0)` AND `embedding_status = 'success'`). Pending/failed embeddings and archived rows do not count. The threshold must be confirmed by a direct database query: `SELECT COUNT(*) FROM memory_index WHERE (is_archived IS NULL OR is_archived = 0) AND embedding_status = 'success'`.\",\n      \"start_line\": 153,\n      \"end_line\": 155,\n      \"score\": 0.6875854180603209\n    },\n    {\n      \"file_path\": \"specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/008-sprint-7-long-horizon/tasks.md\",\n      \"language\": \"markdown\",\n      \"content\": \"- [x] T001 [P] Implement memory summary generation (gated on >5K **active memories with embeddings**) behind `SPECKIT_MEMORY_SUMMARIES` flag [15-20h] — R8 (REQ-S7-001)\\n  - **SKIPPED — scale gate not met (2,411/5,000)**\\n  - Scale gate query: `SELECT COUNT(*) FROM memory_index WHERE (is_archived IS NULL OR is_archived = 0) AND embedding_status = 'success'` returned 2,411 — below 5,000 threshold\\n  - Per task rules: \\\"If result <5K, skip T001 entirely and document\\\" — documented as skipped\\n  - ~~**Scale gate check (required first)**~~: Result: 2,411 active memories with embeddings\\n  - ~~Summary generation algorithm~~ — not implemented (gate not met)\\n  - ~~Pre-filter integration~~ — not implemented (gate not met)\\n  - ~~Latency check~~ — not needed (gate not met)\",\n      \"start_line\": 40,\n      \"end_line\": 47,\n      \"score\": 0.6683184413259777\n    },\n    {\n      \"file_path\": \"specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/research/analysis/analysis-X02.md\",\n      \"language\": \"markdown\",\n      \"content\": \"### SUMMARY\\n- Total findings: 9\\n- Critical: 1, High: 4, Medium: 4, Low: 0\\n- Top 3 recommendations: Fix the metadata wiring so indexed memories actually carry the computed quality score; replace the v2 all-or-nothing gate with configurable severity/score policy; recalibrate the legacy scorer so empty/minimal memories cannot start at 50/100.\",\n      \"start_line\": 1164,\n      \"end_line\": 1167,\n      \"score\": 0.6582016285206702\n    },\n    {\n      \"file_path\": \"specs/system-spec-kit/022-hybrid-rag-fusion/system-spec-kit/feature_catalog/13--memory-quality-and-indexing/05-pre-storage-quality-gate.md\",\n      \"language\": \"markdown\",\n      \"content\": \"# Pre-storage quality gate\\n\\n## 1. OVERVIEW\\n\\nThe pre-storage quality gate validates structural integrity, content quality and semantic deduplication before a memory enters the index.\\n\\nThis is the bouncer at the door before a memory enters the system. It checks three things: is the memory properly structured, is the content actually useful and is it different enough from what is already stored? If a memory fails any of these checks, it gets turned away. Without this gate, the system would fill up with junk and near-duplicates that pollute future search results.\\n\\n---\",\n      \"start_line\": 1,\n      \"end_line\": 9,\n      \"score\": 0.6477961787977744\n    },\n    {\n      \"file_path\": \"specs/system-spec-kit/022-hybrid-rag-fusion/feature_catalog/13--memory-quality-and-indexing/05-pre-storage-quality-gate.md\",\n      \"language\": \"markdown\",\n      \"content\": \"# Pre-storage quality gate\\n\\n## 1. OVERVIEW\\n\\nThe pre-storage quality gate validates structural integrity, content quality and semantic deduplication before a memory enters the index.\\n\\nThis is the bouncer at the door before a memory enters the system. It checks three things: is the memory properly structured, is the content actually useful and is it different enough from what is already stored? If a memory fails any of these checks, it gets turned away. Without this gate, the system would fill up with junk and near-duplicates that pollute future search results.\\n\\n---\",\n      \"start_line\": 1,\n      \"end_line\": 9,\n      \"score\": 0.6477961787977744\n    },\n    {\n      \"file_path\": \"specs/system-spec-kit/022-hybrid-rag-fusion/system-spec-kit/feature_catalog/FEATURE_CATALOG.md\",\n      \"language\": \"markdown\",\n      \"content\": \"#### Current Reality\\n\\nA three-layer quality gate on memory save validates content before it enters the index. Layer 1 checks structural validity (title exists, content at least 50 characters, valid spec folder path format). Layer 2 scores content quality across five dimensions (title quality, trigger quality, length quality, anchor quality, metadata quality) with a 0.4 signal density threshold. Layer 3 checks semantic deduplication via cosine similarity against existing memories in the same spec folder, rejecting near-duplicates above 0.92.\",\n      \"start_line\": 2497,\n      \"end_line\": 2499,\n      \"score\": 0.6329679543875883\n    },\n    {\n      \"file_path\": \"specs/system-spec-kit/022-hybrid-rag-fusion/feature_catalog/FEATURE_CATALOG.md\",\n      \"language\": \"markdown\",\n      \"content\": \"#### Current Reality\\n\\nA three-layer quality gate on memory save validates content before it enters the index. Layer 1 checks structural validity (title exists, content at least 50 characters, valid spec folder path format). Layer 2 scores content quality across five dimensions (title quality, trigger quality, length quality, anchor quality, metadata quality) with a 0.4 signal density threshold. Layer 3 checks semantic deduplication via cosine similarity against existing memories in the same spec folder, rejecting near-duplicates above 0.92.\",\n      \"start_line\": 2497,\n      \"end_line\": 2499,\n      \"score\": 0.6329679543875883\n    },\n    {\n      \"file_path\": \"specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/044-speckit-test-suite/scratch/test-agent-09-tiers/TEST-REPORT.md\",\n      \"language\": \"markdown\",\n      \"content\": \"## Summary\\n- Total Tests: 9\\n- Passed: 7\\n- Observed (needs investigation): 2\\n- Failed: 0\\n\\n## Tier Distribution Found\\n\\nBased on memory_search with tier filtering:\\n- **Constitutional:** 1 (system-spec-kit/gate-enforcement.md)\\n- **Critical:** ~7 memories found\\n- **Important:** 8 memories found\\n- **Normal:** Majority (~110+ memories)\\n- **Deprecated:** 1 memory found (ID 371 - old gate enforcement)\\n- **Temporary:** Not explicitly tested, likely 0\",\n      \"start_line\": 18,\n      \"end_line\": 32,\n      \"score\": 0.6315018177700846\n    },\n    {\n      \"file_path\": \"specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/005-sprint-4-feedback-and-quality/tasks.md\",\n      \"language\": \"markdown\",\n      \"content\": \"## Phase 4: TM-04 Pre-Storage Quality Gate\\n\\n- [x] T007 [P] Implement multi-layer pre-storage quality gate in `memory_save` handler behind `SPECKIT_SAVE_QUALITY_GATE` flag [6-10h] — TM-04 (REQ-S4-004)\\n  - [x] T007a Layer 1: structural validation (existing checks, formalised)\\n  - [x] T007b Layer 2: content quality scoring — title, triggers, length, anchors, metadata, signal density; threshold >= 0.4\\n  - [x] T007c Layer 3: semantic dedup — cosine similarity > 0.92 against existing memories = reject\\n  - [x] T007d Warn-only mode (MR12): for first 2 weeks, log quality scores and would-reject decisions but do NOT block saves; tune thresholds based on false-rejection rate before enforcement\\n<!-- /ANCHOR:phase-4-tm04 -->\\n\\n---\\n\\n<!-- ANCHOR:phase-5-tm06 -->\",\n      \"start_line\": 80,\n      \"end_line\": 91,\n      \"score\": 0.6303331491758399\n    },\n    {\n      \"file_path\": \"specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/003-memory-quality-qp-0-4/spec.md\",\n      \"language\": \"markdown\",\n      \"content\": \"## Problem Statement\\n\\nPackage `003-memory-quality-qp-0-4` must convert research findings into enforceable memory-quality gates so generated memory files remain high-signal and index-safe. Without explicit quality constraints, low-quality memory artifacts can degrade retrieval trust and pollute downstream ranking behavior.\\n<!-- /ANCHOR:problem-statement -->\\n\\n---\\n\\n<!-- ANCHOR:requirements -->\",\n      \"start_line\": 137,\n      \"end_line\": 144,\n      \"score\": 0.6192826790297374\n    }\n  ],\n  \"total_returned\": 10,\n  \"offset\": 0,\n  \"message\": null\n}"
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-006-codex-A2.md:406:CocoIndex returned mostly documentation references, so I’m now validating directly in the core scripts to pinpoint where indexing is actually blocked by quality thresholds (it appears to be upstream of `memory-indexer.ts`).
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-006-codex-A2.md:743:- I'M UNCERTAIN ABOUT THIS: per-CLI comparison is weak from these files alone because frontmatter does not carry a reliable `source_cli` field (many `_sourceSessionId` are empty).
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-006-codex-A2.md:780:- I'M UNCERTAIN ABOUT THIS: per-CLI comparison is weak from these files alone because frontmatter does not carry a reliable `source_cli` field (many `_sourceSessionId` are empty).
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/009-graph-retrieval-improvements/implementation-summary.md:48:Traced `memory_search("Semantic Search")` through the full 4-stage pipeline. Key finding: prior fixes brought results from 0 to 5, but quality remains "weak" (confidence 0.341). All 8 planned improvements confirmed needed.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/009-graph-retrieval-improvements/implementation-summary.md:58:- **Graph-expanded fallback**: `buildGraphExpandedFallback()` walks 1-hop causal edges from concept seeds on zero/weak results, gated by `SPECKIT_GRAPH_FALLBACK`
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/009-graph-retrieval-improvements/implementation-summary.md:61:- **Dual-level retrieval**: `retrievalLevel: 'local' | 'global' | 'auto'` parameter on memory_search — auto mode falls back to community search on weak results, gated by `SPECKIT_DUAL_RETRIEVAL`
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-006-copilot-C2.md:305:3) **Failure point for minimum payload guidance**: not at JSON validation (mostly shape checks), but at post-normalization gates: `INSUFFICIENT_CONTEXT_ABORT` and `CONTAMINATION_GATE_ABORT` (`memory-sufficiency.ts:371-380`, `workflow.ts:2207-2230`). Gaps: permissive `filesModified` validation and generic file-description defaults weaken evidence quality.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/research/deep-research-state.jsonl:2:{"type":"iteration","run":1,"status":"complete","focus":"Feature flag audit -- all SPECKIT_* env vars, defaults, opt-in vs opt-out","findingsCount":8,"newInfoRatio":1.0,"noveltyJustification":"All 8 findings are entirely new -- first iteration establishing baseline inventory of 50+ feature flags","keyQuestions":["Q3: remaining search quality issues","Q4: hookless UX/auto-utilization","Q5: fusion pipeline bugs","Q6: validator fixes correctness","Q7: retrieval quality fixes working","Q8: lexical score propagation","Q9: adaptive fusion refinement","Q10: code graph/CocoIndex integration"],"answeredQuestions":["Q1","Q2"],"ruledOut":[],"focusTrack":"feature-flags","timestamp":"2026-04-01T07:18:00Z","durationMs":180000}
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/research/deep-research-state.jsonl:3:{"type":"iteration","run":2,"status":"complete","focus":"Fusion pipeline bug audit -- stage1 through stage4, ADAPTIVE_RANKING intentionality, governance flag discrepancy","findingsCount":9,"newInfoRatio":0.83,"noveltyJustification":"7.5 of 9 findings are new: 6 fully new (pipeline architecture, score aliasing, deep clone fragility, validation multiplier, stage3 contract, governance flags), 1.5 partially new (ADAPTIVE_RANKING extends Q1 flag findings, stage4 UNKNOWN_STATE extends known tech debt)","keyQuestions":["Q3: remaining search quality issues","Q4: hookless UX/auto-utilization","Q6: validator fixes correctness","Q7: retrieval quality fixes working","Q8: lexical score propagation","Q9: adaptive fusion refinement","Q10: code graph/CocoIndex integration"],"answeredQuestions":["Q1","Q2","Q5"],"ruledOut":["null-pointer-crash-search","off-by-one-filter-errors"],"focusTrack":"pipeline-quality","timestamp":"2026-04-01T07:30:00Z","durationMs":180000}
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/research/deep-research-state.jsonl:4:{"type":"iteration","run":3,"status":"complete","focus":"Verify spec 009/010/011 fix implementations -- V8/V12 validator rules, 6 retrieval quality fixes, lexical score propagation","findingsCount":13,"newInfoRatio":0.85,"noveltyJustification":"11 of 13 findings are fully new (V8 three-pronged detection, V12 trigger_phrase overlap, v-rule-bridge loading, V8/V12 test coverage, 6 individual retrieval fix verifications, FTS5 weighted scoring, sourceScores merge, lexical score fallback chain); 2 partially new (intent propagation and folder discovery extend Q1/Q2 feature flag findings)","keyQuestions":["Q3: remaining search quality issues","Q4: hookless UX/auto-utilization","Q9: adaptive fusion refinement","Q10: code graph/CocoIndex integration"],"answeredQuestions":["Q1","Q2","Q5","Q6","Q7","Q8"],"ruledOut":["V8-V12-regression-search","missing-retrieval-fix-search","lexical-score-loss-during-fusion"],"focusTrack":"fix-verification","timestamp":"2026-04-01T07:45:00Z","durationMs":180000}
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/research/deep-research-state.jsonl:5:{"type":"iteration","run":4,"status":"complete","focus":"Q4 hookless UX/auto-utilization (auto-surface, progressive disclosure, goal refinement, session priming) and Q3 search quality gaps","findingsCount":11,"newInfoRatio":0.91,"noveltyJustification":"10 of 11 findings are fully new (auto-surface hookless architecture, T018 Prime Package, progressive disclosure defaults/structure, goal-always-current-query limitation, cross-turn dedup wiring, dual-scope auto-surface, naive keyword matching, snippet metadata gaps, constitutional limit concern, unused session state fields, no latency circuit-breaker); 1 partially new (auto-surface at compaction extends iteration 1 feature flag findings)","keyQuestions":["Q3: remaining search quality issues (5 improvement items identified)","Q9: adaptive fusion refinement","Q10: code graph/CocoIndex integration"],"answeredQuestions":["Q1","Q2","Q4","Q5","Q6","Q7","Q8"],"ruledOut":["hook-dependency-for-auto-surface","progressive-disclosure-opt-in"],"focusTrack":"ux-quality","timestamp":"2026-04-01T08:00:00Z","durationMs":180000}
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/research/deep-research-state.jsonl:6:{"type":"iteration","run":5,"status":"complete","focus":"Q9 (adaptive fusion weights, scoring parameters, refinement opportunities) and Q10 (Code Graph and CocoIndex integration)","findingsCount":14,"newInfoRatio":0.89,"noveltyJustification":"12.5 of 14 findings are fully new (7 weight profiles, graph weight variance, doc-type shifting, recency boost magnitude, degraded mode contract, graphWeight as 4th RRF channel, Code Graph separate DB, Code Graph not in pipeline, CocoIndex absent from search, 4 causal graph mechanisms, stage2 graph cap 0.03, 3 refinement opportunities); 1.5 partially new (adaptive fusion flag extends Q1 findings, graph signals extend Q2 findings)","keyQuestions":["Q3: remaining search quality issues (5 improvement items + 3 refinement opportunities)"],"answeredQuestions":["Q1","Q2","Q4","Q5","Q6","Q7","Q8","Q9","Q10"],"ruledOut":["cocoindex-feeding-memory-search","code-graph-db-in-fusion-pipeline"],"focusTrack":"fusion-refinement","timestamp":"2026-04-01T08:15:00Z","durationMs":180000}
.opencode/specs/system-spec-kit/z_archive/008-codex-system-wide-audit/scratch/context-typo-path-resolution.md:26:**Tools Used**: memory_match_triggers(), memory_search()
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/009-graph-retrieval-improvements/graph-metadata.json:211:    "causal_summary": "The Spec Kit Memory graph has 3,854 causal edges at 79.92% coverage but is underutilized: `memory_search(\"Semantic Search\")` returns 0 results, graph signals are invisible to users, and the graph fires only reactively via causal boost. Phase 007 surveyed 7 external graph memory systems and produced a 12-item ranked improvement backlog. This spec implements the top 8 improvements across 4 dependency-ordered phases.",
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/spec.md:8:  - "cocoindex path drift"
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/spec.md:54:After repository path changes, indexing subsystems were inconsistent: CocoIndex environment paths were stale, code-graph initialization could fail lazily, and adaptive fusion defaults were not explicitly represented across MCP config surfaces. Lexical score visibility through fusion traces was also incomplete.
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/018-git-context-and-run-state-evaluation/spec.md:59:- Test whether the overlay helps bound continuation without weakening explicit packet and memory contracts.
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/018-git-context-and-run-state-evaluation/spec.md:108:4. **Given** the exit condition is checked, when evidence is still weak, then the packet remains an investigation instead of being promoted prematurely.
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/018-git-context-and-run-state-evaluation/spec.md:134:- **NFR-S01**: The packet must not weaken current governance or validation boundaries.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/plan.md:34:| **Framework** | Spec Kit Memory + CocoIndex + Code Graph |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/plan.md:67:- **CocoIndex settings/environment**: path validity and indexing scope.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/plan.md:101:| Integration | Indexing channel startup + indexing path | CocoIndex + MCP runtime checks |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/plan.md:112:| CocoIndex runtime environment | External/Internal | Yellow | Code semantic channel cannot recover |
.opencode/specs/system-spec-kit/z_archive/008-codex-system-wide-audit/scratch/context-121-audit.md:212:   - **Validation:** memory_search() returns valid file path matching filesystem
.opencode/specs/system-spec-kit/z_archive/008-codex-system-wide-audit/scratch/context-121-audit.md:248:| **Tools Used** | glob, grep, read, memory_search |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/research-reconciliation-decisions.md:178:- Revisit this decision after the source-integrity follow-up for R-11, because wrong-session capture and weak folder detection compound each other and should be corrected together.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/017-json-primary-deprecation/spec.md:156:- **NFR-S01**: The JSON-primary shift must not weaken validation on save inputs.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-008-codex-A1.md:33:mcp: cocoindex_code starting
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-008-codex-A1.md:38:mcp: cocoindex_code ready
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-008-codex-A1.md:40:mcp startup: ready: code_mode, cocoindex_code, sequential_thinking; failed: spec_kit_memory
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-008-codex-A1.md:524:tool cocoindex_code.search({"query":"Where is getSourceCapabilities used in system-spec-kit scripts and what behaviors depend on inputMode toolTitleWithPathExpected prefersStructuredSave?","paths":".opencode/skills/system-spec-kit/scripts/*","limit":20,"refresh_index":false})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-008-codex-A1.md:525:cocoindex_code.search({"query":"Where is getSourceCapabilities used in system-spec-kit scripts and what behaviors depend on inputMode toolTitleWithPathExpected prefersStructuredSave?","paths":".opencode/skills/system-spec-kit/scripts/*","limit":20,"refresh_index":false}) failed in 2ms:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-008-codex-A1.md:535:tool cocoindex_code.search({"query":"getSourceCapabilities usage inputMode toolTitleWithPathExpected prefersStructuredSave in system-spec-kit scripts","paths":[".opencode/skills/system-spec-kit/scripts/**/*"],"limit":20,"refresh_index":false})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-008-codex-A1.md:536:cocoindex_code.search({"query":"getSourceCapabilities usage inputMode toolTitleWithPathExpected prefersStructuredSave in system-spec-kit scripts","paths":[".opencode/skills/system-spec-kit/scripts/**/*"],"limit":20,"refresh_index":false}) success in 398ms:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-008-codex-A1.md:553:tool cocoindex_code.search({"query":"getSourceCapabilities inputMode toolTitleWithPathExpected prefersStructuredSave","limit":20,"refresh_index":false})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-008-codex-A1.md:554:cocoindex_code.search({"query":"getSourceCapabilities inputMode toolTitleWithPathExpected prefersStructuredSave","limit":20,"refresh_index":false}) success in 77ms:
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/018-git-context-and-run-state-evaluation/checklist.md:66:- [ ] CHK-030 [P0] No recommendation weakens current governance or validation controls
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/086-mcp-embedding-failure/plan.md:46:1. User calls memory_search/memory_save (first embedding request)
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/086-mcp-embedding-failure/plan.md:208:- [ ] Test memory_search() works
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/017-json-primary-deprecation/scratch/architecture-deep-dive-report.md:161:collect-session-data.ts is a 960-line coupling point with a 57-field return literal, inconsistent null-input behavior, and F-25 blocker resolution scoping weakness.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/019-speckit-refinement/scratch/legacy-memory-quarantine/23-12-25_13-56__speckit-refinement.md:946:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "004-speckit/010-speckit-refinement" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/019-speckit-refinement/scratch/legacy-memory-quarantine/23-12-25_13-56__speckit-refinement.md:951:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/008-codex-system-wide-audit/scratch/legacy-memory-quarantine/15-02-26_17-31__codex-system-wide-audit.md:566:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "system-spec-kit/z_archive/008-codex-system-wide-audit" })` |
.opencode/specs/system-spec-kit/z_archive/008-codex-system-wide-audit/scratch/legacy-memory-quarantine/15-02-26_17-31__codex-system-wide-audit.md:578:memory_search({ specFolder: "system-spec-kit/z_archive/008-codex-system-wide-audit", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/008-codex-system-wide-audit/scratch/legacy-memory-quarantine/15-02-26_17-31__codex-system-wide-audit.md:584:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/008-codex-system-wide-audit/scratch/legacy-memory-quarantine/15-02-26_17-31__codex-system-wide-audit.md:593:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-005-codex-A3.md:39:mcp: cocoindex_code starting
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-005-codex-A3.md:44:mcp: cocoindex_code ready
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-005-codex-A3.md:46:mcp startup: ready: code_mode, cocoindex_code, sequential_thinking; failed: spec_kit_memory
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-005-codex-A3.md:104:tool cocoindex_code.search({"query":"Where is tree-thinning output consumed and passed to renderer in system-spec-kit scripts workflow","limit":8})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-005-codex-A3.md:105:cocoindex_code.search({"query":"Where is tree-thinning output consumed and passed to renderer in system-spec-kit scripts workflow","limit":8}) success in 7.96s:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-005-codex-A3.md:737:2b8307816 feat: deep-research refinement, CocoIndex skill overhaul, spec-kit updates, and spec folder cleanup
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-005-codex-A3.md:738:689147e76 feat: enforce CocoIndex Code usage in AGENTS.md files, remove research agent, and bulk cleanup
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-005-codex-A3.md:739:01e781ab9 feat: API error content defense, deep research skill, CocoIndex integration, and changelog renumbering
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-005-codex-A3.md:1093:    feat: enforce CocoIndex Code usage in AGENTS.md files, remove research agent, and bulk cleanup
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-005-codex-A3.md:1095:    Add CocoIndex Code MCP as mandatory tool, update code search workflow hierarchy,
.opencode/specs/system-spec-kit/z_archive/008-codex-system-wide-audit/scratch/legacy-memory-quarantine/15-02-26_17-22__codex-system-wide-audit.md:369:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "system-spec-kit/z_archive/008-codex-system-wide-audit" })` |
.opencode/specs/system-spec-kit/z_archive/008-codex-system-wide-audit/scratch/legacy-memory-quarantine/15-02-26_17-22__codex-system-wide-audit.md:381:memory_search({ specFolder: "system-spec-kit/z_archive/008-codex-system-wide-audit", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/008-codex-system-wide-audit/scratch/legacy-memory-quarantine/15-02-26_17-22__codex-system-wide-audit.md:387:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/008-codex-system-wide-audit/scratch/legacy-memory-quarantine/15-02-26_17-22__codex-system-wide-audit.md:396:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/019-speckit-refinement/scratch/legacy-memory-quarantine/23-12-25_15-36__speckit-refinement.md:199:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "004-speckit/010-speckit-refinement" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/019-speckit-refinement/scratch/legacy-memory-quarantine/23-12-25_15-36__speckit-refinement.md:204:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/017-json-primary-deprecation/scratch/dead-code-audit-report.md:256:**M1. `memory_search.minQualityScore` -- Deprecated param still live**
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/016-self-reflection-and-reconsolidation-study/spec.md:108:4. **Given** the exit condition is checked, when evidence is still weak, then the packet remains an investigation instead of being promoted prematurely.
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/016-self-reflection-and-reconsolidation-study/spec.md:134:- **NFR-S01**: The packet must not weaken current governance or validation boundaries.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/026-docs-alignment/scratch/legacy-memory-quarantine/16-02-26_14-50__docs-alignment-complete.md:273:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "`specs/008-memory-docs-alignment/`" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/026-docs-alignment/scratch/legacy-memory-quarantine/16-02-26_14-50__docs-alignment-complete.md:278:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/008-codex-system-wide-audit/scratch/legacy-memory-quarantine/15-02-26_17-29__codex-system-wide-audit.md:369:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "system-spec-kit/z_archive/008-codex-system-wide-audit" })` |
.opencode/specs/system-spec-kit/z_archive/008-codex-system-wide-audit/scratch/legacy-memory-quarantine/15-02-26_17-29__codex-system-wide-audit.md:381:memory_search({ specFolder: "system-spec-kit/z_archive/008-codex-system-wide-audit", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/008-codex-system-wide-audit/scratch/legacy-memory-quarantine/15-02-26_17-29__codex-system-wide-audit.md:387:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/008-codex-system-wide-audit/scratch/legacy-memory-quarantine/15-02-26_17-29__codex-system-wide-audit.md:396:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-007-codex-A1.md:36:mcp: cocoindex_code starting
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-007-codex-A1.md:39:mcp: cocoindex_code ready
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-007-codex-A1.md:41:mcp startup: ready: code_mode, cocoindex_code, sequential_thinking; failed: spec_kit_memory
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-007-codex-A1.md:560:I’m also running a semantic cross-check with CocoIndex to make sure we didn’t miss any alternate workflow return or capture-order implementations outside these files.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-007-codex-A1.md:561:tool cocoindex_code.search({"query":"WorkflowResult interface returned by runWorkflow includes contextDir specFolder contextFilename writtenFiles memoryId indexingStatus stats","limit":5,"refresh_index":false})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-007-codex-A1.md:562:cocoindex_code.search({"query":"WorkflowResult interface returned by runWorkflow includes contextDir specFolder contextFilename writtenFiles memoryId indexingStatus stats","limit":5,"refresh_index":false}) success in 241ms:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-007-codex-A1.md:583:tool cocoindex_code.search({"query":"loadCollectedData preferred native capture order opencode claude codex copilot gemini","paths":".opencode/skills/system-spec-kit/scripts/loaders/*","languages":"typescript","limit":5,"refresh_index":false})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-007-codex-A1.md:584:cocoindex_code.search({"query":"loadCollectedData preferred native capture order opencode claude codex copilot gemini","paths":".opencode/skills/system-spec-kit/scripts/loaders/*","languages":"typescript","limit":5,"refresh_index":false}) failed in 2ms:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-007-codex-A1.md:594:tool cocoindex_code.search({"query":"loadCollectedData preferred native capture order opencode claude codex copilot gemini","paths":[".opencode/skills/system-spec-kit/scripts/loaders/*"],"languages":["typescript"],"limit":5,"refresh_index":false})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-007-codex-A1.md:595:cocoindex_code.search({"query":"loadCollectedData preferred native capture order opencode claude codex copilot gemini","paths":[".opencode/skills/system-spec-kit/scripts/loaders/*"],"languages":["typescript"],"limit":5,"refresh_index":false}) success in 363ms:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-007-codex-A1.md:612:tool cocoindex_code.search({"query":"DEFAULT_NATIVE_CAPTURE_ORDER opencode-capture claude-code-capture codex-cli-capture copilot-cli-capture gemini-cli-capture","limit":5,"refresh_index":false})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-007-codex-A1.md:613:cocoindex_code.search({"query":"DEFAULT_NATIVE_CAPTURE_ORDER opencode-capture claude-code-capture codex-cli-capture copilot-cli-capture gemini-cli-capture","limit":5,"refresh_index":false}) success in 139ms:
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/019-speckit-refinement/scratch/legacy-memory-quarantine/23-12-25_12-03__speckit-refinement.md:599:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "004-speckit/010-speckit-refinement" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/019-speckit-refinement/scratch/legacy-memory-quarantine/23-12-25_12-03__speckit-refinement.md:604:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/016-self-reflection-and-reconsolidation-study/checklist.md:66:- [ ] CHK-030 [P0] No recommendation weakens current governance or validation controls
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-003-codex-A3.md:42:mcp: cocoindex_code starting
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-003-codex-A3.md:48:mcp: cocoindex_code ready
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-003-codex-A3.md:50:mcp startup: ready: code_mode, cocoindex_code, sequential_thinking; failed: spec_kit_memory
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-003-codex-A3.md:217:dce3caa4b 2026-03-18T21:39:57+01:00 michelkerkmeester-barter feat: spec-kit playbook restructure, CocoIndex skill updates, and spec folder refinements
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-003-codex-A3.md:218:2b8307816 2026-03-18T21:22:09+01:00 michelkerkmeester-barter feat: deep-research refinement, CocoIndex skill overhaul, spec-kit updates, and spec folder cleanup
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-003-codex-A3.md:220:8a77947ce 2026-03-19T09:19:54+01:00 michelkerkmeester-barter fix: UX hooks automation — FSRS corruption guard, error capture, structuredClone, CocoIndex skill, and system updates
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-003-codex-A3.md:221:dce3caa4b 2026-03-18T21:39:57+01:00 michelkerkmeester-barter feat: spec-kit playbook restructure, CocoIndex skill updates, and spec folder refinements
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-003-codex-A3.md:222:2b8307816 2026-03-18T21:22:09+01:00 michelkerkmeester-barter feat: deep-research refinement, CocoIndex skill overhaul, spec-kit updates, and spec folder cleanup
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-003-codex-A3.md:224:8a77947ce 2026-03-19T09:19:54+01:00 michelkerkmeester-barter fix: UX hooks automation — FSRS corruption guard, error capture, structuredClone, CocoIndex skill, and system updates
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-003-codex-A3.md:225:dce3caa4b 2026-03-18T21:39:57+01:00 michelkerkmeester-barter feat: spec-kit playbook restructure, CocoIndex skill updates, and spec folder refinements
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-003-codex-A3.md:226:2b8307816 2026-03-18T21:22:09+01:00 michelkerkmeester-barter feat: deep-research refinement, CocoIndex skill overhaul, spec-kit updates, and spec folder cleanup
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-003-codex-A3.md:228:dce3caa4b 2026-03-18T21:39:57+01:00 michelkerkmeester-barter feat: spec-kit playbook restructure, CocoIndex skill updates, and spec folder refinements
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-003-codex-A3.md:229:2b8307816 2026-03-18T21:22:09+01:00 michelkerkmeester-barter feat: deep-research refinement, CocoIndex skill overhaul, spec-kit updates, and spec folder cleanup
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-003-codex-A3.md:245:2b8307816 2026-03-18T21:22:09+01:00 feat: deep-research refinement, CocoIndex skill overhaul, spec-kit updates, and spec folder cleanup
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-003-codex-A3.md:247:2b8307816 2026-03-18T21:22:09+01:00 feat: deep-research refinement, CocoIndex skill overhaul, spec-kit updates, and spec folder cleanup
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-003-codex-A3.md:249:2b8307816 2026-03-18T21:22:09+01:00 feat: deep-research refinement, CocoIndex skill overhaul, spec-kit updates, and spec folder cleanup
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-003-codex-A3.md:251:2b8307816 2026-03-18T21:22:09+01:00 feat: deep-research refinement, CocoIndex skill overhaul, spec-kit updates, and spec folder cleanup
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/019-speckit-refinement/scratch/legacy-memory-quarantine/23-12-25_15-48__speckit-refinement.md:214:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "004-speckit/010-speckit-refinement" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/019-speckit-refinement/scratch/legacy-memory-quarantine/23-12-25_15-48__speckit-refinement.md:219:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/015-anchor-enforcement-automation/scratch/legacy-memory-quarantine/17-02-26_08-42__anchor-enforcement-automation.md:371:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "../.opencode/specs/system-spec-kit/z_archive/015-anchor-enforcement-automation" })` |
.opencode/specs/system-spec-kit/z_archive/015-anchor-enforcement-automation/scratch/legacy-memory-quarantine/17-02-26_08-42__anchor-enforcement-automation.md:383:memory_search({ specFolder: "../.opencode/specs/system-spec-kit/z_archive/015-anchor-enforcement-automation", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/015-anchor-enforcement-automation/scratch/legacy-memory-quarantine/17-02-26_08-42__anchor-enforcement-automation.md:389:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/015-anchor-enforcement-automation/scratch/legacy-memory-quarantine/17-02-26_08-42__anchor-enforcement-automation.md:398:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/025-system-memory-rename/plan.md:318:2. Verify `memory_search` tool accessible
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/074-speckit-template-optimization-refinement/review.md:287:The Spec 073 implementation successfully achieved its primary goals of template reduction and value-based scaling. The CORE + ADDENDUM architecture is well-designed and maintainable. The main weakness is the loss of onboarding guidance for new users, which could be addressed through a "verbose" template variant.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/019-speckit-refinement/scratch/legacy-memory-quarantine/23-12-25_15-13__speckit-refinement.md:1443:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "004-speckit/010-speckit-refinement" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/019-speckit-refinement/scratch/legacy-memory-quarantine/23-12-25_15-13__speckit-refinement.md:1448:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/015-anchor-enforcement-automation/scratch/legacy-memory-quarantine/17-02-26_09-11__anchor-enforcement-automation.md:463:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "../.opencode/specs/system-spec-kit/z_archive/015-anchor-enforcement-automation" })` |
.opencode/specs/system-spec-kit/z_archive/015-anchor-enforcement-automation/scratch/legacy-memory-quarantine/17-02-26_09-11__anchor-enforcement-automation.md:475:memory_search({ specFolder: "../.opencode/specs/system-spec-kit/z_archive/015-anchor-enforcement-automation", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/015-anchor-enforcement-automation/scratch/legacy-memory-quarantine/17-02-26_09-11__anchor-enforcement-automation.md:481:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/015-anchor-enforcement-automation/scratch/legacy-memory-quarantine/17-02-26_09-11__anchor-enforcement-automation.md:490:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/015-anchor-enforcement-automation/research/research.md:33:**Key Finding**: The system has strong validation **detection** but weak **prevention**. Files can be created incorrectly, validated later, and potentially committed with warnings rather than errors.
.opencode/specs/system-spec-kit/z_archive/015-anchor-enforcement-automation/research/research.md:301:<!-- ANCHOR:root-cause-3-routing-weakness -->
.opencode/specs/system-spec-kit/z_archive/015-anchor-enforcement-automation/research/research.md:427:<!-- /ANCHOR:root-cause-3-routing-weakness -->
.opencode/specs/system-spec-kit/z_archive/015-anchor-enforcement-automation/research/research.md:770:All three gaps stem from a **trust-based enforcement model** where agents are instructed to follow rules but not technically prevented from violating them. The system has strong **detection** (validation scripts) but weak **prevention** (routing gates).
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/025-system-memory-rename/checklist.md:50:  - Test: `memory_search`, `memory_list` respond
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/025-system-memory-rename/checklist.md:51:  - Evidence: ✅ Tools respond correctly (used memory_search and memory_list during verification)
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/006-default-on-boost-rollout/spec.md:131:- **SC-001**: A test `memory_search` call with no env vars set returns `sessionBoostApplied` not equal to `"off"` (when a sessionId is provided)
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/006-default-on-boost-rollout/spec.md:132:- **SC-002**: A test `memory_search` call with no env vars set returns `causalBoostApplied` not equal to `"off"`
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/006-default-on-boost-rollout/spec.md:139:**Given** a fresh MCP server with no `SPECKIT_SESSION_BOOST` env var set, **when** `memory_search` is called with a `sessionId`, **then** the response metadata shows `sessionBoostApplied` is not `"off"`.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/006-default-on-boost-rollout/spec.md:141:**Given** a fresh MCP server with no `SPECKIT_CAUSAL_BOOST` env var set, **when** `memory_search` is called, **then** the response metadata shows `causalBoostApplied` is not `"off"`.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/006-default-on-boost-rollout/spec.md:143:**Given** a populated memory database and `mode: "deep"` passed to `memory_search`, **when** the search executes, **then** the response metadata shows `deepExpansion: true`.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/006-default-on-boost-rollout/spec.md:145:**Given** `SPECKIT_SESSION_BOOST=false` is set in the environment, **when** `memory_search` is called with a `sessionId`, **then** the response metadata shows `sessionBoostApplied: "off"`.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/006-default-on-boost-rollout/spec.md:147:**Given** `SPECKIT_CAUSAL_BOOST=false` is set in the environment, **when** `memory_search` is called, **then** the response metadata shows `causalBoostApplied: "off"`.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/019-speckit-refinement/scratch/legacy-memory-quarantine/23-12-25_12-52__speckit-refinement.md:917:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "004-speckit/010-speckit-refinement" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/019-speckit-refinement/scratch/legacy-memory-quarantine/23-12-25_12-52__speckit-refinement.md:922:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-06-hvr-compliance.md:333:- `em dash` at line 54: - [x] CHK-024 [P1] SC-001 validated: strong choice / weak rationale shows split (e.g., CHOICE=0.85, RATIONALE=0.45, legacy=0.45) — Evidence: split-confidence cases now render and preserve legacy `CONFIDENCE = Math.min(choice, rationale)`. [Evidence: Verified in this phase's documented implementation and validation outputs.]
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/checklist.md:67:- [x] CHK-030 [P0] No recommendation weakens current governance or validation controls [EVIDENCE: packet scope stays doc-only and retains existing validators, memory, and command authorities]
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/025-system-memory-rename/scratch/legacy-memory-quarantine/17-12-25_00-00__verification-complete.md:168:memory_search({ query: "system-memory rename", limit: 1 })
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/025-system-memory-rename/scratch/legacy-memory-quarantine/17-12-25_00-00__verification-complete.md:266:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/z_archive/025-system-memory-rename" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/025-system-memory-rename/scratch/legacy-memory-quarantine/17-12-25_00-00__verification-complete.md:271:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/006-default-on-boost-rollout/plan.md:86:memory_search(mode: "deep", sessionId: "xyz")
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/006-default-on-boost-rollout/plan.md:140:- [ ] Run `memory_search({ query: "semantic search", sessionId: "test-session-001" })` — confirm `sessionBoostApplied` not `"off"`
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/006-default-on-boost-rollout/plan.md:141:- [ ] Run `memory_search({ query: "semantic search" })` — confirm `causalBoostApplied` not `"off"`
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/006-default-on-boost-rollout/plan.md:142:- [ ] Run `memory_search({ query: "semantic search", mode: "deep" })` — confirm `deepExpansion: true`
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/006-default-on-boost-rollout/plan.md:158:| Manual | MCP `memory_search` tool calls with/without env vars | MCP client (opencode/Claude Code) |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/025-system-memory-rename/scratch/legacy-memory-quarantine/17-12-25_00-00__testing-continuation.md:183:   memory_search({ query: "system-memory rename", limit: 1 })
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/025-system-memory-rename/scratch/legacy-memory-quarantine/17-12-25_00-00__testing-continuation.md:251:| `memory_search` | ✅ | Vector, multi-concept, filters, decay all work |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/025-system-memory-rename/scratch/legacy-memory-quarantine/17-12-25_00-00__testing-continuation.md:340:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "specs/005-memory/013-system-memory-rename/" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/025-system-memory-rename/scratch/legacy-memory-quarantine/17-12-25_00-00__testing-continuation.md:345:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/025-system-memory-rename/scratch/legacy-memory-quarantine/17-12-24_00-00__rename-complete.md:272:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/z_archive/025-system-memory-rename" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/025-system-memory-rename/scratch/legacy-memory-quarantine/17-12-24_00-00__rename-complete.md:277:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/013-channel-routing-and-delegation-study/spec.md:108:4. **Given** the exit condition is checked, when evidence is still weak, then the packet remains an investigation instead of being promoted prematurely.
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/013-channel-routing-and-delegation-study/spec.md:134:- **NFR-S01**: The packet must not weaken current governance or validation boundaries.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-004-codex-A3.md:42:mcp: cocoindex_code starting
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-004-codex-A3.md:46:mcp: cocoindex_code ready
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-004-codex-A3.md:48:mcp startup: ready: code_mode, cocoindex_code, sequential_thinking; failed: spec_kit_memory
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-004-codex-A3.md:468:tool cocoindex_code.search({"query":"quality_score frontmatter extraction and use in memory indexing threshold comparison","limit":8})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-004-codex-A3.md:469:cocoindex_code.search({"query":"quality_score frontmatter extraction and use in memory indexing threshold comparison","limit":8}) success in 374ms:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-004-codex-A3.md:490:tool cocoindex_code.search({"query":"QUALITY_ABORT_THRESHOLD qualityScore01 comparison and indexing decision in workflow","limit":8})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-004-codex-A3.md:491:cocoindex_code.search({"query":"QUALITY_ABORT_THRESHOLD qualityScore01 comparison and indexing decision in workflow","limit":8}) success in 206ms:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-004-codex-A3.md:512:tool cocoindex_code.search({"query":"quality score threshold comparison workflow indexing uses score01","paths":[".opencode/skills/system-spec-kit/scripts/**"],"limit":8})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-004-codex-A3.md:513:cocoindex_code.search({"query":"quality score threshold comparison workflow indexing uses score01","paths":[".opencode/skills/system-spec-kit/scripts/**"],"limit":8}) success in 688ms:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-004-codex-A3.md:530:tool cocoindex_code.search({"query":"in workflow.ts shouldIndexMemory compares qualityScore01 with qualityAbortThreshold and indexMemory extraction quality_score","languages":"typescript","limit":12})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-004-codex-A3.md:531:cocoindex_code.search({"query":"in workflow.ts shouldIndexMemory compares qualityScore01 with qualityAbortThreshold and indexMemory extraction quality_score","languages":"typescript","limit":12}) failed in 1ms:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-004-codex-A3.md:542:I hit a CocoIndex argument mismatch on the language filter, so I’m rerunning that semantic search with the expected list format to avoid missing any TypeScript-only consumer paths.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-004-codex-A3.md:543:tool cocoindex_code.search({"query":"workflow qualityScore01 qualityAbortThreshold shouldIndexMemory indexMemory quality_score frontmatter extractor","languages":["typescript"],"limit":12})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-004-codex-A3.md:544:cocoindex_code.search({"query":"workflow qualityScore01 qualityAbortThreshold shouldIndexMemory indexMemory quality_score frontmatter extractor","languages":["typescript"],"limit":12}) success in 295ms:
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/025-system-memory-rename/tasks.md:234:  - [x] `memory_search` tool accessible
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/research-reconciliation-spec.md:98:234. | Risk | Broader path equivalence could weaken contamination safety if over-broad | High | Matching still requires one shared `.opencode` anchor and file hints remain workspace-scoped |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/research-reconciliation-spec.md:133:- **`key_files` pipeline weakness**: R-13 found that tree-thinning can over-merge short-description inputs and leave `key_files` empty even when relevant spec files exist. This remains deferred future work rather than an in-scope change for this spec.
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/013-channel-routing-and-delegation-study/checklist.md:66:- [ ] CHK-030 [P0] No recommendation weakens current governance or validation controls
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-03-phases-005-008.md:57:- Checklist structure is the weakest area. Folders **005**, **006**, and **008** do not provide dedicated `P0` / `P1` / `P2` sections at all. Folder **007** is closer, but still incomplete because it lacks any `P2` section.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/019-architecture-remediation/scratch/wave1-codex-A1.md:10:FINDING-CODEX-A1-004 | MEDIUM | EDGE_CASE | .opencode/skills/system-spec-kit/scripts/core/workflow.ts:418 | The stateless alignment safety check silently degrades to keyword-only matching whenever spec-folder extraction fails, which weakens the contamination barrier without surfacing that the stronger path is gone. | `resolveAlignmentTargets()` wraps `extractSpecFolderContext(...)` in `try { ... } catch (_error) { // Fall back to keyword-only alignment when spec docs are unavailable. }`; the earlier stateless gate then uses those reduced targets to decide whether to abort. | Log degraded alignment mode at minimum, and fail closed for stateless saves when explicit spec context cannot be loaded.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/019-architecture-remediation/scratch/codex-1-core-pipeline.md:63:Description: `workflow.ts` relies on broad type assertions at pipeline boundaries instead of a normalized intermediate DTO, which weakens contract safety between stages.  
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/012-runtime-manifest-and-hook-extensibility/spec.md:109:4. **Given** the exit condition is checked, when evidence is still weak, then the packet remains an investigation instead of being promoted prematurely.
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/012-runtime-manifest-and-hook-extensibility/spec.md:135:- **NFR-S01**: The packet must not weaken current governance or validation boundaries.
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/012-runtime-manifest-and-hook-extensibility/checklist.md:66:- [ ] CHK-030 [P0] No recommendation weakens current governance or validation controls
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-004-codex-A2.md:41:mcp: cocoindex_code starting
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-004-codex-A2.md:47:mcp: cocoindex_code ready
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-004-codex-A2.md:49:mcp startup: ready: code_mode, cocoindex_code, sequential_thinking; failed: spec_kit_memory
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-004-codex-A2.md:122:tool cocoindex_code.search({"query":"Where is outsourced agent handback JSON loaded and validated in system-spec-kit scripts? include loader and normalizer functions","limit":8,"refresh_index":false})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-004-codex-A2.md:123:cocoindex_code.search({"query":"Where is outsourced agent handback JSON loaded and validated in system-spec-kit scripts? include loader and normalizer functions","limit":8,"refresh_index":false}) success in 6.11s:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-004-codex-A2.md:144:tool cocoindex_code.search({"query":"tests for runtime memory inputs handback next_steps snake_case and rejection codes","limit":8,"refresh_index":false})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-004-codex-A2.md:145:cocoindex_code.search({"query":"tests for runtime memory inputs handback next_steps snake_case and rejection codes","limit":8,"refresh_index":false}) success in 66ms:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-004-codex-A2.md:150:      "text": "{\n  \"success\": true,\n  \"results\": [\n    {\n      \"file_path\": \"specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/078-speckit-test-suite/tasks.md\",\n      \"language\": \"markdown\",\n      \"content\": \"## L2: PHASE COMPLETION GATES\\n\\n### Gate 1: MCP Handlers Complete\\n- [ ] T001 test-session-learning.js implemented and passing\\n- [ ] T002 test-memory-handlers.js implemented and passing\\n- [ ] Handler tests cover all MCP tool entry points\\n\\n### Gate 2: Integration Complete\\n- [ ] T003 test-cognitive-integration.js implemented and passing\\n- [ ] End-to-end workflows validated\\n- [ ] Cognitive memory patterns verified\\n\\n### Gate 3: Scripts Complete\\n- [ ] T004 test-validation-system.js implemented and passing\\n- [ ] T005 test-extractors-loaders.js implemented and passing\\n- [ ] All script modules have test coverage\\n\\n### Gate 4: Framework Complete\\n- [ ] T006 test-five-checks.js implemented and passing\\n- [ ] T007 test_dual_threshold.py implemented and passing (pytest)\\n- [ ] Framework algorithms validated\",\n      \"start_line\": 159,\n      \"end_line\": 179,\n      \"score\": 0.5482022871573502\n    },\n    {\n      \"file_path\": \"specs/03--commands-and-skills/023-sk-deep-research-creation/research.md\",\n      \"language\": \"markdown\",\n      \"content\": \"## 10. TESTING & DEBUGGING\\n\\n### Test Strategies\\n\\n**Unit Testing**:\\n- Convergence detection function with various state inputs\\n- JSONL parsing and validation\\n- Strategy file update logic\\n\\n**Integration Testing**:\\n- Single iteration: dispatch @deep-research, verify state files updated correctly\\n- Multi-iteration: run 3 iterations, verify convergence detection triggers appropriately\\n- Stuck recovery: simulate 3 no-progress iterations, verify recovery behavior\\n\\n**End-to-End Testing**:\\n- Full loop on a simple research topic (e.g., \\\"What is markdown?\\\")\\n- Verify: state files created, research/research.md produced, memory saved\\n- Target: 3-5 iterations, completes in < 5 minutes\",\n      \"start_line\": 661,\n      \"end_line\": 678,\n      \"score\": 0.5424390518734707\n    },\n    {\n      \"file_path\": \"specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/015-outsourced-agent-handback/memory/16-03-26_22-23__updated-the-outsourced-agent-handback-docs-so.md\",\n      \"language\": \"markdown\",\n      \"content\": \"## 2. OVERVIEW\\n\\nUpdated the outsourced-agent handback docs so every CLI surface explains the post-010 save gates, richer FILE metadata, and the documented snake_case payload contract.\\n\\n**Key Outcomes**:\\n- Updated the outsourced-agent handback docs so every CLI surface explains the post-010 save gates,...\\n- Document the post-010 rejection codes directly in the caller-facing handback doc\\n- Use a dedicated vitest lane to keep the 8 CLI handback docs and the feature cata\\n\\n**Key Files:**\",\n      \"start_line\": 217,\n      \"end_line\": 226,\n      \"score\": 0.5399172286281271\n    },\n    {\n      \"file_path\": \"specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/016-tooling-and-scripts/plan.md\",\n      \"language\": \"markdown\",\n      \"content\": \"## 2. QUALITY GATES\\n\\n### Definition of Ready\\n- [ ] All 21 test IDs are resolved to a source prompt, command path, and evidence expectation.\\n- [ ] The playbook, review protocol, and feature catalog links are available from this phase folder.\\n- [ ] Sandbox targets exist for destructive checks (`bulk-delete`, malformed memories, generated phase folders, watcher temp files).\\n- [ ] MCP/runtime prerequisites are known for tests that require slash commands or `memory_save`.\\n- [ ] The `NEW-139` session-capturing scenario is sourced from the canonical `M-007` section, not reconstructed from memory.\",\n      \"start_line\": 39,\n      \"end_line\": 46,\n      \"score\": 0.5303982779993373\n    },\n    {\n      \"file_path\": \"specs/system-spec-kit/022-hybrid-rag-fusion/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts\",\n      \"language\": \"typescript\",\n      \"content\": \"// ───────────────────────────────────────────────────────────────────\\n// MODULE: Runtime Memory Input Tests\\n// ───────────────────────────────────────────────────────────────────\\n// TEST: Runtime Memory Inputs\\n// Covers explicit data-file failures and next-steps normalization\\nimport fs from 'node:fs/promises';\\nimport os from 'node:os';\\nimport path from 'node:path';\\nimport { beforeEach, describe, expect, it, vi } from 'vitest';\\n\\nimport { normalizeQualityAbortThreshold } from '../core/config';\\nimport { collectSessionData } from '../extractors/collect-session-data';\\nimport { normalizeInputData, transformOpencodeCapture } from '../utils/input-normalizer';\",\n      \"start_line\": 1,\n      \"end_line\": 13,\n      \"score\": 0.5291721811918801\n    },\n    {\n      \"file_path\": \"specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/078-speckit-test-suite/spec.md\",\n      \"language\": \"markdown\",\n      \"content\": \"Without comprehensive coverage, regressions in the memory system, cognitive processing, and validation logic could go undetected.\\n\\n### Purpose\\nAchieve comprehensive test coverage by creating 8 new test files (~3,000 LOC) that validate all system-spec-kit functionality including MCP handlers, cognitive systems, validation logic, and script modules.\\n\\n---\",\n      \"start_line\": 48,\n      \"end_line\": 53,\n      \"score\": 0.527110082421693\n    },\n    {\n      \"file_path\": \"specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/001-retrieval/plan.md\",\n      \"language\": \"markdown\",\n      \"content\": \"## 4. IMPLEMENTATION PHASES\\n\\n### Phase 1: Preconditions\\n- [ ] Verify source documents are open: playbook, review protocol, and linked retrieval feature files.\\n- [ ] Confirm MCP runtime access for `memory_context`, `memory_search`, and `memory_match_triggers`.\\n- [ ] Record baseline environment flags before any fallback or rollout-state testing.\\n- [ ] Prepare disposable sandbox data for trigger edits and a graph-connected sandbox corpus for rollout diagnostics.\\n\\n### Phase 2: Non-Destructive Tests\\n- [ ] Run EX-001, EX-002, EX-003, EX-004, and EX-005 in order to cover orchestration, search, trigger, hybrid, and pipeline-baseline retrieval behavior.\\n- [ ] Run NEW-109 after baseline retrieval tests to inspect tiered degradation behavior and fallback-disabled comparison without mutating corpus content.\\n- [ ] Run NEW-142 to compare trace-enabled versus non-trace `memory_context` responses and confirm no session-transition leakage.\",\n      \"start_line\": 74,\n      \"end_line\": 85,\n      \"score\": 0.5220918021628265\n    },\n    {\n      \"file_path\": \"specs/system-spec-kit/022-hybrid-rag-fusion/system-spec-kit/mcp_server/tests/context-server.vitest.ts\",\n      \"language\": \"typescript\",\n      \"content\": \"  describe('Group 7: Hooks Integration', () => {\\n    // T29: Source imports MEMORY_AWARE_TOOLS\\n    it('T29: Imports MEMORY_AWARE_TOOLS from hooks', () => {\\n      expect(sourceCode).toMatch(/import\\\\s*\\\\{[^}]*MEMORY_AWARE_TOOLS[^}]*\\\\}\\\\s*from\\\\s*'\\\\.\\\\/hooks'/)\\n    })\\n\\n    // T30: Source checks MEMORY_AWARE_TOOLS.has(name)\\n    it('T30: Checks MEMORY_AWARE_TOOLS.has(name)', () => {\\n      expect(sourceCode).toMatch(/MEMORY_AWARE_TOOLS\\\\.has\\\\(name\\\\)/)\\n    })\\n\\n    // T31: Hooks module direct tests\\n    it('T31: MEMORY_AWARE_TOOLS is a Set', async () => {\\n      const hooksModule = await importFirst<HooksModule>([\\n        async () => await import('../hooks/index'),\\n        async () => await import('../hooks'),\\n        async () => await import('../hooks/memory-surface'),\\n      ])\\n      expect(hooksModule?.MEMORY_AWARE_TOOLS).toBeInstanceOf(Set)\\n    })\\n\\n    const expectedAwareTools = ['memory_context', 'memory_search', 'memory_match_triggers', 'memory_list', 'memory_save', 'memory_index_scan']\",\n      \"start_line\": 1327,\n      \"end_line\": 1348,\n      \"score\": 0.5144645602039191\n    }\n  ],\n  \"total_returned\": 8,\n  \"offset\": 0,\n  \"message\": null\n}"
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-004-codex-A2.md:1270:3. `FILES` only enforces `FILE_PATH/path` presence; weak descriptions pass input validation and are filtered only by sufficiency semantics ([input-normalizer.ts](/Users/michelkerkmeester/MEGA/Development%20Opencode%20Env/Public/.opencode/skills/system-spec-kit/scripts/utils/input-normalizer.ts#L609), [memory-sufficiency.ts](/Users/michelkerkmeester/MEGA/Development%20Opencode%20Env/Public/.opencode/skills/system-spec-kit/shared/parsing/memory-sufficiency.ts#L181)).
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-004-codex-A2.md:1309:3. `FILES` only enforces `FILE_PATH/path` presence; weak descriptions pass input validation and are filtered only by sufficiency semantics ([input-normalizer.ts](/Users/michelkerkmeester/MEGA/Development%20Opencode%20Env/Public/.opencode/skills/system-spec-kit/scripts/utils/input-normalizer.ts#L609), [memory-sufficiency.ts](/Users/michelkerkmeester/MEGA/Development%20Opencode%20Env/Public/.opencode/skills/system-spec-kit/shared/parsing/memory-sufficiency.ts#L181)).
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/029-comprehensive-bug-fix/scratch/legacy-memory-quarantine/24-12-25_12-07__comprehensive-bug-fix-029.md:1002:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "005-memory/017-comprehensive-bug-fix" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/029-comprehensive-bug-fix/scratch/legacy-memory-quarantine/24-12-25_12-07__comprehensive-bug-fix-029.md:1007:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/015-system-analysis/spec.md:3:description: "To deconstruct and analyze the SpecKit system's architecture, identifying strengths, weaknesses, and structural risks (specifically the synchronization between Skills and Comman..."
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/015-system-analysis/spec.md:42:To deconstruct and analyze the SpecKit system's architecture, identifying strengths, weaknesses, and structural risks (specifically the synchronization between Skills and Commands).
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/002-extraction-rollout-phases-2-3/scratch/legacy-memory-quarantine/19-02-26_08-52__extraction-rollout-phases-2-3.md:371:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "../.opencode/specs/system-spec-kit/020-mcp-working-memory-hybrid-rag/002-extraction-rollout-phases-2-3" })` |
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/002-extraction-rollout-phases-2-3/scratch/legacy-memory-quarantine/19-02-26_08-52__extraction-rollout-phases-2-3.md:383:memory_search({ specFolder: "../.opencode/specs/system-spec-kit/020-mcp-working-memory-hybrid-rag/002-extraction-rollout-phases-2-3", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/002-extraction-rollout-phases-2-3/scratch/legacy-memory-quarantine/19-02-26_08-52__extraction-rollout-phases-2-3.md:389:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/002-extraction-rollout-phases-2-3/scratch/legacy-memory-quarantine/19-02-26_08-52__extraction-rollout-phases-2-3.md:398:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/010-tracer-seam-prototype/spec.md:107:4. **Given** the exit condition is checked, when evidence is still weak, then the packet remains an investigation instead of being promoted prematurely.
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/010-tracer-seam-prototype/spec.md:133:- **NFR-S01**: The packet must not weaken current governance or validation boundaries.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-003-codex-A1.md:59:mcp: cocoindex_code starting
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-003-codex-A1.md:65:mcp: cocoindex_code ready
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-003-codex-A1.md:67:mcp startup: ready: code_mode, cocoindex_code, sequential_thinking; failed: spec_kit_memory
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-003-codex-A1.md:178:tool cocoindex_code.search({"query":"timestamp validation parse date fallback now calculate duration negative minutes session extractor","limit":8})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-003-codex-A1.md:179:cocoindex_code.search({"query":"timestamp validation parse date fallback now calculate duration negative minutes session extractor","limit":8}) success in 6.91s:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-003-codex-A1.md:200:tool cocoindex_code.search({"query":"extractKeyTopics duplicate detectContextType detectProjectPhase extractBlockers detectRelatedDocs","limit":10})
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-003-codex-A1.md:201:cocoindex_code.search({"query":"extractKeyTopics duplicate detectContextType detectProjectPhase extractBlockers detectRelatedDocs","limit":10}) success in 166ms:
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-003-codex-A1.md:325:.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/research/research-pipeline-improvements.md:458:R-13 revealed that the spec folder auto-detection cascade — the very first step that determines WHERE memory is saved — has structural weaknesses that compound with R-11's transcript selection failures. Depth-bias in ranking (children outrank parents), absence of git-status signals, and 445+ candidates competing on stale mtime create a system that fails precisely when it matters most: new spec folders with many children, first-time saves, and bulk file creation workflows. The cascade was designed for simple cases (few spec folders, clear mtime winner) but breaks in production-scale repos. Combined with R-03's dual-write decision bug and tree-thinning's over-aggressive merging of description-length "content," R-13 demonstrates that R-01–R-12 issues are not isolated — they combine multiplicatively. Two consecutive bad saves for the same folder produced files where 83% of all known R-series issues manifest simultaneously. R-13f verification additionally revealed a blocker extraction bug where truncated observation text containing markdown section headers is parsed as a blocker string — the `Blockers: PROBLEM' to '## 2.` artifact in the 15:31 file is a content validation gap in `extractBlockers()` that is independent of transcript selection.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-003-codex-A1.md:346:| #1 | Session ID used `Math.random()` -- weak randomness, predictable IDs | session-extractor.ts | DONE |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/014-anchor-enforcement/scratch/legacy-memory-quarantine/16-12-25_00-00__anchor-id-validation-warning.md:292:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/z_archive/014-anchor-enforcement" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/014-anchor-enforcement/scratch/legacy-memory-quarantine/16-12-25_00-00__anchor-id-validation-warning.md:297:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/research-source-06-conan505-hybrid-rag.md:5:Hybrid-RAG is an early-stage Python/FastAPI RAG system that already implements document upload, async processing, semantic retrieval, reranking, and cost-aware LLM routing, but does not yet implement true hybrid retrieval (keyword + semantic fusion), despite naming and README claims. The codebase is practical and composable, with useful production-minded patterns (fallbacks, structured logging, service boundaries), while several TODOs and contract mismatches indicate MVP maturity rather than production readiness. [SOURCE: /tmp/conan505-hybrid-rag/README.md:22] [SOURCE: /tmp/conan505-hybrid-rag/app/api/routes/search.py:51] [SOURCE: /tmp/conan505-hybrid-rag/app/services/rag.py:97]
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/083-speckit-reimagined-bug-fixes/plan.md:248:2. Semantic memory search via `memory_search()`
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/083-speckit-reimagined-bug-fixes/plan.md:372:- spec_kit_memory_memory_search({
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/083-speckit-reimagined-bug-fixes/plan.md:390:- │ DETECTION       │ memory_search(query: "session")     │
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/083-speckit-reimagined-bug-fixes/plan.md:391:+ │ DETECTION       │ spec_kit_memory_memory_search(...)  │
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/010-tracer-seam-prototype/checklist.md:66:- [ ] CHK-030 [P0] No recommendation weakens current governance or validation controls
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/tasks.md:44:- [x] T001 Validate CocoIndex path/runtime drift symptoms.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/tasks.md:54:- [x] T004 Rebuild CocoIndex environment/settings for current repository path.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/014-anchor-enforcement/scratch/legacy-memory-quarantine/16-12-25_20-48__anchor-enforcement.md:382:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "005-memory/008-anchor-enforcement" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/014-anchor-enforcement/scratch/legacy-memory-quarantine/16-12-25_20-48__anchor-enforcement.md:387:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-13-frontmatter.md:488:- **Trigger phrase consistency:** duplication exists across standard docs, especially `template compliance` (8 files), `perfect session capturing` (5 files), `memory uniqueness` (3 files), and `per-folder description` (3 files). Several later files also use only 1-2 trigger phrases, which is syntactically fine but weak for retrieval quality.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/015-system-analysis/graph-metadata.json:198:    "causal_summary": "To deconstruct and analyze the SpecKit system's architecture, identifying strengths, weaknesses, and structural risks (specifically the synchronization between Skills and Commands).",
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/014-anchor-enforcement/scratch/legacy-memory-quarantine/16-12-25_20-27__anchor-enforcement.md:257:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "005-memory/008-anchor-enforcement" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/014-anchor-enforcement/scratch/legacy-memory-quarantine/16-12-25_20-27__anchor-enforcement.md:262:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/c136-05-staged-rollout-evidence.md:98:- **Foreground operations**: deterministic, synchronous response — all MCP tool handlers (memory_context, memory_search, memory_save) execute synchronously and return structured results
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/014-anchor-enforcement/scratch/legacy-memory-quarantine/16-12-25_00-00__anchor-enforcement-complete.md:284:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/z_archive/014-anchor-enforcement" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/014-anchor-enforcement/scratch/legacy-memory-quarantine/16-12-25_00-00__anchor-enforcement-complete.md:289:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/083-speckit-reimagined-bug-fixes/scratch/legacy-memory-quarantine/03-02-26_17-28__speckit-reimagined-bug-fixes.md:454:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/083-speckit-reimagined-bug-fixes" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/083-speckit-reimagined-bug-fixes/scratch/legacy-memory-quarantine/03-02-26_17-28__speckit-reimagined-bug-fixes.md:466:memory_search({ specFolder: "003-memory-and-spec-kit/083-speckit-reimagined-bug-fixes", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/083-speckit-reimagined-bug-fixes/scratch/legacy-memory-quarantine/03-02-26_17-28__speckit-reimagined-bug-fixes.md:472:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/083-speckit-reimagined-bug-fixes/scratch/legacy-memory-quarantine/03-02-26_17-28__speckit-reimagined-bug-fixes.md:481:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/003-loop-observability/spec.md:85:| REQ-001 | Keep the current Public authorities authoritative | The packet does not recommend replacing `/spec_kit:*`, the current agent stack, Spec Kit Memory, CocoIndex, or code-graph |
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/003-loop-observability/spec.md:136:- **NFR-S01**: The packet must not weaken current governance or validation boundaries.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/083-speckit-reimagined-bug-fixes/scratch/legacy-memory-quarantine/03-02-26_19-50__speckit-reimagined-bug-fixes.md:273:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/083-speckit-reimagined-bug-fixes" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/083-speckit-reimagined-bug-fixes/scratch/legacy-memory-quarantine/03-02-26_19-50__speckit-reimagined-bug-fixes.md:285:memory_search({ specFolder: "003-memory-and-spec-kit/083-speckit-reimagined-bug-fixes", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/083-speckit-reimagined-bug-fixes/scratch/legacy-memory-quarantine/03-02-26_19-50__speckit-reimagined-bug-fixes.md:291:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/083-speckit-reimagined-bug-fixes/scratch/legacy-memory-quarantine/03-02-26_19-50__speckit-reimagined-bug-fixes.md:300:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/083-speckit-reimagined-bug-fixes/scratch/legacy-memory-quarantine/03-02-26_17-56__audit-fixes.md:285:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/085-audit-fixes" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/083-speckit-reimagined-bug-fixes/scratch/legacy-memory-quarantine/03-02-26_17-56__audit-fixes.md:297:memory_search({ specFolder: "003-memory-and-spec-kit/085-audit-fixes", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/083-speckit-reimagined-bug-fixes/scratch/legacy-memory-quarantine/03-02-26_17-56__audit-fixes.md:303:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/083-speckit-reimagined-bug-fixes/scratch/legacy-memory-quarantine/03-02-26_17-56__audit-fixes.md:312:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/003-loop-observability/checklist.md:66:- [ ] CHK-030 [P0] No recommendation weakens current governance or validation controls
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/039-node-modules-consolidation/scratch/legacy-memory-quarantine/25-12-25_18-55__node-modules-consolidation.md:1291:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/039-node-modules-consolidation" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/039-node-modules-consolidation/scratch/legacy-memory-quarantine/25-12-25_18-55__node-modules-consolidation.md:1296:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/083-speckit-reimagined-bug-fixes/analysis-report.md:82:2. **Lines 283-289**: Uses `memory_search` with `sortBy` parameter (should be `memory_list`)
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/graphrag-hybrid/src/index.md:3:This directory contains the core source code for the GraphRAG hybrid retrieval system.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/083-speckit-reimagined-bug-fixes/tasks.md:256:- **Change:** `memory_search` → `memory_list`
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/research-source-05-memori.md:5:Memori is a Python memory layer that intercepts LLM calls, persists conversation history with entity/process/session attribution, and injects recalled facts back into future prompts. It supports local datastore mode (SQLite/Postgres/MySQL/Oracle/OceanBase/MongoDB) and cloud mode (Memori API), with asynchronous advanced augmentation that extracts facts, process attributes, and semantic triples for hybrid retrieval. [SOURCE: https://raw.githubusercontent.com/MemoriLabs/Memori/main/README.md] [SOURCE: https://raw.githubusercontent.com/MemoriLabs/Memori/main/memori/__init__.py] [SOURCE: https://raw.githubusercontent.com/MemoriLabs/Memori/main/memori/llm/_base.py]
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/001-architecture-boundary-freeze/spec.md:87:| REQ-001 | Keep the current Public authorities authoritative | The packet does not recommend replacing `/spec_kit:*`, the current agent stack, Spec Kit Memory, CocoIndex, or code-graph |
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/001-architecture-boundary-freeze/spec.md:138:- **NFR-S01**: The packet must not weaken current governance or validation boundaries.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/083-speckit-reimagined-bug-fixes/CHANGELOG.md:83:- **Fixed:** `memory_search` → `memory_list` for sortBy parameter in continue.md
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/009-speckit-testing/scratch/legacy-memory-quarantine/17-12-25_00-00__speckit-testing-complete.md:280:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/z_archive/009-speckit-testing" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/009-speckit-testing/scratch/legacy-memory-quarantine/17-12-25_00-00__speckit-testing-complete.md:285:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/003-memory-quality-qp-0-4/scratch/legacy-memory-quarantine/19-02-26_08-52__memory-quality-qp-0-4.md:370:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "../.opencode/specs/system-spec-kit/020-mcp-working-memory-hybrid-rag/003-memory-quality-qp-0-4" })` |
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/003-memory-quality-qp-0-4/scratch/legacy-memory-quarantine/19-02-26_08-52__memory-quality-qp-0-4.md:382:memory_search({ specFolder: "../.opencode/specs/system-spec-kit/020-mcp-working-memory-hybrid-rag/003-memory-quality-qp-0-4", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/003-memory-quality-qp-0-4/scratch/legacy-memory-quarantine/19-02-26_08-52__memory-quality-qp-0-4.md:388:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/003-memory-quality-qp-0-4/scratch/legacy-memory-quarantine/19-02-26_08-52__memory-quality-qp-0-4.md:397:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/001-architecture-boundary-freeze/checklist.md:66:- [ ] CHK-030 [P0] No recommendation weakens current governance or validation controls
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/068-constitutional-readme-fix/scratch/legacy-memory-quarantine/16-01-26_09-05__constitutional-readme-fix.md:252:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/068-constitutional-readme-fix" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/068-constitutional-readme-fix/scratch/legacy-memory-quarantine/16-01-26_09-05__constitutional-readme-fix.md:257:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/research-source-04-memos.md:118:- Optimized scheduler (hybrid retrieval/history): <https://github.com/MemTensor/MemOS/blob/main/src/memos/mem_scheduler/optimized_scheduler.py>
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/021-memory-choice-enforcement/scratch/legacy-memory-quarantine/17-12-25_08-08__memory-choice-enforcement.md:412:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "005-memory/011-memory-choice-enforcement" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/021-memory-choice-enforcement/scratch/legacy-memory-quarantine/17-12-25_08-08__memory-choice-enforcement.md:417:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/009-quality-gate-pipeline/spec.md:85:| REQ-001 | Keep the current Public authorities authoritative | The packet does not recommend replacing `/spec_kit:*`, the current agent stack, Spec Kit Memory, CocoIndex, or code-graph |
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/009-quality-gate-pipeline/spec.md:136:- **NFR-S01**: The packet must not weaken current governance or validation boundaries.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/041-post-merge-refinement-4/spec.md:108:As an AI agent, I need memory_search to reject invalid queries gracefully so that I receive actionable error messages instead of silent failures or crashes.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/041-post-merge-refinement-4/spec.md:112:**Independent Test**: Call memory_search with empty string, whitespace-only, and null query. Each should return a clear error message.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/041-post-merge-refinement-4/spec.md:115:1. **Given** memory_search receives empty query "", **When** executed, **Then** returns error "Query cannot be empty"
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/041-post-merge-refinement-4/spec.md:116:2. **Given** memory_search receives whitespace query "   ", **When** executed, **Then** returns error "Query cannot be empty or whitespace-only"
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/041-post-merge-refinement-4/spec.md:201:- **REQ-FUNC-004:** memory_search MUST validate query parameter is non-empty and non-whitespace
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/041-post-merge-refinement-4/spec.md:202:- **REQ-FUNC-005:** memory_search MUST return actionable error message for invalid queries
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/041-post-merge-refinement-4/spec.md:222:- **REQ-FUNC-016:** Tool naming MUST be consistent (memory_search vs memorySearch)
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/041-post-merge-refinement-4/spec.md:344:| R-004 | Missing edge cases in query validation | Low | Medium | Comprehensive test suite for memory_search | Dev Team |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/019-architecture-remediation/scratch/wave1-codex-A3.md:20:FINDING-CODEX-A3-014 | LOW | TYPE_SAFETY | [`tests/runtime-memory-inputs.vitest.ts`](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts):622 | tests use `as any` and `as unknown as` to bypass contracts, which weakens the suite’s ability to catch real type regressions | evidence: [`tests/memory-indexer-weighting.vitest.ts`](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/scripts/tests/memory-indexer-weighting.vitest.ts):139, [`tests/tool-sanitizer.vitest.ts`](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/scripts/tests/tool-sanitizer.vitest.ts):156-157, [`tests/runtime-memory-inputs.vitest.ts`](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts):622 and 667, [`tests/utils-regressions.vitest.ts`](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/scripts/tests/utils-regressions.vitest.ts):22 | recommended fix: replace casted fixtures with typed builders or `Partial<>` helpers that validate at runtime before narrowing
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/009-quality-gate-pipeline/checklist.md:66:- [ ] CHK-030 [P0] No recommendation weakens current governance or validation controls
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/041-post-merge-refinement-4/plan.md:279:| VAL-001 | Test all MCP tools (memory_search, memory_save, etc.) | 1h     | [P]      |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/008-create-sh-phase-parent/plan.md:41:This phase defines how `create.sh` should support appending child phases to nested parent folders under `.opencode/specs/`. The real script facts that drive the plan are: `--phase-parent` does not exist today, `--parent` is the current phase append flag, `resolve_and_validate_spec_path()` validates only the basename against `^[0-9]{3}-[A-Za-z0-9._-]+$`, nested parent paths fail current expectations, and `SPECS_DIR` always points at `$REPO_ROOT/specs`. The planned fix is to accept `--phase-parent`, relax nested-path handling without weakening safety, and derive append output from the validated parent tree.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/008-create-sh-phase-parent/plan.md:158:- **Trigger**: The planned fix appears to break flat behavior or weakens path safety during implementation.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/046-post-release-refinement-1/plan.md:88:- [ ] Run memory_search, verify no duplicates
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/041-post-merge-refinement-4/checklist.md:72:  - Evidence: `memory_search({ query: "" })` returns error
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-004-codex-A1.md:42:mcp: cocoindex_code starting
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-004-codex-A1.md:48:mcp: cocoindex_code ready
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/scratch/agent-output-iter-004-codex-A1.md:50:mcp startup: ready: code_mode, cocoindex_code, sequential_thinking; failed: spec_kit_memory
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/046-post-release-refinement-1/checklist.md:75:- [x] **P0** `memory_search` returns unique results
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/087-speckit-deep-analysis/implementation-summary.md:77:| L1    | `memory_search`, `memory_save`               | Core operations    |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/087-speckit-deep-analysis/implementation-summary.md:85:| L2    | `memory_search`, `memory_match_triggers`, `memory_save`                      | Core operations          |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/087-speckit-deep-analysis/implementation-summary.md:141:  are prefixed `spec_kit_memory_` (e.g., `spec_kit_memory_memory_search()`). Short names like
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/087-speckit-deep-analysis/implementation-summary.md:142:  `memory_search()` used in this document are for readability.
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/001-foundation-phases-0-1-1-5/scratch/legacy-memory-quarantine/19-02-26_08-52__foundation-phases-0-1-1-5.md:371:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "../.opencode/specs/system-spec-kit/020-mcp-working-memory-hybrid-rag/001-foundation-phases-0-1-1-5" })` |
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/001-foundation-phases-0-1-1-5/scratch/legacy-memory-quarantine/19-02-26_08-52__foundation-phases-0-1-1-5.md:383:memory_search({ specFolder: "../.opencode/specs/system-spec-kit/020-mcp-working-memory-hybrid-rag/001-foundation-phases-0-1-1-5", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/001-foundation-phases-0-1-1-5/scratch/legacy-memory-quarantine/19-02-26_08-52__foundation-phases-0-1-1-5.md:389:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/001-foundation-phases-0-1-1-5/scratch/legacy-memory-quarantine/19-02-26_08-52__foundation-phases-0-1-1-5.md:398:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/007-lifecycle-entrypoint-simplification/spec.md:87:| REQ-001 | Keep the current Public authorities authoritative | The packet does not recommend replacing `/spec_kit:*`, the current agent stack, Spec Kit Memory, CocoIndex, or code-graph |
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/007-lifecycle-entrypoint-simplification/spec.md:138:- **NFR-S01**: The packet must not weaken current governance or validation boundaries.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/checklist.md:75:- [x] CHK-030 [P0] This pass does not weaken published safety language [Evidence: the docs remain conservative and do not alter runtime behavior claims.]
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/041-post-merge-refinement-4/analysis-report.md:82:4. **Tool Naming Inconsistency** - Documentation uses both `memory_search()` and `spec_kit_memory_memory_search()` - the latter is the actual MCP tool name
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/041-post-merge-refinement-4/analysis-report.md:100:12. **Constitutional Query Overhead** - Every `memory_search()` call includes constitutional memories at top, adding ~500 tokens even when not relevant
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/041-post-merge-refinement-4/analysis-report.md:214:   - `memory_search` - Semantic vector search
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/041-post-merge-refinement-4/analysis-report.md:383:   Database → memory_search() → Vector similarity results
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/041-post-merge-refinement-4/analysis-report.md:566:   - Correct tool: `memory_search` with `includeContent: true`
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/041-post-merge-refinement-4/analysis-report.md:600:4. **Tool naming inconsistency** - `memory_search()` vs `spec_kit_memory_memory_search()`
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/046-post-release-refinement-1/tasks.md:82:- [ ] `memory_search` returns unique results
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/implementation-summary.md.orig:63:Gated by the `SPECKIT_EXTENDED_TELEMETRY` flag (default: on). Telemetry is integrated into both `memory_search` and `memory_context` handlers.
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/implementation-summary.md.orig:104:| Bounded causal seed input (top-ranked only) | Reduces ranking noise. Causal expansion stays aligned with high-signal inputs instead of amplifying weak matches. |
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/007-lifecycle-entrypoint-simplification/checklist.md:66:- [ ] CHK-030 [P0] No recommendation weakens current governance or validation controls
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/041-post-merge-refinement-4/tasks.md:191:- **Description:** memory_search allows empty string queries which produce invalid embeddings
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/041-post-merge-refinement-4/tasks.md:196:- **Approach:** Add input validation at start of memory_search handler
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/041-post-merge-refinement-4/tasks.md:197:- **Verification:** Test `memory_search({ query: "" })` and `memory_search({ query: "   " })` return errors
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/041-post-merge-refinement-4/tasks.md:397:  - [ ] Replaced with `memory_search({ includeContent: true })`
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/041-post-merge-refinement-4/tasks.md:862:  - [ ] memory_search
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/graphrag-hybrid/your_docs_here/index.md:3:This directory is where you add your markdown documents to be processed and imported into the GraphRAG hybrid retrieval system. Any `.md` files placed here will be processed, embedded, and stored in both Neo4j and Qdrant databases.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/implementation-summary.md:46:CocoIndex environment/settings were corrected for the active workspace path, code-graph DB access gained safer lazy initialization behavior, and search formatter output now preserves lexical provenance fields through fused output pathways.
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/implementation-summary.md:52:| `.cocoindex_code/settings.yml` | Modified | Correct include/exclude targeting for live repo |
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/graph-metadata.json:26:      "cocoindex path drift",
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/graph-metadata.json:40:      "cocoindex",
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/graph-metadata.json:52:      ".cocoindex_code/settings.yml",
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/graph-metadata.json:63:        "path": ".cocoindex_code/settings.yml",
.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/011-indexing-and-adaptive-fusion/graph-metadata.json:205:    "causal_summary": "After repository path changes, indexing subsystems were inconsistent: CocoIndex environment paths were stale, code-graph initialization could fail lazily, and adaptive fusion defaults were not explicitly represented across MCP config surfaces. Lexical score visibility through fusion traces was also incomplete.",
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/graphrag-hybrid/your_docs_here/sample.md:91:Authentication weaknesses to avoid:
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/research/136 - analysis-working-memory-hybrid-rag-systems.md:24:**Target System Foundation**: Spec Kit Memory MCP already has hybrid retrieval (vector + FTS + BM25 + RRF), session-aware working memory table, and layered architecture (`.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:687-732`, `.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:287`).
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/research/136 - analysis-working-memory-hybrid-rag-systems.md:131:3. **Ranking Gap**: Working memory exists as table but doesn't influence `memory_search` scoring. Recent session items have same weight as 6-month-old docs. User sees stale results first, manually scrolls for recent work.
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/research/136 - analysis-working-memory-hybrid-rag-systems.md:391:- `opencode-working-memory`: Strong operational automation, weak type safety, config drift
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/research/136 - prioritized-implementation-backlog-post-research.md:7:The work is prioritized to unblock governance approvals, close release evidence gaps, and complete the remaining implementation hardening for hybrid retrieval behavior.
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/research/136 - prioritized-implementation-backlog-post-research.md:24:| P0 | C136-08 | Typed `ContextEnvelope` and `RetrievalTrace` contracts | Reduces integration ambiguity and enforces stable cross-module interfaces for hybrid retrieval behavior. | Existing handler and schema baseline | MCP server maintainers | Type definitions merged, compile-time checks pass, contract tests pass |
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/research/136 - recommendations-external-memory-rag-adoption-for-speckit.md:7:The recommended implementation plan is four phases: (1) context envelope and telemetry contracts, (2) adaptive hybrid retrieval policy, (3) mutation-aware memory write path with history guarantees, and (4) transport and deterministic-tool hardening. This sequence maximizes impact while controlling implementation risk.
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/research/research.md:23:- The sampled files show moderate-to-low operational usefulness: high template/boilerplate consistency, but weak extraction fidelity and low actionability.
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/research/research.md:155:### RC5: Quality gating is weak at write time
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/research/136 - recommendations-working-memory-hybrid-rag-adoption.md:9:The target system already has strong foundations: hybrid retrieval (`.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:215-462`), intent-aware weighting, RRF fusion, and causal edges. **The main gap**: session-time operational cognition.
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/011-event-journal-and-replay-study/spec.md:107:4. **Given** the exit condition is checked, when evidence is still weak, then the packet remains an investigation instead of being promoted prematurely.
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/011-event-journal-and-replay-study/spec.md:133:- **NFR-S01**: The packet must not weaken current governance or validation boundaries.
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/c136-01-tech-lead-approval-packet.md:53:- **Evaluation dataset**: 100 real queries bootstrapped from memory_search logs with baseline rankings; minimum 5 queries per intent type (`add_feature`, `fix_bug`, `refactor`, `understand`, `find_spec`)
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/research/136 - analysis-external-memory-rag-systems-for-speckit.md:54:This project demonstrates local-first hybrid retrieval with document-type-aware branching (CSV vs text-like), explicit ingestion telemetry, and both REST and MCP interfaces. The MCP server defines strict tool contracts and schema-like boundaries. It also includes deterministic structured-query tools rather than forcing all operations through free-form generative retrieval. The practical insight is that retrieval strategy should depend on artifact type and query intent, not one default retriever for all data classes. [Evidence: `research-source-07-gwyer-hybrid-rag-project.md:5`, `research-source-07-gwyer-hybrid-rag-project.md:12`, `research-source-07-gwyer-hybrid-rag-project.md:45`, `research-source-07-gwyer-hybrid-rag-project.md:60`]
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/graphrag-hybrid/AI_ENTRY.md:7:GraphRAG is a hybrid retrieval augmentation generation (RAG) system that leverages both Neo4j (graph database) and Qdrant (vector database) to provide enhanced document retrieval capabilities. The system processes Markdown documents with YAML frontmatter, establishing relationships between documents while enabling semantic search capabilities.
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/011-event-journal-and-replay-study/checklist.md:66:- [ ] CHK-030 [P0] No recommendation weakens current governance or validation controls
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/003-data-fidelity/implementation-summary.md:63:3. Treated `_manualDecisions` as the authoritative manual-decision source and `_manualDecision` as observation-level enrichment or fallback, which fixes the duplication bug without weakening the existing manual path.
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/legacy-memory-quarantine/20-02-26_08-04__mcp-working-memory-hybrid-rag.md:512:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "../.opencode/specs/system-spec-kit/020-mcp-working-memory-hybrid-rag" })` |
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/legacy-memory-quarantine/20-02-26_08-04__mcp-working-memory-hybrid-rag.md:524:memory_search({ specFolder: "../.opencode/specs/system-spec-kit/020-mcp-working-memory-hybrid-rag", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/legacy-memory-quarantine/20-02-26_08-04__mcp-working-memory-hybrid-rag.md:530:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/legacy-memory-quarantine/20-02-26_08-04__mcp-working-memory-hybrid-rag.md:539:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/research-source-03-cognee.md:56:2. Keep retrieval modular via a search-type registry/factory; this makes adding hybrid retrieval modes low-risk and isolated. [SOURCE: `cognee/modules/search/methods/get_search_type_retriever_instance.py:65`]
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/legacy-memory-quarantine/19-02-26_09-15__mcp-working-memory-hybrid-rag.md:371:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "system-spec-kit/020-mcp-working-memory-hybrid-rag" })` |
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/legacy-memory-quarantine/19-02-26_09-15__mcp-working-memory-hybrid-rag.md:383:memory_search({ specFolder: "system-spec-kit/020-mcp-working-memory-hybrid-rag", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/legacy-memory-quarantine/19-02-26_09-15__mcp-working-memory-hybrid-rag.md:389:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/legacy-memory-quarantine/19-02-26_09-15__mcp-working-memory-hybrid-rag.md:398:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/043-post-merge-refinement-final/scratch/legacy-memory-quarantine/26-12-25_08-12__post-merge-refinement-final.md:622:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/043-post-merge-refinement-final" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/043-post-merge-refinement-final/scratch/legacy-memory-quarantine/26-12-25_08-12__post-merge-refinement-final.md:627:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/008-continuity-and-memory-ux-integration/spec.md:88:| REQ-001 | Keep the current Public authorities authoritative | The packet does not recommend replacing `/spec_kit:*`, the current agent stack, Spec Kit Memory, CocoIndex, or code-graph |
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/008-continuity-and-memory-ux-integration/spec.md:139:- **NFR-S01**: The packet must not weaken current governance or validation boundaries.
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/legacy-memory-quarantine/19-02-26_15-19__mcp-working-memory-hybrid-rag.md:467:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "system-spec-kit/020-mcp-working-memory-hybrid-rag" })` |
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/legacy-memory-quarantine/19-02-26_15-19__mcp-working-memory-hybrid-rag.md:479:memory_search({ specFolder: "system-spec-kit/020-mcp-working-memory-hybrid-rag", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/legacy-memory-quarantine/19-02-26_15-19__mcp-working-memory-hybrid-rag.md:485:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/legacy-memory-quarantine/19-02-26_15-19__mcp-working-memory-hybrid-rag.md:494:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/008-continuity-and-memory-ux-integration/checklist.md:66:- [ ] CHK-030 [P0] No recommendation weakens current governance or validation controls
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/043-post-merge-refinement-final/tasks.md:194:  4. [ ] Replace `memory_search` with `spec_kit_memory_memory_search`
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/023-path-scoped-rules/001-mvp-monolithic/scratch/legacy-memory-quarantine/24-12-25_13-25__path-scoped-rules.md:354:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "004-speckit/012-path-scoped-rules" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/023-path-scoped-rules/001-mvp-monolithic/scratch/legacy-memory-quarantine/24-12-25_13-25__path-scoped-rules.md:359:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/legacy-memory-quarantine/18-02-26_17-38__mcp-working-memory-hybrid-rag.md:361:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "../.opencode/specs/system-spec-kit/020-mcp-working-memory-hybrid-rag" })` |
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/legacy-memory-quarantine/18-02-26_17-38__mcp-working-memory-hybrid-rag.md:373:memory_search({ specFolder: "../.opencode/specs/system-spec-kit/020-mcp-working-memory-hybrid-rag", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/legacy-memory-quarantine/18-02-26_17-38__mcp-working-memory-hybrid-rag.md:379:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/legacy-memory-quarantine/18-02-26_17-38__mcp-working-memory-hybrid-rag.md:388:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/023-path-scoped-rules/001-mvp-monolithic/scratch/legacy-memory-quarantine/24-12-25_12-33__path-scoped-rules.md:1292:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "004-speckit/012-path-scoped-rules" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/023-path-scoped-rules/001-mvp-monolithic/scratch/legacy-memory-quarantine/24-12-25_12-33__path-scoped-rules.md:1297:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/legacy-memory-quarantine/19-02-26_08-52__mcp-working-memory-hybrid-rag.md:371:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "system-spec-kit/020-mcp-working-memory-hybrid-rag" })` |
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/legacy-memory-quarantine/19-02-26_08-52__mcp-working-memory-hybrid-rag.md:383:memory_search({ specFolder: "system-spec-kit/020-mcp-working-memory-hybrid-rag", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/legacy-memory-quarantine/19-02-26_08-52__mcp-working-memory-hybrid-rag.md:389:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/legacy-memory-quarantine/19-02-26_08-52__mcp-working-memory-hybrid-rag.md:398:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/043-post-merge-refinement-final/implementation-summary.md:213:2. **Functional Testing** - Run memory_search, checkpoint_create/restore after restart
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/005-confidence-calibration/spec.md:67:The single `CONFIDENCE` field on `DecisionRecord` conflates two independent dimensions: certainty about the chosen option and certainty about the captured rationale. The current algorithm normalizes to 0-1 using a heuristic ladder (0.70 if alternatives present, 0.65 if rationale present, else 0.50). This blended value loses diagnostic power -- a decision with a strong choice but a weak rationale looks the same as one with a moderate choice and moderate rationale. Downstream consumers (`DecisionRecord`, `decision-tree-generator`, ascii-boxes renderer, `workflow.ts` percent conversion, the live context template, and `validate-memory-quality.ts`) all treat this single number as ground truth.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/005-confidence-calibration/spec.md:133:- **SC-001**: Decisions with strong choice but weak rationale show appropriately split confidence -- e.g., CHOICE_CONFIDENCE=0.85 / RATIONALE_CONFIDENCE=0.45 produces legacy CONFIDENCE=0.45
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/legacy-memory-quarantine/19-02-26_08-43__mcp-working-memory-hybrid-rag.md:371:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "system-spec-kit/020-mcp-working-memory-hybrid-rag" })` |
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/legacy-memory-quarantine/19-02-26_08-43__mcp-working-memory-hybrid-rag.md:383:memory_search({ specFolder: "system-spec-kit/020-mcp-working-memory-hybrid-rag", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/legacy-memory-quarantine/19-02-26_08-43__mcp-working-memory-hybrid-rag.md:389:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/legacy-memory-quarantine/19-02-26_08-43__mcp-working-memory-hybrid-rag.md:398:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/023-path-scoped-rules/001-mvp-monolithic/scratch/legacy-memory-quarantine/24-12-25_14-04__path-scoped-rules.md:289:### OBSERVATION: Tool: semantic_memory_memory_search
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/023-path-scoped-rules/001-mvp-monolithic/scratch/legacy-memory-quarantine/24-12-25_14-04__path-scoped-rules.md:291:Executed semantic_memory_memory_search
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/023-path-scoped-rules/001-mvp-monolithic/scratch/legacy-memory-quarantine/24-12-25_14-04__path-scoped-rules.md:293:**Details:** Tool: semantic_memory_memory_search | Status: completed
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/023-path-scoped-rules/001-mvp-monolithic/scratch/legacy-memory-quarantine/24-12-25_14-04__path-scoped-rules.md:623:**Tool: semantic_memory_memory_search**
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/023-path-scoped-rules/001-mvp-monolithic/scratch/legacy-memory-quarantine/24-12-25_14-04__path-scoped-rules.md:624:Tool: semantic_memory_memory_search
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/023-path-scoped-rules/001-mvp-monolithic/scratch/legacy-memory-quarantine/24-12-25_14-04__path-scoped-rules.md:666:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "004-speckit/012-path-scoped-rules" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/023-path-scoped-rules/001-mvp-monolithic/scratch/legacy-memory-quarantine/24-12-25_14-04__path-scoped-rules.md:671:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/005-confidence-calibration/checklist.md:74:- [x] CHK-024 [P1] SC-001 validated: strong choice / weak rationale shows split (e.g., CHOICE=0.85, RATIONALE=0.45, legacy=0.45) [Evidence: split-confidence cases now render and preserve legacy `CONFIDENCE = Math.min(choice, rationale)`.]
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/017-swarm-mailbox-artifacts-study/spec.md:108:4. **Given** the exit condition is checked, when evidence is still weak, then the packet remains an investigation instead of being promoted prematurely.
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/017-swarm-mailbox-artifacts-study/spec.md:134:- **NFR-S01**: The packet must not weaken current governance or validation boundaries.
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/t028-t055-dark-launch-checklist.md:52:[x] memory_search returns results without boost metadata in response
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/t028-t055-dark-launch-checklist.md:53:    Test: call memory_search({ query: "test" })
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/t028-t055-dark-launch-checklist.md:104:[x] memory_search returns results; no causal-boost metadata in response
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/legacy-memory-quarantine/18-02-26_17-25__mcp-working-memory-hybrid-rag.md:479:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "../.opencode/specs/system-spec-kit/020-mcp-working-memory-hybrid-rag" })` |
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/legacy-memory-quarantine/18-02-26_17-25__mcp-working-memory-hybrid-rag.md:491:memory_search({ specFolder: "../.opencode/specs/system-spec-kit/020-mcp-working-memory-hybrid-rag", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/legacy-memory-quarantine/18-02-26_17-25__mcp-working-memory-hybrid-rag.md:497:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/legacy-memory-quarantine/18-02-26_17-25__mcp-working-memory-hybrid-rag.md:506:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/017-swarm-mailbox-artifacts-study/checklist.md:66:- [ ] CHK-030 [P0] No recommendation weakens current governance or validation controls
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/legacy-memory-quarantine/18-02-26_08-44__mcp-working-memory-hybrid-rag.md:371:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "../.opencode/specs/system-spec-kit/020-mcp-working-memory-hybrid-rag" })` |
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/legacy-memory-quarantine/18-02-26_08-44__mcp-working-memory-hybrid-rag.md:383:memory_search({ specFolder: "../.opencode/specs/system-spec-kit/020-mcp-working-memory-hybrid-rag", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/legacy-memory-quarantine/18-02-26_08-44__mcp-working-memory-hybrid-rag.md:389:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/legacy-memory-quarantine/18-02-26_08-44__mcp-working-memory-hybrid-rag.md:398:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/023-path-scoped-rules/001-mvp-monolithic/scratch/legacy-memory-quarantine/24-12-25_12-41__path-scoped-rules.md:1451:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "004-speckit/012-path-scoped-rules" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/023-path-scoped-rules/001-mvp-monolithic/scratch/legacy-memory-quarantine/24-12-25_12-41__path-scoped-rules.md:1456:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/legacy-memory-quarantine/18-02-26_23-01__mcp-working-memory-hybrid-rag.md:371:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "system-spec-kit/020-mcp-working-memory-hybrid-rag" })` |
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/legacy-memory-quarantine/18-02-26_23-01__mcp-working-memory-hybrid-rag.md:383:memory_search({ specFolder: "system-spec-kit/020-mcp-working-memory-hybrid-rag", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/legacy-memory-quarantine/18-02-26_23-01__mcp-working-memory-hybrid-rag.md:389:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/legacy-memory-quarantine/18-02-26_23-01__mcp-working-memory-hybrid-rag.md:398:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/006-agent-role-consolidation/spec.md:85:| REQ-001 | Keep the current Public authorities authoritative | The packet does not recommend replacing `/spec_kit:*`, the current agent stack, Spec Kit Memory, CocoIndex, or code-graph |
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/006-agent-role-consolidation/spec.md:136:- **NFR-S01**: The packet must not weaken current governance or validation boundaries.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/083-memory-command-consolidation/scratch/legacy-memory-quarantine/03-02-25_00-00__verification-complete.md:323:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "** 083-memory-command-consolidation" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/083-memory-command-consolidation/scratch/legacy-memory-quarantine/03-02-25_00-00__verification-complete.md:328:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/006-agent-role-consolidation/checklist.md:66:- [ ] CHK-030 [P0] No recommendation weakens current governance or validation controls
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/083-memory-command-consolidation/implementation-summary.md:120:| L2 Core | `memory_search`, `memory_match_triggers`, `memory_save` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/049-system-analysis-bugs/handover.md:33:| Fixed `memory_search()` hardcoded dimension | Was validating against hardcoded 768 instead of profile dimension | `context-server.js:674-679` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/049-system-analysis-bugs/handover.md:40:| memory_search() dimension validation | RESOLVED | Fixed hardcoded 768 to use getEmbeddingProfile() |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/049-system-analysis-bugs/handover.md:55:- **Context:** All code fixes complete, need to verify memory_search() works after restart
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/049-system-analysis-bugs/handover.md:59:2. Verify `memory_search()` works without dimension error
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/049-system-analysis-bugs/handover.md:76:- [ ] Tests passing (if applicable) - PENDING: requires MCP restart for memory_search
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/049-system-analysis-bugs/handover.md:101:| Verify memory_search() works | FAIL - found third bug |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/049-system-analysis-bugs/handover.md:113:memory_search({ query: "embedding dimension bug" })  // Should return results (not error)
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/015-worktree-and-pipeline-evaluation/spec.md:108:4. **Given** the exit condition is checked, when evidence is still weak, then the packet remains an investigation instead of being promoted prematurely.
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/015-worktree-and-pipeline-evaluation/spec.md:134:- **NFR-S01**: The packet must not weaken current governance or validation boundaries.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/006-auto-indexing/scratch/legacy-memory-quarantine/16-12-25_11-39__docs-alignment-v12.md:157:- Updated memory_search parameters to include tier, contextType, useDecay, includeContiguity, includeConstitutional
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/006-auto-indexing/scratch/legacy-memory-quarantine/16-12-25_11-39__docs-alignment-v12.md:225:1. **memory_search** - Semantic vector search with hybrid FTS5 fusion
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/006-auto-indexing/scratch/legacy-memory-quarantine/16-12-25_11-39__docs-alignment-v12.md:319:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "specs/005-memory/004-auto-indexing" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/006-auto-indexing/scratch/legacy-memory-quarantine/16-12-25_11-39__docs-alignment-v12.md:324:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/023-path-scoped-rules/002-modular-architecture/scratch/legacy-memory-quarantine/24-12-25_15-45__modular-architecture.md:1223:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "004-speckit/012-path-scoped-rules/002-modular-architecture" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/023-path-scoped-rules/002-modular-architecture/scratch/legacy-memory-quarantine/24-12-25_15-45__modular-architecture.md:1228:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/049-system-analysis-bugs/testing-handover.md:402:   memory_search({ query: "system analysis bugs" })
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/049-system-analysis-bugs/testing-handover.md:414:- [ ] memory_search() returns results
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/006-auto-indexing/scratch/legacy-memory-quarantine/16-12-25_00-00__v12-references-removed.md:238:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/z_archive/006-auto-indexing" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/006-auto-indexing/scratch/legacy-memory-quarantine/16-12-25_00-00__v12-references-removed.md:243:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/002-agentic-adoption/015-worktree-and-pipeline-evaluation/checklist.md:66:- [ ] CHK-030 [P0] No recommendation weakens current governance or validation controls
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/023-path-scoped-rules/002-modular-architecture/scratch/legacy-memory-quarantine/24-12-25_15-27__modular-architecture.md:241:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "004-speckit/012-path-scoped-rules/002-modular-architecture" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/023-path-scoped-rules/002-modular-architecture/scratch/legacy-memory-quarantine/24-12-25_15-27__modular-architecture.md:246:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/006-auto-indexing/scratch/legacy-memory-quarantine/16-12-25_12-45__session-complete.md:158:| `memory_search` - Vector search | ✅ |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/006-auto-indexing/scratch/legacy-memory-quarantine/16-12-25_12-45__session-complete.md:299:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/z_archive/006-auto-indexing" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/006-auto-indexing/scratch/legacy-memory-quarantine/16-12-25_12-45__session-complete.md:304:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/023-path-scoped-rules/002-modular-architecture/scratch/legacy-memory-quarantine/24-12-25_15-36__modular-architecture.md:466:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "004-speckit/012-path-scoped-rules/002-modular-architecture" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/023-path-scoped-rules/002-modular-architecture/scratch/legacy-memory-quarantine/24-12-25_15-36__modular-architecture.md:471:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/049-system-analysis-bugs/checklist.md:55:- [x] `memory_search()` returns relevant results
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/049-system-analysis-bugs/checklist.md:56:- **Evidence:** Verified 2024-12-31: memory_index_scan completed (147 files). memory_search fix: context-server.js:676 changed `profile?.dimension` to `profile?.dim` (profile object uses `dim` property). Fix applied 2024-12-31 Attempt 2. MCP restart required to verify.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/049-system-analysis-bugs/checklist.md:115:- [x] `memory_search({ tier: 'constitutional' })` returns results
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/037-post-merge-refinement-2/scratch/legacy-memory-quarantine/16-02-26_14-50__session-summary.md:503:Search repo for unnamespaced memory_search() references
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/037-post-merge-refinement-2/scratch/legacy-memory-quarantine/16-02-26_14-50__session-summary.md:1373:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/037-post-merge-refinement-2" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/037-post-merge-refinement-2/scratch/legacy-memory-quarantine/16-02-26_14-50__session-summary.md:1378:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/028-memory-alignment-fix/scratch/legacy-memory-quarantine/22-12-25_14-51__memory-alignment-fix.md:370:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "005-memory/016-memory-alignment-fix" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/028-memory-alignment-fix/scratch/legacy-memory-quarantine/22-12-25_14-51__memory-alignment-fix.md:375:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/006-auto-indexing/scratch/legacy-memory-quarantine/16-12-25_11-45__docs-alignment-complete.md:152:   - Updated memory_search parameters (tier, contextType, useDecay, includeContiguity, includeConstitutional)
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/006-auto-indexing/scratch/legacy-memory-quarantine/16-12-25_11-45__docs-alignment-complete.md:198:- memory_search, memory_load, memory_match_triggers
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/006-auto-indexing/scratch/legacy-memory-quarantine/16-12-25_11-45__docs-alignment-complete.md:312:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "** specs/005-memory/004-auto-indexing" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/006-auto-indexing/scratch/legacy-memory-quarantine/16-12-25_11-45__docs-alignment-complete.md:317:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/049-system-analysis-bugs/tasks.md:218:- [x] Constitutional files appear in `memory_search` results
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/023-path-scoped-rules/002-modular-architecture/scratch/legacy-memory-quarantine/24-12-25_14-51__modular-architecture.md:1585:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "004-speckit/012-path-scoped-rules/002-modular-architecture" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/023-path-scoped-rules/002-modular-architecture/scratch/legacy-memory-quarantine/24-12-25_14-51__modular-architecture.md:1590:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/006-auto-indexing/scratch/legacy-memory-quarantine/16-12-25_13-30__command-alignment.md:296:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/z_archive/006-auto-indexing" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/006-auto-indexing/scratch/legacy-memory-quarantine/16-12-25_13-30__command-alignment.md:301:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/037-post-merge-refinement-2/scratch/legacy-memory-quarantine/25-12-25_19-06__post-merge-refinement-2.md:502:Search repo for unnamespaced memory_search() references
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/037-post-merge-refinement-2/scratch/legacy-memory-quarantine/25-12-25_19-06__post-merge-refinement-2.md:1372:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/037-post-merge-refinement-2" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/037-post-merge-refinement-2/scratch/legacy-memory-quarantine/25-12-25_19-06__post-merge-refinement-2.md:1377:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/037-post-merge-refinement-2/scratch/legacy-memory-quarantine/25-12-25_18-59__post-merge-refinement-2.md:265:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/037-post-merge-refinement-2" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/037-post-merge-refinement-2/scratch/legacy-memory-quarantine/25-12-25_18-59__post-merge-refinement-2.md:270:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/006-auto-indexing/scratch/legacy-memory-quarantine/16-12-24_00-00__memory-docs-cleanup.md:252:| Search | `memory_search()` | ❌ ERROR | `no such column: m.importance_tier` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/006-auto-indexing/scratch/legacy-memory-quarantine/16-12-24_00-00__memory-docs-cleanup.md:311:| **Search** | `memory_search()` | ✅ **FIXED** | Vector search with tier filtering |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/006-auto-indexing/scratch/legacy-memory-quarantine/16-12-24_00-00__memory-docs-cleanup.md:380:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "** `specs/005-memory/004-auto-indexing`" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/006-auto-indexing/scratch/legacy-memory-quarantine/16-12-24_00-00__memory-docs-cleanup.md:385:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/075-post-speckit-template-upgrade-testing/decision-record.md:602:**Details**: Test files import tool handler functions directly and test them in isolation. A smaller set of integration tests verify the MCP protocol layer works correctly with 2-3 representative tools (memory_search, memory_save, index_status).
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/075-post-speckit-template-upgrade-testing/review.md:287:The Spec 073 implementation successfully achieved its primary goals of template reduction and value-based scaling. The CORE + ADDENDUM architecture is well-designed and maintainable. The main weakness is the loss of onboarding guidance for new users, which could be addressed through a "verbose" template variant.
.opencode/specs/system-spec-kit/z_archive/020-mcp-working-memory-hybrid-rag/scratch/opencode-working-memory/index.ts:1513:- "Add new tool: working_memory_search to query pool items by keyword"
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/075-post-speckit-template-upgrade-testing/plan.md:106:- [ ] Test memory_search with semantic matching
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/075-post-speckit-template-upgrade-testing/plan.md:477:| memory_search | Semantic context search | P0 |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/075-post-speckit-template-upgrade-testing/checklist.md:103:  - Evidence: **PASSED** - test-mcp-tools.js memory_search: 6/6 tests passed, semantic similarity search verified
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/075-post-speckit-template-upgrade-testing/checklist.md:105:  - Evidence: **PASSED** - test-mcp-tools.js memory_search: anchor filtering validated
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/075-post-speckit-template-upgrade-testing/checklist.md:107:  - Evidence: **PASSED** - test-mcp-tools.js memory_search: folder-scoped queries return correct results
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/066-context-server-modularization/plan.md:226:- `memory_search` returns expected results
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/005-speckit-consolidation/scratch/legacy-memory-quarantine/17-12-25_00-00__speckit-consolidation-complete.md:391:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "** `specs/004-speckit/003-speckit-consolidation/`" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/005-speckit-consolidation/scratch/legacy-memory-quarantine/17-12-25_00-00__speckit-consolidation-complete.md:396:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/066-context-server-modularization/code-style-alignment.md:182: * Handle memory_search tool requests
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/066-context-server-modularization/code-style-alignment.md:200:| `handleMemorySearch` | `handle_memory_search` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/066-context-server-modularization/code-style-alignment.md:269:module.exports = { handle_memory_search, handle_memory_save, ... };
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/001-research-agentic-systems/006-ralph-main/research/deep-research-strategy.md:45:- Replacing existing Spec Kit Memory, CocoIndex, or code-graph stack
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/001-research-agentic-systems/006-ralph-main/research/deep-research-strategy.md:90:Code_Environment/Public agent stack: orchestrate, deep-research, deep-review, context, general agents; spec_kit workflow; system-spec-kit skill; memory system with trigger-based recall, semantic search, causal links; CocoIndex; code-graph.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/024-comprehensive-alignment-fix/scratch/legacy-memory-quarantine/24-12-25_19-48__comprehensive-alignment-fix.md:398:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "004-speckit/013-comprehensive-alignment-fix" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/024-comprehensive-alignment-fix/scratch/legacy-memory-quarantine/24-12-25_19-48__comprehensive-alignment-fix.md:403:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/076-post-speckit-template-upgrade-command-allignment/implementation-summary.md:102:| spec_kit/assets | 14 | Version refs, missing Level 1 file, memory_search params |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/076-post-speckit-template-upgrade-command-allignment/implementation-summary.md:120:| memory_search params | Missing query, no anchors | `query`, `specFolder`, `anchors: ['summary', 'state', 'next-steps']` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/076-post-speckit-template-upgrade-command-allignment/implementation-summary.md:172:| memory_search has anchors | 2 YAMLs | 2 YAMLs | PASS |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/070-memory-ranking/plan.md:318:| `memory_search()` | Works | Works (enhanced ranking internal) |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/075-post-speckit-template-upgrade-testing/tasks.md:100:- [ ] T040 Test memory_search with text query (`query: "implementation pattern"`)
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/075-post-speckit-template-upgrade-testing/tasks.md:101:- [ ] T041 Test memory_search with concepts array (`concepts: ["template", "validation"]`)
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/075-post-speckit-template-upgrade-testing/tasks.md:102:- [ ] T042 Test memory_search with anchors (`anchors: ["summary", "decisions"]`)
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/075-post-speckit-template-upgrade-testing/tasks.md:103:- [ ] T043 Test memory_search with specFolder filter (`specFolder: "specs/075-..."`)
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/075-post-speckit-template-upgrade-testing/tasks.md:104:- [ ] T044 Test memory_search with includeContent flag
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/075-post-speckit-template-upgrade-testing/tasks.md:105:- [ ] T045 Test memory_search with limit parameter
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/075-post-speckit-template-upgrade-testing/tasks.md:106:- [ ] T046 Test memory_search empty results handling
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/075-post-speckit-template-upgrade-testing/tasks.md:107:- [ ] T047 Test memory_search relevance scoring
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/075-post-speckit-template-upgrade-testing/tasks.md:242:- [ ] T133 Query memory_search for newly saved content
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/075-post-speckit-template-upgrade-testing/tasks.md:263:- [ ] T148 Load suggested memories via memory_search
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/066-context-server-modularization/checklist.md:91:- [ ] CHK027 [P0] `memory_search` works correctly
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/066-context-server-modularization/checklist.md:154:- [x] CHK027 [P0] memory_search works | Evidence: Tested via Claude Code, returns expected results
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/070-memory-ranking/checklist.md:164:- [x] **P0** `memory_search()` returns results (ranking may differ) ✓ Verified 2026-01-16
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/023-path-scoped-rules/002-modular-architecture/test-fixtures/invalid-anchors/scratch/legacy-memory-quarantine/context.md:218:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/z_archive/023-path-scoped-rules/002-modular-architecture/test-fixtures/invalid-anchors" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/023-path-scoped-rules/002-modular-architecture/test-fixtures/invalid-anchors/scratch/legacy-memory-quarantine/context.md:223:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/066-context-server-modularization/scratch/legacy-memory-quarantine/15-01-26_16-58__context-server-modularization.md:461:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/066-context-server-modularization" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/066-context-server-modularization/scratch/legacy-memory-quarantine/15-01-26_16-58__context-server-modularization.md:466:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/033-ux-deep-analysis/scratch/legacy-memory-quarantine/25-12-25_11-36__ux-deep-analysis.md:317:### OBSERVATION: Tool: semantic_memory_memory_search
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/033-ux-deep-analysis/scratch/legacy-memory-quarantine/25-12-25_11-36__ux-deep-analysis.md:319:Executed semantic_memory_memory_search
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/033-ux-deep-analysis/scratch/legacy-memory-quarantine/25-12-25_11-36__ux-deep-analysis.md:321:**Details:** Tool: semantic_memory_memory_search | Status: completed
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/033-ux-deep-analysis/scratch/legacy-memory-quarantine/25-12-25_11-36__ux-deep-analysis.md:885:**Tool: semantic_memory_memory_search**
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/033-ux-deep-analysis/scratch/legacy-memory-quarantine/25-12-25_11-36__ux-deep-analysis.md:886:Tool: semantic_memory_memory_search
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/033-ux-deep-analysis/scratch/legacy-memory-quarantine/25-12-25_11-36__ux-deep-analysis.md:912:**Tool: semantic_memory_memory_search**
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/033-ux-deep-analysis/scratch/legacy-memory-quarantine/25-12-25_11-36__ux-deep-analysis.md:913:Tool: semantic_memory_memory_search
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/033-ux-deep-analysis/scratch/legacy-memory-quarantine/25-12-25_11-36__ux-deep-analysis.md:1030:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/033-ux-deep-analysis" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/033-ux-deep-analysis/scratch/legacy-memory-quarantine/25-12-25_11-36__ux-deep-analysis.md:1035:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/044-speckit-test-suite/handover.md:122:memory_search({ specFolder: "044-speckit-test-suite", includeContent: true })
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/033-ux-deep-analysis/fix-summary.md:35:**Current (WRONG):** `mcp__semantic_memory__memory_search({...})`
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/033-ux-deep-analysis/fix-summary.md:36:**Correct:** `semantic_memory_memory_search({...})`
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/033-ux-deep-analysis/fix-summary.md:45:- allowed-tools: Read, Bash, mcp__semantic_memory__memory_search, mcp__semantic_memory__memory_load
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/033-ux-deep-analysis/fix-summary.md:46:+ allowed-tools: Read, Bash, semantic_memory_memory_search, semantic_memory_memory_load
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/033-ux-deep-analysis/fix-summary.md:676:**Note:** resume.md lines 367-372 correctly use `semantic_memory_memory_search` format
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/033-ux-deep-analysis/fix-summary.md:732:| P2-26 | Search results not paginated | memory_search | Add pagination |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/066-context-server-modularization/tasks.md:91:- [ ] T019 Verify memory_search and memory_match_triggers work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/070-memory-ranking/scratch/legacy-memory-quarantine/16-01-26_14-02__memory-ranking.md:162:- Ran backward compatibility tests: memory_stats(), memory_list(), memory_search() all work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/070-memory-ranking/scratch/legacy-memory-quarantine/16-01-26_14-02__memory-ranking.md:213:2. **All P0 integration tests passed** - Backward compatibility verified for memory_stats(), memory_list(), memory_search()
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/070-memory-ranking/scratch/legacy-memory-quarantine/16-01-26_14-02__memory-ranking.md:285:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/071-memory-ranking" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/070-memory-ranking/scratch/legacy-memory-quarantine/16-01-26_14-02__memory-ranking.md:290:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/feature-summary.md:41:- All `memory_search` calls - Different ranking behavior
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/feature-summary.md:529:  'memory_search': {
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/feature-summary.md:549:Comprehensive mapping of all error codes to recovery actions. Covers: memory_search, checkpoint_restore, memory_save, and all other tools.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/044-speckit-test-suite/decision-record.md:137:| Vector search | <500ms | memory_search() with vector |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/033-ux-deep-analysis/scratch/legacy-memory-quarantine/25-12-25_15-28__ux-deep-analysis.md:424:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/033-ux-deep-analysis" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/033-ux-deep-analysis/scratch/legacy-memory-quarantine/25-12-25_15-28__ux-deep-analysis.md:429:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/068-memory-index-commands/tasks.md:281:| Load by Spec Folder | Section 5.2 | memory_search, Read |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/068-memory-index-commands/tasks.md:282:| Load with Anchor | Section 5.3 | memory_search, Read |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/068-memory-index-commands/tasks.md:283:| Search | Section 7 | memory_search |
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/001-research-agentic-systems/006-ralph-main/research/iterations/iteration-014.md:19:Ralph is not anti-validation; it is radically specific about what counts as proof. The main difference is that its proof is attached directly to the story being executed. `system-spec-kit` has stronger packet integrity guarantees, but those guarantees can become the center of gravity, especially when tasks are still broad. That creates a bad loop: weakly-sized tasks force larger checklists, and larger checklists encourage process-heavy completion rather than sharp evidence about one verified change. The better architecture is two-tier validation: lightweight packet integrity checks plus first-class executable acceptance criteria on each task.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/spec.md:132:| "continue [spec name]" | Surface relevant context via memory_search | Gate 2 |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/spec.md:170:| REQ-009 | Recovery Hints Catalog | Complete error-to-hint mapping for memory_search, checkpoint_restore, memory_save |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/044-speckit-test-suite/comprehensive-analysis.md:76:**Description:** Setting `includeConstitutional: false` in memory_search does not exclude constitutional memories from results.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/044-speckit-test-suite/comprehensive-analysis.md:143:5. **context-server.js**: Add limit bounds to memory_search
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/068-memory-index-commands/plan.md:313:- `spec_kit_memory_memory_search` - Semantic search
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/033-ux-deep-analysis/scratch/legacy-memory-quarantine/25-12-25_11-07__ux-deep-analysis.md:238:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/033-ux-deep-analysis" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/033-ux-deep-analysis/scratch/legacy-memory-quarantine/25-12-25_11-07__ux-deep-analysis.md:243:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/tests/test-implementation-guide.md:1696:      memory_search: async (p) => {
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/tests/test-implementation-guide.md:1697:        // Simulate memory_search handler
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/tests/test-implementation-guide.md:1764:      const searchResult = await callMcpTool('memory_search', {
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/023-path-scoped-rules/002-modular-architecture/test-fixtures/valid-anchors/scratch/legacy-memory-quarantine/context.md:217:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/z_archive/023-path-scoped-rules/002-modular-architecture/test-fixtures/valid-anchors" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/023-path-scoped-rules/002-modular-architecture/test-fixtures/valid-anchors/scratch/legacy-memory-quarantine/context.md:222:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/089-speckit-reimagined-refinement/checklist.md:125:- [ ] memory_search() returns results (MCP server functional)
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/001-research-agentic-systems/006-ralph-main/research/iterations/iteration-015.md:48:- Can Ralph's gitignored working-file pattern give `system-spec-kit` a lightweight operator-facing bridge without weakening archival memory?
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/001-scratch-enforcement/scratch/legacy-memory-quarantine/13-12-25_00-00__scratch-enforcement-complete.md:297:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/z_archive/001-scratch-enforcement" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/001-scratch-enforcement/scratch/legacy-memory-quarantine/13-12-25_00-00__scratch-enforcement-complete.md:302:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/089-speckit-reimagined-refinement/scratch/all-new-things.md:50:| N-23 | `bypassCache` in memory_search tool schema | `mcp_server/context-server.js:92` | Handler accepts it but schema doesn't declare it — clients can't discover it |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/001-scratch-enforcement/scratch/legacy-memory-quarantine/13-12-25_00-00__verification-and-fixes.md:309:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/z_archive/001-scratch-enforcement" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/001-scratch-enforcement/scratch/legacy-memory-quarantine/13-12-25_00-00__verification-and-fixes.md:314:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/068-memory-index-commands/scratch/search-backup-20260116.md:4:allowed-tools: Read, Bash, spec_kit_memory_memory_search, spec_kit_memory_memory_match_triggers, spec_kit_memory_memory_list, spec_kit_memory_memory_stats, spec_kit_memory_memory_validate, spec_kit_memory_memory_update, spec_kit_memory_memory_delete
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/068-memory-index-commands/scratch/search-backup-20260116.md:159:│ BY SPEC FOLDER  │ memory_search(specFolder) → Read(filePath)               │ SEQUENCE │ No memories     │
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/068-memory-index-commands/scratch/search-backup-20260116.md:165:│ SEARCH          │ memory_search                                           │ SINGLE   │ No results msg  │
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/068-memory-index-commands/scratch/search-backup-20260116.md:167:│ DETAIL VIEW     │ memory_search (includeContent: true)                    │ SINGLE   │ Show error msg  │
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/068-memory-index-commands/scratch/search-backup-20260116.md:187:spec_kit_memory_memory_search({ query: "<q>", limit: N, tier: "<tier>", contextType: "<type>", includeContent: true, includeContiguity: false, concepts: [...] })
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/068-memory-index-commands/scratch/search-backup-20260116.md:194:### Full Parameter Reference: memory_search
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/068-memory-index-commands/scratch/search-backup-20260116.md:249:   spec_kit_memory_memory_search({ 
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/068-memory-index-commands/scratch/search-backup-20260116.md:370:spec_kit_memory_memory_search({
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/044-speckit-test-suite/checklist.md:201:- [x] **P0** memory_search tests (12) [EVIDENCE: scratch/test-agent-02-search/TEST-REPORT.md - T2.1-T2.7 PASS (88%)]
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/checklist.md:103:- [x] CHK-025 [P0] `RECOVERY_HINTS` catalog covers memory_search, checkpoint_restore, memory_save
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/checklist.md:227:  - [E:code] formatters/search-results.js uses envelope for memory_search
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/checklist.md:599:  - [E:code] Affected tools: memory_search, memory_match_triggers, memory_list_folders, memory_read
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/consolidated-analysis.md:240:| L4 | Exploration | 500-1500 | `memory_search`, `memory_list` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/consolidated-analysis.md:591:  'memory_search': {
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/consolidated-analysis.md:630:    memory_search: [
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/consolidated-analysis.md:674:memory_search({ query: "session ${session.id}", anchors: ['state'] })
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/consolidated-analysis.md:1091:    tools: ['memory_search', 'memory_list', 'memory_browse'],
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/consolidated-analysis.md:1670:| 001-a | `081-speckit-reimagined-pre-analysis/001-a-analysis-cross-repository-architecture.md` | Triple-hybrid retrieval, RRF fusion, dotmd patterns |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/089-speckit-reimagined-refinement/scratch/legacy-memory-quarantine/06-02-26_16-32__speckit-reimagined-refinement.md:464:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/089-speckit-reimagined-refinement" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/089-speckit-reimagined-refinement/scratch/legacy-memory-quarantine/06-02-26_16-32__speckit-reimagined-refinement.md:476:memory_search({ specFolder: "003-memory-and-spec-kit/089-speckit-reimagined-refinement", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/089-speckit-reimagined-refinement/scratch/legacy-memory-quarantine/06-02-26_16-32__speckit-reimagined-refinement.md:482:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/089-speckit-reimagined-refinement/scratch/legacy-memory-quarantine/06-02-26_16-32__speckit-reimagined-refinement.md:491:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/007-system-spec-kit-rename/scratch/legacy-memory-quarantine/17-12-25_08-52__system-spec-kit-rename.md:188:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "008-system-spec-kit-rename" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/007-system-spec-kit-rename/scratch/legacy-memory-quarantine/17-12-25_08-52__system-spec-kit-rename.md:193:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/089-speckit-reimagined-refinement/scratch/legacy-memory-quarantine/06-02-26_12-47__speckit-reimagined-refinement.md:419:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/089-speckit-reimagined-refinement" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/089-speckit-reimagined-refinement/scratch/legacy-memory-quarantine/06-02-26_12-47__speckit-reimagined-refinement.md:431:memory_search({ specFolder: "003-memory-and-spec-kit/089-speckit-reimagined-refinement", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/089-speckit-reimagined-refinement/scratch/legacy-memory-quarantine/06-02-26_12-47__speckit-reimagined-refinement.md:437:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/089-speckit-reimagined-refinement/scratch/legacy-memory-quarantine/06-02-26_12-47__speckit-reimagined-refinement.md:446:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/007-system-spec-kit-rename/scratch/legacy-memory-quarantine/17-12-25_08-41__system-spec-kit-rename.md:347:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "008-system-spec-kit-rename" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/007-system-spec-kit-rename/scratch/legacy-memory-quarantine/17-12-25_08-41__system-spec-kit-rename.md:352:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/044-speckit-test-suite/scratch/test-agent-10-e2e/TEST-REPORT.md:47:              memory_search({ query })
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/044-speckit-test-suite/scratch/test-agent-10-e2e/TEST-REPORT.md:147:                  memory_search({ specFolder: "..." })
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/044-speckit-test-suite/scratch/test-agent-10-e2e/TEST-REPORT.md:191:specs/006-speckit-   Errors: 1              memory_search()
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/044-speckit-test-suite/scratch/test-agent-10-e2e/TEST-REPORT.md:254:**Verification**: Every `memory_search()` call with `includeConstitutional: true` (default) showed the gate enforcement memory first with 100% similarity boost.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/044-speckit-test-suite/scratch/test-agent-10-e2e/TEST-REPORT.md:267:**Positive Finding**: The `specFolder` filter in `memory_search()` correctly isolates results to the specified folder, while unfiltered searches return all matching memories.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/scratch/legacy-memory-quarantine/01-02-26_11-55__speckit-reimagined.md:278:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/082-speckit-reimagined" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/scratch/legacy-memory-quarantine/01-02-26_11-55__speckit-reimagined.md:283:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/001-research-agentic-systems/006-ralph-main/research/iterations/iteration-002.md:7:Ralph lowers context drift, but pays for it with repeated setup work and weaker recovery when durable artifacts are thin.
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/001-research-agentic-systems/006-ralph-main/research/iterations/iteration-002.md:39:- Can `system-spec-kit` add a compact restart digest without weakening the richer retrieval model?
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/tasks.md:60:- [x] T004 [W-S][B:T001][B:T002] Integrate SessionManager into memory_search tool handler
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/tasks.md:100:  - TOOL_SPECIFIC_HINTS for contextual overrides (memory_search, checkpoint_restore, memory_save, etc.)
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/tasks.md:127:- [x] T014 [W-I][B:T012] Integrate cache into memory_search with bypass option
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/tasks.md:136:  - Affected tools: memory_search, memory_match_triggers, memory_list_folders, memory_read
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/tasks.md:193:- [x] T027 [W-D][B:T024] Update memory_search to increment access_count
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/tasks.md:258:- [x] T039 [W-R][B:T037] Add intent parameter to memory_search tool
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/tasks.md:259:  - Added `intent` parameter to memory_search tool schema (context-server.js:78)
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/tasks.md:279:  - memory-search.js: 1 tool (memory_search) via format_search_results formatter
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/tasks.md:345:  - Added `rerank` and `applyLengthPenalty` params to memory_search handler
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/tasks.md:362:- [x] T058 [W-D][B:T056] Add state filtering to memory_search - `filter_by_memory_state()` in memory-search.js + minState/applyStateLimits params
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/001-research-agentic-systems/006-ralph-main/research/iterations/iteration-012.md:19:Phase 1 already concluded that Ralph's minimal persistence model is too weak to replace Spec Kit Memory. Phase 2 changes the question: not "replace memory," but "separate memory concerns." Ralph makes a sharp distinction between execution bridge state and long-term audit history. `system-spec-kit` currently has excellent long-term retrieval, but the bridge between consecutive autonomous runs is comparatively heavy: handovers, indexed memory files, and command setup flows all carry more structure than the next iteration usually needs. That suggests an architectural refactor, not a replacement: add a first-class, append-only run-state artifact that feeds or summarizes into semantic memory later.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/scratch/legacy-memory-quarantine/01-02-26_11-22__speckit-reimagined.md:317:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/082-speckit-reimagined" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/scratch/legacy-memory-quarantine/01-02-26_11-22__speckit-reimagined.md:322:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/089-speckit-reimagined-refinement/scratch/legacy-memory-quarantine/06-02-26_11-57__speckit-reimagined-refinement.md:566:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/089-speckit-reimagined-refinement" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/089-speckit-reimagined-refinement/scratch/legacy-memory-quarantine/06-02-26_11-57__speckit-reimagined-refinement.md:578:memory_search({ specFolder: "003-memory-and-spec-kit/089-speckit-reimagined-refinement", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/089-speckit-reimagined-refinement/scratch/legacy-memory-quarantine/06-02-26_11-57__speckit-reimagined-refinement.md:584:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/089-speckit-reimagined-refinement/scratch/legacy-memory-quarantine/06-02-26_11-57__speckit-reimagined-refinement.md:593:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/scratch/legacy-memory-quarantine/01-02-26_14-15__speckit-reimagined-complete.md:283:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/082-speckit-reimagined" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/044-speckit-test-suite/scratch/test-agent-10-e2e/test-folder-a/scratch/legacy-memory-quarantine/test-memory-a.md:200:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/z_archive/044-speckit-test-suite/scratch/test-agent-10-e2e/test-folder-a" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/044-speckit-test-suite/scratch/test-agent-10-e2e/test-folder-a/scratch/legacy-memory-quarantine/test-memory-a.md:205:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/065-anchor-system-implementation/decision-record.md:42:- **Performance**: Parsing must happen on-the-fly during `memory_search`, so it must be fast (<10ms).
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/scratch/legacy-memory-quarantine/02-02-26_17-53__speckit-reimagined.md:372:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/082-speckit-reimagined" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/scratch/legacy-memory-quarantine/02-02-26_17-53__speckit-reimagined.md:384:memory_search({ specFolder: "003-memory-and-spec-kit/082-speckit-reimagined", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/scratch/legacy-memory-quarantine/02-02-26_17-53__speckit-reimagined.md:390:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/scratch/legacy-memory-quarantine/02-02-26_17-53__speckit-reimagined.md:399:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/scratch/legacy-memory-quarantine/02-02-26_17-45__speckit-reimagined.md:289:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/082-speckit-reimagined" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/scratch/legacy-memory-quarantine/02-02-26_17-45__speckit-reimagined.md:301:memory_search({ specFolder: "003-memory-and-spec-kit/082-speckit-reimagined", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/scratch/legacy-memory-quarantine/02-02-26_17-45__speckit-reimagined.md:307:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/scratch/legacy-memory-quarantine/02-02-26_17-45__speckit-reimagined.md:316:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/065-anchor-system-implementation/spec.md:50:- The `memory_search` tool is the primary entry point for retrieving context.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/065-anchor-system-implementation/spec.md:59:- **MCP Tool Update:** Updating `memory_search` to accept an `anchors` parameter.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/065-anchor-system-implementation/spec.md:72:| `.opencode/skills/system-spec-kit/mcp_server/context-server.js` | Modify | Update `memory_search` schema and handler |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/065-anchor-system-implementation/spec.md:88:1. **Given** a memory file with `ANCHOR:summary` and `ANCHOR:details`, **When** I call `memory_search` with `anchors=['summary']`, **Then** I receive ONLY the summary content.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/065-anchor-system-implementation/spec.md:108:- **REQ-FUNC-003:** The `memory_search` tool MUST accept an optional `anchors` parameter (array of strings).
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/065-anchor-system-implementation/spec.md:150:- **SC-001**: `memory_search` correctly filters content based on anchor IDs.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/065-anchor-system-implementation/spec.md:165:- **R-002**: Breaking existing `memory_search` clients. *Mitigation:* Make `anchors` parameter optional; default behavior (full content) remains unchanged.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/052-codebase-fixes/scratch/legacy-memory-quarantine/31-12-25_19-45__codebase-fixes.md:159:- Tool: spec_kit_memory_memory_search
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/052-codebase-fixes/scratch/legacy-memory-quarantine/31-12-25_19-45__codebase-fixes.md:200:### OBSERVATION: Tool: spec_kit_memory_memory_search
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/052-codebase-fixes/scratch/legacy-memory-quarantine/31-12-25_19-45__codebase-fixes.md:202:Executed spec_kit_memory_memory_search
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/052-codebase-fixes/scratch/legacy-memory-quarantine/31-12-25_19-45__codebase-fixes.md:204:**Details:** Tool: spec_kit_memory_memory_search | Status: completed
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/052-codebase-fixes/scratch/legacy-memory-quarantine/31-12-25_19-45__codebase-fixes.md:367:**Tool: spec_kit_memory_memory_search**
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/052-codebase-fixes/scratch/legacy-memory-quarantine/31-12-25_19-45__codebase-fixes.md:368:Tool: spec_kit_memory_memory_search
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/052-codebase-fixes/scratch/legacy-memory-quarantine/31-12-25_19-45__codebase-fixes.md:410:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/052-codebase-fixes" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/052-codebase-fixes/scratch/legacy-memory-quarantine/31-12-25_19-45__codebase-fixes.md:415:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/scratch/legacy-memory-quarantine/01-02-26_11-53__speckit-reimagined.md:336:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/z_archive/082-speckit-reimagined" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/scratch/legacy-memory-quarantine/01-02-26_11-53__speckit-reimagined.md:341:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/065-anchor-system-implementation/plan.md:3:description: "The implementation focuses on enhancing the existing memory-parser.js to support extraction (not just validation) and integrating this capability into the memory_search MCP tool."
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/065-anchor-system-implementation/plan.md:19:The implementation focuses on enhancing the existing `memory-parser.js` to support **extraction** (not just validation) and integrating this capability into the `memory_search` MCP tool.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/065-anchor-system-implementation/plan.md:28:    *   **Tool Schema:** Add `anchors: string[]` to `memory_search` input.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/065-anchor-system-implementation/plan.md:37:1.  User calls `memory_search(query="...", includeContent=true, anchors=["summary", "state"])`.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/065-anchor-system-implementation/plan.md:59:- [ ] Update `memory_search` tool definition in `context-server.js`.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/065-anchor-system-implementation/plan.md:65:- [ ] Verify `memory_search` returns filtered content.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/065-anchor-system-implementation/plan.md:89:2.  Call `memory_search` with anchors via inspector or script.
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/research/research-pipeline-improvements.md:458:R-13 revealed that the spec folder auto-detection cascade — the very first step that determines WHERE memory is saved — has structural weaknesses that compound with R-11's transcript selection failures. Depth-bias in ranking (children outrank parents), absence of git-status signals, and 445+ candidates competing on stale mtime create a system that fails precisely when it matters most: new spec folders with many children, first-time saves, and bulk file creation workflows. The cascade was designed for simple cases (few spec folders, clear mtime winner) but breaks in production-scale repos. Combined with R-03's dual-write decision bug and tree-thinning's over-aggressive merging of description-length "content," R-13 demonstrates that R-01–R-12 issues are not isolated — they combine multiplicatively. Two consecutive bad saves for the same folder produced files where 83% of all known R-series issues manifest simultaneously. R-13f verification additionally revealed a blocker extraction bug where truncated observation text containing markdown section headers is parsed as a blocker string — the `Blockers: PROBLEM' to '## 2.` artifact in the 15:31 file is a content validation gap in `extractBlockers()` that is independent of transcript selection.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/044-speckit-test-suite/scratch/test-agent-10-e2e/test-folder-b/scratch/legacy-memory-quarantine/test-memory-b.md:200:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/z_archive/044-speckit-test-suite/scratch/test-agent-10-e2e/test-folder-b" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/044-speckit-test-suite/scratch/test-agent-10-e2e/test-folder-b/scratch/legacy-memory-quarantine/test-memory-b.md:205:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/052-codebase-fixes/scratch/legacy-memory-quarantine/31-12-25_19-44__codebase-fixes.md:356:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/052-codebase-fixes" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/052-codebase-fixes/scratch/legacy-memory-quarantine/31-12-25_19-44__codebase-fixes.md:361:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/scratch/legacy-memory-quarantine/01-02-26_10-53__speckit-reimagined.md:289:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/082-speckit-reimagined" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/scratch/legacy-memory-quarantine/01-02-26_10-53__speckit-reimagined.md:294:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/scratch/legacy-memory-quarantine/01-02-26_12-19__speckit-reimagined.md:558:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/082-speckit-reimagined" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/scratch/legacy-memory-quarantine/01-02-26_12-19__speckit-reimagined.md:563:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/065-anchor-system-implementation/test-results.md:30:Simulates the `memory_search` tool handler with the new filtering logic.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/065-anchor-system-implementation/checklist.md:24:    - [x] `memory_search` tool schema updated with `anchors` param
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/001-research-agentic-systems/006-ralph-main/research/iterations/iteration-017.md:37:- Does Ralph's optional Amp auto-handoff weaken the repo's own "one iteration = one context window" story?
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/050-security-doc-remediation/spec.md:60:2. Existing functionality unaffected (memory_search, generate-context.js work correctly)
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/050-security-doc-remediation/plan.md:89:2. Run `memory_search()` - should work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/065-anchor-system-implementation/scratch/test-runtime-anchors.js:232:  // Simulate requesting only first anchor (like memory_search with anchors param)
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/018-generate-context-fix/scratch/legacy-memory-quarantine/17-12-25_08-21__generate-context-fix.md:367:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "005-memory/010-generate-context-fix" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/018-generate-context-fix/scratch/legacy-memory-quarantine/17-12-25_08-21__generate-context-fix.md:372:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/001-research-agentic-systems/006-ralph-main/research/iterations/iteration-018.md:19:This is a useful correction to Phase 1. Ralph's repo messaging is slightly self-contradictory: the skills insist on one-window sizing, yet the README offers runtime-level handoff support as an escape hatch. The underlying principle is still valid, but it is narrower than Phase 1 first suggested. The stable rule is not "always one context window." It is "one independently verifiable unit, with sizing chosen for the weakest runtime or explicit handoff behavior available."
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/001-research-agentic-systems/006-ralph-main/research/iterations/iteration-018.md:24:finding: `system-spec-kit` should adopt runtime-aware task sizing language: every autonomous run should complete one independently verifiable unit, and task granularity should be chosen based on the weakest runtime's safe handoff behavior rather than a dogmatic universal context-window rule.
.opencode/specs/system-spec-kit/z_future/agentic-system-upgrade/001-research-agentic-systems/006-ralph-main/research/iterations/iteration-018.md:41:- **Migration path:** Replace "one context window" wording with "one independently verifiable unit per autonomous run, sized for the weakest supported runtime."
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/050-security-doc-remediation/checklist.md:40:- [x] `memory_search()` still returns results
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/050-security-doc-remediation/checklist.md:99:# Test memory_search  
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/050-security-doc-remediation/checklist.md:100:curl or MCP call memory_search({ query: "test" })
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/042-post-merge-refinement-5/recommendations.md:50:**Verification**: Run `memory_search()` twice - second call should show cache hit in debug logs
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/042-post-merge-refinement-5/recommendations.md:80:**Verification**: Call `memory_search()`, then query DB to confirm `last_accessed` updated
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/042-post-merge-refinement-5/recommendations.md:215:**Verification**: Create checkpoint, restore it, run `memory_search()` - should return semantic results
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/042-post-merge-refinement-5/recommendations.md:245:**Verification**: Call `memory_search({ includeContiguity: true })`, verify adjacent memories returned
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/042-post-merge-refinement-5/recommendations.md:576:**Solution**: Add `offset` parameter to `memory_search`:
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/042-post-merge-refinement-5/recommendations.md:578:memory_search({ query: "...", limit: 10, offset: 20 })
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/078-speckit-test-suite/files-changed.md:40:  - Tests `memory_search` - vector search, keyword fallback, filters
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/research/qa/qa-13-alignment-drift.md:410:.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/012-perfect-session-capturing/scratch/remediation-manifest.md:11:| #1 | Session ID used `Math.random()` -- weak randomness, predictable IDs | session-extractor.ts | DONE |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/018-generate-context-fix/scratch/legacy-memory-quarantine/17-12-25_07-37__generate-context-fix.md:284:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "005-memory/010-generate-context-fix" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/018-generate-context-fix/scratch/legacy-memory-quarantine/17-12-25_07-37__generate-context-fix.md:289:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/078-speckit-test-suite/tasks.md:47:  - Tests: memory_save, memory_search, memory_match_triggers, anchors, errors
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/031-comprehensive-bug-fix/checklist.md:101:- [x] memory_search returns results *(Verified by Agent 6)*
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/078-speckit-test-suite/spec.md:102:| REQ-002 | Memory MCP handler tests | ~500 LOC covering all 8 handlers (memory_search, memory_match_triggers, memory_save, memory_delete, etc.) with 17 tool coverage |
.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/research/qa/qa-10-p3-and-regressions.md:210:### FINDING-02: Stateless alignment check now hard-fails on a weak filename heuristic
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/050-security-doc-remediation/implementation-summary.md:121:# memory_search works  
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/050-security-doc-remediation/implementation-summary.md:122:memory_search({ query: "security" })  # Returns: 3 results with similarity scores
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/072-speckit-template-memory-ranking-release/scans/spec-069-tests.md:155:   - Test memory_search() with tier filtering
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/084-generate-context-template-warnings/scratch/legacy-memory-quarantine/03-02-26_19-40__generate-context-template-warnings.md:274:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/084-generate-context-template-warnings" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/084-generate-context-template-warnings/scratch/legacy-memory-quarantine/03-02-26_19-40__generate-context-template-warnings.md:286:memory_search({ specFolder: "003-memory-and-spec-kit/084-generate-context-template-warnings", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/084-generate-context-template-warnings/scratch/legacy-memory-quarantine/03-02-26_19-40__generate-context-template-warnings.md:292:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/084-generate-context-template-warnings/scratch/legacy-memory-quarantine/03-02-26_19-40__generate-context-template-warnings.md:301:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/078-speckit-test-suite/plan.md:229:- memory_search with various query types
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/018-generate-context-fix/scratch/legacy-memory-quarantine/17-12-25_07-43__generate-context-fix.md:367:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "005-memory/010-generate-context-fix" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/018-generate-context-fix/scratch/legacy-memory-quarantine/17-12-25_07-43__generate-context-fix.md:372:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/031-comprehensive-bug-fix/scratch/legacy-memory-quarantine/24-12-25_19-52__comprehensive-bug-fix.md:240:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "005-memory/018-comprehensive-bug-fix" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/031-comprehensive-bug-fix/scratch/legacy-memory-quarantine/24-12-25_19-52__comprehensive-bug-fix.md:245:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/078-speckit-test-suite/checklist.md:107:- [x] CHK-013 [P0] P0 handler tests: `memory_search`
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/078-speckit-test-suite/checklist.md:108:  - Evidence: `test-memory-handlers.js` includes memory_search handler tests
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/065-anchor-system-implementation/tasks.md:25:- [x] Update `memory_search` schema in `context-server.js`
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/031-comprehensive-bug-fix/tasks.md:34:- [ ] P2-003: Fix memory_search schema documentation
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/084-generate-context-template-warnings/scratch/legacy-memory-quarantine/03-02-26_19-39__generate-context-template-warnings.md:274:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/084-generate-context-template-warnings" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/084-generate-context-template-warnings/scratch/legacy-memory-quarantine/03-02-26_19-39__generate-context-template-warnings.md:286:memory_search({ specFolder: "003-memory-and-spec-kit/084-generate-context-template-warnings", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/084-generate-context-template-warnings/scratch/legacy-memory-quarantine/03-02-26_19-39__generate-context-template-warnings.md:292:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/084-generate-context-template-warnings/scratch/legacy-memory-quarantine/03-02-26_19-39__generate-context-template-warnings.md:301:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/018-generate-context-fix/scratch/legacy-memory-quarantine/16-02-26_14-50__implementation-summary.md:243:- **Tools verified:** memory_stats, memory_search, memory_load, memory_match_triggers, memory_list, memory_update, memory_validate, memory_save, memory_index_scan, checkpoint_create, checkpoint_list, checkpoint_restore, checkpoint_delete
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/018-generate-context-fix/scratch/legacy-memory-quarantine/16-02-26_14-50__implementation-summary.md:433:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "** 005-memory/010-generate-context-fix" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/018-generate-context-fix/scratch/legacy-memory-quarantine/16-02-26_14-50__implementation-summary.md:438:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/065-anchor-system-implementation/scratch/legacy-memory-quarantine/15-01-26_13-59__anchor-system-implementation.md:236:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/065-anchor-system-implementation" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/065-anchor-system-implementation/scratch/legacy-memory-quarantine/15-01-26_13-59__anchor-system-implementation.md:241:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/084-generate-context-template-warnings/scratch/legacy-memory-quarantine/03-02-26_19-50__generate-context-template-warnings.md:274:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/084-generate-context-template-warnings" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/084-generate-context-template-warnings/scratch/legacy-memory-quarantine/03-02-26_19-50__generate-context-template-warnings.md:286:memory_search({ specFolder: "003-memory-and-spec-kit/084-generate-context-template-warnings", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/084-generate-context-template-warnings/scratch/legacy-memory-quarantine/03-02-26_19-50__generate-context-template-warnings.md:292:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/084-generate-context-template-warnings/scratch/legacy-memory-quarantine/03-02-26_19-50__generate-context-template-warnings.md:301:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/065-anchor-system-implementation/implementation-summary.md:29:- Updated `memory_search` tool schema to accept optional `anchors: string[]`.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/065-anchor-system-implementation/scratch/legacy-memory-quarantine/15-01-26_13-31__anchor-system-implementation.md:268:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/065-anchor-system-implementation" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/065-anchor-system-implementation/scratch/legacy-memory-quarantine/15-01-26_13-31__anchor-system-implementation.md:273:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/018-generate-context-fix/scratch/legacy-memory-quarantine/17-12-25_07-34__generate-context-fix.md:168:rootCause: Script falls back to simulation mode when CONFIG.DATA_FILE is null (line 555-575); solution: AI agent must create JSON with sessionSummary, keyDecisions, filesModified, triggerPhrases; scriptPath: .opencode/skills/workflows-memory/scripts/generate-context.js; mcpToolsTested: memory_stats, memory_search, memory_load, memory_match_triggers, memory_list, memory_update, memory_validate, memory_save, memory_index_scan, checkpoint_create, checkpoint_list, checkpoint_delete (14 total); docFixCount: 20+ path corrections in README.md and INSTALL_GUIDE.md
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/018-generate-context-fix/scratch/legacy-memory-quarantine/17-12-25_07-34__generate-context-fix.md:327:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "005-memory/010-generate-context-fix" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/018-generate-context-fix/scratch/legacy-memory-quarantine/17-12-25_07-34__generate-context-fix.md:332:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/036-post-merge-refinement-1/analysis_findings.md:69:   - Action: Replace the reference with `semantic_memory_memory_search({ includeContent: true })` (or equivalent) and audit for any other phantom tools.
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/065-anchor-system-implementation/scratch/legacy-memory-quarantine/15-01-26_13-32__anchor-system-implementation.md:272:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/065-anchor-system-implementation" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/065-anchor-system-implementation/scratch/legacy-memory-quarantine/15-01-26_13-32__anchor-system-implementation.md:277:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/042-post-merge-refinement-5/checklist.md:402:| CHK095 | [P2] offset parameter added to memory_search | |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/042-post-merge-refinement-5/checklist.md:406:- [ ] CHK095 [P2] offset parameter added to memory_search
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/084-generate-context-template-warnings/scratch/legacy-memory-quarantine/03-02-26_19-44__from-anobel.md:428:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/084-generate-context-template-warnings" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/084-generate-context-template-warnings/scratch/legacy-memory-quarantine/03-02-26_19-44__from-anobel.md:440:memory_search({ specFolder: "003-memory-and-spec-kit/084-generate-context-template-warnings", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/084-generate-context-template-warnings/scratch/legacy-memory-quarantine/03-02-26_19-44__from-anobel.md:446:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/084-generate-context-template-warnings/scratch/legacy-memory-quarantine/03-02-26_19-44__from-anobel.md:455:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/018-generate-context-fix/implementation-summary.md:36:- Verified via `memory_search()` - returned 5 results with 81-84% similarity scores
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/018-generate-context-fix/implementation-summary.md:90:- `memory_search()` - query, limit, tier, contextType, specFolder, useDecay, includeContiguity, concepts
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/084-generate-context-template-warnings/scratch/legacy-memory-quarantine/03-02-26_19-44__generate-context-template-warnings.md:274:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/084-generate-context-template-warnings" })` |
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/084-generate-context-template-warnings/scratch/legacy-memory-quarantine/03-02-26_19-44__generate-context-template-warnings.md:286:memory_search({ specFolder: "003-memory-and-spec-kit/084-generate-context-template-warnings", limit: 10 })
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/084-generate-context-template-warnings/scratch/legacy-memory-quarantine/03-02-26_19-44__generate-context-template-warnings.md:292:memory_search({ query: "orphaned", anchors: ["state"] })
.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/084-generate-context-template-warnings/scratch/legacy-memory-quarantine/03-02-26_e isolation, parallel development - **Commit**: Conventional commit format, staged change analysis, clean commit messages - **Finish**: PR creation, branch cleanup, integration workflows **Trigger Keywords:** worktree, branch, commit, merge, pr, pull request, git workflow, conventional commits, finish work, integrate changes **Invocation:** Automatic via Gate 2 routing when git tasks detected, or manually via `Read(".opencode/skills/sk-git/SKILL.md")`. ## Skills A skill is a set of local instructions to follow that is stored in a `SKILL.md` file. Below is the list of skills that can be used. Each entry includes a name, description, and file path so you can open the source for full instructions when using a specific skill. ### Available skills - cli-claude-code: Claude Code CLI orchestrator enabling external AI assistants (Gemini, Codex, Copilot) to invoke Anthropic's Claude Code CLI for supplementary tasks including deep reasoning, code editing, structured output, code review, agent delegation, and extended thinking. (file: /Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/cli-claude-code/SKILL.md) - cli-codex: Codex CLI orchestrator enabling any AI assistant to invoke OpenAI's Codex CLI for supplementary AI tasks including code generation, code review, web research, codebase analysis, cross-AI validation, and parallel task processing. (file: /Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/cli-codex/SKILL.md) - cli-copilot: GitHub Copilot CLI orchestrator enabling external AI assistants to invoke the standalone 'copilot' binary for supplementary tasks including collaborative planning, cloud delegation, versatile code generation, and autonomous task execution. (file: /Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/cli-copilot/SKILL.md) - cli-gemini: Gemini CLI orchestrator enabling any AI assistant to invoke Google's Gemini CLI for supplementary AI tasks including code generation, web research via Google Search, codebase architecture analysis, cross-AI validation, and parallel task processing. (file: /Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/cli-gemini/SKILL.md) - mcp-chrome-devtools: Chrome DevTools orchestrator providing intelligent routing between CLI (bdg) and MCP (Code Mode) approaches. CLI prioritized for speed and token efficiency; MCP fallback for multi-tool integration scenarios. (file: /Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/mcp-chrome-devtools/SKILL.md) - mcp-clickup: ClickUp project management orchestrator providing intelligent routing between CLI (cu) and MCP (Code Mode) approaches. CLI prioritized for speed and token efficiency; MCP for enterprise features like docs, goals, webhooks, and bulk operations. (file: /Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/mcp-clickup/SKILL.md) - mcp-code-mode: MCP orchestration via TypeScript execution for efficient multi-tool workflows. Use Code Mode for ALL MCP tool calls (ClickUp, Notion, Figma, Webflow, Chrome DevTools, etc.). Provides 98.7% context reduction, 60% faster execution, and type-safe invocation. Mandatory for external tool integration. (file: /Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/mcp-code-mode/SKILL.md) - mcp-figma: Figma design file access via MCP providing 18 tools for file retrieval, image export, component/style extraction, team management, and collaborative commenting. Accessed via Code Mode for token-efficient workflows. (file: /Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/mcp-figma/SKILL.md) - sk-code-full-stack: Stack-agnostic development orchestrator guiding developers through implementation, testing, and verification phases with automatic stack detection via marker files and bundled stack-specific knowledge. (file: /Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/sk-code-full-stack/SKILL.md) - sk-code-opencode: Multi-language code standards for OpenCode system code (JavaScript, TypeScript, Python, Shell, JSON/JSONC) with language detection routing, universal patterns, and quality checklists. (file: /Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/sk-code-opencode/SKILL.md) - sk-code-review: Stack-agnostic code review baseline skill with findings-first severity analysis, mandatory security/correctness minimums, and adaptive overlay compatibility with sk-code-opencode, sk-code-web, and sk-code-full-stack standards. (file: /Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/sk-code-review/SKILL.md) - sk-code-web: Orchestrator guiding developers through implementation, debugging, and verification phases across specialized code quality skills (project) (file: /Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/sk-code-web/SKILL.md) - sk-doc: Unified markdown and OpenCode component specialist providing document quality enforcement, content optimization, component creation workflows (skills, agents, commands), ASCII flowcharts and install guides. (file: /Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/sk-doc/SKILL.md) - sk-git: Git workflow orchestrator guiding developers through workspace setup, clean commits, and work completion across git-worktrees, git-commit, and git-finish skills (file: /Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/sk-git/SKILL.md) - sk-improve-prompt: Prompt engineering specialist that transforms vague requests into structured, scored AI prompts using 7 proven frameworks (RCAF, COSTAR, RACE, CIDI, TIDD-EC, CRISPE, CRAFT), DEPTH thinking methodology, and CLEAR scoring across text modes. (file: /Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/sk-improve-prompt/SKILL.md) - system-spec-kit: Unified documentation and context preservation: spec folder workflow (levels 1-3+), CORE + ADDENDUM template architecture (v2.2), validation, and Spec Kit Memory for context preservation. Mandatory for all file modifications. (file: /Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/system-spec-kit/SKILL.md) - openai-docs: Use when the user asks how to build with OpenAI products or APIs and needs up-to-date official documentation with citations, help choosing the latest model for a use case, or explicit GPT-5.4 upgrade and prompt-upgrade guidance; prioritize OpenAI docs MCP tools, use bundled references only as helper context, and restrict any fallback browsing to official OpenAI domains. (file: /Users/michelkerkmeester/.codex/skills/.system/openai-docs/SKILL.md) - skill-creator: Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Codex's capabilities with specialized knowledge, workflows, or tool integrations. (file: /Users/michelkerkmeester/.codex/skills/.system/skill-creator/SKILL.md) - skill-installer: Install Codex skills into $CODEX_HOME/skills from a curated list or a GitHub repo path. Use when a user asks to list installable skills, install a curated skill, or install a skill from another repo (including private repos). (file: /Users/michelkerkmeester/.codex/skills/.system/skill-installer/SKILL.md) ### How to use skills - Discovery: The list above is the skills available in this session (name + description + file path). Skill bodies live on disk at the listed paths. - Trigger rules: If the user names a skill (with `$SkillName` or plain text) OR the task clearly matches a skill's description shown above, you must use that skill for that turn. Multiple mentions mean use them all. Do not carry skills across turns unless re-mentioned. - Missing/blocked: If a named skill isn't in the list or the path can't be read, say so briefly and continue with the best fallback. - How to use a skill (progressive disclosure): 1) After deciding to use a skill, open its `SKILL.md`. Read only enough to follow the workflow. 2) When `SKILL.md` references relative paths (e.g., `scripts/foo.py`), resolve them relative to the skill directory listed above first, and only consider other paths if needed. 3) If `SKILL.md` points to extra folders such as `references/`, load only the specific files needed for the request; don't bulk-load everything. 4) If `scripts/` exist, prefer running or patching them instead of retyping large code blocks. 5) If `assets/` or templates exist, reuse them instead of recreating from scratch. - Coordination and sequencing: - If multiple skills apply, choose the minimal set that covers the request and state the order you'll use them. - Announce which skill(s) you're using and why (one short line). If you skip an obvious skill, say why. - Context hygiene: - Keep context small: summarize long sections instead of pasting them; only load extra files when needed. - Avoid deep reference-chasing: prefer opening only files directly linked from `SKILL.md` unless you're blocked. - When variants exist (frameworks, providers, domains), pick only the relevant reference file(s) and note that choice. - Safety and fallback: If a skill can't be applied cleanly (missing files, unclear instructions), state the issue, pick the next-best approach, and continue. Files called AGENTS.md commonly appear in many places inside a container - at "/", in "~", deep within git repositories, or in any other directory; their location is not limited to version-controlled folders. Their purpose is to pass along human guidance to you, the agent. Such guidance can include coding standards, explanations of the project layout, steps for building or testing, and even wording that must accompany a GitHub pull-request description produced by the agent; all of it is to be followed. Each AGENTS.md governs the entire directory that contains it and every child directory beneath that point. Whenever you change a file, you have to comply with every AGENTS.md whose scope covers that file. Naming conventions, stylistic rules and similar directives are restricted to the code that falls inside that scope unless the document explicitly states otherwise. When two AGENTS.md files disagree, the one located deeper in the directory structure overrides the higher-level file, while instructions given directly in the prompt by the system, developer, or user outrank any AGENTS.md content.   /Users/michelkerkmeester/MEGA/Development/Opencode Env/Public zsh 2026-03-16 Europe/Amsterdam
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/S1/cli-codex-1/output.txt:418:.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/004-opencode-mnemosyne-main/research/iterations/iteration-036.md:2970:/bin/zsh -lc 'rg -n "/spec_kit:resume|/memory:save|memory_context|memory_match_triggers|memory_search|generate-context" .opencode/skills/system-spec-kit/references .opencode/skills/system-spec-kit/scripts .opencode/skills/system-spec-kit/feature_catalog' in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/S1/cli-codex-1/output.txt:519:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/000-release-cleanup/001-memory-terminology/spec.md:94:- **Tool, command, frontmatter, table, file, and folder names** — `memory_search`, `memory_save`, `/memory:save`, `/memory:learn`, `_memory.continuity`, `memory_index` SQL table, `memory-search.ts` handler files, `references/memory/` folder, `scripts/dist/memory/` folder — all stay exactly as-is. The prior research output (archived) recommended a rename; the user explicitly scoped that out.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/S1/cli-codex-1/output.txt:550:.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/004-opencode-mnemosyne-main/research/research.md:249646:/bin/zsh -lc 'rg -n "/spec_kit:resume|/memory:save|memory_context|memory_match_triggers|memory_search|generate-context" .opencode/skills/system-spec-kit/references .opencode/skills/system-spec-kit/scripts .opencode/skills/system-spec-kit/feature_catalog' in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/S1/cli-codex-1/output.txt:609:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/000-release-cleanup/001-memory-terminology/research_archive/rename-pivot-2026-04-26-pt-01/001-memory-terminology-pt-01/iterations/iteration-001.md:17:5. **Anthropic's Claude Memory tool primary terminology is narrow and well-bounded.** Verbatim noun phrases used by Anthropic: "memory tool", "memory file directory", "memory directory", "memory operations", "memory commands" (the six are `view`, `create`, `str_replace`, `insert`, `delete`, `rename`), "memory artifacts", "memory store", "memory backend", "/memories" (the canonical container path), "memory_20250818" (the API beta tool type identifier), and "memory tool helpers". The conceptual layers are: (1) the LLM tool surface (`tools: [{type: "memory_20250818", name: "memory"}]`), (2) the client-side handler implementation (`BetaAbstractMemoryTool` / `betaMemoryTool`), and (3) the on-disk container (`/memories`). Anthropic does NOT use the terms `continuity`, `spec doc`, `packet`, `handover`, `recovery ladder`, `causal graph`, or `lineage` — none of our internal vocabulary collides downward. The collision surface is bidirectional and asymmetric: any of our identifiers that contain the bare token `memory` (especially `memory_save`, `memory_search`, `memory_context`, `memory_match_triggers`, `/memory:save`, `/memory:search`, `_memory.continuity`) will read in our READMEs as if they refer to Anthropic's tool. The reverse is not true — Anthropic's `memory_20250818` is dated and clearly Anthropic-branded. This means the rename's collision-mitigation work falls entirely on the local side; we do NOT need a defensive Anthropic-side disambiguation strategy beyond a one-line positioning callout. [SOURCE: https://platform.claude.com/docs/en/docs/agents-and-tools/tool-use/memory-tool]
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/S1/cli-codex-1/output.txt:612:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/000-release-cleanup/001-memory-terminology/research_archive/rename-pivot-2026-04-26-pt-01/001-memory-terminology-pt-01/iterations/iteration-002.md:47:4. **The agent-def class is dominated by 4 tools and shows a clean cliff at the rest.** Of 16 agent-def files (`.claude/agents/*.md` + `.opencode/agents/*.md`) that reference any memory tool, the class count distribution is: `memory_context`=52, `memory_search`=42, `memory_match_triggers`=34, `memory_list`=10, `memory_stats`=4, `memory_save`=0, all 15 others=0. The cliff between `memory_stats` (4) and the next non-zero (`memory_list`=10) is shallow but the cliff from `memory_list` (10) down to all 15 zero-counts is total. Sample quotes confirm context (e.g., `.claude/agents/deep-review.md:` `"Do NOT redundantly call memory_context or memory_match_triggers for the same information"`) — these are operator-instruction quotes, not casual mentions. `memory_save` having `a=0` is interesting: agent definitions never invoke save directly; saves are routed through `/memory:save` slash command. This means `memory_save` is a top-doc-tier quote (CLAUDE.md MEMORY SAVE RULE) but not an agent-def-tier quote. Tiering still places it as T1 because top-doc presence + skill-docs intensity (164) + handover quotes (4) carry it. [SOURCE: `.claude/agents/deep-review.md`, `.claude/agents/context.md`, plus 14 other agent files; per-file-class grep iteration 2]
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/S1/cli-codex-1/output.txt:623:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/review/016-foundational-runtime-pt-01/iterations/iteration-004.md:103:2. **`description.json.lastUpdated` has no auto-refresh mechanism; the drift observed in R3-P2-001 is the predictable outcome of an infrastructure gap, not a one-off lapse** — `.opencode/skills/system-spec-kit/scripts/dist/memory/generate-context.js` (grep: zero `lastUpdated` references), `.git/hooks/` (all `.sample`, zero active), `.opencode/skills/system-spec-kit/scripts/dist/memory/*.js` (zero hits across all 9 dist scripts) — R3-P2-001 documented the drift between `description.json.lastUpdated: 2026-04-16T21:45:00Z` and `graph-metadata.json.last_save_at: 2026-04-17T11:20:00Z`. This iteration confirms the **root cause**: no code path in `generate-context.js` writes `lastUpdated`, no git hook refreshes either file on commit, and the `.githooks`/`.husky` directories do not exist. The drift is guaranteed to recur every time a spec folder's code lands but the corresponding `/memory:save` is not explicitly run. Because `description.json` is cited in `graph-metadata.json.authoritativeSources` and is consumed by `memory_search` / `skill_advisor` / continuity recovery flows, any consumer that reads `description.json` as its source-of-truth for "current folder state" gets a stale snapshot whenever the auto-save cadence falls behind commit cadence. Classified P1 because this is the direct maintainability root cause of an already-flagged P2 traceability finding AND because the fix requires new infrastructure (a post-commit hook or a `lastUpdated` writer in `generate-context.js`), not just a one-line docs tweak. Reinforces the R3 theme that canonical-save-surface hygiene is inconsistent.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/S1/cli-codex-1/output.txt:625:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/000-release-cleanup/001-memory-terminology/research_archive/rename-pivot-2026-04-26-pt-01/001-memory-terminology-pt-01/findings-registry.json:74:      "text": "**Anthropic's Claude Memory tool primary terminology is narrow and well-bounded.** Verbatim noun phrases used by Anthropic: \"memory tool\", \"memory file directory\", \"memory directory\", \"memory operations\", \"memory commands\" (the six are `view`, `create`, `str_replace`, `insert`, `delete`, `rename`), \"memory artifacts\", \"memory store\", \"memory backend\", \"/memories\" (the canonical container path), \"memory_20250818\" (the API beta tool type identifier), and \"memory tool helpers\". The conceptual layers are: (1) the LLM tool surface (`tools: [{type: \"memory_20250818\", name: \"memory\"}]`), (2) the client-side handler implementation (`BetaAbstractMemoryTool` / `betaMemoryTool`), and (3) the on-disk container (`/memories`). Anthropic does NOT use the terms `continuity`, `spec doc`, `packet`, `handover`, `recovery ladder`, `causal graph`, or `lineage` — none of our internal vocabulary collides downward. The collision surface is bidirectional and asymmetric: any of our identifiers that contain the bare token `memory` (especially `memory_save`, `memory_search`, `memory_context`, `memory_match_triggers`, `/memory:save`, `/memory:search`, `_memory.continuity`) will read in our READMEs as if they refer to Anthropic's tool. The reverse is not true — Anthropic's `memory_20250818` is dated and clearly Anthropic-branded. This means the rename's collision-mitigation work falls entirely on the local side; we do NOT need a defensive Anthropic-side disambiguation strategy beyond a one-line positioning callout. [SOURCE: https://platform.claude.com/docs/en/docs/agents-and-tools/tool-use/memory-tool]",
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/S1/cli-codex-1/output.txt:626:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/000-release-cleanup/001-memory-terminology/research_archive/rename-pivot-2026-04-26-pt-01/001-memory-terminology-pt-01/findings-registry.json:259:      "text": "**The agent-def class is dominated by 4 tools and shows a clean cliff at the rest.** Of 16 agent-def files (`.claude/agents/*.md` + `.opencode/agents/*.md`) that reference any memory tool, the class count distribution is: `memory_context`=52, `memory_search`=42, `memory_match_triggers`=34, `memory_list`=10, `memory_stats`=4, `memory_save`=0, all 15 others=0. The cliff between `memory_stats` (4) and the next non-zero (`memory_list`=10) is shallow but the cliff from `memory_list` (10) down to all 15 zero-counts is total. Sample quotes confirm context (e.g., `.claude/agents/deep-review.md:` `\"Do NOT redundantly call memory_context or memory_match_triggers for the same information\"`) — these are operator-instruction quotes, not casual mentions. `memory_save` having `a=0` is interesting: agent definitions never invoke save directly; saves are routed through `/memory:save` slash command. This means `memory_save` is a top-doc-tier quote (CLAUDE.md MEMORY SAVE RULE) but not an agent-def-tier quote. Tiering still places it as T1 because top-doc presence + skill-docs intensity (164) + handover quotes (4) carry it. [SOURCE: `.claude/agents/deep-review.md`, `.claude/agents/context.md`, plus 14 other agent files; per-file-class grep iteration 2]",
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/S1/cli-codex-1/output.txt:942:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/001-search-scenario-design/spec.md:138:- **Target tools**: `memory_search`, `memory_match_triggers` (trigger phrase "planner-first" should hit)
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/S1/cli-codex-1/output.txt:1142:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/iterations/iteration-006.md:25:This seam is weaker than the public surface suggests in two different ways. First, the assistive lane is not actually independent of TM-06/planner mode; the planner-first default disables it before similarity search even runs. Second, even when the lane does run, its highest-severity tier is advisory-only, so the system advertises an "auto-merge" outcome that never materializes in live write behavior.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/S1/cli-codex-1/output.txt:1170:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/iterations/iteration-037.md:30:- **Downstream Impact:** A concurrent insert/update can make the main planner miss a candidate that the later assistive pass does see, so the same request can persist as a normal complement while also returning a late review recommendation against a newer candidate universe. That weakens the auditability of save responses and makes stale duplicate creation harder to distinguish from intentional keep-separate behavior.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/S1/cli-codex-1/output.txt:1233:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/findings-registry.json:2204:      "downstream_impact": "A concurrent insert/update can make the main planner miss a candidate that the later assistive pass does see, so the same request can persist as a normal complement while also returning a late review recommendation against a newer candidate universe. That weakens the auditability of save responses and makes stale duplicate creation harder to distinguish from intentional keep-separate behavior."
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/S1/cli-codex-1/output.txt:1631:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/001-search-scenario-design/spec.md:138:- **Target tools**: `memory_search`, `memory_match_triggers` (trigger phrase "planner-first" should hit)
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-opencode-1/score.md:6:| Tool Selection | 0 | Used cocoindex/memory tools but apparently retrieved hallucinated context (or LLM filled in plausible-sounding paths from training) |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-opencode-1/score.md:12:**Notable**: MAJOR FINDING: opencode (with full MCP) catastrophically hallucinated when the user prompt was vague AND the canonical packet wasn't in the immediate context. Asks 'what kind of search bug?' — sign of not retrieving 005 cleanly. This contradicts 005/REQ-008 (folder-discovery should not auto-bind on weak signal) — instead, the model invented packets when the routing failed.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-opencode-1/score.md:21:| Tool Selection | 0 | Used cocoindex/memory tools but apparently retrieved hallucinated context (or LLM filled in plausible-sounding paths from training) |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-opencode-1/output.txt:4:{"type":"tool_use","timestamp":1777229033253,"sessionID":"ses_234e554ccffeW0TNHKymcQvFwX","part":{"id":"prt_dcb1ae9c1001L9JJpkAmhnioFi","messageID":"msg_dcb1aad2f001RIUVdNZBZSsqf4","sessionID":"ses_234e554ccffeW0TNHKymcQvFwX","type":"tool","tool":"cocoindex_code_search","callID":"call_01_SUNvobEzGDBqgumNAXVW0BSR","state":{"status":"completed","input":{"query":"search functionality implementation","limit":5},"output":"{\n  \"success\": true,\n  \"results\": [\n    {\n      \"file_path\": \".gemini/specs/02--system-spec-kit/022-hybrid-rag-fusion/system-spec-kit/mcp_server/lib/search/README.md\",\n      \"language\": \"markdown\",\n      \"content\": \"## 1. OVERVIEW\\n<!-- ANCHOR:overview -->\\n\\nThe search subsystem provides production-grade hybrid search capabilities with multiple retrieval methods fused via RRF scoring. It handles query expansion, intent classification, typo tolerance and optional cross-encoder reranking.\\n\\n**Core Capabilities:**\",\n      \"start_line\": 35,\n      \"end_line\": 40,\n      \"score\": 0.5830114693717245\n    },\n    {\n      \"file_path\": \".gemini/skills/system-spec-kit/mcp_server/lib/search/README.md\",\n      \"language\": \"markdown\",\n      \"content\": \"## 1. OVERVIEW\\n<!-- ANCHOR:overview -->\\n\\nThe search subsystem provides production-grade hybrid search capabilities with multiple retrieval methods fused via RRF scoring. It handles query expansion, intent classification, typo tolerance and optional cross-encoder reranking.\\n\\n**Core Capabilities:**\",\n      \"start_line\": 35,\n      \"end_line\": 40,\n      \"score\": 0.5830114693717245\n    },\n    {\n      \"file_path\": \"specs/02--system-spec-kit/022-hybrid-rag-fusion/system-spec-kit/mcp_server/lib/search/README.md\",\n      \"language\": \"markdown\",\n      \"content\": \"## 1. OVERVIEW\\n<!-- ANCHOR:overview -->\\n\\nThe search subsystem provides production-grade hybrid search capabilities with multiple retrieval methods fused via RRF scoring. It handles query expansion, intent classification, typo tolerance and optional cross-encoder reranking.\\n\\n**Core Capabilities:**\",\n      \"start_line\": 35,\n      \"end_line\": 40,\n      \"score\": 0.5830114693717245\n    },\n    {\n      \"file_path\": \".opencode/skills/system-spec-kit/mcp_server/lib/search/README.md\",\n      \"language\": \"markdown\",\n      \"content\": \"## 1. OVERVIEW\\n<!-- ANCHOR:overview -->\\n\\nThe search subsystem provides production-grade hybrid search capabilities with multiple retrieval methods fused via RRF scoring. It handles query expansion, intent classification, typo tolerance and optional cross-encoder reranking.\\n\\n**Core Capabilities:**\",\n      \"start_line\": 35,\n      \"end_line\": 40,\n      \"score\": 0.5830114693717245\n    },\n    {\n      \"file_path\": \".agents/specs/02--system-spec-kit/022-hybrid-rag-fusion/system-spec-kit/mcp_server/lib/search/README.md\",\n      \"language\": \"markdown\",\n      \"content\": \"## 1. OVERVIEW\\n<!-- ANCHOR:overview -->\\n\\nThe search subsystem provides production-grade hybrid search capabilities with multiple retrieval methods fused via RRF scoring. It handles query expansion, intent classification, typo tolerance and optional cross-encoder reranking.\\n\\n**Core Capabilities:**\",\n      \"start_line\": 35,\n      \"end_line\": 40,\n      \"score\": 0.5830114693717245\n    }\n  ],\n  \"total_returned\": 5,\n  \"offset\": 0,\n  \"message\": null\n}","metadata":{"truncated":false},"title":"","time":{"start":1777229032774,"end":1777229033252},"attachments":[]}}}
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-opencode-1/output.txt:5:{"type":"tool_use","timestamp":1777229034925,"sessionID":"ses_234e554ccffeW0TNHKymcQvFwX","part":{"id":"prt_dcb1aef22001GBPHhc3FqhG4p9","messageID":"msg_dcb1aad2f001RIUVdNZBZSsqf4","sessionID":"ses_234e554ccffeW0TNHKymcQvFwX","type":"tool","tool":"spec_kit_memory_memory_search","callID":"call_02_cFMv354bllHRHx349UC7Rcio","state":{"status":"completed","input":{"query":"search bug debugging","limit":5},"output":"{\n  \"summary\": \"Found 5 memories\",\n  \"data\": {\n    \"searchType\": \"hybrid\",\n    \"count\": 1,\n    \"constitutionalCount\": 0,\n    \"requestQuality\": {\n      \"label\": \"weak\"\n    },\n    \"recovery\": {\n      \"status\": \"low_confidence\",\n      \"reason\": \"knowledge_gap\",\n      \"suggestedQueries\": [],\n      \"recommendedAction\": \"ask_user\"\n    },\n    \"stateStats\": {\n      \"minState\": \"\",\n      \"before\": {\n        \"UNKNOWN\": 5\n      },\n      \"after\": {\n        \"UNKNOWN\": 5\n      },\n      \"removed\": 0\n    },\n    \"featureFlags\": {\n      \"trmEnabled\": true,\n      \"multiQueryEnabled\": true,\n      \"stateLimitsApplied\": false\n    },\n    \"pipelineMetadata\": {\n      \"stage1\": {\n        \"searchType\": \"hybrid\",\n        \"channelCount\": 1,\n        \"activeChannels\": 2,\n        \"candidateCount\": 7,\n        \"constitutionalInjected\": 2,\n        \"durationMs\": 316\n      },\n      \"stage2\": {\n        \"sessionBoostApplied\": \"off\",\n        \"causalBoostApplied\": \"applied\",\n        \"intentWeightsApplied\": \"off\",\n        \"artifactRoutingApplied\": \"applied\",\n        \"feedbackSignalsApplied\": \"off\",\n        \"graphContribution\": {\n          \"killSwitchActive\": false,\n          \"causalBoosted\": 1,\n          \"coActivationBoosted\": 0,\n          \"communityInjected\": 0,\n          \"graphSignalsBoosted\": 0,\n          \"totalGraphInjected\": 0,\n          \"rolloutState\": \"bounded_runtime\"\n        },\n        \"qualityFiltered\": 0,\n        \"durationMs\": 7,\n        \"recencyFusionApplied\": true,\n        \"recencyFusionBoosted\": 6,\n        \"coActivationApplied\": true,\n        \"graphSignalsApplied\": true\n      },\n      \"stage3\": {\n        \"rerankApplied\": true,\n        \"rerankProvider\": \"cross-encoder\",\n        \"chunkReassemblyStats\": {\n          \"collapsedChunkHits\": 0,\n          \"chunkParents\": 0,\n          \"reassembled\": 0,\n          \"fallback\": 0\n        },\n        \"durationMs\": 275\n      },\n      \"stage4\": {\n        \"stateFiltered\": 0,\n        \"constitutionalInjected\": 2,\n        \"evidenceGapDetected\": false,\n        \"durationMs\": 0\n      },\n      \"timing\": {\n        \"stage1\": 316,\n        \"stage2\": 7,\n        \"stage3\": 275,\n        \"stage4\": 0,\n        \"total\": 598\n      }\n    },\n    \"lexicalPath\": \"fts5\",\n    \"fallbackState\": \"ok\",\n    \"intent\": {\n      \"type\": \"understand\",\n      \"confidence\": 1,\n      \"description\": \"Understanding or exploring the codebase\",\n      \"weightsApplied\": \"off\"\n    },\n    \"artifactRouting\": {\n      \"strategy\": {\n        \"artifactClass\": \"research\",\n        \"semanticWeight\": 0.7,\n        \"keywordWeight\": 0.3,\n        \"recencyBias\": 0.2,\n        \"maxResults\": 5,\n        \"boostFactor\": 1\n      },\n      \"detectedClass\": \"research\",\n      \"confidence\": 0.16666666666666666\n    },\n    \"artifact_routing\": {\n      \"strategy\": {\n        \"artifactClass\": \"research\",\n        \"semanticWeight\": 0.7,\n        \"keywordWeight\": 0.3,\n        \"recencyBias\": 0.2,\n        \"maxResults\": 5,\n        \"boostFactor\": 1\n      },\n      \"detectedClass\": \"research\",\n      \"confidence\": 0.16666666666666666\n    },\n    \"graphContribution\": {\n      \"killSwitchActive\": false,\n      \"causalBoosted\": 1,\n      \"coActivationBoosted\": 0,\n      \"communityInjected\": 0,\n      \"graphSignalsBoosted\": 0,\n      \"totalGraphInjected\": 0,\n      \"rolloutState\": \"bounded_runtime\"\n    },\n    \"graph_contribution\": {\n      \"killSwitchActive\": false,\n      \"causalBoosted\": 1,\n      \"coActivationBoosted\": 0,\n      \"communityInjected\": 0,\n      \"graphSignalsBoosted\": 0,\n      \"totalGraphInjected\": 0,\n      \"rolloutState\": \"bounded_runtime\"\n    },\n    \"rerankMetadata\": {\n      \"reranking_enabled\": true,\n      \"reranking_requested\": true,\n      \"reranking_applied\": true\n    },\n    \"sourceContract\": {\n      \"version\": \"gate-d-reader-ready-v1\",\n      \"archivedTierEnabled\": false,\n      \"legacyFallbackEnabled\": false,\n      \"includeArchivedCompatibility\": \"not_requested\",\n      \"preferredDocumentTypes\": [\n        \"spec_doc\",\n        \"continuity\"\n      ],\n      \"retainedResults\": 5,\n      \"droppedNonCanonicalResults\": 0,\n      \"countsBySourceKind\": {\n        \"spec_doc\": 5,\n        \"continuity\": 0,\n        \"constitutional\": 0\n      }\n    },\n    \"retrievalTrace\": {\n      \"traceId\": \"tr_mog4a38c_bj80hv\",\n      \"query\": \"search bug debugging\",\n      \"intent\": \"understand\",\n      \"stages\": [\n        {\n          \"stage\": \"candidate\",\n          \"timestamp\": 1777229034205,\n          \"inputCount\": 0,\n          \"outputCount\": 0,\n          \"durationMs\": 0,\n          \"metadata\": {\n            \"channel\": \"d2-concept-expansion\",\n            \"originalQuery\": \"search bug debugging\",\n            \"expandedQuery\": \"search bug debugging retrieval query queries lookup semantic\",\n            \"expansionTerms\": [\n              \"retrieval\",\n              \"query\",\n              \"queries\",\n              \"lookup\",\n              \"semantic\"\n            ],\n            \"matchedConcepts\": [\n              \"search\"\n            ]\n          }\n        },\n        {\n          \"stage\": \"candidate\",\n          \"timestamp\": 1777229034205,\n          \"inputCount\": 0,\n          \"outputCount\": 0,\n          \"durationMs\": 0,\n          \"metadata\": {\n            \"channel\": \"d2-concept-routing\",\n            \"matchedConcepts\": [\n              \"search\"\n            ],\n            \"graphActivated\": true\n          }\n        },\n        {\n          \"stage\": \"candidate\",\n          \"timestamp\": 1777229034521,\n          \"inputCount\": 1,\n          \"outputCount\": 7,\n          \"durationMs\": 316,\n          \"metadata\": {\n            \"searchType\": \"hybrid\",\n            \"mode\": null,\n            \"channelCount\": 1,\n            \"deepExpansion\": false,\n            \"r12EmbeddingExpansion\": true\n          }\n        },\n        {\n          \"stage\": \"fusion\",\n          \"timestamp\": 1777229034528,\n          \"inputCount\": 7,\n          \"outputCount\": 5,\n          \"durationMs\": 7,\n          \"metadata\": {\n            \"sessionBoostApplied\": \"off\",\n            \"causalBoostApplied\": \"applied\",\n            \"intentWeightsApplied\": \"off\",\n            \"artifactRoutingApplied\": \"applied\",\n            \"feedbackSignalsApplied\": \"off\",\n            \"graphContribution\": {\n              \"killSwitchActive\": false,\n              \"causalBoosted\": 1,\n              \"coActivationBoosted\": 0,\n              \"communityInjected\": 0,\n              \"graphSignalsBoosted\": 0,\n              \"totalGraphInjected\": 0,\n              \"rolloutState\": \"bounded_runtime\"\n            },\n            \"searchType\": \"hybrid\",\n            \"isHybrid\": true\n          }\n        },\n        {\n          \"stage\": \"rerank\",\n          \"timestamp\": 1777229034800,\n          \"inputCount\": 5,\n          \"outputCount\": 5,\n          \"durationMs\": 272,\n          \"metadata\": {\n            \"rerankApplied\": true,\n            \"provider\": \"cross-encoder\"\n          }\n        },\n        {\n          \"stage\": \"final-rank\",\n          \"timestamp\": 1777229034803,\n          \"inputCount\": 5,\n          \"outputCount\": 5,\n          \"durationMs\": 0,\n          \"metadata\": {\n            \"collapsedChunkHits\": 0,\n            \"chunkParents\": 0,\n            \"reassembled\": 0,\n            \"fallback\": 0\n          }\n        },\n        {\n          \"stage\": \"filter\",\n          \"timestamp\": 1777229034803,\n          \"inputCount\": 5,\n          \"outputCount\": 5,\n          \"durationMs\": 0,\n          \"metadata\": {\n            \"stateFiltered\": 0,\n            \"evidenceGapDetected\": false,\n            \"trmEnabled\": true,\n            \"applyStateLimits\": false,\n            \"minState\": \"\"\n          }\n        }\n      ],\n      \"totalDurationMs\": 595,\n      \"finalResultCount\": 5\n    },\n    \"appliedBoosts\": {\n      \"session\": {\n        \"applied\": \"off\"\n      },\n      \"causal\": {\n        \"applied\": \"applied\"\n      }\n    },\n    \"applied_boosts\": {\n      \"session\": {\n        \"applied\": \"off\"\n      },\n      \"causal\": {\n        \"applied\": \"applied\"\n      }\n    },\n    \"progressiveDisclosure\": {\n      \"summaryLayer\": {\n        \"count\": 5,\n        \"digest\": \"5 weak\"\n      },\n      \"results\": [\n        {\n          \"snippet\": \"\",\n          \"detailAvailable\": false,\n          \"resultId\": \"1745\"\n        },\n        {\n          \"snippet\": \"\",\n          \"detailAvailable\": false,\n          \"resultId\": \"2067\"\n        },\n        {\n          \"snippet\": \"\",\n          \"detailAvailable\": false,\n          \"resultId\": \"1995\"\n        },\n        {\n          \"snippet\": \"\",\n          \"detailAvailable\": false,\n          \"resultId\": \"1992\"\n        },\n        {\n          \"snippet\": \"\",\n          \"detailAvailable\": false,\n          \"resultId\": \"1994\"\n        }\n      ],\n      \"continuation\": null\n    },\n    \"results\": [\n      {\n        \"id\": 1745,\n        \"specFolder\": \"system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/008-bug-fixes-and-data-integrity\",\n        \"filePath\": \"/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/008-bug-fixes-and-data-integrity/description.json\",\n        \"title\": \"Description: Feature Specification: Manual Testing — Bug Fixes and Data Integrity\",\n        \"similarity\": 69.03,\n        \"isConstitutional\": false,\n        \"importanceTier\": \"normal\",\n        \"triggerPhrases\": [],\n        \"createdAt\": \"2026-04-26T14:28:28.148Z\",\n        \"isChunk\": false,\n        \"parentId\": null,\n        \"chunkIndex\": null,\n        \"chunkLabel\": null,\n        \"chunkCount\": null,\n        \"trustBadges\": {\n          \"confidence\": 0.5,\n          \"extractionAge\": \"today\",\n          \"lastAccessAge\": \"never\",\n          \"orphan\": true,\n          \"weightHistoryChanged\": false\n        },\n        \"confidence\": {\n          \"label\": \"medium\",\n          \"value\": 0.477,\n          \"drivers\": [\n            \"large_margin\"\n          ]\n        },\n        \"why\": {\n          \"summary\": \"Ranked first because semantic similarity\",\n          \"topSignals\": [\n            \"semantic_match\"\n          ]\n        }\n      }\n    ],\n    \"evidenceDigest\": \"5 results retrieved; avg score 0.69.\",\n    \"followUps\": []\n  },\n  \"hints\": [\n    \"Use includeContent: true to embed file contents in results\",\n    \"Auto-surface hook: injected 2 constitutional and 5 triggered memories (1ms)\",\n    \"Token budget enforced: truncated 5 → 1 results to fit 3500 token budget\"\n  ],\n  \"meta\": {\n    \"tool\": \"memory_search\",\n    \"tokenCount\": 3507,\n    \"latencyMs\": 607,\n    \"cacheHit\": false,\n    \"responseProfile\": \"research\",\n    \"autoSurface\": {\n      \"constitutionalCount\": 2,\n      \"triggeredCount\": 5,\n      \"surfaced_at\": \"2026-04-26T18:43:54.185Z\",\n      \"latencyMs\": 1\n    },\n    \"autoSurfacedContext\": {\n      \"constitutional\": [\n        {\n          \"id\": 2574,\n          \"specFolder\": \"system-spec-kit\",\n          \"filePath\": \"/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/constitutional/gate-tool-routing.md\",\n          \"title\": \"TOOL ROUTING - Search & Retrieval Decision Tree\",\n          \"importanceTier\": \"constitutional\",\n          \"retrieval_directive\": \"Always surface when: TOOL ROUTING - Search & Retrieval Decision Tree | Prioritize when: task context aligns with \\\"TOOL ROUTING - Search & Retrieval Decision Tree\\\"\"\n        },\n        {\n          \"id\": 415,\n          \"specFolder\": \"system-spec-kit\",\n          \"filePath\": \"/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/constitutional/gate-enforcement.md\",\n          \"title\": \"GATE ENFORCEMENT - Edge Cases & Cross-Reference\",\n          \"importanceTier\": \"constitutional\",\n          \"retrieval_directive\": \"Always surface when: GATE ENFORCEMENT - Edge Cases & Cross-Reference | Prioritize when: task context aligns with \\\"GATE ENFORCEMENT - Edge Cases & Cross-Reference\\\"\"\n        }\n      ],\n      \"triggered\": [\n        {\n          \"memory_id\": 1912,\n          \"spec_folder\": \"system-spec-kit/023-hybrid-rag-fusion-refinement/007-hybrid-search-null-db-fix\",\n          \"title\": \"Research: Memory Search [system-spec-kit/023-hybrid-rag-fusion-refinement/007-hybrid-search-null-db-fix/research]\",\n          \"matched_phrases\": [\n            \"search\"\n          ]\n        },\n        {\n          \"memory_id\": 680,\n          \"spec_folder\": \"system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/003-graph-metadata-validation-research\",\n          \"title\": \"...or/001-memory-search-routing-tuning/003-graph-metadata-validation/research/003-graph-metadata-validation-research/research]\",\n          \"matched_phrases\": [\n            \"search\"\n          ]\n        },\n        {\n          \"memory_id\": 679,\n          \"spec_folder\": \"system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/002-content-routing-accuracy-research\",\n          \"title\": \"...sor/001-memory-search-routing-tuning/002-content-routing-accuracy/research/002-content-routing-accuracy-research/research]\",\n          \"matched_phrases\": [\n            \"search\"\n          ]\n        },\n        {\n          \"memory_id\": 678,\n          \"spec_folder\": \"system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/001-search-fusion-routing-research\",\n          \"title\": \"...advisor/001-memory-search-routing-tuning/001-search-fusion-tuning/research/001-search-fusion-routing-research/research]\",\n          \"matched_phrases\": [\n            \"search\"\n          ]\n        },\n        {\n          \"memory_id\": 144,\n          \"spec_folder\": \"system-spec-kit/026-graph-and-context-optimization/006-search-routing-advisor/001-memory-search-routing-tuning/research/001-search-fusion-routing-research\",\n          \"title\": \"...advisor/001-memory-search-routing-tuning/001-search-fusion-tuning/research/001-search-fusion-routing-research/research]\",\n          \"matched_phrases\": [\n            \"search\"\n          ]\n        }\n      ],\n      \"surfaced_at\": \"2026-04-26T18:43:54.185Z\",\n      \"latencyMs\": 1\n    },\n    \"tokenBudget\": 3500,\n    \"tokenBudgetTruncated\": true,\n    \"originalResultCount\": 5,\n    \"returnedResultCount\": 1\n  }\n}","metadata":{"truncated":false},"title":"","time":{"start":1777229034175,"end":1777229034923},"attachments":[]}}}
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:283:.opencode/skills/sk-deep-research/manual_testing_playbook/04--convergence-and-recovery/022-quality-guard-no-single-weak-source.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:422:.opencode/skills/mcp-coco-index/manual_testing_playbook/07--code-graph-integration/003-session-resume-includes-cocoindex.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:764:.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/09-cocoindex-bridge-context.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1128:.opencode/specs/system-spec-kit/024-compact-code-graph/changelog/changelog-024-012-cocoindex-ux-utilization.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1145:.opencode/specs/system-spec-kit/024-compact-code-graph/changelog/changelog-024-010-cocoindex-bridge-context.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1191:.opencode/skills/system-spec-kit/manual_testing_playbook/22--context-preservation-and-code-graph/255-cocoindex-code-graph-routing.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1356:.opencode/specs/system-spec-kit/024-compact-code-graph/012-cocoindex-ux-utilization/spec.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1357:.opencode/specs/system-spec-kit/024-compact-code-graph/012-cocoindex-ux-utilization/plan.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1387:.opencode/specs/system-spec-kit/024-compact-code-graph/012-cocoindex-ux-utilization/review/deep-review-config.json
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1388:.opencode/skills/system-spec-kit/mcp_server/lib/utils/cocoindex-path.ts
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1422:.opencode/specs/system-spec-kit/024-compact-code-graph/012-cocoindex-ux-utilization/review/iterations/iteration-004.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1423:.opencode/specs/system-spec-kit/024-compact-code-graph/012-cocoindex-ux-utilization/review/iterations/iteration-005.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1424:.opencode/specs/system-spec-kit/024-compact-code-graph/012-cocoindex-ux-utilization/review/iterations/iteration-001.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1425:.opencode/specs/system-spec-kit/024-compact-code-graph/012-cocoindex-ux-utilization/review/iterations/iteration-006.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1426:.opencode/specs/system-spec-kit/024-compact-code-graph/012-cocoindex-ux-utilization/review/iterations/iteration-002.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1427:.opencode/specs/system-spec-kit/024-compact-code-graph/012-cocoindex-ux-utilization/review/iterations/iteration-003.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1428:.opencode/specs/system-spec-kit/024-compact-code-graph/012-cocoindex-ux-utilization/review/iterations/iteration-007.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1429:.opencode/specs/system-spec-kit/024-compact-code-graph/012-cocoindex-ux-utilization/review/iterations/iteration-008.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1430:.opencode/specs/system-spec-kit/024-compact-code-graph/012-cocoindex-ux-utilization/review/deep-review-state.jsonl
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1431:.opencode/specs/system-spec-kit/024-compact-code-graph/012-cocoindex-ux-utilization/review/deep-review-dashboard.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1432:.opencode/specs/system-spec-kit/024-compact-code-graph/012-cocoindex-ux-utilization/review/deep-review-strategy.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1433:.opencode/specs/system-spec-kit/024-compact-code-graph/012-cocoindex-ux-utilization/review/review-report.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1434:.opencode/specs/system-spec-kit/024-compact-code-graph/012-cocoindex-ux-utilization/checklist.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1435:.opencode/specs/system-spec-kit/024-compact-code-graph/012-cocoindex-ux-utilization/tasks.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1436:.opencode/specs/system-spec-kit/024-compact-code-graph/012-cocoindex-ux-utilization/description.json
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1437:.opencode/specs/system-spec-kit/024-compact-code-graph/012-cocoindex-ux-utilization/implementation-summary.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1438:.opencode/specs/system-spec-kit/024-compact-code-graph/012-cocoindex-ux-utilization/graph-metadata.json
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1665:.opencode/specs/system-spec-kit/024-compact-code-graph/010-cocoindex-bridge-context/spec.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1666:.opencode/specs/system-spec-kit/024-compact-code-graph/010-cocoindex-bridge-context/plan.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1697:.opencode/specs/system-spec-kit/024-compact-code-graph/010-cocoindex-bridge-context/review/deep-review-config.json
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1737:.opencode/specs/system-spec-kit/024-compact-code-graph/010-cocoindex-bridge-context/review/iterations/iteration-004.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1738:.opencode/specs/system-spec-kit/024-compact-code-graph/010-cocoindex-bridge-context/review/iterations/iteration-005.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1739:.opencode/specs/system-spec-kit/024-compact-code-graph/010-cocoindex-bridge-context/review/iterations/iteration-001.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1740:.opencode/specs/system-spec-kit/024-compact-code-graph/010-cocoindex-bridge-context/review/iterations/iteration-006.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1741:.opencode/specs/system-spec-kit/024-compact-code-graph/010-cocoindex-bridge-context/review/iterations/iteration-002.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1742:.opencode/specs/system-spec-kit/024-compact-code-graph/010-cocoindex-bridge-context/review/iterations/iteration-003.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1743:.opencode/specs/system-spec-kit/024-compact-code-graph/010-cocoindex-bridge-context/review/iterations/iteration-007.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1744:.opencode/specs/system-spec-kit/024-compact-code-graph/010-cocoindex-bridge-context/review/iterations/iteration-008.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1745:.opencode/specs/system-spec-kit/024-compact-code-graph/010-cocoindex-bridge-context/review/deep-review-state.jsonl
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1746:.opencode/specs/system-spec-kit/024-compact-code-graph/010-cocoindex-bridge-context/review/deep-review-dashboard.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1747:.opencode/specs/system-spec-kit/024-compact-code-graph/010-cocoindex-bridge-context/review/deep-review-strategy.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1748:.opencode/specs/system-spec-kit/024-compact-code-graph/010-cocoindex-bridge-context/review/review-report.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1749:.opencode/specs/system-spec-kit/024-compact-code-graph/010-cocoindex-bridge-context/checklist.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1750:.opencode/specs/system-spec-kit/024-compact-code-graph/010-cocoindex-bridge-context/tasks.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1751:.opencode/specs/system-spec-kit/024-compact-code-graph/010-cocoindex-bridge-context/description.json
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1752:.opencode/specs/system-spec-kit/024-compact-code-graph/010-cocoindex-bridge-context/implementation-summary.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:1753:.opencode/specs/system-spec-kit/024-compact-code-graph/010-cocoindex-bridge-context/graph-metadata.json
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6645:/bin/zsh -lc "rg -n \"search bug|search|query|CocoIndex|coco|memory_search|memory_context|memory_quick_search\" specs .opencode -g '"'!*node_modules*'"' -g '"'!*.png'"' -g '"'!*.jpg'"'" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6661:.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/007-code-audit-per-feature-catalog/spec.md:142:| 1 | `001-retrieval/` | Audit 11 retrieval features (memory_context, memory_search, memory_continue, etc.) | None | Coverage sync required (8M/2P + 1 pending) |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6672:.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/046-post-release-refinement-1/tasks.md:82:- [ ] `memory_search` returns unique results
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6684:.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/025-system-memory-rename/tasks.md:234:  - [x] `memory_search` tool accessible
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6752:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:49:| CocoIndex integration | **USE** — existing semantic layer, complements structural code graph | Iterations 036-045 + CocoIndex skill analysis |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6753:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:50:| CocoIndex ↔ Code Graph bridge | **BUILD** — file-range seeds, 1-hop expansion, reverse semantic augmentation | Iterations 046-055 |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6754:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:51:| Token budget allocation | **FLOORS + OVERFLOW** — constitutional 700, graph 1200, CocoIndex 900, triggered 400, overflow 800 | Iteration 049 |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6758:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:88:- Resume brief lives in **inner** `memory_search` envelope, NOT outer `memory_context` envelope
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6768:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:383:│  │ Memory  │  │  Code    │  │ CocoIndex │  │
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6770:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:392:│       + cocoindex_code search                │
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6771:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:410:│  │ CocoIndex (.cocoindex_code/)         │   │
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6773:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:423:6. **Phase 010**: code_graph_context + CocoIndex bridge — seed normalization, reverse semantic augmentation (3-4 days)
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6776:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:438:| 5 | 046-055 | CocoIndex + Code Graph integration | 0.49-0.76 |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6781:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:473:| 033 | 48 | CocoIndex integration options |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6782:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:486:| 046 | 284 | CocoIndex ↔ Code Graph bridge design |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6783:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:487:| 047 | 70 | tree-sitter ↔ CocoIndex chunk alignment |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6784:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:494:| 054 | 549 | code_graph_context API with CocoIndex seeds |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6785:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:499:## Part VI: CocoIndex Integration Impact
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6786:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:501:### What CocoIndex Already Covers
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6787:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:503:CocoIndex Code is deployed as an MCP server providing semantic code search via vector embeddings:
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6789:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:514:| Build semantic index for code recall | **DROP** | CocoIndex already provides this |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6790:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:515:| Choose code embedding model | **DROP** | CocoIndex uses voyage-code-3 / all-MiniLM-L6-v2 |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6791:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:516:| Implement code chunking for embeddings | **DROP** | CocoIndex handles function-level chunking |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6792:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:517:| Dual-index retrieval (code + text) | **DROP** | Already exists: CocoIndex (code) + Memory DB (text) |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6793:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:518:| tree-sitter + SQLite structural graph | **KEEP** | Structural relationships CocoIndex can't provide |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6795:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:520:| Incremental graph updates (chokidar + git) | **KEEP** | Graph-specific, independent of CocoIndex |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6796:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:524:| Code graph API accepts CocoIndex results as seeds | **MODIFY** | Structural expansion of semantic hits |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6797:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:525:| Reranking uses graph edges for CocoIndex results | **MODIFY** | Structurally connected results rank higher |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6798:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:526:| Query-intent routing for code tasks | **MODIFY** | Route structural → code_graph, semantic → CocoIndex |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6799:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:527:| CocoIndex ↔ Code Graph bridge | **ADD** | Bidirectional enrichment between systems |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6800:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:533:| "Find code related to X" | CocoIndex (semantic) | Code graph (expand neighbors) |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6801:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:536:| "How does retry logic work?" | CocoIndex (semantic) | Code graph (trace call chain) |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6802:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:543:PreCompact pipeline (enriched with CocoIndex):
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6803:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:545:  2. CocoIndex: semantic neighbors of active symbols  ← EXISTING MCP
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6804:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:556:CocoIndex covering semantic search means the code graph can be **purely structural** and much simpler. No embeddings, no chunking, no vector search in the code graph at all. It becomes a lightweight relationship index that answers "what connects to what" while CocoIndex answers "what resembles what." The two complement each other without overlap.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6805:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:560:**Bridge Design** (iter 046): `code_graph_context` accepts file-range seeds directly from CocoIndex. Execution is parallel-then-sequential: Stage A (parallel semantic + graph bootstrap) → Stage B (cross-expansion) → Stage C (late fusion). Latency budget: <2s for PreCompact.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6806:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:562:**Chunk Alignment** (iter 047): CocoIndex uses structure-aware character chunking (~1000 chars), not true AST function-level splitting. Seed-to-node resolution: exact symbol → enclosing symbol → file anchor.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6807:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:564:**Intent Router** (iter 048): New top-level router separate from existing `query-router.ts`. Routes structural→code_graph, semantic→CocoIndex, session→Memory. MVP: keyword heuristics with telemetry.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6808:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:566:**Token Budget** (iter 049): Floors + overflow pool model. Constitutional 700, Graph 1200, CocoIndex 900, Triggered 400, Overflow 800. When a source is empty, its floor redistributes to overflow. Priority: constitutional > graph > CocoIndex > triggered.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6809:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:568:**Repo Maps** (iter 050): Query-ranked dynamic maps using typed graph edges + CocoIndex relevance scores. Improves on aider's flat reference counting.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6810:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:570:**Index Coordination** (iter 051): Independent refresh cycles for CocoIndex and Code Graph. Freshness state exposed in API. No shared event bus needed for v1.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6811:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:572:**Merge Strategy** (iter 052): Constitutional → graph → CocoIndex → triggered. Structured output sections. File-level deduplication.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6812:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:576:**API Design** (iter 054): Three query modes — neighborhood (expand around seeds), outline (structural overview), impact (reverse dependency). Seed types: CocoIndexSeed, ManualSeed, GraphSeed. Normalized to ArtifactRef internally.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6814:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:590:| Budget Allocator | Needs adaptive weighting by query intent (structural→more graph, semantic→more CocoIndex), usage-based learning, dynamic overflow proportional to context budget, source-quality scoring | P2 |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6815:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:592:| Hook System | Needs incremental graph refresh on Stop hook, pre-compaction graph snapshot, hook-based CocoIndex re-index trigger, cross-runtime parity patterns | P1 |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6818:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:608:**Automatic AI Utilization** (iter 057): Three-tier auto-enrichment architecture for code graph + CocoIndex without explicit tool calls:
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6819:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:612:| T1: Session lifecycle | SessionStart / Compaction | Background incremental code_graph_scan + ccc_reindex; preload working set neighborhoods | Zero (background) | 300-500 tokens graph, 200-400 CocoIndex |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6820:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:614:| T3: Query-aware | memory_context/memory_search runs | Graph neighborhood expansion alongside semantic results; intent-based routing | Shares main budget | Via 3-source allocator (floors + overflow) |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6821:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:620:- **Lazy per-file staleness checks via `ensureFreshFiles()`** (iter 067): On `code_graph_query`/`code_graph_context` call, extract touched file paths from results, run two-tier staleness check: (1) mtime fast-path comparing `statSync().mtimeMs` against stored `code_files.file_mtime_ms` (~1ms/file), (2) content hash verification only when mtime differs (~5-20ms/file). Hybrid sync/async reindex: <=2 stale files reindexed synchronously, 3-10 files deferred to async with `freshness.reindexInProgress: true` flag, >10 files triggers nextAction suggesting full scan. Requires `ALTER TABLE code_files ADD COLUMN file_mtime_ms INTEGER` schema extension (mirrors memory system's `memory_index.file_mtime_ms` pattern). CocoIndex coordination: code graph stores `lastStaleDetectedAt` timestamp; `ccc_status` checks it and triggers `ccc_reindex({ full: false })` if recent. Session-start batch: first MCP call triggers parallel `handleCodeGraphScan({ incremental: true })` + `cccReindex({ full: false })` via `resolveTrustedSession` session detection.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6826:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:647:- **Agent definitions are cross-runtime identical**: `.opencode/agents/`, `.codex/agents/`, `.claude/agents/` all declare same MCP server access (`spec_kit_memory`, `cocoindex_code`) with same workflow.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6827:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:657:- **Per-tool priming behavior**: memory tools get full recovery hints (interrupted sessions, last spec folder, graph freshness); code graph tools get index freshness warnings; CocoIndex tools get availability status.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6829:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:676:**CocoIndex Utilization Improvements** (iter 059): Five improvement areas for better CocoIndex integration:
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6830:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:681:   - Propagate CocoIndex similarity score into ArtifactRef confidence (currently discarded)
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6831:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:689:   - Keyword pre-classification: "who calls X" -> Code Graph impact; "find code that does X" -> CocoIndex search
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6832:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:690:   - Confidence-based fallback: low CocoIndex similarity (<0.3) -> fall back to code graph; file_anchor resolution -> suggest CocoIndex
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6835:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:694:   - Structural expansion of semantic results: CocoIndex -> resolve seeds -> expand neighborhood automatically
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6836:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:695:   - Semantic enrichment of structural results: Code graph call chain -> CocoIndex finds similar non-connected code
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6837:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:696:   - Working set warm-up: code graph hot files + CocoIndex adjacent code on session start
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6838:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:698:5. **Underutilized CocoIndex features**:
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6839:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:699:   - Language/path filters not passed through from code graph metadata to CocoIndex searches
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6840:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:715:- **Seed resolution** deepened: CocoIndex scores are discarded at integration seam, needs near-exact tier
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6843:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:749:| CocoIndex availability graceful degradation | Low | Partial |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6844:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:757:5. CocoIndex/Code Graph independence: true at index level, tightly integrated at query level
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6846:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:828:| 0 | Full | Code Graph + CocoIndex + Memory | Default | 3-source merge |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6847:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:829:| 1 | Graph-down | CocoIndex + Memory | `initDb()` throws or `getStats()` null | Skip codeGraph in MergeInput, log warning |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6848:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:830:| 2 | Graph+Coco-down | Memory only | CocoIndex binary missing AND graph unavailable | Constitutional + triggered memories only |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6849:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:833:Implementation: A `DegradationLevel` enum (0-3) computed once per session via `computeDegradationLevel()` that probes each source. Passed into `mergeCompactBrief` to reallocate token budgets (e.g., Level 1 moves code graph's 1200-token floor to CocoIndex and memory). Estimated: ~60 LOC.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6853:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:867:4. **USE** CocoIndex as complementary semantic layer -- no overlap with structural code graph
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6856:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:895:**Q16 -- CocoIndex Utilization** (iterations 059, 063):
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6857:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:897:- CocoIndex score propagation: similarity scores currently discarded at integration seam; blend into ArtifactRef confidence
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6859:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:930:| CocoIndex MCP roundtrip | N/A (not in hook path) | 100-500ms | Must be tool-dispatch-time only |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6860:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:939:- Level 0 (full): Code Graph + CocoIndex + Memory
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6861:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:940:- Level 1 (graph-down): CocoIndex + Memory (code graph DB unavailable)
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6881:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:1162:| 033 | 48 | CocoIndex integration options |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6882:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:1175:| 046 | 284 | CocoIndex-Code Graph bridge design |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6883:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:1176:| 047 | 70 | tree-sitter-CocoIndex chunk alignment |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6884:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:1183:| 054 | 549 | code_graph_context API with CocoIndex seeds |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6885:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:1188:| 059 | ~200 | CocoIndex utilization: seed resolution, auto-reindex, hybrid queries |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6886:.opencode/specs/system-spec-kit/024-compact-code-graph/research/research.md:1199:| 070 | ~250 | Performance analysis: 1800ms budget, SQLite <10ms, CocoIndex 100-500ms |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6915:.opencode/specs/skilled-agent-orchestration/042-sk-deep-research-review-improvement-2/research/iterations/iteration-016.md:11:- A different namespace-isolation weakness does exist on the shared read side for research/review sessions: the convergence handler never accepts `sessionId`, constructs its namespace from only `{ specFolder, loopType }`, and then calls `getStats()` plus `computeSignals()` / `computeMomentum()` without session scoping, so convergence decisions aggregate all sessions sharing the same spec folder and loop type (`.opencode/skills/system-spec-kit/mcp_server/handlers/coverage-graph/convergence.ts:47-52`, `.opencode/skills/system-spec-kit/mcp_server/handlers/coverage-graph/convergence.ts:92-111`, `.opencode/skills/system-spec-kit/mcp_server/lib/coverage-graph/coverage-graph-db.ts:511-545`, `.opencode/skills/system-spec-kit/mcp_server/lib/coverage-graph/coverage-graph-signals.ts:163-220`).
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6987:.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/18-session-resume-tool.md:3:description: "Composite MCP tool (session_resume) that merges memory resume context, code graph status, CocoIndex availability, and structural bootstrap hints into a detailed recovery payload."
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6988:.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/18-session-resume-tool.md:12:Composite MCP tool (session_resume) that merges memory resume context, code graph status, CocoIndex availability, and structural bootstrap hints into a single recovery payload.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6989:.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/18-session-resume-tool.md:14:The `session_resume` handler performs three recovery steps: (1) a filesystem-first resume ladder via `buildResumeLadder()` that reconstructs session state from `handover.md -> _memory.continuity -> spec docs`, (2) code graph status lookup returning freshness-aware `fresh | stale | empty | error` values plus counts and last scan timestamp, and (3) CocoIndex binary availability probing. It also appends the shared structural `ready | stale | missing` contract from `session-snapshot.ts`, so callers can tell when a deeper refresh is needed. Results are merged into a `SessionResumeResult` with `memory`, `codeGraph`, `cocoIndex`, optional `structuralContext`, and `hints` fields. For the canonical first-call recovery step, use `session_bootstrap`; for operator-facing packet recovery, start from `handover.md -> _memory.continuity -> spec docs`; `session_resume` remains the detailed merged surface.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:6990:.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/18-session-resume-tool.md:20:`session_resume` is the detailed merged recovery surface behind the higher-level `/spec_kit:resume` workflow. The handler still merges the resume ladder, code-graph status, CocoIndex availability, and structural bootstrap hints into one response, but Phase 017 added a transport-bound auth check around any explicit `args.sessionId`.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7013:.opencode/specs/system-spec-kit/024-compact-code-graph/research/synthesis-106-110.md:24:The overlap is partial: both check graph status and CocoIndex, but only agent priming does memory resume and only MCP priming does constitutional memory injection and session-primed state management.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7014:.opencode/specs/system-spec-kit/024-compact-code-graph/research/synthesis-106-110.md:30:Cold-start latency is dominated by `memory_context(resume)` -- the other 3 calls in the bootstrap are nearly free. The existing `primeSessionIfNeeded()` already provides a sub-50ms minimum viable prime with graph freshness, CocoIndex availability, and recommended next calls.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7017:.opencode/specs/system-spec-kit/024-compact-code-graph/research/synthesis-106-110.md:63:7. Create `session_bootstrap()` composite tool that returns memory + graph + CocoIndex + health in one call
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7112:.opencode/skills/system-spec-kit/feature_catalog/09--evaluation-and-measurement/01-evaluation-database-and-schema.md:20:Logging hooks in the search, context and trigger handlers are best-effort and fail-safe: they run only when `SPECKIT_EVAL_LOGGING=true`, and all write paths are wrapped in non-fatal `try/catch` blocks so query responses continue even if eval logging fails. `memory_search` and `memory_context` emit per-channel rows. `memory_match_triggers` emits query/final-result rows.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7121:.opencode/skills/system-spec-kit/feature_catalog/02--mutation/01-memory-indexing-memorysave.md:55:Successful insertions now clear the search cache immediately instead of waiting for delete-time invalidation or TTL expiry. `index_memory()` calls `clear_search_cache()` after the transactional insert, active-projection update and optional `vec_memories` write succeed, so a brand-new spec-doc record becomes visible to repeated `memory_search` calls right away. The fix closes a stale-results gap where the save path could report success while cached searches still replayed a pre-insert snapshot.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7145:.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/12-compact-merger.md:3:description: "Compact merger combines context from Memory, Code Graph, and CocoIndex into a unified compact brief within the 4000-token budget."
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7146:.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/12-compact-merger.md:11:Compact merger combines context from Memory, Code Graph, and CocoIndex into a unified compact brief within the 4000-token budget.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7173:.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/14-query-intent-classifier.md:3:description: "Heuristic pre-classifier that routes queries to the optimal retrieval backend: structural (code graph), semantic (CocoIndex), or hybrid (both)."
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7174:.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/14-query-intent-classifier.md:11:Heuristic pre-classifier that routes queries to the optimal retrieval backend: structural (code graph), semantic (CocoIndex), or hybrid (both).
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7175:.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/14-query-intent-classifier.md:13:Keyword-dictionary scoring classifies queries into three intents: structural (symbol/relationship queries routed to code graph), semantic (conceptual/discovery queries routed to CocoIndex), and hybrid (mixed queries that merge results from both). Confidence scores and matched keywords are returned alongside the intent classification. Integrated into memory_context handler for automatic query-intent routing.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7214:.opencode/specs/system-spec-kit/024-compact-code-graph/research/deep-research-state.jsonl:37:{"type":"iteration","run":33,"status":"complete","focus":"CocoIndex Code integration options","findingsCount":7,"newInfoRatio":0.65,"noveltyJustification":"Semantic search vs structural graph, separate concerns, possible shared embedding","timestamp":"2026-03-30T10:37:00.000Z"}
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7217:.opencode/specs/system-spec-kit/024-compact-code-graph/research/deep-research-state.jsonl:52:{"type":"event","event":"segment_start","segment":5,"focus":"CocoIndex + Code Graph Integration Research","method":"GPT-5.4 codex agents, high reasoning, 2 waves of 5 parallel","timestamp":"2026-03-30T16:30:00.000Z"}
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7218:.opencode/specs/system-spec-kit/024-compact-code-graph/research/deep-research-state.jsonl:53:{"type":"iteration","run":46,"status":"complete","focus":"CocoIndex ↔ Code Graph Bridge Design","findingsCount":10,"newInfoRatio":0.75,"noveltyJustification":"Bridge API contract, seed shape, expansion behavior, reverse enrichment, latency budget","timestamp":"2026-03-30T17:00:00.000Z"}
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7219:.opencode/specs/system-spec-kit/024-compact-code-graph/research/deep-research-state.jsonl:54:{"type":"iteration","run":47,"status":"complete","focus":"tree-sitter ↔ CocoIndex Chunk Alignment","findingsCount":8,"newInfoRatio":0.68,"noveltyJustification":"Chunk boundary mapping, structure-aware chunking vs function-level, source map design","timestamp":"2026-03-30T17:00:00.000Z"}
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7220:.opencode/specs/system-spec-kit/024-compact-code-graph/research/deep-research-state.jsonl:56:{"type":"iteration","run":50,"status":"complete","focus":"Compact Repo Map Generation — Structural Graph + CocoIndex","findingsCount":10,"newInfoRatio":0.76,"noveltyJustification":"Aider repo-map analysis, typed graph improvement, CocoIndex ranking influence, MVP map design","timestamp":"2026-03-30T17:00:00.000Z"}
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7221:.opencode/specs/system-spec-kit/024-compact-code-graph/research/deep-research-state.jsonl:57:{"type":"iteration","run":51,"status":"complete","focus":"Incremental Index Coordination — CocoIndex + Code Graph Sync","findingsCount":10,"newInfoRatio":0.65,"noveltyJustification":"Independent refresh cycles, freshness metadata, branch switch handling","timestamp":"2026-03-30T17:00:00.000Z"}
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7222:.opencode/specs/system-spec-kit/024-compact-code-graph/research/deep-research-state.jsonl:60:{"type":"iteration","run":49,"status":"complete","focus":"Token Budget Allocation Across 3 Context Sources","findingsCount":10,"newInfoRatio":0.71,"noveltyJustification":"Three-source allocator with floors+overflow, priority order, CocoIndex token estimation, SessionStart budget profile","timestamp":"2026-03-30T18:15:00.000Z"}
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7223:.opencode/specs/system-spec-kit/024-compact-code-graph/research/deep-research-state.jsonl:61:{"type":"iteration","run":55,"status":"complete","focus":"Implementation Readiness — CocoIndex-Aware Code Graph Architecture","findingsCount":10,"newInfoRatio":0.65,"noveltyJustification":"Final synthesis: phase 008+ specs, readiness scorecard, MVP scope, LOC estimates","timestamp":"2026-03-30T18:15:00.000Z"}
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7224:.opencode/specs/system-spec-kit/024-compact-code-graph/research/deep-research-state.jsonl:62:{"type":"iteration","run":54,"status":"complete","focus":"MCP Tool API — code_graph_context with CocoIndex Seeds","findingsCount":10,"newInfoRatio":0.74,"noveltyJustification":"Full parameter schema, seed normalization, output format, budget enforcement, query modes","timestamp":"2026-03-30T18:30:00.000Z"}
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7225:.opencode/specs/system-spec-kit/024-compact-code-graph/research/deep-research-state.jsonl:63:{"type":"event","event":"synthesis_complete","totalIterations":55,"segment":5,"stopReason":"all_cocoindex_integration_iterations_complete","timestamp":"2026-03-30T18:35:00.000Z"}
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7228:.opencode/specs/system-spec-kit/024-compact-code-graph/research/deep-research-state.jsonl:68:{"type":"iteration","run":59,"status":"complete","focus":"CocoIndex utilization improvements — seed resolution, auto-reindexing, query routing, hybrid patterns","findingsCount":5,"newInfoRatio":0.80,"noveltyJustification":"4 of 5 findings are fully new (near-exact seed resolution, auto-reindex triggers, hybrid query patterns, underutilized features); intent router improvement partially builds on segment 5 research","keyQuestions":["Q16"],"answeredQuestions":["Q16"],"ruledOut":["real-time file watcher for CocoIndex","LSP integration for query routing"],"focusTrack":"cocoindex-utilization","timestamp":"2026-03-31T14:45:00.000Z","durationMs":480000}
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7229:.opencode/specs/system-spec-kit/024-compact-code-graph/research/deep-research-state.jsonl:70:{"type":"iteration","run":63,"status":"complete","focus":"Q16 DEEP DIVE — seed resolution chain, auto-reindex, hybrid queries, CocoIndex MCP tools","findingsCount":8,"newInfoRatio":0.75,"noveltyJustification":"6 of 8 findings are new implementation-level designs (near-exact tier with confidence formula, score propagation blend, stale-triggered auto-reindex, hybrid query patterns A/B/C, missing composite index); 2 deepen prior findings (CocoIndex 1-tool limitation, computeFreshness coarseness)","keyQuestions":["Q16"],"answeredQuestions":["Q16"],"ruledOut":["SQLite editdist3 for fuzzy names","real-time file watcher","extending CocoIndex native MCP"],"focusTrack":"cocoindex-utilization","timestamp":"2026-03-31T15:30:00.000Z","durationMs":420000}
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7230:.opencode/specs/system-spec-kit/024-compact-code-graph/research/deep-research-state.jsonl:75:{"type":"iteration","run":67,"status":"complete","focus":"Auto-indexing and staleness detection design — stale-on-read mechanism with per-file granularity","findingsCount":8,"newInfoRatio":0.72,"noveltyJustification":"6 of 8 findings new (mtime fast-path gap, per-file staleness vs global MAX, ensureFreshFiles function design, hybrid sync/async threshold, schema extension with file_mtime_ms, CocoIndex freshness coordination); 2 deepen prior findings (content hash mechanism details from iter-063, computeFreshness coarseness from iter-063)","keyQuestions":[],"answeredQuestions":["Auto-indexing mechanism design","Staleness detection with latency constraints","CocoIndex coordination"],"ruledOut":["file watchers","global-only freshness check","synchronous reindex for all stale files"],"focusTrack":"auto-indexing","timestamp":"2026-03-31T18:00:00.000Z","durationMs":420000}
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7232:.opencode/specs/system-spec-kit/024-compact-code-graph/research/deep-research-state.jsonl:78:{"type":"iteration","run":70,"status":"complete","focus":"PERFORMANCE AND LATENCY ANALYSIS — hook timeout budget, SQLite query costs, token estimation accuracy, CocoIndex latency, pipeline latency budget design","findingsCount":8,"newInfoRatio":0.72,"noveltyJustification":"6 of 8 findings are new (1700ms headroom quantification, SQLite 1-9ms 1-hop expansion, token estimation 15-25% error margin, CocoIndex 100-500ms MCP roundtrip, tree-sitter 5-50ms per file, full pipeline latency budget table); 2 partially new (staleness check cost deepens iter-067 design, expandAnchor 400ms deadline budget confirms iter-061)","keyQuestions":[],"answeredQuestions":["Hook budget headroom","SQLite query costs","Token estimation accuracy","CocoIndex latency","Pipeline latency budget"],"ruledOut":["CocoIndex in hook path","synchronous tree-sitter reindex >3 files in hook"],"focusTrack":"performance-analysis","timestamp":"2026-03-31T20:30:00.000Z","durationMs":420000}
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7235:.opencode/specs/system-spec-kit/024-compact-code-graph/research/deep-research-state.jsonl:87:{"type":"iteration","run":79,"status":"complete","focus":"VERIFY Q16 findings from iterations 059 and 063 against current code in seed-resolver.ts, code-graph-db.ts, code-graph-context.ts, and CocoIndex MCP registration","findingsCount":7,"newInfoRatio":0.74,"noveltyJustification":"5 of 7 prior Q16 claims were disproven as current implementation, 1 was confirmed (native CocoIndex MCP exposes only search, with management surfaced through wrappers), and 1 was narrowed to a partial confirmation (missing composite index exists but performance necessity is not proven by live code).","keyQuestions":["Which Q16 findings from iterations 059 and 063 are actually implemented in current code?"],"answeredQuestions":["Which Q16 findings from iterations 059 and 063 are actually implemented in current code?"],"ruledOut":["Treating Q16 design proposals as shipped behavior","Inferring auto-reindex from freshness/staleness helpers alone","Inferring hybrid query execution from CocoIndex seed support alone"],"focusTrack":"verification","timestamp":"2026-03-31T13:44:00.000Z","durationMs":780000}
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7236:.opencode/specs/system-spec-kit/024-compact-code-graph/research/deep-research-state.jsonl:90:{"type": "iteration", "run": 77, "status": "complete", "focus": "VERIFY Q14 findings from iterations 057 and 061 against current code: auto-enrichment tiers, GRAPH_AWARE_TOOLS, pre-dispatch interception, MEMORY_AWARE_TOOLS double-check, and latency-budget implications", "findingsCount": 5, "newInfoRatio": 0.38, "noveltyJustification": "Primarily a verification pass. Two Q14 claims remain directly supported by current code (pre-dispatch interception and MEMORY_AWARE_TOOLS double-check). Three claims were narrowed from implementation-sounding statements to design-only proposals (three-tier graph/CocoIndex auto-enrichment, GRAPH_AWARE_TOOLS, and Promise.allSettled orchestration).", "keyQuestions": ["Do the five Q14 claims from iterations 057 and 061 still match the current implementation?"], "answeredQuestions": ["Three-tier graph/CocoIndex auto-enrichment is not implemented in the current code", "GRAPH_AWARE_TOOLS is not present in the current code", "Pre-dispatch interception remains the correct insertion point", "The MEMORY_AWARE_TOOLS defensive double-check pattern still exists", "The 250ms latency budget still exists, but Promise.allSettled remains a future-facing recommendation"], "ruledOut": ["Treating proposed graph/CocoIndex auto-enrichment as already shipped", "Assuming WorkingSetTracker performs session-start graph preloading"], "focusTrack": "verification", "timestamp": "2026-03-31T23:15:00.000Z", "durationMs": 300000}
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7237:.opencode/specs/system-spec-kit/024-compact-code-graph/research/deep-research-state.jsonl:91:{"type":"iteration","run":82,"status":"complete","focus":"VERIFY performance analysis from iteration 070 against current timing code in shared.ts, compact-inject.ts, compact-merger.ts, and budget-allocator.ts","findingsCount":6,"newInfoRatio":0.68,"noveltyJustification":"This pass uncovered a major scope correction: the live PreCompact hook only times stdin parsing and merge execution, so iteration 070's end-to-end headroom and enriched-pipeline latency numbers are not currently measured facts but mostly future-state estimates.","keyQuestions":["Which iteration 070 performance claims are still directly supported by current timing code?"],"answeredQuestions":["HOOK_TIMEOUT_MS is still 1800ms but only wraps parseHookStdin() in the live PreCompact hook","Token estimation still uses Math.ceil(text.length / 4)","Current code does not instrument or execute the richer SQLite/CocoIndex/tree-sitter hook pipeline assumed in iteration 070","Budget allocator timing remains uninstrumented"],"ruledOut":["Treating the 1800ms timeout as an end-to-end guard on the full live hook body","Treating 1-hop SQLite, CocoIndex, and full hook-path latency numbers as currently measured in source","Treating the current hook's cocoIndex section as a live CocoIndex MCP result"],"focusTrack":"verification","timestamp":"2026-03-31T13:38:38.148Z","durationMs":420000}
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7312:.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/029-comprehensive-bug-fix/scratch/legacy-memory-quarantine/24-12-25_12-07__comprehensive-bug-fix-029.md:1002:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "005-memory/017-comprehensive-bug-fix" })` |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7313:.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/029-comprehensive-bug-fix/scratch/legacy-memory-quarantine/24-12-25_12-07__comprehensive-bug-fix-029.md:1007:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7378:.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/01-category-overview.md:3:description: "Category covering Claude Code hooks (PreCompact, SessionStart, Stop), structural code graph (indexer, SQLite, MCP tools), CocoIndex bridge, and compaction working-set integration."
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7379:.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/01-category-overview.md:12:Category covering runtime hook automation, structural code graph (indexer, SQLite, MCP tools), CocoIndex bridge, and compaction working-set integration.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7380:.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/01-category-overview.md:14:This category documents the hybrid context injection system that preserves critical knowledge across context compaction events. It combines three complementary systems: hook-based lifecycle automation, structural code analysis (code graph), and semantic search (CocoIndex) — all merging under a 4000-token budget for compaction injection.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7383:.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/01-category-overview.md:38:| `mcp_server/handlers/session-resume.ts` | Handler | Composite resume (memory + graph + CocoIndex) |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7437:.opencode/specs/skilled-agent-orchestration/042-sk-deep-research-review-improvement-2/research/deep-research-dashboard.md:148:- This is not another reducer merge-stability regression. Iteration 9 already established that finding dedup and transition ordering stay stable at 50+ findings, which leaves observability and recovery handoff as the remaining D2 weakness (`.opencode/specs/skilled-agent-orchestration/042-sk-deep-research-review-improvement-2/research/iterations/iteration-009.md:7-11`). (iteration 10)
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7439:.opencode/specs/skilled-agent-orchestration/042-sk-deep-research-review-improvement-2/research/deep-research-dashboard.md:160:- A command-doc requirement to invoke structural graph tools before or during iterations; the inspected command surfaces only bootstrap CocoIndex. (iteration 15)
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7459:.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/001-sprint-0-measurement-foundation/plan.md:101:- [ ] G-NEW-2 Pre-Analysis: Lightweight agent consumption pattern survey (3-4h) — WHY: Understanding how AI agents currently query memory_search (what patterns, what they select, what they ignore) directly informs ground truth query design. Without this, synthetic queries risk being unrepresentative of real usage.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7523:.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/043-post-merge-refinement-final/scratch/legacy-memory-quarantine/26-12-25_08-12__post-merge-refinement-final.md:622:| Memory Not Found | Search returns no results | Check `memory_search({ specFolder: "003-memory-and-spec-kit/043-post-merge-refinement-final" })` |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7524:.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/043-post-merge-refinement-final/scratch/legacy-memory-quarantine/26-12-25_08-12__post-merge-refinement-final.md:627:2. **Load memory context** - Use memory_search to surface prior work
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7528:.opencode/skills/system-spec-kit/feature_catalog/09--evaluation-and-measurement/07-bm25-only-baseline.md:3:description: "Describes the BM25/FTS5-only baseline measurement (MRR@5 of 0.2083) that confirmed lexical search alone still underperforms hybrid retrieval."
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7529:.opencode/skills/system-spec-kit/feature_catalog/09--evaluation-and-measurement/07-bm25-only-baseline.md:10:Describes the BM25/FTS5-only baseline measurement (MRR@5 of 0.2083) that confirmed lexical search alone still underperforms hybrid retrieval.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7532:.opencode/skills/system-spec-kit/feature_catalog/09--evaluation-and-measurement/07-bm25-only-baseline.md:20:If BM25 had been competitive, the entire multi-channel approach would be questioned. Instead, the gap confirmed that hybrid retrieval adds real value over lexical search. The contingency decision to proceed with the full program was based on this measurement. No opinions, no intuitions, just a number. The current runtime keeps the in-memory BM25 path enabled by default; use `ENABLE_BM25=false` if you need to force the FTS5 fallback for comparison.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7546:.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/001-sprint-0-measurement-foundation/tasks.md:101:  - Implementation hint: Check `memory_search` call sites in `.opencode/skills/` and `.claude/agents/` for query construction patterns
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:7559:.opencode/skills/system-spec-kit/feature_catalog/12--query-intelligence/08-hyde-hypothetical-document-embeddings.md:13:When a search returns weak results, the problem is often a vocabulary mismatch between the query and the stored content. HyDE bridges this gap by asking an LLM to write a short document that would answer the question, then searching with that document's embedding instead of the query's. Since the hypothetical document uses the language of an answer rather than a question, it often matches stored content better. It is active by default (both `SPECKIT_HYDE` and `SPECKIT_HYDE_ACTIVE` are ON); set `SPECKIT_HYDE_ACTIVE=false` to revert to shadow mode where results are logged but not merged.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:8092:.opencode/specs/skilled-agent-orchestration/042-sk-deep-research-review-improvement-2/research/findings-registry.json:1613:      "text": "The command docs do not carry that structural-routing contract forward. Their \"Code Context Bootstrap\" sections tell operators to use only CocoIndex before starting the loop, at `.opencode/commands/spec_kit/deep-research.md:203` and `.opencode/commands/spec_kit/deep-review.md:239`; neither command doc mentions `code_graph_query`, `code_graph_context`, or `deep_loop_graph_convergence`.",
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:8100:.opencode/specs/skilled-agent-orchestration/042-sk-deep-research-review-improvement-2/research/findings-registry.json:1633:      "text": "The executable auto-YAML wrappers also omit structural graph tools from the live LEAF-tool budget. Deep research exposes `[Read, Write, Edit, Bash, Grep, Glob, WebFetch, mcp__cocoindex_code__search]` at `.opencode/commands/spec_kit/assets/spec_kit_deep-research_auto.yaml:72`, and deep review exposes `[Read, Write, Edit, Bash, Grep, Glob, mcp__cocoindex_code__search]` at `.opencode/commands/spec_kit/assets/spec_kit_deep-review_auto.yaml:76`; neither wrapper provisions `code_graph_query`, `code_graph_context`, or `deep_loop_graph_convergence`.",
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:8116:.opencode/specs/skilled-agent-orchestration/042-sk-deep-research-review-improvement-2/research/findings-registry.json:1673:      "text": "The skill-level contracts undercut the agent-doc promise further. `sk-deep-research`'s `allowed-tools` list includes memory tools but no CocoIndex or Code Graph at `.opencode/skills/sk-deep-research/SKILL.md:4`, while `sk-deep-review` includes CocoIndex but still no structural graph tools at `.opencode/skills/sk-deep-review/SKILL.md:4`; its integration guidance likewise documents only semantic search via `mcp__cocoindex_code__search` at `.opencode/skills/sk-deep-review/SKILL.md:476`.",
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:8138:.opencode/specs/skilled-agent-orchestration/042-sk-deep-research-review-improvement-2/research/findings-registry.json:1735:      "text": "A different namespace-isolation weakness does exist on the shared read side for research/review sessions: the convergence handler never accepts `sessionId`, constructs its namespace from only `{ specFolder, loopType }`, and then calls `getStats()` plus `computeSignals()` / `computeMomentum()` without session scoping, so convergence decisions aggregate all sessions sharing the same spec folder and loop type (`.opencode/skills/system-spec-kit/mcp_server/handlers/coverage-graph/convergence.ts:47-52`, `.opencode/skills/system-spec-kit/mcp_server/handlers/coverage-graph/convergence.ts:92-111`, `.opencode/skills/system-spec-kit/mcp_server/lib/coverage-graph/coverage-graph-db.ts:511-545`, `.opencode/skills/system-spec-kit/mcp_server/lib/coverage-graph/coverage-graph-signals.ts:163-220`).",
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:8270:.opencode/specs/skilled-agent-orchestration/042-sk-deep-research-review-improvement-2/research/findings-registry.json:2498:      "text": "This is not another reducer merge-stability regression. Iteration 9 already established that finding dedup and transition ordering stay stable at 50+ findings, which leaves observability and recovery handoff as the remaining D2 weakness (`.opencode/specs/skilled-agent-orchestration/042-sk-deep-research-review-improvement-2/research/iterations/iteration-009.md:7-11`).",
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:8273:.opencode/specs/skilled-agent-orchestration/042-sk-deep-research-review-improvement-2/research/findings-registry.json:2558:      "text": "A command-doc requirement to invoke structural graph tools before or during iterations; the inspected command surfaces only bootstrap CocoIndex.",
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:8278:.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/19-query-intent-routing.md:3:description: "Automatic backend selection in memory_context that routes queries to code graph, CocoIndex, or both based on the query-intent classifier output."
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:8279:.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/19-query-intent-routing.md:11:Automatic backend selection in memory_context that routes queries to code graph, CocoIndex, or both based on the query-intent classifier output.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:8280:.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/19-query-intent-routing.md:13:When memory_context receives a query, the query-intent classifier scores it against structural and semantic keyword dictionaries. Structural queries (e.g., "what calls functionX", "show imports") are routed to the code graph for symbol-level results. Semantic queries (e.g., "find examples of error handling") are routed to CocoIndex for vector-similarity results. Hybrid queries trigger both backends and merge the results. The routing is transparent to the caller; memory_context auto-selects the backend without requiring explicit mode parameters.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:8470:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-graph-impact-and-affordance-uplift/008-deep-research-review/research/resource-map.md:197:| `mcp_server/tests/causal-edges-unit.vitest.ts` | (R-007-12 cases × 6) | Tests counter increments only — not cache-key change at memory_search level |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:8501:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-graph-impact-and-affordance-uplift/008-deep-research-review/research/research.md:226:| D17 R-007-12 cache-key memory_search semantics | P2 | 010/009 | test-add |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:8502:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-graph-impact-and-affordance-uplift/008-deep-research-review/research/research.md:283:- R-007-12 memory_search end-to-end cache-key change test + enableCausalBoost gating test (D17)
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:8531:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-graph-impact-and-affordance-uplift/008-deep-research-review/research/008-deep-research-review-pt-01/iterations/iteration-010.md:56:| D17: R-007-12 tests prove generation increments but not `memory_search` cache-key semantics | P2 | `010/009-test-rig-adversarial-coverage` | test-add |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:8635:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-skill-graph-metadata-routing-boosts/research/deep-research-strategy.md:26:- [ ] Q8: How does the graph interact with CocoIndex semantic search?
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:8671:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-skill-graph-metadata-routing-boosts/research/iterations/iteration-010.md:29:1. `system-spec-kit` is under-modeled as a zero-edge hub even though its own docs describe downstream flows to `sk-code-opencode`, `sk-git`, and `sk-doc`, and it routes semantic queries to CocoIndex. Evidence: `.opencode/skills/system-spec-kit/graph-metadata.json:6-15`, `.opencode/skills/system-spec-kit/SKILL.md:775-777`, `.opencode/skills/system-spec-kit/SKILL.md:919-923`, `.opencode/skills/system-spec-kit/SKILL.md:943-951`. Provenance: iterations 001, 004, 006, and 007.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:8674:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-skill-graph-metadata-routing-boosts/research/iterations/iteration-010.md:54:6. Built-in CocoIndex search fails closed to `[]` on any subprocess problem, so semantic/graph interaction silently disappears in restricted environments. Primary edit surface: `.opencode/skills/skill-advisor/scripts/skill_advisor.py:1038-1065`. Provenance: iteration 005.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:8680:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-skill-graph-metadata-routing-boosts/research/iterations/iteration-010.md:114:5. Make CocoIndex failure debuggable.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:8683:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-skill-graph-metadata-routing-boosts/research/iterations/iteration-010.md:160:4. CocoIndex failure diagnostics.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:8731:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-skill-graph-metadata-routing-boosts/research/iterations/iteration-006.md:15:6. `mcp-coco-index` is the remaining likely graph gap. Its zero-edge metadata is technically valid (`.opencode/skills/mcp-coco-index/graph-metadata.json:6-15`), but the skill description and surrounding workflow docs show that it is not actually isolated in use. Its frontmatter and activation section frame it as the default semantic search surface for unfamiliar-code exploration and concept-based code discovery (`.opencode/skills/mcp-coco-index/SKILL.md:2-4`, `.opencode/skills/mcp-coco-index/SKILL.md:20-41`), and `system-spec-kit` explicitly routes "semantic/concept queries" to CocoIndex (`.opencode/skills/system-spec-kit/SKILL.md:775-777`). That means "zero edges" is probably under-modeling a real workflow coupling. I would not call the exact target fully settled yet, but I do think this audit strengthens the case that `mcp-coco-index` should have at least one directional `enhances` relationship to a workflow skill that consumes semantic search. The cleanest current candidate among graph nodes is `system-spec-kit`, because that skill explicitly delegates semantic query routing to CocoIndex.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:8733:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-skill-graph-metadata-routing-boosts/research/iterations/iteration-006.md:21:2. If `mcp-coco-index` stops being a zero-edge skill, should its first edge be `enhances -> system-spec-kit`, or do we want to reserve `system-spec-kit` for broader workflow links and instead connect CocoIndex to a code-workflow skill such as `sk-code-full-stack` or `sk-code-web`?
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:8790:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-skill-graph-metadata-routing-boosts/research/findings-registry.json:10:    "Q8: CocoIndex interaction",
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:8791:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-skill-graph-metadata-routing-boosts/research/iterations/iteration-005.md:2:This iteration answered Q7 and Q8 by measuring the real size impact of compiling `domains` and `intent_signals` into `.opencode/skills/skill-advisor/scripts/skill-graph.json`, then tracing how CocoIndex semantic hits enter `skill_advisor.py` and interact with graph propagation. The main result is that the current `~2KB` target is only realistic for topology-only output. If the compiled artifact is expected to carry routing metadata as well, the practical target should move to roughly `3-4KB` with a compact indexed layout, because raw string-heavy inclusion lands closer to `5.2KB`. On the scoring side, semantic hits and graph boosts are complementary, but they are not independent: semantic evidence is blended first, then graph edges propagate that same evidence to related skills, which can legitimately help companion routing but can also double-count confidence.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:8793:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-skill-graph-metadata-routing-boosts/research/iterations/iteration-005.md:13:5. The semantic-search pipeline and graph pipeline are intentionally stacked, not isolated. In `analyze_request()`, the advisor first adds the auto-semantic intent hint for `mcp-coco-index`, then blends CocoIndex hits via `_apply_semantic_boosts()`, then applies token and phrase boosters, and only after that applies `_apply_graph_boosts()` and `_apply_family_affinity()`. Explicit skill-name boosts happen later and therefore do not cascade through the graph. The practical effect is that semantic hits can seed related skills through graph propagation, but explicit naming cannot (`.opencode/skills/skill-advisor/scripts/skill_advisor.py:1128-1154`, `.opencode/skills/skill-advisor/scripts/skill_advisor.py:1465-1499`, `.opencode/skills/skill-advisor/scripts/skill_advisor.py:1500-1510`).
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:8794:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-skill-graph-metadata-routing-boosts/research/iterations/iteration-005.md:19:8. There is also an operational failure mode in the CocoIndex interaction: built-in semantic search fails closed and effectively becomes invisible to the advisor. `_cocoindex_search_builtin()` returns an empty hit list on any non-zero `ccc` exit or subprocess error. In this sandbox, direct `ccc search` failed because the daemon wanted to write `~/.cocoindex_code/daemon.log`, which is outside the writable sandbox; in normal advisor execution that would collapse to `[]` with no routing-visible error. So part of the Q8 answer is that graph/semantic interaction can disappear entirely in restricted environments, not because the logic is wrong but because semantic retrieval is silently suppressed upstream (`.opencode/skills/skill-advisor/scripts/skill_advisor.py:1038-1056`).
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:8795:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-skill-graph-metadata-routing-boosts/research/iterations/iteration-005.md:28:3. Should `_cocoindex_search_builtin()` surface a diagnostic reason when semantic search fails, so graph/semantic interaction is debuggable instead of silently degrading to keyword-only routing?
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:8812:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-skill-graph-metadata-routing-boosts/research/deep-research-state.jsonl:6:{"type":"iteration","run":5,"status":"insight","focus":"Q7+Q8: size target and CocoIndex interaction","findingsCount":6,"newInfoRatio":0.50,"timestamp":"2026-04-13T14:52:00.000Z","sessionId":"sgraph-research-001","generation":1}
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:8822:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-skill-graph-metadata-routing-boosts/review/review_archive/gen1-2026-04-13/iterations/iteration-012.md:7:- `health_check()` still emits the graph-status fields `skill_graph_loaded`, `skill_graph_skill_count`, and `skill_graph_path`, and the CLI prints that payload after CocoIndex enrichment. [SOURCE: .opencode/skills/skill-advisor/scripts/skill_advisor.py:1660] [SOURCE: .opencode/skills/skill-advisor/scripts/skill_advisor.py:1675] [SOURCE: .opencode/skills/skill-advisor/scripts/skill_advisor.py:1790]
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:8947:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-graph-impact-and-affordance-uplift/006-docs-and-catalogs-rollup/tasks.md:18:| T-006-B1 | Update root `/README.md` features section | B | complete — `README.md` lines updated under §3 CocoIndex + Code Graph (Edge Explanation + `detect_changes` Preflight subsections), §3 Skill Advisor (Affordance Evidence subsection), §3 Memory Engine (Causal Trust Display Badges subsection); footer version bump 4.2 -> 4.3 |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:8964:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-graph-impact-and-affordance-uplift/005-memory-causal-trust-display/spec.md:56:- Surface in `memory_search` and `memory_context` response shapers
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:8967:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-graph-impact-and-affordance-uplift/005-memory-causal-trust-display/spec.md:97:- [ ] Integration: memory_search returns `trustBadges` in envelope
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9003:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-graph-impact-and-affordance-uplift/005-memory-causal-trust-display/plan.md:17:4. Decide display placement (memory_search results / context envelope / status panel) — record in implementation-summary.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9008:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-graph-impact-and-affordance-uplift/005-memory-causal-trust-display/implementation-summary.md:62:The trust display ships on each `MemoryResultEnvelope` result in `memory_search` output, then flows through profile shaping unchanged. I did not place it in a top-level status panel or context envelope because the trust signal is about a specific Memory claim, not the search request as a whole.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9070:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-graph-impact-and-affordance-uplift/008-deep-research-review/research/008-deep-research-review-pt-01/deltas/iteration-009.jsonl:1:{"iter":9,"convergence_score":0.88,"findings":[{"id":"F24","severity":"P2","title":"011 detect_changes absolute-path test is not absolute and misses mixed-header bypasses","status":"new","rq":["RQ5"],"remediation":"test-add"},{"id":"F25","severity":"P2","title":"Edge metadata sanitizer tests do not assert all documented read-path call sites","status":"new","rq":["RQ5"],"remediation":"test-add"},{"id":"F26","severity":"P2","title":"R-007-12 unit tests miss memory_search cache-key semantics and enableCausalBoost gating","status":"new","rq":["RQ5"],"remediation":"test-add"},{"id":"F27","severity":"P2","title":"Playbook 199 claims R-007-8 coverage without conflicts_with parity checks","status":"new","rq":["RQ2","RQ5"],"remediation":"test-add/doc-fix"},{"id":"F28","severity":"P2","title":"Manual fixture retains boilerplate-heavy near-duplicate seed pairs","status":"new","rq":["RQ5"],"remediation":"test-add"}],"checklist_handled":19,"checklist_gap":5,"rq_coverage":{"RQ1":"No new P0/P1; known F1/F6 remains open and uncovered by 011 cases.","RQ2":"Extended with playbook closure-surface precision for F12/F14/F17/F19-F23.","RQ3":"Adversarial coverage improved but mixed-header and sanitizer call-site wiring remain gaps.","RQ4":"No new umbrella-doc drift; playbook metadata mismatch captured as F27.","RQ5":"Expanded materially with F24-F28 test-rig sufficiency gaps."},"new_p0":0,"new_p1":0,"new_p2":5}
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9078:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-graph-impact-and-affordance-uplift/005-memory-causal-trust-display/prompts/agent-brief.md:67:7. **Display placement** — record your decision (memory_search results vs context envelope vs status panel) in `implementation-summary.md` under "Display Placement Decision".
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9085:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-graph-impact-and-affordance-uplift/008-deep-research-review/research/008-deep-research-review-pt-01/prompts/iteration-010.md:48:| F26 | iter 9 | P2 | test-add | RQ5 | R-007-12 cache-key memory_search semantics untested | ADOPT | new tests |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9099:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-graph-impact-and-affordance-uplift/008-deep-research-review/research/008-deep-research-review-pt-01/iterations/iteration-009.md:55:- **C3:** NO. The tests verify only the counter increments. They do not run `memory_search`, build the cache key end to end, or assert cache hit/miss behavior through `toolCache.generateCacheKey` at `memory-search.ts:891`.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9100:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-graph-impact-and-affordance-uplift/008-deep-research-review/research/008-deep-research-review-pt-01/iterations/iteration-009.md:56:- **C4:** NO. There is no concurrency/race test. The generation counter is in-memory and incremented before degree-cache invalidation (`causal-edges.ts:173-182` from the rg result), but the suite does not verify deterministic behavior when two `memory_search` calls race with a mutation.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9105:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-graph-impact-and-affordance-uplift/008-deep-research-review/research/008-deep-research-review-pt-01/iterations/iteration-009.md:82:- **F26 (P2, test-add, RQ5): R-007-12 unit tests prove generation increments, not memory_search cache invalidation semantics.** Evidence: G1-G6 only read `getCausalEdgesGeneration()` around storage mutations (`causal-edges-unit.vitest.ts:702-771`). The actual semantics live in `memory-search.ts:847-891` and `search-utils.ts:178-214`, but no test asserts `enableCausalBoost=true` changes the cache key while `false` stays stable. Remediation: add a focused `memory_search` cache-key test with mutation and causal-boost on/off controls.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9107:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-graph-impact-and-affordance-uplift/008-deep-research-review/research/008-deep-research-review-pt-01/iterations/iteration-009.md:107:{"iter":9,"convergence_score":0.88,"findings":[{"id":"F24","severity":"P2","title":"011 detect_changes absolute-path test is not absolute and misses mixed-header bypasses","status":"new","rq":["RQ5"],"remediation":"test-add"},{"id":"F25","severity":"P2","title":"Edge metadata sanitizer tests do not assert all documented read-path call sites","status":"new","rq":["RQ5"],"remediation":"test-add"},{"id":"F26","severity":"P2","title":"R-007-12 unit tests miss memory_search cache-key semantics and enableCausalBoost gating","status":"new","rq":["RQ5"],"remediation":"test-add"},{"id":"F27","severity":"P2","title":"Playbook 199 claims R-007-8 coverage without conflicts_with parity checks","status":"new","rq":["RQ2","RQ5"],"remediation":"test-add/doc-fix"},{"id":"F28","severity":"P2","title":"Manual fixture retains boilerplate-heavy near-duplicate seed pairs","status":"new","rq":["RQ5"],"remediation":"test-add"}],"checklist_handled":19,"checklist_gap":5,"rq_coverage":{"RQ1":"No new P0/P1; known F1/F6 remains open and uncovered by 011 cases.","RQ2":"Extended with playbook closure-surface precision for F12/F14/F17/F19-F23.","RQ3":"Adversarial coverage improved but mixed-header and sanitizer call-site wiring remain gaps.","RQ4":"No new umbrella-doc drift; playbook metadata mismatch captured as F27.","RQ5":"Expanded materially with F24-F28 test-rig sufficiency gaps."},"new_p0":0,"new_p1":0,"new_p2":5}
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9124:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-graph-impact-and-affordance-uplift/008-deep-research-review/research/008-deep-research-review-pt-01/prompts/iteration-007.md:43:D2. Smoke-test invocation examples for detect_changes, blast_radius, memory_search — do they match current handler signatures?
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9162:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-graph-impact-and-affordance-uplift/005-memory-causal-trust-display/review/review-report.md:23:- P1 — Cached `memory_search` responses can serve stale trust badges after causal-edge changes. The cache key is built from search arguments, not causal-edge state; formatted responses, including `trustBadges`, are cached for the default 60 seconds. Causal-edge mutations invalidate degree and graph-signal caches, but they do not bump or clear the `memory_search` tool cache, so recent `strength`, `last_accessed`, or `weight_history` updates can be hidden behind a cache hit. Evidence: `.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:880`, `.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:889`, `.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:1188`, `.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:1190`, `.opencode/skills/system-spec-kit/mcp_server/lib/cache/tool-cache.ts:56`, `.opencode/skills/system-spec-kit/mcp_server/lib/cache/tool-cache.ts:58`, `.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:150`, `.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:160`, `.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:660`. Fix: include a causal-edge generation/version in the cache key or invalidate `memory_search` cache entries when causal edges or weight history mutate.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9166:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-graph-impact-and-affordance-uplift/005-memory-causal-trust-display/review/review-report.md:53:3. Tie `memory_search` cache validity to causal-edge/weight-history mutations, or avoid caching dynamic trust badge fields.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9196:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-graph-impact-and-affordance-uplift/008-deep-research-review/research/008-deep-research-review-pt-01/prompts/iteration-009.md:44:C3. Do they verify the cache key actually changes (i.e. test through `memory_search` end-to-end), or only the counter increments?
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9207:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-graph-impact-and-affordance-uplift/007-review-remediation/implementation-summary.md:48:- **T-F (doc cleanup + query.ts micro-fixes + cache invalidation):** memory_search cache key includes causal-edge generation counter (folded only when `enableCausalBoost=true`); INSTALL_GUIDE Python smoke-test path fixed; tool count canonicalized to 51 (`TOOL_DEFINITIONS.length`) across all umbrella docs with explicit deferred-handlers-do-not-count note; broken `FEATURE_CATALOG_IN_SIMPLE_TERMS` link removed; `structural-indexer.ts` `runPhases` wrapped in try/catch/finally so error outcome metric emits; `query.ts` detects true overflow by comparing full-BFS-traversal size against `limit` BEFORE slicing (semantically equivalent to `limit + 1` — the BFS frontier is already over-collected, so no extra SQL request is needed; 008/D8 doc-fix correction), preserves seed nodes on multi-subject sibling failures, adds stable `failureFallback.code` + new `spec_kit.graph.blast_radius_failure_total` metric, and dedupes 4 switch branches via shared edge mapper; affordance debug counters (received/accepted/dropped_unsafe/dropped_empty/dropped_unknown_skill) added to TS + Python; 010/006 alias note for renumber. Closes R-007-12, 16, 17, 18, P2-2, P2-4, P2-5, P2-6, P2-7, P2-9, P2-12.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9218:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-graph-impact-and-affordance-uplift/007-review-remediation/implementation-summary.md:271:**Strategy:** include a causal-edges generation counter in the `memory_search` cache key. Mutations bump a module-level counter; readers fold the counter into the cache key only when `enableCausalBoost=true` so unrelated callers do not suffer needless cache misses.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9221:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-graph-impact-and-affordance-uplift/007-review-remediation/implementation-summary.md:291:- `/README.md` lines 7, 56, 1261, 1281, 1301 → "60 MCP tools" (51 spec_kit_memory + 7 code mode + 1 CocoIndex + 1 sequential thinking) and "51 tools, 7 layers + L8 graph/advisor + L9 coverage"
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9236:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-graph-impact-and-affordance-uplift/007-review-remediation/checklist.md:41:- [ ] R-007-12 memory_search cache invalidation
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9279:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-graph-impact-and-affordance-uplift/007-review-remediation/prompts/agent-brief-T-F.md:7:Close 4 P1 + 7 P2 cleanup findings — broken links, conflicting tool counts, INSTALL_GUIDE bug, memory_search cache invalidation, `query.ts` micro-fixes, doc dedup.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9280:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-graph-impact-and-affordance-uplift/007-review-remediation/prompts/agent-brief-T-F.md:25:| `mcp_server/handlers/memory-search.ts` (lines 880, 889, 1188, 1190) + `mcp_server/lib/cache/tool-cache.ts` (lines 56-58) + `mcp_server/lib/storage/causal-edges.ts` (lines 150, 160, 660) | R-007-12 | Include causal-edge generation/version in memory_search cache key, OR invalidate memory_search cache entries on causal-edge mutations |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9286:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-graph-impact-and-affordance-uplift/007-review-remediation/prompts/agent-brief-T-F.md:64:- Commit: `fix(010/007/T-F): doc + label cleanup, query.ts micro-fixes, memory_search cache invalidation`
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9291:The repo’s specs live under `.opencode/specs`, not `specs`, and the broad grep was too noisy. The useful signal so far is around `026-graph-and-context-optimization`, especially a “search intelligence stress test” packet and a review remediation note mentioning `memory_search` cache invalidation.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9382:/bin/zsh -lc "rg -n \"memory_search cache|cache invalidation|search intelligence|search bug|empty results|fallback|FTS|BM25|CocoIndex\" .opencode/specs/system-spec-kit/026-graph-and-context-optimization -g 'spec.md' -g 'plan.md' -g 'tasks.md' -g 'implementation-summary.md' -g 'review-report.md' -g 'agent-brief*.md'" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9436:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-graph-impact-and-affordance-uplift/006-docs-and-catalogs-rollup/tasks.md:18:| T-006-B1 | Update root `/README.md` features section | B | complete — `README.md` lines updated under §3 CocoIndex + Code Graph (Edge Explanation + `detect_changes` Preflight subsections), §3 Skill Advisor (Affordance Evidence subsection), §3 Memory Engine (Causal Trust Display Badges subsection); footer version bump 4.2 -> 4.3 |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9444:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-graph-impact-and-affordance-uplift/007-review-remediation/prompts/agent-brief-T-F.md:7:Close 4 P1 + 7 P2 cleanup findings — broken links, conflicting tool counts, INSTALL_GUIDE bug, memory_search cache invalidation, `query.ts` micro-fixes, doc dedup.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9445:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-graph-impact-and-affordance-uplift/007-review-remediation/prompts/agent-brief-T-F.md:25:| `mcp_server/handlers/memory-search.ts` (lines 880, 889, 1188, 1190) + `mcp_server/lib/cache/tool-cache.ts` (lines 56-58) + `mcp_server/lib/storage/causal-edges.ts` (lines 150, 160, 660) | R-007-12 | Include causal-edge generation/version in memory_search cache key, OR invalidate memory_search cache entries on causal-edge mutations |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9446:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-graph-impact-and-affordance-uplift/007-review-remediation/prompts/agent-brief-T-F.md:64:- Commit: `fix(010/007/T-F): doc + label cleanup, query.ts micro-fixes, memory_search cache invalidation`
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9456:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/005-memory-search-runtime-bugs/spec.md:90:- Re-architecting the hybrid retrieval pipeline (graph + vector + FTS5/BM25); only the observable surface defects are catalogued.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9458:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/005-memory-search-runtime-bugs/spec.md:124:| REQ-007 | `QUALITY=gap` flag MUST trigger automatic broadening before returning. | Spec §1 promises 3-tier FTS fallback (FTS5 → BM25 → Grep) on weak retrievals. Currently `avg_score:0.13`, `quality:"gap"` is reported but no broadening occurs. After fix, gap-flagged retrievals attempt at least one fallback tier before returning. |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9459:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/005-memory-search-runtime-bugs/spec.md:134:| REQ-012 | CocoIndex daemon health MUST be checked before relying on the vector channel. | Current behavior: command attempts CocoIndex search, fails silently when daemon is down. After fix, command emits an explicit `WARN: vector channel unavailable, lexical-only` line in the result block when daemon is unreachable. |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9460:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/005-memory-search-runtime-bugs/spec.md:136:| REQ-014 | AskUserQuestion custom-answer routing MUST be defined. | Spec §4 offers 7 intents + "Analysis tools". A custom answer like "Semantic Search" currently becomes the QUERY (auto-detect intent) — undocumented. Either document this routing or add explicit "Code search / Explore codebase" option that routes to CocoIndex. |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9461:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/005-memory-search-runtime-bugs/spec.md:175:| Dependency | CocoIndex daemon must be runnable for REQ-012 verification. | Medium | Document the start command and add a smoke test before remediation lands. |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9468:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/001-research-and-baseline/spec.md:92:- Implementing runtime code in Spec Kit Memory, Code Graph, CocoIndex, or startup hooks.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9470:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/005-memory-search-runtime-bugs/plan.md:98:- **Cluster 6 — Folder Discovery + Channel Health (P1/P2)** — REQ-008, REQ-012, REQ-017. Folder-discovery binds on weak signal ("Semantic Search" → `skilled-agent-orchestration/023-sk-deep-research-creation`); CocoIndex daemon failure is silent; "code graph" vs "causal graph" naming collides. Change surface: similarity threshold + startup health check + naming disambiguation.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9473:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/005-memory-search-runtime-bugs/plan.md:156:| CocoIndex daemon | External | Red (down — observed in conversation) | REQ-012 verification blocked until daemon runnable |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9489:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/007-hook-parity/003-codex-native-startup-advisor-hooks/implementation-summary.md:121:2. **CocoIndex timed out during implementation.** Code exploration used direct file reads and `rg` after semantic search timed out.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9494:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/005-memory-search-runtime-bugs/tasks.md:108:- [ ] T602 [P] Add CocoIndex daemon health check at `/memory:search` invocation start
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9496:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/005-memory-search-runtime-bugs/tasks.md:118:- [ ] T705 Regression test: weak query triggers fallback; output includes `fallback_tier` field
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9497:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/001-research-and-baseline/003-contextador/spec.md:62:`Code_Environment/Public` already operates CocoIndex, Code Graph MCP, and Spec Kit Memory. It does not yet have a Mainframe-style shared query-result cache or a self-healing loop that patches stale code-context artifacts after agent failures. Contextador appears to address both concerns, but its claims (93% token reduction, "self-improving" knowledge, cross-agent reuse) need to be verified against the actual checked-in source instead of README marketing.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9498:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/001-research-and-baseline/003-contextador/spec.md:83:- Direct comparison with current CocoIndex, Code Graph MCP, and Spec Kit Memory surfaces in this repository
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9499:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/001-research-and-baseline/003-contextador/spec.md:133:| REQ-006 | Compare Contextador against current CocoIndex, Code Graph MCP, and Spec Kit Memory surfaces | research.md cites concrete repo paths in the comparison |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9512:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-manual-testing-playbook-coverage-and-run/spec.md:64:Phase 010 and the 010/007 remediation pass shipped 33 closed findings spanning new operator-facing surfaces (detect_changes MCP tool, blast_radius enrichment, edge reason/step, affordance evidence, trust badges, memory_search causal cache invalidation). The baseline manual-testing-playbook scenarios written by 010/006 were authored before 010/007 hardened those surfaces. Two scenarios (014 detect_changes, 026 blast_radius) are now stale on adversarial paths and on the 010/007-added behaviour (path canonicalization, multi-file diff boundary, minConfidence, overflow detection, multi-subject seed preservation, failureFallback.code, edge reason/step sanitization, cache invalidation). One new scenario (memory_search cache invalidation on causal-edge mutation) is missing. Without this sync, the playbook is reassuring but not actually probing the surfaces operators rely on.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9514:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/spec.md:74:The system-spec-kit "Search / Query / Intelligence" surfaces (memory_search, memory_context, code_graph_query, advisor_recommend, intent classifier, etc.) have grown organically across 26+ optimization packets. Sibling packet `005-memory-search-runtime-bugs` catalogs 17 defects observed in a single live session. We need a reproducible, cross-AI stress-test that quantifies how well the search intelligence performs under realistic prompt variation — not just bug-hunt, but ongoing quality regression.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9516:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/spec.md:175:| Risk | CocoIndex daemon may be down during execution (REQ-012 from 005) | Medium | Pre-flight check; document the channel as unavailable in findings if so |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9520:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/005-memory-search-runtime-bugs/implementation-summary.md:159:4. **CocoIndex daemon health was not directly probed.** REQ-012 is based on the conversation transcript reporting daemon-not-running; verify the daemon's actual state before remediation.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9530:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-graph-impact-and-affordance-uplift/007-review-remediation/implementation-summary.md:48:- **T-F (doc cleanup + query.ts micro-fixes + cache invalidation):** memory_search cache key includes causal-edge generation counter (folded only when `enableCausalBoost=true`); INSTALL_GUIDE Python smoke-test path fixed; tool count canonicalized to 51 (`TOOL_DEFINITIONS.length`) across all umbrella docs with explicit deferred-handlers-do-not-count note; broken `FEATURE_CATALOG_IN_SIMPLE_TERMS` link removed; `structural-indexer.ts` `runPhases` wrapped in try/catch/finally so error outcome metric emits; `query.ts` detects true overflow by comparing full-BFS-traversal size against `limit` BEFORE slicing (semantically equivalent to `limit + 1` — the BFS frontier is already over-collected, so no extra SQL request is needed; 008/D8 doc-fix correction), preserves seed nodes on multi-subject sibling failures, adds stable `failureFallback.code` + new `spec_kit.graph.blast_radius_failure_total` metric, and dedupes 4 switch branches via shared edge mapper; affordance debug counters (received/accepted/dropped_unsafe/dropped_empty/dropped_unknown_skill) added to TS + Python; 010/006 alias note for renumber. Closes R-007-12, 16, 17, 18, P2-2, P2-4, P2-5, P2-6, P2-7, P2-9, P2-12.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9532:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-graph-impact-and-affordance-uplift/007-review-remediation/implementation-summary.md:291:- `/README.md` lines 7, 56, 1261, 1281, 1301 → "60 MCP tools" (51 spec_kit_memory + 7 code mode + 1 CocoIndex + 1 sequential thinking) and "51 tools, 7 layers + L8 graph/advisor + L9 coverage"
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9545:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/plan.md:110:            ├──> Pre-flight: check CLIs installed, mem DB snapshot, CocoIndex daemon
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9546:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/plan.md:170:| CocoIndex daemon running | External | Red (down per 005 evidence) | Vector channel unavailable; document in findings |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9549:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/001-research-and-baseline/003-contextador/tasks.md:71:- [x] T018 Iteration 6 - compare against current Public retrieval surfaces (CocoIndex, Code Graph MCP, Spec Kit Memory)
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9589:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/spec.md:72:- Pre-flight contract (CLIs installed, authenticated, CocoIndex daemon status, DB snapshot)
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9590:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/spec.md:141:│    • Check CocoIndex daemon         │
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9592:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/001-research-and-baseline/003-contextador/implementation-summary.md:43:This phase produced a deep, source-grounded research packet on Contextador, the Bun-based MCP query server. The headline takeaway is that Public already wins on retrieval substrate (CocoIndex semantic, Code Graph structural, Spec Kit Memory continuity), so Contextador's surviving value is runtime retrieval ergonomics, not a replacement retrieval engine. The 93% token-reduction claim is estimated from fixed constants in `external/src/lib/core/stats.ts:26-28`, not benchmarked, and the served `context` payload is narrower than the README suggests. After the 20-iteration closeout, source coverage remained approximately 84.8% of files in `external/src/` and approximately 100% of non-test production source files, with the extension pass focused on question closure rather than broader production-file discovery.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9593:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/001-research-and-baseline/003-contextador/implementation-summary.md:55:`research/research.md` Section 4 contains the cross-comparison table against CocoIndex, Code Graph MCP, and Spec Kit Memory, with NEW/DUPLICATE/HYBRID/NEGATIVE verdicts per capability. Section 5 contains the cross-phase ownership table for 002-codesight, 003-contextador, and 004-graphify, establishing that 003 owns runtime retrieval ergonomics, 002 owns scan-time analysis and artifact generation, and 004 owns graph and provenance intelligence.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9623:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/plan.md:78:- **Pre-flight check** (`scripts/preflight.sh`) — verify CLIs + auth + DB snapshot + CocoIndex daemon
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9624:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/plan.md:157:| CocoIndex daemon | External | Red per 005 evidence | Vector channel unavailable; document |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9627:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/implementation-summary.md:129:4. **CocoIndex daemon may be down** — 005 reports the daemon was unreachable. If still down at execution, the vector retrieval channel will be absent; document as a known constraint in findings.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9629:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/001-search-scenario-design/spec.md:145:- **Target tools**: `memory_context` (auto mode), with FTS5 fallback if vector channel weak
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9630:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/001-search-scenario-design/spec.md:159:- **Target tools**: `code_graph_query` (structural traversal), fallback to `cocoindex_search` or grep
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9633:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/001-search-scenario-design/spec.md:212:- **2**: Optimal tool selection per expected behavior; uses CocoIndex/code_graph/memory_search correctly per scenario
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9635:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/tasks.md:69:- [ ] T103 Verify CocoIndex daemon status; document if down
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9665:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/001-research-and-baseline/007-external-project/implementation-summary.md:123:3. **CocoIndex bootstrap timed out.** The synthesis relies on direct reads, reducer state, and source citations instead.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9688:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/001-research-and-baseline/004-graphify/spec.md:30:Phase 4 of `001-research-graph-context-systems` is a read-only audit of the graphify external Python skill to translate its two-pass codebase knowledge graph patterns into concrete improvements for Code_Environment/Public's existing structural retrieval stack (Code Graph MCP, CocoIndex, Spec Kit Memory). The deliverable is an evidence-backed Adopt/Adapt/Reject table grounded in specific `external/graphify/` file:line citations, not a generic feature inventory. No source files outside this spec folder are modified during the research phase.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9689:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/001-research-and-baseline/004-graphify/spec.md:32:**Key Decisions**: Use a 20-iteration two-wave deep-research loop; preserve K1 to K42 finding lineage across the original run plus completed-continue wave; keep Code Graph MCP and CocoIndex as the platform while translating graphify patterns into additive rollout guidance for Public.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9690:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/001-research-and-baseline/004-graphify/spec.md:61:Public already has Code Graph MCP for structural code queries (442.9K nodes, 225.4K edges), CocoIndex for semantic retrieval, Spec Kit Memory for persistent context, and hook-based context injection patterns. It does NOT have community-clustered knowledge graphs, multimodal artifact extraction (PDFs, images), evidence-tagged provenance for retrieval edges, or a PreToolUse hook that nudges Claude away from raw Grep when a structural index exists. graphify ships all four capabilities in a small Python package, so it is the closest external candidate to study before deciding which patterns to bring inside Public.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9691:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/001-research-and-baseline/004-graphify/spec.md:65:Produce an evidence-backed translation layer that tells Public exactly which graphify patterns to adopt directly, adapt into existing surfaces, or reject as duplicative or non-applicable, with every recommendation tied to `external/graphify/` file:line evidence and to a specific Public surface (Code Graph MCP, CocoIndex, Spec Kit Memory, hooks, or CLAUDE.md).
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9692:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/001-research-and-baseline/004-graphify/spec.md:93:- Wholesale replacement of Code Graph MCP or CocoIndex - prompt Don'ts forbid it unless graphify clearly solves something they cannot
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9693:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/001-research-and-baseline/004-graphify/spec.md:130:| REQ-009 | Compare graphify against Public's existing Code Graph MCP and CocoIndex without duplicating phase 002 or phase 003 findings | research.md section 10 has a capability matrix; section 11 documents cross-phase deduplication |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9694:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/001-research-and-baseline/004-graphify/spec.md:288:1. **Given** any Adopt row in research/research.md section 12, **When** I read the "Concrete Adoption Plan" column, **Then** I see a specific Public surface (for example `code_graph_query` response payload, project hooks, CocoIndex incremental update path).
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9715:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/001-research-and-baseline/004-graphify/implementation-summary.md:3:description: "20 total deep-research iterations across two waves produced 42 consolidated findings (K1 to K42) and a phased rollout translation for Public's Code Graph, CocoIndex, hooks, validation, and scoring surfaces."
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9716:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/001-research-and-baseline/004-graphify/implementation-summary.md:43:You can now point any Public maintainer at `research/research.md` and get a line-grounded translation layer that says exactly which graphify patterns to adopt, adapt, or reject for Code Graph MCP, CocoIndex, Spec Kit Memory, hooks, validation, and scoring surfaces. The audit now covers 20 total iterations across two waves, produced 42 consolidated K-findings (K1 through K42), and answered all 22 research questions. Reading section 12 plus sections 13.A and 13.B gives the full recommendation and rollout set without backfilling assumptions.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9726:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/001-research-and-baseline/002-codesight/spec.md:30:Phase 2 of `001-research-graph-context-systems` is a read-only audit of the codesight external Node.js/TypeScript skill (zero-runtime-dependency CLI that scans a project root and generates AI-assistant context artifacts) to translate its detector architecture, MCP tool design, profile generation, scanner heuristics, and blast-radius analysis into concrete improvements for `Code_Environment/Public`'s existing structural retrieval stack (Code Graph MCP, CocoIndex, Spec Kit Memory). The deliverable is an evidence-backed Adopt/Adapt/Reject table plus late-session adoption synthesis grounded in specific `external/src/` file:line citations across 20 deep-research iterations, not a generic feature inventory. No source files outside this spec folder are modified during the research phase.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9728:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/001-research-and-baseline/002-codesight/spec.md:60:`Code_Environment/Public` already has CocoIndex semantic search, Code Graph MCP for structural queries, and Spec Kit Memory for context preservation, but it lacks Codesight-style automated `CLAUDE.md` / `.cursorrules` / `codex.md` / `AGENTS.md` generation from a single project scan, per-AI-tool profile generation, and a blast-radius command built around reverse-import BFS. Without an evidence-grounded survey of Codesight's actual implementation (separated from its README marketing claims), any port would risk importing the wrong patterns, the wrong claims, and the wrong risks.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9729:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/001-research-and-baseline/002-codesight/spec.md:93:- Re-implementing CocoIndex semantic search, Code Graph MCP structural queries, or Spec Kit Memory in Public.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9822:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/spec.md:58:3. Which code-graph tools, events, or signals are under-used by downstream consumers (memory search, CocoIndex bridge, session bootstrap)?
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9824:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/spec.md:72:- CocoIndex ↔ code-graph bridge: seed resolution, neighborhood expansion.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9825:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/spec.md:79:- CocoIndex's own indexing pipeline (covered by 026 phase 006 research instead).
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9833:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/plan.md:87:CALLS-oriented queries first resolve a subject node in `query.ts`, then execute graph reads that must either return implementation-focused results or an explicit blocked/degraded contract when readiness demands a full scan (`013-ZC-F-001`, `013-F-001`). Context requests carry richer CocoIndex seed metadata and bounded-work deadline state through `seed-resolver.ts` and `code-graph-context.ts` (`013-F-002`, `013-F-006`), while scans persist metadata that status/startup readers can surface without leaving stale summaries behind (`013-F-003`, `013-F-004`, `013-F-005`).
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9834:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/review/002-content-routing-accuracy-research/archive-invalid-2026-04-13T16-59-27Z/review-report.md:66:- CocoIndex semantic discovery could not be used in this session because each attempted query returned a cancelled-tool response.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9860:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/implementation-summary.md:55:The packet hardened code-graph CALLS resolution so ambiguous `handle*` subjects now select callable implementation nodes instead of wrapper shadows, and it made query/context reads fail explicitly when readiness requires a suppressed full scan. It also preserved CocoIndex ranking fidelity through seed resolution, cleared stale edge-enrichment summaries on null-summary scans, surfaced `graphQualitySummary` through status/startup readers, transported a compact startup shared-payload contract through Claude, Gemini, Copilot, and Codex runtime hooks, and turned `deadlineMs` plus `partialOutput` into real context response metadata.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9861:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/implementation-summary.md:63:| `.opencode/skills/system-spec-kit/mcp_server/code-graph/lib/seed-resolver.ts` | CocoIndex score/snippet/range/provider preservation and ranking |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9862:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/implementation-summary.md:94:- Preserved CocoIndex semantic score as the primary seed-ordering signal and graph confidence as the fallback/tie-break layer.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9866:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/review/review-report.md:31:Evidence: CocoIndex fidelity survives only when callers send `seed.file`; `seed.filePath` falls through the generic seed path and drops provider-specific metadata.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9867:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/review/review-report.md:32:Recommended fix: treat `filePath` as equivalent to `file` for CocoIndex seeds and add a regression for that public input shape.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9868:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/review/review-report.md:101:3. Fix `F-002` and `F-003` together: complete the new context contract by accepting `filePath` CocoIndex seeds and correcting `omittedAnchors`.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:9870:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/tasks.md:72:- [ ] T008 P1 Address `013-F-002` by preserving CocoIndex `score`, `snippet`, and range fidelity in `.opencode/skills/system-spec-kit/mcp_server/code-graph/lib/seed-resolver.ts` and `.opencode/skills/system-spec-kit/mcp_server/code-graph/handlers/context.ts`, with ranking coverage in `.opencode/skills/system-spec-kit/mcp_server/code-graph/tests/code-graph-context-handler.vitest.ts`
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10197:    74	The system-spec-kit "Search / Query / Intelligence" surfaces (memory_search, memory_context, code_graph_query, advisor_recommend, intent classifier, etc.) have grown organically across 26+ optimization packets. Sibling packet `005-memory-search-runtime-bugs` catalogs 17 defects observed in a single live session. We need a reproducible, cross-AI stress-test that quantifies how well the search intelligence performs under realistic prompt variation — not just bug-hunt, but ongoing quality regression.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10298:   175	| Risk | CocoIndex daemon may be down during execution (REQ-012 from 005) | Medium | Pre-flight check; document the channel as unavailable in findings if so |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10398:    81	- Documenting every observed defect from the conversation transcript and the live reproduction probes against `memory_context`, `memory_search`, and `memory_causal_stats`.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10407:    90	- Re-architecting the hybrid retrieval pipeline (graph + vector + FTS5/BM25); only the observable surface defects are catalogued.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10441:   124	| REQ-007 | `QUALITY=gap` flag MUST trigger automatic broadening before returning. | Spec §1 promises 3-tier FTS fallback (FTS5 → BM25 → Grep) on weak retrievals. Currently `avg_score:0.13`, `quality:"gap"` is reported but no broadening occurs. After fix, gap-flagged retrievals attempt at least one fallback tier before returning. |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10442:   125	| REQ-008 | Folder-discovery MUST NOT auto-bind on weak signal. | Currently "Semantic Search" caused `folderDiscovery.specFolder = "skilled-agent-orchestration/023-sk-deep-research-creation"` (no semantic relationship). After fix, folder-binding requires either explicit `specFolder` parameter or per-token similarity above a documented threshold. |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10451:   134	| REQ-012 | CocoIndex daemon health MUST be checked before relying on the vector channel. | Current behavior: command attempts CocoIndex search, fails silently when daemon is down. After fix, command emits an explicit `WARN: vector channel unavailable, lexical-only` line in the result block when daemon is unreachable. |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10453:   136	| REQ-014 | AskUserQuestion custom-answer routing MUST be defined. | Spec §4 offers 7 intents + "Analysis tools". A custom answer like "Semantic Search" currently becomes the QUERY (auto-detect intent) — undocumented. Either document this routing or add explicit "Code search / Explore codebase" option that routes to CocoIndex. |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10492:   175	| Dependency | CocoIndex daemon must be runnable for REQ-012 verification. | Medium | Document the start command and add a smoke test before remediation lands. |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10595:/bin/zsh -lc 'rg -n "function|async function|export|memory_search|toolCache|cache|causal|FTS|BM25|vector|search" .opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts .opencode/skills/system-spec-kit/mcp_server/handlers/memory-context.ts .opencode/skills/system-spec-kit/mcp_server/lib/cache/tool-cache.ts .opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts .opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts' in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10636:.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:729:      tool: 'memory_search',
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10642:.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:1044:    tool: 'memory_search',
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10680:.opencode/skills/system-spec-kit/mcp_server/lib/cache/tool-cache.ts:312:    'memory_search',
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10714:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-context.ts:88:  includeTrace?: boolean; // CHK-040: Forward to internal memory_search calls
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10715:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-context.ts:124:  includeTrace?: boolean; // CHK-040: Forward to internal memory_search calls
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10726:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-context.ts:530:            tool: 'memory_search',
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10727:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-context.ts:542:            tool: 'memory_search',
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10728:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-context.ts:559:          tool: 'memory_search',
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10729:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-context.ts:570:          tool: 'memory_search',
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10750:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-context.ts:1706:      `For more granular control, use L2 tools: memory_search, memory_match_triggers`,
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10764:.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:153: * value in cache keys (e.g. memory_search when `enableCausalBoost=true`) so
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10767:.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:157: * R-007-12 — targeted memory_search cache invalidation.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10776:.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:175:  // includes it (e.g. memory_search when enableCausalBoost=true) becomes
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10855:.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:1039:  // R-007-12: Generation counter for memory_search cache invalidation
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10877:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:106:// Feature catalog: Semantic and lexical search (memory_search)
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10901:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:467:    tool: 'memory_search',
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10911:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:609:/** Handle memory_search tool — performs hybrid vector/BM25 search with intent-aware ranking.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10916:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:680:        tool: 'memory_search',
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10918:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:692:      tool: 'memory_search',
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10921:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:720:          tool: 'memory_search',
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10922:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:739:      tool: 'memory_search',
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10923:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:751:      tool: 'memory_search',
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10933:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:849:  // the affected memory_search entries on the next lookup. We deliberately
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10942:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:891:  const cacheKey = toolCache.generateCacheKey('memory_search', cacheArgs);
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10950:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:952:    // Phase B T018/T019: Community search fallback — inject community members on weak results
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10958:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:1201:      toolCache.set(cacheKey, cachePayload, { toolName: 'memory_search' });
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10984:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:1531:const handle_memory_search = handleMemorySearch;
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:10986:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:1534:  handle_memory_search,
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:11059:    69	- [ ] Memory indexer surfaces this packet via `memory_search`
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:11088:    98	- **Cluster 6 — Folder Discovery + Channel Health (P1/P2)** — REQ-008, REQ-012, REQ-017. Folder-discovery binds on weak signal ("Semantic Search" → `skilled-agent-orchestration/023-sk-deep-research-creation`); CocoIndex daemon failure is silent; "code graph" vs "causal graph" naming collides. Change surface: similarity threshold + startup health check + naming disambiguation.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:11146:   156	| CocoIndex daemon | External | Red (down — observed in conversation) | REQ-012 verification blocked until daemon runnable |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:11269:   108	- [ ] T602 [P] Add CocoIndex daemon health check at `/memory:search` invocation start
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:11279:   118	- [ ] T705 Regression test: weak query triggers fallback; output includes `fallback_tier` field
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:11308:   147	- [ ] Memory indexer surfaces this packet via `memory_search "memory search runtime bugs"`
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:11697:   849	  // the affected memory_search entries on the next lookup. We deliberately
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:11739:   891	  const cacheKey = toolCache.generateCacheKey('memory_search', cacheArgs);
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:11771:   952	    // Phase B T018/T019: Community search fallback — inject community members on weak results
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:11803:  1201	      toolCache.set(cacheKey, cachePayload, { toolName: 'memory_search' });
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12015:   159	4. **CocoIndex daemon health was not directly probed.** REQ-012 is based on the conversation transcript reporting daemon-not-running; verify the daemon's actual state before remediation.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12019:/bin/zsh -lc "rg -n \"TODO|REQ-00|Cluster|Semantic Search|folderDiscovery|quality|gap|causal-stats|memory_causal_stats|CocoIndex|fallback_tier\" .opencode/skills/system-spec-kit/mcp_server .opencode/commands/memory/search.md .opencode/specs/system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/005-memory-search-runtime-bugs -g '"'!*.map'"'" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12022:.opencode/commands/memory/search.md:4:allowed-tools: Read, spec_kit_memory_memory_context, spec_kit_memory_memory_quick_search, spec_kit_memory_memory_search, spec_kit_memory_memory_match_triggers, spec_kit_memory_task_preflight, spec_kit_memory_task_postflight, spec_kit_memory_memory_drift_why, spec_kit_memory_memory_causal_link, spec_kit_memory_memory_causal_stats, spec_kit_memory_memory_causal_unlink, spec_kit_memory_eval_run_ablation, spec_kit_memory_eval_reporting_dashboard, spec_kit_memory_memory_get_learning_history
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12024:.opencode/commands/memory/search.md:106:- CocoIndex semantic search (`mcp__cocoindex_code__search`) integrates as the vector/semantic channel, providing natural-language code discovery alongside indexed-continuity vector search
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12056:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/005-memory-search-runtime-bugs/spec.md:81:- Documenting every observed defect from the conversation transcript and the live reproduction probes against `memory_context`, `memory_search`, and `memory_causal_stats`.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12065:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/005-memory-search-runtime-bugs/spec.md:124:| REQ-007 | `QUALITY=gap` flag MUST trigger automatic broadening before returning. | Spec §1 promises 3-tier FTS fallback (FTS5 → BM25 → Grep) on weak retrievals. Currently `avg_score:0.13`, `quality:"gap"` is reported but no broadening occurs. After fix, gap-flagged retrievals attempt at least one fallback tier before returning. |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12066:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/005-memory-search-runtime-bugs/spec.md:125:| REQ-008 | Folder-discovery MUST NOT auto-bind on weak signal. | Currently "Semantic Search" caused `folderDiscovery.specFolder = "skilled-agent-orchestration/023-sk-deep-research-creation"` (no semantic relationship). After fix, folder-binding requires either explicit `specFolder` parameter or per-token similarity above a documented threshold. |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12068:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/005-memory-search-runtime-bugs/spec.md:134:| REQ-012 | CocoIndex daemon health MUST be checked before relying on the vector channel. | Current behavior: command attempts CocoIndex search, fails silently when daemon is down. After fix, command emits an explicit `WARN: vector channel unavailable, lexical-only` line in the result block when daemon is unreachable. |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12070:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/005-memory-search-runtime-bugs/spec.md:136:| REQ-014 | AskUserQuestion custom-answer routing MUST be defined. | Spec §4 offers 7 intents + "Analysis tools". A custom answer like "Semantic Search" currently becomes the QUERY (auto-detect intent) — undocumented. Either document this routing or add explicit "Code search / Explore codebase" option that routes to CocoIndex. |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12074:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/005-memory-search-runtime-bugs/spec.md:175:| Dependency | CocoIndex daemon must be runnable for REQ-012 verification. | Medium | Document the start command and add a smoke test before remediation lands. |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12093:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/005-memory-search-runtime-bugs/plan.md:98:- **Cluster 6 — Folder Discovery + Channel Health (P1/P2)** — REQ-008, REQ-012, REQ-017. Folder-discovery binds on weak signal ("Semantic Search" → `skilled-agent-orchestration/023-sk-deep-research-creation`); CocoIndex daemon failure is silent; "code graph" vs "causal graph" naming collides. Change surface: similarity threshold + startup health check + naming disambiguation.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12102:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/005-memory-search-runtime-bugs/plan.md:156:| CocoIndex daemon | External | Red (down — observed in conversation) | REQ-012 verification blocked until daemon runnable |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12114:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/005-memory-search-runtime-bugs/tasks.md:108:- [ ] T602 [P] Add CocoIndex daemon health check at `/memory:search` invocation start
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12119:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/005-memory-search-runtime-bugs/tasks.md:118:- [ ] T705 Regression test: weak query triggers fallback; output includes `fallback_tier` field
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12126:.opencode/skills/system-spec-kit/mcp_server/context-server.ts:736:    hints.push(`Code graph: ${pkg.codeGraphStatus}, CocoIndex: ${pkg.cocoIndexAvailable ? 'available' : 'not installed'}`);
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12133:.opencode/skills/system-spec-kit/mcp_server/ENV_REFERENCE.md:17:**Graph as a first-class feature family.** The `SPECKIT_GRAPH_*` variables form a dedicated feature family (see [Section 6](#6-graph) and [Section 7](#7-graph-calibration)) controlling structural code graph indexing, graph-first routing in the search pipeline, causal graph traversal, and calibration profiles. Since graph-first routing is now the default query dispatch order (Code Graph -> CocoIndex -> Memory), the graph env vars are among the most impactful configuration levers.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12163:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/005-memory-search-runtime-bugs/implementation-summary.md:159:4. **CocoIndex daemon health was not directly probed.** REQ-012 is based on the conversation transcript reporting daemon-not-running; verify the daemon's actual state before remediation.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12170:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/005-memory-search-runtime-bugs/graph-metadata.json:115:    "causal_summary": "Live /memory:search invocation against the indexed-continuity runtime exposed 17 defects across the retrieval, output rendering, and causal-graph subcommands. P0 issues: intent classifier returns fix_bug at confidence 0.098 for 'Semantic Search' instead of the documented understand fallback; memory_context wrapper reports truncated=true with returnedResultCount>0 yet emits count:0,results:[] in the payload while consuming only 2% of token budget; output rendering uses 'Auto-triggered memories' — explicitly forbidden by spec §4A Step 4b; dual classifiers (meta.intent vs data.queryIntentRouting) emit different intents with no resolution policy. P1 issues: causal-stats returns 3 of 6 documented relation types, labels itself healthy while meetsTarget=false, exhibits lopsided supersedes-only edge growth (+344 in 15 min, caused/supports unchanged); ephemeral session defaults defeat enableDedup; 'Context quality is degraded' hint emitted unconditionally; folder-discovery binds on weak signal. P2 issues: CocoIndex daemon failure silent; QUALITY=gap flag does not trigger documented 3-tier FTS fallback; AskUserQuestion custom-answer routing undefined; 'code graph' vs 'causal graph' naming collision. Findings clustered into 7 root-cause buckets in plan.md for staged remediation by a follow-up packet.",
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12171:.opencode/skills/system-spec-kit/mcp_server/tool-schemas.ts:48:  description: '[L1:Orchestration] Unified entry point for context retrieval with intent-aware routing. START HERE for most context-retrieval operations across indexed spec docs and constitutional rules. For session recovery, use mode: \'resume\' with profile: \'resume\'. Automatically detects task intent (add_feature, fix_bug, refactor, security_audit, understand, find_spec, find_decision) and routes to optimal retrieval strategy. Modes: auto (default), quick (trigger-based), deep (comprehensive), focused (intent-optimized), resume (session recovery). Token Budget: 3500. For code search by concept/intent, prefer mcp__cocoindex_code__search (CocoIndex). For structural code queries (callers, imports), prefer code_graph_query.',
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12172:.opencode/skills/system-spec-kit/mcp_server/tool-schemas.ts:55:  description: '[L2:Core] Search indexed spec-doc continuity semantically using vector similarity. Returns ranked results with similarity scores. Constitutional tier rules are ALWAYS included at the top of results (~2000 tokens max), regardless of query. Requires query (string), concepts (array of 2-5 strings), or cursor (string) for continuation pagination. Supports intent-aware retrieval (REQ-006) with task-specific weight adjustments. When implicit feedback logging is enabled, searches also emit shadow-only feedback signals such as search_shown and, for includeContent runs, result_cited. Token Budget: 3500. For code search by concept/intent, prefer mcp__cocoindex_code__search (CocoIndex). For structural code queries (callers, imports), prefer code_graph_query.',
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12182:.opencode/skills/system-spec-kit/mcp_server/tool-schemas.ts:600:  description: '[L6:Analysis] Get LLM-oriented compact graph neighborhoods. Accepts CocoIndex search results as seeds — use CocoIndex (mcp__cocoindex_code__search) for semantic search first, then pass results here for structural expansion. Supports manual seeds (provider: manual) and graph seeds (provider: graph). Modes: neighborhood (1-hop calls+imports), outline (file symbols), impact (reverse callers). When readiness requires a full scan, returns an explicit blocked payload with requiredAction `code_graph_scan`, readiness metadata, and lastPersistedAt instead of degraded graph answers. Successful responses include metadata.partialOutput for deadline/budget truncation details (reasons, omittedSections, omittedAnchors, truncatedText). Token Budget: 1200.',
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12183:.opencode/skills/system-spec-kit/mcp_server/tool-schemas.ts:618:            file: { type: 'string', description: 'CocoIndex file path (provider: cocoindex)' },
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12184:.opencode/skills/system-spec-kit/mcp_server/tool-schemas.ts:619:            range: { type: 'object', properties: { start: { type: 'number' }, end: { type: 'number' } }, description: 'CocoIndex line range' },
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12185:.opencode/skills/system-spec-kit/mcp_server/tool-schemas.ts:620:            score: { type: 'number', description: 'CocoIndex relevance score' },
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12186:.opencode/skills/system-spec-kit/mcp_server/tool-schemas.ts:621:            snippet: { type: 'string', description: 'CocoIndex snippet text preserved with the seed' },
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12187:.opencode/skills/system-spec-kit/mcp_server/tool-schemas.ts:628:        description: 'Seeds from CocoIndex, manual input, or graph lookups',
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12188:.opencode/skills/system-spec-kit/mcp_server/tool-schemas.ts:718:  description: '[L7:Maintenance] Check CocoIndex availability. Returns available, binaryPath, indexExists, indexSize, and recommendation.',
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12189:.opencode/skills/system-spec-kit/mcp_server/tool-schemas.ts:724:  description: '[L7:Maintenance] Trigger CocoIndex incremental (or full) re-indexing of the workspace.',
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12190:.opencode/skills/system-spec-kit/mcp_server/tool-schemas.ts:736:  description: '[L7:Maintenance] Submit quality feedback on CocoIndex search results to improve future searches.',
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12191:.opencode/skills/system-spec-kit/mcp_server/tool-schemas.ts:759:  description: '[L1:Orchestration] Resume session with combined memory, code graph, and CocoIndex status in a single call. Use when you want the detailed merged resume payload directly. For the canonical first-call recovery path on session start or after /clear, prefer session_bootstrap. Use minimal: true to skip the heavy memory context call and return code graph, CocoIndex, structural context, hints, and session-quality metadata without the full memory payload.',
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12192:.opencode/skills/system-spec-kit/mcp_server/tool-schemas.ts:766:      minimal: { type: 'boolean', description: 'When true, skip the heavy memory context call and return code-graph, CocoIndex, structural-context, hints, and session-quality fields without the full memory payload' },
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12195:.opencode/skills/system-spec-kit/mcp_server/tool-schemas.ts:954:  // L8: CocoIndex
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12197:.opencode/skills/system-spec-kit/mcp_server/INSTALL_GUIDE.md:640:### memory_search: Semantic Search
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12203:.opencode/skills/system-spec-kit/mcp_server/README.md:59:| **MCP tools** | Live registry | Core memory layers plus dedicated code graph, CocoIndex dispatch, and Skill Advisor groups |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12204:.opencode/skills/system-spec-kit/mcp_server/README.md:60:| **Search channels** | 5 core + CocoIndex bridge | Vector, FTS5, BM25, Causal Graph, Degree (+ CocoIndex semantic code search as external bridge) |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12205:.opencode/skills/system-spec-kit/mcp_server/README.md:73:| **Search** | Vector similarity only | 5 core channels + CocoIndex bridge, fused with Reciprocal Rank Fusion (K tuned per intent) |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12206:.opencode/skills/system-spec-kit/mcp_server/README.md:74:| **Routing** | No routing | Graph-first structural routing: Code Graph -> CocoIndex -> Memory; 3-tier FTS fallback when graph/semantic miss |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12208:.opencode/skills/system-spec-kit/mcp_server/README.md:89:The indexed-continuity store exposes its MCP tools through 4 memory slash commands plus the borrowed recovery workflow in `/spec_kit:resume`. Dedicated code-graph, CocoIndex, and Skill Advisor tools live in the same server. Think of commands as doors into the system. Each door opens access only to the tools it needs.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12209:.opencode/skills/system-spec-kit/mcp_server/README.md:245:**Five core search channels** work together, with **CocoIndex** available as an external semantic code search bridge:
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12210:.opencode/skills/system-spec-kit/mcp_server/README.md:254:| **CocoIndex** *(bridge)* | Semantic code search via vector embeddings across source files | Finding code implementations when memory channels miss; concept-first code discovery |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12211:.opencode/skills/system-spec-kit/mcp_server/README.md:256:**Graph-first routing** determines query dispatch order: structural queries route to the Code Graph first, then CocoIndex for semantic code discovery, then the 5-channel memory pipeline. This avoids forcing one search system to handle both structural relationships and semantic similarity.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12214:.opencode/skills/system-spec-kit/mcp_server/README.md:284:**Stage 1 -- Gather candidates** using graph-first routing: structural queries dispatch to Code Graph first, then CocoIndex for semantic code discovery, then the spec-doc record pipeline's active channels in parallel. Constitutional-tier memories are always injected regardless of score.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12224:.opencode/skills/system-spec-kit/mcp_server/README.md:542:**Architecture:** CocoIndex (semantic, external MCP) finds code by concept. Code Graph (structural, this server) maps imports, calls and hierarchy. Memory (session, this server) preserves decisions. The compact-merger combines all three under a 4000-token budget for compaction injection. Code-graph source is self-contained under `code-graph/` with `handlers/`, `lib/`, `tools/`, and `tests/`.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12225:.opencode/skills/system-spec-kit/mcp_server/README.md:566:**Query routing:** Structural queries (callers, imports, dependencies) go to `code_graph_query`. Semantic and concept queries go to CocoIndex (`mcp__cocoindex_code__search`). Session and memory queries go to `memory_context`.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12226:.opencode/skills/system-spec-kit/mcp_server/README.md:655:Resume session with combined memory, code graph and CocoIndex status in a single call. Use when you want the detailed merged resume payload directly. The response carries freshness-aware code-graph status (`fresh`, `stale`, `empty`, `error`) instead of count-only health. Session-resume auth binds `args.sessionId` to the transport caller context from `lib/context/caller-context.ts`; mismatches are rejected by default, with `MCP_SESSION_RESUME_AUTH_MODE=permissive` available for canary rollout. For the canonical first-call recovery path on session start or after `/clear`, prefer `session_bootstrap`, and for operator-facing packet recovery prefer `/spec_kit:resume`, which reconstructs context from `handover.md`, then `_memory.continuity`, then packet docs.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12227:.opencode/skills/system-spec-kit/mcp_server/README.md:660:| `minimal` | boolean | Skip heavy memory context, return code graph, CocoIndex, structural context, hints, and optional session quality without the full memory payload |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12236:.opencode/skills/system-spec-kit/mcp_server/README.md:1075:Get LLM-oriented compact graph neighborhoods. Accepts CocoIndex search results as seeds for structural expansion. Modes: `neighborhood` (1-hop calls plus imports), `outline` (file symbols), `impact` (reverse callers). Successful responses return `status: "ok"` plus readiness/trust metadata, resolved anchors, graph context, and `data.metadata.partialOutput` so callers can see whether deadline or token-budget pressure produced partial output. When the read path determines the graph needs a full scan, the tool returns an explicit `status: "blocked"` payload with `data.blocked`, `graphAnswersOmitted`, `requiredAction: "code_graph_scan"`, and the same readiness/trust metadata instead of partial graph answers.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12237:.opencode/skills/system-spec-kit/mcp_server/README.md:1082:| `seeds` | array | Seeds from CocoIndex, manual input or graph lookups |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12239:.opencode/skills/system-spec-kit/mcp_server/README.md:1190:Check CocoIndex availability, binary path and index status.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12240:.opencode/skills/system-spec-kit/mcp_server/README.md:1194:| _(none required)_ |  | Returns CocoIndex health |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12241:.opencode/skills/system-spec-kit/mcp_server/README.md:1200:Trigger CocoIndex incremental or full re-indexing of the workspace.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12242:.opencode/skills/system-spec-kit/mcp_server/README.md:1210:Submit quality feedback on CocoIndex search results to improve future searches.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12244:.opencode/skills/system-spec-kit/mcp_server/README.md:1287:| L8 | Code Graph + Skill Graph + CocoIndex bridge + Skill Advisor | 15 | 1,400 | Code graph scan/query/status/context, `detect_changes`, skill graph + advisor (`advisor_recommend`/`advisor_status`/`advisor_validate`), CocoIndex bridge (`ccc_status`/`ccc_reindex`/`ccc_feedback`) |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12248:.opencode/skills/system-spec-kit/mcp_server/README.md:1555:{ "tool": "memory_search", "arguments": { "query": "your query", "min_quality_score": 0.5 } }
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12256:.opencode/skills/system-spec-kit/mcp_server/schemas/tool-input-schemas.ts:647:  memory_search: ['cursor', 'query', 'concepts', 'specFolder', 'tenantId', 'userId', 'agentId', 'limit', 'sessionId', 'enableDedup', 'tier', 'contextType', 'useDecay', 'includeContiguity', 'includeConstitutional', 'enableSessionBoost', 'enableCausalBoost', 'includeContent', 'anchors', 'min_quality_score', 'minQualityScore', 'bypassCache', 'rerank', 'applyLengthPenalty', 'applyStateLimits', 'minState', 'intent', 'autoDetectIntent', 'trackAccess', 'includeArchived', 'mode', 'includeTrace', 'profile'],
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12265:.opencode/skills/system-spec-kit/mcp_server/skill_advisor/lib/scorer/scoring-constants.ts:108:  readonly semanticSearchCocoIndexBonus: number;
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12266:.opencode/skills/system-spec-kit/mcp_server/skill_advisor/lib/scorer/scoring-constants.ts:175:    semanticSearchCocoIndexBonus: 0.5,
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12271:.opencode/skills/system-spec-kit/mcp_server/code_graph/handlers/README.md:14:| `context.ts` | `code_graph_context` | Build LLM-oriented graph neighborhoods from manual, graph, or CocoIndex seeds; successful responses include anchors, graph context, and `metadata.partialOutput`, while full-scan-required reads return an explicit blocked payload with `requiredAction: "code_graph_scan"` |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12275:.opencode/skills/system-spec-kit/mcp_server/code_graph/handlers/ccc-reindex.ts:2:// MODULE: CocoIndex Re-index Handler
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12276:.opencode/skills/system-spec-kit/mcp_server/code_graph/handlers/ccc-reindex.ts:39:            error: 'CocoIndex binary not found. Install: bash .opencode/skills/mcp-coco-index/scripts/install.sh',
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12277:.opencode/skills/system-spec-kit/mcp_server/skill_advisor/lib/scorer/fusion.ts:220:    if (recommendation.skill === 'mcp-coco-index') return R.semanticSearchCocoIndexBonus;
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12310:.opencode/skills/system-spec-kit/mcp_server/code_graph/handlers/ccc-feedback.ts:2:// MODULE: CocoIndex Feedback Handler
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12343:.opencode/skills/system-spec-kit/mcp_server/code_graph/handlers/ccc-status.ts:2:// MODULE: CocoIndex Status Handler
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12344:.opencode/skills/system-spec-kit/mcp_server/code_graph/handlers/ccc-status.ts:4:// MCP tool handler for ccc_status — reports CocoIndex availability and stats.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12345:.opencode/skills/system-spec-kit/mcp_server/code_graph/handlers/ccc-status.ts:55:              ? 'Install CocoIndex: bash .opencode/skills/mcp-coco-index/scripts/install.sh'
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12346:.opencode/skills/system-spec-kit/mcp_server/code_graph/handlers/ccc-status.ts:58:                : 'CocoIndex is ready. Use mcp__cocoindex_code__search for semantic queries.',
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12356:.opencode/skills/system-spec-kit/mcp_server/skill_advisor/scripts/skill_advisor.py:1517:    # --- CocoIndex semantic code search ---
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12357:.opencode/skills/system-spec-kit/mcp_server/skill_advisor/scripts/skill_advisor.py:1789:# Multiplier applied to CocoIndex relevance score (0-1) to produce an advisor boost.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12358:.opencode/skills/system-spec-kit/mcp_server/skill_advisor/scripts/skill_advisor.py:1799:# Max results from CocoIndex when using built-in search.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12360:.opencode/skills/system-spec-kit/mcp_server/skill_advisor/scripts/skill_advisor.py:1981:    """Map a CocoIndex result file path to a known skill name.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12361:.opencode/skills/system-spec-kit/mcp_server/skill_advisor/scripts/skill_advisor.py:2100:    """Blend CocoIndex semantic search results into keyword scoring.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12362:.opencode/skills/system-spec-kit/mcp_server/skill_advisor/scripts/skill_advisor.py:2124:    """Return the preferred CocoIndex binary path, favoring the repo-local install."""
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12363:.opencode/skills/system-spec-kit/mcp_server/skill_advisor/scripts/skill_advisor.py:2131:    """Return True when external CocoIndex lookup is disabled via environment."""
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12367:.opencode/skills/system-spec-kit/mcp_server/skill_advisor/scripts/skill_advisor.py:2694:        semantic_hits: Optional CocoIndex search results as a list of
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12368:.opencode/skills/system-spec-kit/mcp_server/skill_advisor/scripts/skill_advisor.py:2722:    # Blend CocoIndex semantic search results when available
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12369:.opencode/skills/system-spec-kit/mcp_server/skill_advisor/scripts/skill_advisor.py:3144:  # CocoIndex semantic search (built-in, requires ccc daemon):
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12370:.opencode/skills/system-spec-kit/mcp_server/skill_advisor/scripts/skill_advisor.py:3148:  # CocoIndex semantic search (pre-computed MCP results):
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12371:.opencode/skills/system-spec-kit/mcp_server/skill_advisor/scripts/skill_advisor.py:3182:                         help='Run CocoIndex semantic search (via ccc CLI) to supplement keyword matching.')
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12372:.opencode/skills/system-spec-kit/mcp_server/skill_advisor/scripts/skill_advisor.py:3184:                         help='Pre-computed CocoIndex results as JSON array of {"path": str, "score": float} objects.')
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12380:.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:250:  it('recommends "ask_user" for low_confidence + knowledge_gap', () => {
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12426:.opencode/skills/system-spec-kit/mcp_server/code_graph/lib/README.md:3:Core implementation for the structural code graph system. Provides file parsing, SQLite storage, graph queries, CocoIndex bridge, budget allocation, and compaction merging.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12427:.opencode/skills/system-spec-kit/mcp_server/code_graph/lib/README.md:14:| `seed-resolver.ts` | Resolves CocoIndex file:line results to graph nodes |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12428:.opencode/skills/system-spec-kit/mcp_server/code_graph/lib/README.md:18:| `compact-merger.ts` | 3-source merge (Memory + Code Graph + CocoIndex) for compaction |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12429:.opencode/skills/system-spec-kit/mcp_server/code_graph/lib/README.md:24:- **CocoIndex** (semantic, external MCP): finds relevant code by concept
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12434:.opencode/skills/system-spec-kit/mcp_server/tests/startup-brief.vitest.ts:50:  isCocoIndexAvailable: vi.fn(() => false),
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12435:.opencode/skills/system-spec-kit/mcp_server/tests/startup-brief.vitest.ts:77:    expect(brief.startupSurface).toContain('- CocoIndex: missing');
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12436:.opencode/skills/system-spec-kit/mcp_server/tests/startup-brief.vitest.ts:134:    vi.mocked(cocoIndexPath.isCocoIndexAvailable).mockReturnValueOnce(true);
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12437:.opencode/skills/system-spec-kit/mcp_server/tests/startup-brief.vitest.ts:137:    expect(brief.startupSurface).toContain('- CocoIndex: available');
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12438:.opencode/skills/system-spec-kit/mcp_server/tests/startup-brief.vitest.ts:143:    expect(brief.graphOutline).toContain('CocoIndex');
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12444:.opencode/skills/system-spec-kit/mcp_server/code_graph/lib/query-intent-classifier.ts:6:// (CocoIndex) vs hybrid (both).
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12445:.opencode/skills/system-spec-kit/mcp_server/code_graph/lib/query-intent-classifier.ts:118: * (code graph) and semantic (CocoIndex) retrieval backends.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12455:.opencode/skills/system-spec-kit/mcp_server/code_graph/lib/code-graph-context.ts:4:// LLM-oriented compact graph neighborhoods with CocoIndex seed support.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12484:.opencode/skills/system-spec-kit/mcp_server/code_graph/lib/startup-brief.ts:10:import { isCocoIndexAvailable } from '../../lib/utils/cocoindex-path.js';
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12485:.opencode/skills/system-spec-kit/mcp_server/code_graph/lib/startup-brief.ts:139:    `- CocoIndex: ${args.cocoIndexAvailable ? 'available' : 'missing'}`,
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12489:.opencode/skills/system-spec-kit/mcp_server/code_graph/lib/startup-brief.ts:239:      lines.push('Orientation: use code graph highlights for structural entry points and call paths; use CocoIndex for semantic discovery when the symbol or file is still unknown.');
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12490:.opencode/skills/system-spec-kit/mcp_server/code_graph/lib/startup-brief.ts:302:  const cocoIndexAvailable = isCocoIndexAvailable();
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12535:.opencode/skills/system-spec-kit/mcp_server/code_graph/lib/compact-merger.ts:4:// Merges context from multiple sources (Memory, Code Graph, CocoIndex, Session)
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12536:.opencode/skills/system-spec-kit/mcp_server/code_graph/lib/compact-merger.ts:18:  cocoIndex: string;         // Semantic neighbors (from CocoIndex)
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12551:.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:339:    expect(requestQuality.label).toBe('gap');
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12553:.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:357:    expect(requestQuality.label).toBe('gap');
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12554:.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:364:    // Scores around 0.4–0.45 → should be "weak" (not gap, not good)
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12555:.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:369:    const validLabels = ['good', 'weak', 'gap'];
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12567:.opencode/skills/system-spec-kit/mcp_server/code_graph/lib/seed-resolver.ts:4:// Resolves CocoIndex search results (file:line) to code graph nodes.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12568:.opencode/skills/system-spec-kit/mcp_server/code_graph/lib/seed-resolver.ts:10:/** A seed from CocoIndex or other providers */
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12569:.opencode/skills/system-spec-kit/mcp_server/code_graph/lib/seed-resolver.ts:19:/** Native CocoIndex search result as a seed */
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12570:.opencode/skills/system-spec-kit/mcp_server/code_graph/lib/seed-resolver.ts:20:export interface CocoIndexSeed {
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12571:.opencode/skills/system-spec-kit/mcp_server/code_graph/lib/seed-resolver.ts:47:export type AnySeed = CodeGraphSeed | CocoIndexSeed | ManualSeed | GraphSeed;
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12572:.opencode/skills/system-spec-kit/mcp_server/code_graph/lib/seed-resolver.ts:75:function isCocoIndexSeed(seed: unknown): seed is CocoIndexSeed {
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12573:.opencode/skills/system-spec-kit/mcp_server/code_graph/lib/seed-resolver.ts:95:/** Resolve a CocoIndex seed by converting to CodeGraphSeed and delegating */
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12574:.opencode/skills/system-spec-kit/mcp_server/code_graph/lib/seed-resolver.ts:96:export function resolveCocoIndexSeed(seed: CocoIndexSeed): ArtifactRef {
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12575:.opencode/skills/system-spec-kit/mcp_server/code_graph/lib/seed-resolver.ts:334:  if (isCocoIndexSeed(seed)) return resolveCocoIndexSeed(seed);
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12582:.opencode/skills/system-spec-kit/mcp_server/code_graph/README.md:98:│   ├── ccc-status.ts               # CocoIndex status bridge
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12583:.opencode/skills/system-spec-kit/mcp_server/code_graph/README.md:99:│   ├── ccc-reindex.ts              # CocoIndex reindex bridge
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12584:.opencode/skills/system-spec-kit/mcp_server/code_graph/README.md:100:│   ├── ccc-feedback.ts             # CocoIndex feedback bridge
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12587:.opencode/skills/system-spec-kit/mcp_server/code_graph/README.md:159:| `anchors[*]` | `source`, `provider`, `score`, `snippet`, `range` | Preserves seed provenance so CocoIndex/manual/graph-sourced anchors stay traceable |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12654:.opencode/skills/system-spec-kit/mcp_server/tests/codex-session-start-hook.vitest.ts:28:        '- CocoIndex: available',
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12655:.opencode/skills/system-spec-kit/mcp_server/tests/codex-session-start-hook.vitest.ts:65:          '- CocoIndex: available',
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12678:.opencode/skills/system-spec-kit/mcp_server/tests/structural-contract.vitest.ts:46:    isCocoIndexAvailable: vi.fn(() => false),
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12702:.opencode/skills/system-spec-kit/mcp_server/handlers/session-resume.ts:5:// code graph status, and CocoIndex availability into a single call.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12703:.opencode/skills/system-spec-kit/mcp_server/handlers/session-resume.ts:13:import { isCocoIndexAvailable } from '../lib/utils/cocoindex-path.js';
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12704:.opencode/skills/system-spec-kit/mcp_server/handlers/session-resume.ts:107:interface CocoIndexStatus {
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12705:.opencode/skills/system-spec-kit/mcp_server/handlers/session-resume.ts:115:  cocoIndex: CocoIndexStatus;
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12706:.opencode/skills/system-spec-kit/mcp_server/handlers/session-resume.ts:128:  cocoIndex: CocoIndexStatus;
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12707:.opencode/skills/system-spec-kit/mcp_server/handlers/session-resume.ts:141:  cocoIndex: CocoIndexStatus;
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12708:.opencode/skills/system-spec-kit/mcp_server/handlers/session-resume.ts:182:        title: 'CocoIndex Status',
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12709:.opencode/skills/system-spec-kit/mcp_server/handlers/session-resume.ts:609:  // ── Sub-call 3: CocoIndex availability (F046/F051: shared helper) ──
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12710:.opencode/skills/system-spec-kit/mcp_server/handlers/session-resume.ts:610:  const cocoIndex: CocoIndexStatus = {
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12711:.opencode/skills/system-spec-kit/mcp_server/handlers/session-resume.ts:611:    available: isCocoIndexAvailable(),
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12712:.opencode/skills/system-spec-kit/mcp_server/handlers/session-resume.ts:615:    hints.push('CocoIndex not installed. Install: `bash .opencode/skills/mcp-coco-index/scripts/install.sh`');
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12713:.opencode/skills/system-spec-kit/mcp_server/handlers/session-resume.ts:707:      title: 'CocoIndex Status',
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12755:.opencode/skills/system-spec-kit/mcp_server/tests/budget-allocator.vitest.ts:34:      // CocoIndex and triggered are empty, their floors + overflow go to others
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12850:.opencode/skills/system-spec-kit/mcp_server/tests/hook-session-start.vitest.ts:259:            '- CocoIndex: available',
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12866:.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:23:  label: 'good' | 'weak' | 'gap';
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12867:.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:352:  it('assesses request quality as good, weak, or gap at the query level', async () => {
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12869:.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:402:    expect(gapEnvelope.data.requestQuality?.label).toBe('gap');
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12947:.opencode/skills/system-spec-kit/mcp_server/tests/search-fallback-tiered.vitest.ts:325:    expect(['low_quality', 'both']).toContain(weak?.reason);
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:12948:.opencode/skills/system-spec-kit/mcp_server/tests/graph-payload-validator.vitest.ts:212:      isCocoIndexAvailable: vi.fn(() => true),
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:13096:.opencode/skills/system-spec-kit/mcp_server/lib/session/session-snapshot.ts:12:import { isCocoIndexAvailable } from '../utils/cocoindex-path.js';
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:13097:.opencode/skills/system-spec-kit/mcp_server/lib/session/session-snapshot.ts:155:  // CocoIndex availability
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:13098:.opencode/skills/system-spec-kit/mcp_server/lib/session/session-snapshot.ts:158:    cocoIndexAvailable = isCocoIndexAvailable();
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:13335:.opencode/skills/system-spec-kit/mcp_server/hooks/memory-surface.ts:5:import { isCocoIndexAvailable } from '../lib/utils/cocoindex-path.js';
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:13336:.opencode/skills/system-spec-kit/mcp_server/hooks/memory-surface.ts:451:  // F046: CocoIndex availability via shared helper (no process.cwd())
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:13337:.opencode/skills/system-spec-kit/mcp_server/hooks/memory-surface.ts:452:  const cocoIndexAvailable = isCocoIndexAvailable();
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:13390:.opencode/skills/system-spec-kit/mcp_server/lib/utils/cocoindex-path.ts:2:// MODULE: CocoIndex Path Helper
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:13391:.opencode/skills/system-spec-kit/mcp_server/lib/utils/cocoindex-path.ts:4:// F046/F051: Shared helper for resolving the CocoIndex binary path.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:13392:.opencode/skills/system-spec-kit/mcp_server/lib/utils/cocoindex-path.ts:12:/** Relative path from project root to the CocoIndex CLI binary. */
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:13393:.opencode/skills/system-spec-kit/mcp_server/lib/utils/cocoindex-path.ts:48: * Get the absolute path to the CocoIndex binary.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:13394:.opencode/skills/system-spec-kit/mcp_server/lib/utils/cocoindex-path.ts:51:export function getCocoIndexBinaryPath(): string {
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:13395:.opencode/skills/system-spec-kit/mcp_server/lib/utils/cocoindex-path.ts:56: * Check whether the CocoIndex binary exists on disk.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:13396:.opencode/skills/system-spec-kit/mcp_server/lib/utils/cocoindex-path.ts:58:export function isCocoIndexAvailable(): boolean {
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:13397:.opencode/skills/system-spec-kit/mcp_server/lib/utils/cocoindex-path.ts:59:  return existsSync(getCocoIndexBinaryPath());
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:13495:.opencode/skills/system-spec-kit/mcp_server/hooks/gemini/session-prime.ts:180:        '- CocoIndex: unknown',
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:13496:.opencode/skills/system-spec-kit/mcp_server/hooks/claude/session-prime.ts:172:    '- CocoIndex: unknown',
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:13505:.opencode/skills/system-spec-kit/mcp_server/hooks/copilot/session-prime.ts:102:    '- CocoIndex: unknown',
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:13572:.opencode/skills/system-spec-kit/mcp_server/lib/search/confidence-scoring.ts:20://     "label": "good" | "weak" | "gap"
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:13574:.opencode/skills/system-spec-kit/mcp_server/lib/search/confidence-scoring.ts:63:export type RequestQualityLabel = 'good' | 'weak' | 'gap';
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:13581:.opencode/skills/system-spec-kit/mcp_server/lib/search/confidence-scoring.ts:298:    return { requestQuality: { label: 'gap' } };
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:13585:.opencode/skills/system-spec-kit/mcp_server/lib/search/confidence-scoring.ts:315:  return { requestQuality: { label: 'gap' } };
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:13597:.opencode/skills/system-spec-kit/mcp_server/hooks/claude/compact-inject.ts:6:// using the 3-source merge pipeline (Memory, Code Graph, CocoIndex)
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:13598:.opencode/skills/system-spec-kit/mcp_server/hooks/claude/compact-inject.ts:151:  // Hint for AI to use CocoIndex for semantic neighbors after recovery
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:13599:.opencode/skills/system-spec-kit/mcp_server/hooks/claude/compact-inject.ts:153:    sections.push('## Semantic Context (CocoIndex)\nUse `mcp__cocoindex_code__search` to find semantic neighbors of active files listed above.');
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:13803:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:952:    // Phase B T018/T019: Community search fallback — inject community members on weak results
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:13871:.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1028:    if (name !== 'memory_search' && name !== 'memory_context' && name !== 'memory_quick_search' && name !== 'session_health') {
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:13898:.opencode/skills/system-spec-kit/mcp_server/README.md:655:Resume session with combined memory, code graph and CocoIndex status in a single call. Use when you want the detailed merged resume payload directly. The response carries freshness-aware code-graph status (`fresh`, `stale`, `empty`, `error`) instead of count-only health. Session-resume auth binds `args.sessionId` to the transport caller context from `lib/context/caller-context.ts`; mismatches are rejected by default, with `MCP_SESSION_RESUME_AUTH_MODE=permissive` available for canary rollout. For the canonical first-call recovery path on session start or after `/clear`, prefer `session_bootstrap`, and for operator-facing packet recovery prefer `/spec_kit:resume`, which reconstructs context from `handover.md`, then `_memory.continuity`, then packet docs.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:13907:.opencode/skills/system-spec-kit/mcp_server/README.md:1194:| _(none required)_ |  | Returns CocoIndex health |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:13929:.opencode/skills/system-spec-kit/mcp_server/skill_advisor/scripts/skill_advisor.py:3198:        health["cocoindex_available"] = cocoindex_binary is not None
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:13930:.opencode/skills/system-spec-kit/mcp_server/skill_advisor/scripts/skill_advisor.py:3199:        health["cocoindex_binary"] = cocoindex_binary or ""
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:14381:.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:1472:          if (name !== 'memory_search' && name !== 'memory_context' && name !== 'memory_quick_search' && name !== 'session_health') {
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:14941:That’s the bug catalog. It lists the concrete failures around `memory_context`, `memory_search`, `memory_causal_stats`, folder discovery, and fallback behavior. Then read the task ledger:
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/I2/cli-codex-1/output.txt:14964:That’s the bug catalog. It lists the concrete failures around `memory_context`, `memory_search`, `memory_causal_stats`, folder discovery, and fallback behavior. Then read the task ledger:
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/013-code-graph-hook-improvements-pt-02/research.md:28:This packet deepened the code-graph and hook investigation beyond pt-01 by focusing on residual contract gaps that survived the earlier remediation wave. The strongest new issues are not broad storage or parser failures, but downstream correctness and transport leaks: read-path handlers continue operating when a full scan is required but intentionally suppressed, the CocoIndex bridge sheds semantic ranking fidelity before graph resolution, and scan-time enrichment metadata can remain stale because null summaries never clear prior state [.opencode/skills/system-spec-kit/mcp_server/code-graph/handlers/query.ts:595-599; .opencode/skills/system-spec-kit/mcp_server/code-graph/handlers/context.ts:103-106; .opencode/skills/system-spec-kit/mcp_server/code-graph/lib/seed-resolver.ts:19-25,86-92; .opencode/skills/system-spec-kit/mcp_server/code-graph/handlers/scan.ts:239-242]. The investigation also confirmed that persisted detector/enrichment summaries are still effectively write-only for operators, while startup structured payloads exist only at the builder layer and disappear at adapter boundaries and in adapter test expectations [.opencode/skills/system-spec-kit/mcp_server/code-graph/lib/code-graph-db.ts:226-259,652-692; .opencode/skills/system-spec-kit/mcp_server/code-graph/lib/startup-brief.ts:230-245; .opencode/skills/system-spec-kit/mcp_server/tests/startup-brief.vitest.ts:64-81; .opencode/skills/system-spec-kit/mcp_server/tests/codex-session-start-hook.vitest.ts:46-68]. The context deadline surface remains only partially real because the handler never supplies `deadlineMs`, only one mode enforces an elapsed-time budget, and budget-driven omissions are unlabeled in the response payload [.opencode/skills/system-spec-kit/mcp_server/code-graph/lib/code-graph-context.ts:13-21,189-240,281-327; .opencode/skills/system-spec-kit/mcp_server/code-graph/handlers/context.ts:168-176]. Ten iterations were used because novelty kept tapering but did not hit the two-iteration early-stop condition soon enough to justify a legal early exit.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/013-code-graph-hook-improvements-pt-02/research.md:35:- CocoIndex-to-code-graph seed resolution and neighborhood expansion behavior [.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/spec.md:67-74].
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/013-code-graph-hook-improvements-pt-02/research.md:41:- CocoIndex indexing internals, broad memory-system work, storage-engine rewrites, or the dedicated zero-calls lane [.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/spec.md:76-81].
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/013-code-graph-hook-improvements-pt-02/research.md:45:The packet ran 10 iterations and stopped at the configured cap rather than early convergence. Sources included the parent spec packet, pt-01 synthesis and findings registry, the closed CF notes used as background boundaries, live code in `mcp_server/code-graph/**` and `hooks/**`, and runtime-facing tests/docs. I attempted to use the deferred Spec Kit Memory and CocoIndex MCP tools first, but their calls returned cancelled responses in this runtime, so the investigation proceeded via direct source inspection and line-cited local evidence. Iteration notes were used to separate live gaps from ruled-out or already-closed themes, then collapsed into a six-finding synthesis.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/013-code-graph-hook-improvements-pt-02/research.md:62:- `F-002` `correctness` — The CocoIndex bridge discards semantic `score`, `snippet`, and meaningful range semantics before graph resolution, then reorders seeds by local graph confidence, which can mis-anchor or mis-rank multi-seed semantic search results [.opencode/skills/system-spec-kit/mcp_server/code-graph/lib/seed-resolver.ts:19-25,86-92,185-246,275-290].
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/013-code-graph-hook-improvements-pt-02/research.md:75:- Iteration 03 showed that the CocoIndex bridge drops semantic ranking context before graph resolution and then reorders on graph confidence [`iterations/iteration-03.md#findings`].
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/013-code-graph-hook-improvements-pt-02/research.md:92:### CocoIndex Bridge Fidelity
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/013-code-graph-hook-improvements-pt-02/research.md:97:  Recommendation: preserve CocoIndex `score`, `snippet`, and full range overlap through seed resolution, and only fall back to local graph confidence as a secondary tie-breaker.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/013-code-graph-hook-improvements-pt-02/research.md:150:| Semantic ranking is lost before graph resolution | P1 | Multi-seed semantic discovery can anchor to the wrong graph nodes | Preserve CocoIndex score/snippet/range through resolution |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/013-code-graph-hook-improvements-pt-02/research.md:165:- What combined scoring rule should order resolved CocoIndex seeds: semantic score first, graph confidence first, or a weighted blend?
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/013-code-graph-hook-improvements-pt-02/deep-research-dashboard.md:21:| 03 | `new-territory` | 0.68 | CocoIndex seed fidelity and graph bridge loss | 2 |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/013-code-graph-hook-improvements-pt-02/deep-research-dashboard.md:33:- `F-002` `P1` `correctness` — CocoIndex seeds lose ranking/snippet/range fidelity before graph resolution.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/013-code-graph-hook-improvements-pt-02/deep-research-strategy.md:10:- Do not treat CocoIndex indexing internals as the subject of this packet; only the code-graph bridge contract is in scope.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/013-code-graph-hook-improvements-pt-02/deep-research-strategy.md:27:- The parent packet explicitly scoped code-graph scan/read/readiness paths, CocoIndex bridge behavior, hook-triggered staleness handling, and operator-facing status/docs surfaces for follow-on investigation [.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/spec.md:54-74].
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/013-code-graph-hook-improvements-pt-02/deep-research-strategy.md:40:2. The CocoIndex-to-code-graph bridge still discards semantic ranking context, causing anchor resolution quality loss even when the graph lookup succeeds.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/013-code-graph-hook-improvements-pt-02/deep-research-strategy.md:57:3. Audit the CocoIndex seed bridge and graph anchor resolution fidelity.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/013-code-graph-hook-improvements-pt-02/deep-research-strategy.md:70:- Risk: mixing code-graph gaps with zero-calls or unrelated CocoIndex infrastructure.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/013-code-graph-hook-improvements-pt-02/findings-registry.json:37:      "summary": "The CocoIndex seed bridge throws away semantic score, snippet, and most range semantics before graph resolution, then reorders by local graph confidence.",
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/013-code-graph-hook-improvements-pt-02/findings-registry.json:45:      "recommended_fix": "Preserve CocoIndex score/snippet/range fidelity through seed resolution and blend semantic score with graph confidence when ordering resolved anchors.",
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/S3/cli-opencode-pure-1/output.txt:4:{"type":"tool_use","timestamp":1777229405218,"sessionID":"ses_234df9aedffegwYGjWKmvpEXVJ","part":{"id":"prt_dcb209106001uxxsaIrQCCy5FK","messageID":"msg_dcb2066ea001HRuyGlLyB7dWD0","sessionID":"ses_234df9aedffegwYGjWKmvpEXVJ","type":"tool","tool":"spec_kit_memory_memory_search","callID":"call_00_J2VxtmP5HgAl2ZuQBTpwpGYA","state":{"status":"completed","input":{"query":"SPECKIT_SAVE_PLANNER_MODE decision rationale","limit":10,"includeContent":true},"output":"{\n  \"summary\": \"> **[EVIDENCE GAP DETECTED]: Retrieved context has low mathematical confidence (Z=0.96). Consider first principles.**\\n\\nFound 5 memories (1 constitutional)\",\n  \"data\": {\n    \"searchType\": \"hybrid\",\n    \"count\": 1,\n    \"constitutionalCount\": 1,\n    \"requestQuality\": {\n      \"label\": \"gap\"\n    },\n    \"recovery\": {\n      \"status\": \"low_confidence\",\n      \"reason\": \"knowledge_gap\",\n      \"suggestedQueries\": [],\n      \"recommendedAction\": \"ask_user\"\n    },\n    \"stateStats\": {\n      \"minState\": \"\",\n      \"before\": {\n        \"UNKNOWN\": 5\n      },\n      \"after\": {\n        \"UNKNOWN\": 5\n      },\n      \"removed\": 0\n    },\n    \"featureFlags\": {\n      \"trmEnabled\": true,\n      \"multiQueryEnabled\": true,\n      \"stateLimitsApplied\": false\n    },\n    \"pipelineMetadata\": {\n      \"stage1\": {\n        \"searchType\": \"hybrid\",\n        \"channelCount\": 1,\n        \"activeChannels\": 2,\n        \"candidateCount\": 12,\n        \"constitutionalInjected\": 2,\n        \"durationMs\": 309\n      },\n      \"stage2\": {\n        \"sessionBoostApplied\": \"off\",\n        \"causalBoostApplied\": \"applied\",\n        \"intentWeightsApplied\": \"off\",\n        \"artifactRoutingApplied\": \"applied\",\n        \"feedbackSignalsApplied\": \"off\",\n        \"graphContribution\": {\n          \"killSwitchActive\": false,\n          \"causalBoosted\": 1,\n          \"coActivationBoosted\": 0,\n          \"communityInjected\": 0,\n          \"graphSignalsBoosted\": 0,\n          \"totalGraphInjected\": 0,\n          \"rolloutState\": \"bounded_runtime\"\n        },\n        \"qualityFiltered\": 0,\n        \"durationMs\": 6,\n        \"recencyFusionApplied\": true,\n        \"recencyFusionBoosted\": 11,\n        \"coActivationApplied\": true,\n        \"graphSignalsApplied\": true\n      },\n      \"stage3\": {\n        \"rerankApplied\": true,\n        \"rerankProvider\": \"cross-encoder\",\n        \"chunkReassemblyStats\": {\n          \"collapsedChunkHits\": 0,\n          \"chunkParents\": 0,\n          \"reassembled\": 0,\n          \"fallback\": 0\n        },\n        \"durationMs\": 261\n      },\n      \"stage4\": {\n        \"stateFiltered\": 0,\n        \"constitutionalInjected\": 2,\n        \"evidenceGapDetected\": true,\n        \"durationMs\": 0\n      },\n      \"timing\": {\n        \"stage1\": 310,\n        \"stage2\": 6,\n        \"stage3\": 261,\n        \"stage4\": 0,\n        \"total\": 577\n      }\n    },\n    \"lexicalPath\": \"fts5\",\n    \"fallbackState\": \"ok\",\n    \"evidenceGapWarning\": \"> **[EVIDENCE GAP DETECTED]: Retrieved context has low mathematical confidence (Z=0.96). Consider first principles.**\",\n    \"intent\": {\n      \"type\": \"find_decision\",\n      \"confidence\": 0.3214048531120873,\n      \"description\": \"Finding decision records or rationale\",\n      \"weightsApplied\": \"off\"\n    },\n    \"artifactRouting\": {\n      \"strategy\": {\n        \"artifactClass\": \"decision-record\",\n        \"semanticWeight\": 0.6,\n        \"keywordWeight\": 0.4,\n        \"recencyBias\": 0.2,\n        \"maxResults\": 5,\n        \"boostFactor\": 1\n      },\n      \"detectedClass\": \"decision-record\",\n      \"confidence\": 0.3333333333333333\n    },\n    \"artifact_routing\": {\n      \"strategy\": {\n        \"artifactClass\": \"decision-record\",\n        \"semanticWeight\": 0.6,\n        \"keywordWeight\": 0.4,\n        \"recencyBias\": 0.2,\n        \"maxResults\": 5,\n        \"boostFactor\": 1\n      },\n      \"detectedClass\": \"decision-record\",\n      \"confidence\": 0.3333333333333333\n    },\n    \"graphContribution\": {\n      \"killSwitchActive\": false,\n      \"causalBoosted\": 1,\n      \"coActivationBoosted\": 0,\n      \"communityInjected\": 0,\n      \"graphSignalsBoosted\": 0,\n      \"totalGraphInjected\": 0,\n      \"rolloutState\": \"bounded_runtime\"\n    },\n    \"graph_contribution\": {\n      \"killSwitchActive\": false,\n      \"causalBoosted\": 1,\n      \"coActivationBoosted\": 0,\n      \"communityInjected\": 0,\n      \"graphSignalsBoosted\": 0,\n      \"totalGraphInjected\": 0,\n      \"rolloutState\": \"bounded_runtime\"\n    },\n    \"rerankMetadata\": {\n      \"reranking_enabled\": true,\n      \"reranking_requested\": true,\n      \"reranking_applied\": true\n    },\n    \"sourceContract\": {\n      \"version\": \"gate-d-reader-ready-v1\",\n      \"archivedTierEnabled\": false,\n      \"legacyFallbackEnabled\": false,\n      \"includeArchivedCompatibility\": \"not_requested\",\n      \"preferredDocumentTypes\": [\n        \"spec_doc\",\n        \"continuity\"\n      ],\n      \"retainedResults\": 5,\n      \"droppedNonCanonicalResults\": 0,\n      \"countsBySourceKind\": {\n        \"spec_doc\": 4,\n        \"continuity\": 0,\n        \"constitutional\": 1\n      }\n    },\n    \"retrievalTrace\": {\n      \"traceId\": \"tr_mog4i0ym_ab3d91\",\n      \"query\": \"SPECKIT_SAVE_PLANNER_MODE decision rationale\",\n      \"intent\": \"find_decision\",\n      \"stages\": [\n        {\n          \"stage\": \"candidate\",\n          \"timestamp\": 1777229404820,\n          \"inputCount\": 1,\n          \"outputCount\": 12,\n          \"durationMs\": 309,\n          \"metadata\": {\n            \"searchType\": \"hybrid\",\n            \"mode\": null,\n            \"channelCount\": 1,\n            \"deepExpansion\": false,\n            \"r12EmbeddingExpansion\": true\n          }\n        },\n        {\n          \"stage\": \"fusion\",\n          \"timestamp\": 1777229404826,\n          \"inputCount\": 12,\n          \"outputCount\": 5,\n          \"durationMs\": 6,\n          \"metadata\": {\n            \"sessionBoostApplied\": \"off\",\n            \"causalBoostApplied\": \"applied\",\n            \"intentWeightsApplied\": \"off\",\n            \"artifactRoutingApplied\": \"applied\",\n            \"feedbackSignalsApplied\": \"off\",\n            \"graphContribution\": {\n              \"killSwitchActive\": false,\n              \"causalBoosted\": 1,\n              \"coActivationBoosted\": 0,\n              \"communityInjected\": 0,\n              \"graphSignalsBoosted\": 0,\n              \"totalGraphInjected\": 0,\n              \"rolloutState\": \"bounded_runtime\"\n            },\n            \"searchType\": \"hybrid\",\n            \"isHybrid\": true\n          }\n        },\n        {\n          \"stage\": \"rerank\",\n          \"timestamp\": 1777229405086,\n          \"inputCount\": 5,\n          \"outputCount\": 5,\n          \"durationMs\": 260,\n          \"metadata\": {\n            \"rerankApplied\": true,\n            \"provider\": \"cross-encoder\"\n          }\n        },\n        {\n          \"stage\": \"final-rank\",\n          \"timestamp\": 1777229405087,\n          \"inputCount\": 5,\n          \"outputCount\": 5,\n          \"durationMs\": 0,\n          \"metadata\": {\n            \"collapsedChunkHits\": 0,\n            \"chunkParents\": 0,\n            \"reassembled\": 0,\n            \"fallback\": 0\n          }\n        },\n        {\n          \"stage\": \"filter\",\n          \"timestamp\": 1777229405087,\n          \"inputCount\": 5,\n          \"outputCount\": 5,\n          \"durationMs\": 0,\n          \"metadata\": {\n            \"stateFiltered\": 0,\n            \"evidenceGapDetected\": true,\n            \"trmEnabled\": true,\n            \"applyStateLimits\": false,\n            \"minState\": \"\"\n          }\n        }\n      ],\n      \"totalDurationMs\": 575,\n      \"finalResultCount\": 5\n    },\n    \"appliedBoosts\": {\n      \"session\": {\n        \"applied\": \"off\"\n      },\n      \"causal\": {\n        \"applied\": \"applied\"\n      }\n    },\n    \"applied_boosts\": {\n      \"session\": {\n        \"applied\": \"off\"\n      },\n      \"causal\": {\n        \"applied\": \"applied\"\n      }\n    },\n    \"progressiveDisclosure\": {\n      \"summaryLayer\": {\n        \"count\": 5,\n        \"digest\": \"5 weak\"\n      },\n      \"results\": [\n        {\n          \"snippet\": \"\",\n          \"detailAvailable\": false,\n          \"resultId\": \"2316\"\n        },\n        {\n          \"snippet\": \"\",\n          \"detailAvailable\": false,\n          \"resultId\": \"415\"\n        },\n        {\n          \"snippet\": \"\",\n          \"detailAvailable\": false,\n          \"resultId\": \"2317\"\n        },\n        {\n          \"snippet\": \"\",\n          \"detailAvailable\": false,\n          \"resultId\": \"92\"\n        },\n        {\n          \"snippet\": \"\",\n          \"detailAvailable\": false,\n          \"resultId\": \"94\"\n        }\n      ],\n      \"continuation\": null\n    },\n    \"results\": [\n      {\n        \"id\": 2316,\n        \"specFolder\": \"system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/004-memory-save-rewrite\",\n        \"filePath\": \"/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/specs/system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/004-memory-save-rewrite/plan.md\",\n        \"title\": \"Implemen [system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/004-memory-save-rewrite/plan]\",\n        \"similarity\": 75.99,\n        \"isConstitutional\": false,\n        \"importanceTier\": \"important\",\n        \"triggerPhrases\": [],\n        \"createdAt\": \"2026-04-26T14:30:22.365Z\",\n        \"isChunk\": false,\n        \"parentId\": null,\n        \"chunkIndex\": null,\n        \"chunkLabel\": null,\n        \"chunkCount\": null,\n        \"contentSource\": \"file_read_fallback\",\n        \"trustBadges\": {\n          \"confidence\": 0.9,\n          \"extractionAge\": \"today\",\n          \"lastAccessAge\": \"never\",\n          \"orphan\": false,\n          \"weightHistoryChanged\": false\n        },\n        \"content\": \"---\\ntitle: \\\"Implemen [system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/004-memory-save-rewrite/plan]\\\"\\ndescription: \\\"Milestoned delivery (M1-M10) for the planner-first /memory:save contract: audit + retirement of the legacy [spec]/memory/*.md write path, 20-iteration relevance research, planner contract + fallback implementation, routing/quality/reconsolidation/enrichment trim, follow-up API extraction, verification, release alignment, and deep-review remediation.\\\"\\ntrigger_phrases:\\n  - \\\"implementation plan\\\"\\n  - \\\"memory save planner first\\\"\\n  - \\\"planner-first memory save plan\\\"\\n  - \\\"save flow trim plan\\\"\\n  - \\\"retirement audit to planner-first\\\"\\nimportance_tier: \\\"important\\\"\\ncontextType: \\\"planning\\\"\\n_memory:\\n  continuity:\\n    packet_pointer: \\\"system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/004-memory-save-rewrite\\\"\\n    last_updated_at: \\\"2026-04-15T10:00:01Z\\\"\\n    last_updated_by: \\\"cli-copilot\\\"\\n    recent_action: \\\"Folder renamed; plan rewritten as M1-M10 planner-first delivery\\\"\\n    next_safe_action: \\\"Packet complete\\\"\\n    blockers: []\\n    key_files:\\n      - \\\"plan.md\\\"\\n      - \\\"spec.md\\\"\\n      - \\\"tasks.md\\\"\\n      - \\\"checklist.md\\\"\\n      - \\\"decision-record.md\\\"\\n      - \\\"implementation-summary.md\\\"\\n    session_dedup:\\n      fingerprint: \\\"sha256:014-planner-first-plan-2026-04-15\\\"\\n      session_id: \\\"014-planner-first-plan-2026-04-15\\\"\\n      parent_session_id: \\\"014-planner-first-seed\\\"\\n    completion_pct: 100\\n    open_questions: []\\n    answered_questions:\\n      - \\\"The planner-first default + explicit fallback architecture preserves the canonical writer while eliminating the default-path overreach.\\\"\\n      - \\\"Delivery spanned M1-M10 across audit, research, implementation, verification, release alignment, and deep-review remediation.\\\"\\ntemplate_source_hint: \\\"<!-- SPECKIT_TEMPLATE_SOURCE: plan-core | v2.2 -->\\\"\\n---\\n# Implementation Plan: /memory:save Planner-First Default\\n\\n<!-- SPECKIT_LEVEL: 3+ -->\\n<!-- SPECKIT_TEMPLATE_SOURCE: plan-core | v2.2 -->\\n\\n---\\n\\n<!-- ANCHOR:summary -->\\n## 1. SUMMARY\\n\\n### Technical Context\\n\\n| Aspect | Value |\\n|--------|-------|\\n| **Language or Stack** | TypeScript save-flow handlers, CLI wrapper, routing, validation, indexing, and follow-up APIs; markdown packet docs + release notes |\\n| **Framework** | system-spec-kit MCP server + spec-folder workflow |\\n| **Storage** | Canonical spec docs, vector DB, routed record identity, graph metadata, optional follow-up indexing |\\n| **Testing** | `validate_document.py`, `validate.sh --strict`, vitest suites, transcript prototypes, env-flag orthogonality tests |\\n| **Runtime Surface** | TypeScript save-flow handlers, CLI wrapper, routing, validation, indexing, and follow-up APIs described in `spec.md §3` |\\n\\n### Overview\\n\\nThe plan delivers a planner-first default for `/memory:save` while preserving the canonical atomic writer as an explicit fallback. It retires the legacy `[spec]/memory/*.md` write path end-to-end, gates four previously default-on save-path behaviors behind explicit env flags, and extracts freshness into three explicit follow-up APIs. Delivery runs through 10 sequential milestones: audit surface + classification, retirement cutover, relevance research, planner contract build-out, routing + quality trim, verification + transcript prototypes, release alignment, and deep-review remediation.\\n\\n### Full Delivery Summary\\n\\n| Milestone | Theme | Main Output | Why It Matters |\\n|-----------|-------|-------------|----------------|\\n| M1 | Audit kickoff | Classification rules + iteration plan | Establishes the audit frame |\\n| M2 | Audit convergence | 25-finding audit report + half-migrated diagnosis | Proves the default contract is broken |\\n| M3 | Retirement cutover | v3.4.1.0 removes legacy memory-file write path + aligns docs | Bridges audit to planner work |\\n| M4 | Research kickoff | Q1-Q10 relevance questions | Sets the classification scope |\\n| M5 | Research convergence | 15-subsystem classification + trim-targeted verdict | Decides what survives the default path |\\n| M6 | Planner contract | Planner-first default + flag plumbing + type surface + shared types | Ships the new operator contract |\\n| M7 | Routing and quality trim | Tier 3 + quality-loop + reconsolidation + enrichment leave the default path | Aligns runtime to verdict |\\n| M8 | Verification + transcripts | Targeted tests, transcript prototypes, packet validation | Grounds planner behavior in real operator flows |\\n| M9 | Release alignment | v3.4.1.0 release note + env reference + template updates | Runtime contract documented honestly |\\n| M10 | Deep-review remediation | 9-finding closure (3 P0, 5 P1, 1 P2) | Closes the last correctness + honesty gaps |\\n\\n---\\n\\n<!-- /ANCHOR:summary -->\\n<!-- ANCHOR:quality-gates -->\\n## 2. QUALITY GATES\\n\\n### Definition of Ready\\n\\n- [x] Audit classification rules and dimension plan defined before iteration started.\\n- [x] Q1-Q10 relevance questions agreed before M4 kickoff.\\n- [x] Load-bearing core and candidate trim targets defined before M6 kickoff.\\n- [x] Packet scope limited to the planner contract, retirement of legacy write path, subsystem gating, follow-up APIs, and docs alignment.\\n\\n### Definition of Done\\n\\n- [x] Packet canonical docs exist and agree on the planner-first contract.\\n- [x] Audit, research, deep-review, and transcript snapshots copied into the packet.\\n- [x] Every copied Markdown file begins with the required snapshot note.\\n- [x] `description.json`, `graph-metadata.json`, and packet-local nested changelog exist.\\n- [x] All primary docs pass `validate_document.py`.\\n- [x] Packet passes `validate.sh --strict` with no blocking errors.\\n- [x] Planner-default runtime tests prove the default path is non-mutating.\\n- [x] Full-auto fallback tests prove atomic mutation + rollback + `POST_SAVE_FINGERPRINT` parity.\\n- [x] Follow-up APIs (`refreshGraphMetadata`, `reindexSpecDocs`, `runEnrichmentBackfill`) have execution-level coverage.\\n- [x] Deep-review findings F001-F009 closed.\\n\\n---\\n\\n<!-- /ANCHOR:quality-gates -->\\n<!-- ANCHOR:architecture -->\\n## 3. ARCHITECTURE\\n\\n### Pattern\\n\\nPlanner-first wrapper around the preserved canonical atomic writer. The default path computes route + legality + advisory data and returns structured planner output without mutating files. An explicit fallback path activates the canonical writer with full atomic semantics intact. Freshness work lives in callable follow-up APIs.\\n\\n### Key Components\\n\\n- **Planner-first handler (`memory-save.ts`)**: Default execution path returning planner output (routes, blockers, advisories, follow-up actions). No mutation on default.\\n- **Canonical atomic writer (preserved: `create-record.ts`, `atomic-index-memory.ts`, `thin-continuity-record.ts`, `post-insert.ts`)**: Fallback path when `SPECKIT_SAVE_PLANNER_MODE=full-auto`. Rollback, promotion, same-path identity, `POST_SAVE_FINGERPRINT` parity intact.\\n- **Content router (`content-router.ts`)**: Eight-category contract preserved. Scoped exception: Tier 3 default-disable + manual-review guard.\\n- **Quality gate (`quality-loop.ts`, `save-quality-gate.ts`)**: Hard blockers preserved. Auto-fix retries gated behind `SPECKIT_QUALITY_AUTO_FIX=true`.\\n- **Reconsolidation (`reconsolidation-bridge.ts`)**: Gated behind `SPECKIT_RECONSOLIDATION_ENABLED=true` or explicit fallback.\\n- **Post-insert enrichment (`post-insert.ts`)**: Gated behind `SPECKIT_POST_INSERT_ENRICHMENT_ENABLED=true` or follow-up API.\\n- **Follow-up indexing APIs (`api/indexing.ts`, `graph-metadata-parser.ts`)**: `refreshGraphMetadata`, `reindexSpecDocs`, `runEnrichmentBackfill`.\\n- **Env reference + command docs + release notes**: Aligned to describe default/opt-in/reserved/fallback consistently.\\n\\n### Data Flow\\n\\n```text\\nCaller invokes /memory:save\\n    |\\n    v\\nResolve SPECKIT_SAVE_PLANNER_MODE\\n    |\\n    |-- default or plan-only or hybrid(reserved) -->\\n    |       Compute route + legality + advisories\\n    |       Respect env flags for deferred helpers\\n    |       Return structured planner output (no mutation)\\n    |\\n    +-- full-auto -->\\n            Canonical atomic writer\\n            Promotion + rollback + same-path identity\\n            POST_SAVE_FINGERPRINT parity\\n            Gated subsystems run only when their env flag is true\\n```\\n\\n### File-Level Change Map\\n\\nSee `spec.md §3 Files to Change` for the consolidated table covering legacy write-path retirement, planner contract core, canonical writer preservation, content router scoped exception, quality gate updates, reconsolidation gating, enrichment deferral, freshness APIs, command + reference + env docs, release notes, test surfaces, and packet metadata.\\n\\n### Runtime Surface Summary\\n\\n| Area | Files | Role |\\n|------|-------|------|\\n| Legacy write path retirement | `directory-setup.ts`, `workflow.ts`, `file-writer.ts`, `memory-indexer.ts`, `memory-metadata.ts` | Removed from runtime |\\n| Load-bearing core preserved | `memory-save.ts`, `create-record.ts`, `atomic-index-memory.ts`, `thin-continuity-record.ts`, `content-router.ts`, `post-insert.ts`, `reconsolidation-bridge.ts`, `workflow.ts` | Writer core + continuity + routing |\\n| Planner contract | `types.ts`, `response-builder.ts`, `validation-responses.ts`, `generate-context.ts`, `/memory:save` docs | Default non-mutating output |\\n| Follow-up APIs | `api/indexing.ts`, `graph-metadata-parser.ts` | Deferred freshness + enrichment |\\n| Remediation surfaces | `content-router.ts`, `memory-save.ts`, `post-insert.ts`, `../../../../skill/system-spec-kit/mcp_server/ENV_REFERENCE.md`, `../../../../changelog/01--system-spec-kit/v3.4.1.0.md` | Deep-review closure + honesty fixes |\\n\\n---\\n\\n<!-- /ANCHOR:architecture -->\\n<!-- ANCHOR:phases -->\\n## 4. IMPLEMENTATION PHASES\\n\\n### Milestone Flow\\n\\n```text\\nM1 Audit kickoff\\n  -> M2 Audit convergence\\n  -> M3 Retirement closure (v3.4.1.0 legacy write-path removal)\\n  -> M4 Research kickoff\\n  -> M5 Research convergence (15-subsystem classification + trim-targeted verdict)\\n  -> M6 Planner contract\\n  -> M7 Routing + quality + reconsolidation + enrichment trim\\n  -> M8 Verification and transcripts\\n  -> M9 Release alignment\\n  -> M10 Deep-review remediation\\n```\\n\\n### M1 — Audit kickoff\\n\\nOpen the audit with a narrow question: does any active file still write, read, or assume `[spec]/memory/*.md` in contradiction to the retirement claim? Define classification rules and the iteration plan. Evidence: `research/013-audit-snapshot/primary-docs/spec.md`, `research/013-audit-snapshot/deep-review-strategy.md`.\\n\\n### M2 — Audit convergence\\n\\nRun the audit to convergence across 7 iterations. Document the half-migrated state in concrete families: runtime write path, runtime read path, doc contradiction, phantom dedup contract, test drift, and template drift. 25 active findings across 9 P0, 9 P1, and 7 P2 produce three closure paths (A retire, B rescind, C dedup redesign). Evidence: `research/013-audit-snapshot/iterations/`, `research/013-audit-snapshot/review-report.md`.\\n\\n### M3 — Retirement closure\\n\\nRemove the live memory-file write path, clean up templates and docs, and align the runtime with the intended canonical-doc model. v3.4.1.0 records the cutover. Evidence: `../../../../changelog/01--system-spec-kit/v3.4.1.0.md`.\\n\\n### M4 — Research kickoff\\n\\nAfter the retirement cutover, open relevance research with Q1-Q10 covering load-bearing core, planner-first feasibility, quality-check classification, reindex vs freshness, graph-metadata refresh, entity extraction, reconsolidation cost, router classifier overfitting, trigger harmonization, and continuity ownership. Evidence: `research/014-research-snapshot/primary-docs/spec.md`, `research/014-research-snapshot/deep-research-strategy.md`.\\n\\n### M5 — Research convergence\\n\\nRun 20 iterations of relevance research. Classify 15 subsystems into load-bearing (canonical atomic writer, routed record identity, content-router core, thin continuity validation), candidate trim targets (Tier 3 routing, reconsolidation-on-save, heavy quality-loop auto-fix, post-insert enrichment), and other categories. Reach the `trim-targeted` verdict: keep the writer, trim the oversized default-path stack. Evidence: `research/014-research-snapshot/research.md`, `research/014-research-snapshot/findings-registry.json`.\\n\\n### M6 — Planner contract\\n\\nBuild the planner-first default, CLI defaults, docs, and type surfaces:\\n\\n- [x] T001-T005 Add planner-default and fallback flag definitions; planner response interfaces; response serialization helpers; planner blocker and advisory response helpers.\\n- [x] T006-T008 Make `generate-context.ts` request planner-first behavior by default; update `/memory:save` docs; make `memory-save.ts` return planner output by default with explicit fallback.\\n- [x] T009-T012 Update aggregate and handler tests for planner-default behavior; focused planner-first regression coverage.\\n\\n### M7 — Routing and quality trim\\n\\nTrim Tier 3 routing, quality-loop auto-fix, reconsolidation-on-save, and post-insert enrichment from the default hot path while preserving the category contract and hard blockers:\\n\\n- [x] T013-T017 Trim default Tier 3 participation while preserving category contract; reduce Tier 2 prototype library; update content-router tests for Tier 1/Tier 2 deterministic default; update runtime routing + intent-routing tests.\\n- [x] T018-T022 Retire default-path auto-fix retries; preserve hard structural blockers; update quality-loop + save-quality-gate + pipeline-enforcement tests.\\n- [x] T023-T026 Gate reconsolidation behind explicit flag/fallback; move default-path enrichment to explicit follow-up behavior; preserve same-path lineage; keep chunking as size-driven fallback.\\n- [x] T027-T034 Move unconditional graph refresh + spec-doc reindex out of planner-default saves; expose explicit follow-up indexing entry points; keep graph refresh callable as explicit follow-up; update reconsolidation-bridge, reconsolidation, assistive-reconsolidation, chunking, graph-refresh tests.\\n\\n### M8 — Verification and transcripts\\n\\nProve the planner-first model holds up against real session evidence:\\n\\n- [x] T035-T037 Memory-save integration tests for planner-default plus fallback end-to-end; planner UX regression tests for readable output; thin-continuity tests for normalization + upsert parity.\\n- [x] T038 Prototype planner-first behavior against three real session transcripts. Evidence: `scratch/transcripts-snapshot/`.\\n- [x] T039-T040 Run per-file doc validation + strict packet validation; capture follow-on defects.\\n- [x] T041-T043 Review structural parity between `/memory:save` + `AGENTS.md` + system-spec-kit skill doc; review fallback safety against `atomic-index-memory.ts` + `create-record.ts`; review transcript mismatches and convert unresolved issues into follow-on tasks.\\n\\n### M9 — Release alignment\\n\\nDocument the shipped contract in `v3.4.1.0` release notes and closeout docs, including the explicit follow-up APIs, the scoped router exception, and the reserved state of `hybrid`. Evidence: `review/015-deep-review-snapshot/primary-docs/implementation-summary.md`, `../../../../changelog/01--system-spec-kit/v3.4.1.0.md`.\\n\\n### M10 — Deep-review remediation\\n\\nClose the 9 findings from the deep-review pass (3 P0, 5 P1, 1 P2):\\n\\n- **F001 [P0]**: router-preservation contradiction → resolved by documenting the scoped `content-router.ts` exception (ADR-007).\\n- **F002 [P0]**: fallback safety parity → resolved by reinstating `POST_SAVE_FINGERPRINT`.\\n- **F003 [P0]**: template-contract failures hidden as advisories → resolved by promoting them to planner blockers.\\n- **F004 [P1]**: deferred enrichment returning success-shaped status → resolved by returning explicit `deferred` status.\\n- **F005 [P2]**: `hybrid` assumed live → resolved by marking reserved and documenting `plan-only`-equivalent behavior.\\n- **F006 [P1]**: follow-up API coverage → resolved by adding execution-level coverage for `refreshGraphMetadata`, `reindexSpecDocs`, `runEnrichmentBackfill`.\\n- **F007 [P1]**: follow-up tool names in packet docs → resolved by aligning docs to shipped names.\\n- **F008 [P1]**: env reference drift → resolved by documenting `hybrid` honestly in `ENV_REFERENCE.md`.\\n- **F009 [P1]**: release-note honesty → resolved by describing router scope and `hybrid` state accurately in `v3.4.1.0.md`.\\n\\n---\\n\\n<!-- /ANCHOR:phases -->\\n<!-- ANCHOR:testing -->\\n## 5. TESTING STRATEGY\\n\\n| Test Type | Scope | Tools | Source |\\n|-----------|-------|-------|--------|\\n| Audit validation | Verify runtime + doc contradictions | Deep-review iterations + synthesis report | `research/013-audit-snapshot/**` |\\n| Research convergence | Verify Q1-Q10 answers + 15-subsystem verdicts | Deep-research iterations + findings registry | `research/014-research-snapshot/**` |\\n| Runtime contract tests | Planner-default + fallback parity + router + quality + follow-up APIs | Vitest suites + targeted sweeps | `review/015-deep-review-snapshot/primary-docs/tasks.md`, `review/015-deep-review-snapshot/primary-docs/checklist.md`, `review/015-deep-review-snapshot/primary-docs/implementation-summary.md` |\\n| Transcript validation | Planner-first behavior against real sessions | Transcript markdown + planner-output JSON + transcript reviews | `scratch/transcripts-snapshot/` |\\n| Review convergence | Deep-review isolation of real defect set | Review report + findings registry + iteration ledger | `review/015-deep-review-snapshot/**` |\\n| Remediation confirmation | All 9 review findings resolved | Remediated docs + tests + changelog + implementation summary | `review/015-deep-review-snapshot/primary-docs/implementation-summary.md`, `../../../../changelog/01--system-spec-kit/v3.4.1.0.md` |\\n| Packet validation | Packet structural soundness | `validate_document.py`, `validate.sh --strict` | This packet |\\n\\n### Audit Approach (M1-M3)\\n\\n- Focused deep-review loop over runtime, docs, tests, and templates.\\n- Classification rule applied each iteration.\\n- Convergence threshold tracked and documented.\\n- Retirement cutover delivered as part of v3.4.1.0; docs aligned to the canonical-doc model.\\n\\n### Research Approach (M4-M5)\\n\\n- 20 iterations with explicit subsystem questions.\\n- Research document and findings registry used as the canonical synthesis.\\n- Minimal replacement design evaluated against live code surfaces.\\n- Final report explicitly ruled out a full writer redesign.\\n\\n### Implementation Approach (M6-M8)\\n\\n- Planner-first contract built before trim work.\\n- Routing, quality, reconsolidation, enrichment, and follow-up APIs covered by targeted tests.\\n- Transcript prototypes used to validate real operator narratives.\\n- Packet-local doc validation and strict packet validation used as release gates.\\n\\n### Remediation Approach (M10)\\n\\n- Deep review split concerns into runtime correctness, follow-up API integrity, coverage, and documentation honesty.\\n- Remediation closed all 9 findings and aligned packet docs and release notes.\\n- Packet docs reflect the remediated state as the final truth.\\n\\n---\\n\\n<!-- /ANCHOR:testing -->\\n<!-- ANCHOR:dependencies -->\\n## 6. DEPENDENCIES\\n\\n| Dependency | Type | Status | Impact if Blocked |\\n|------------|------|--------|-------------------|\\n| Audit evidence | Documentation source | Ready | Audit truth cannot be grounded |\\n| Research synthesis | Documentation source | Ready | Verdicts and Q1-Q10 would be underspecified |\\n| Canonical atomic writer | Runtime core | Preserved | Fallback path depends on it |\\n| Eight-category router contract | Runtime core | Preserved | Target authority depends on it |\\n| Vitest suites | Verification tooling | Ready | Runtime contract evidence |\\n| Transcript fixtures | Verification input | Ready | Real-operator-flow evidence |\\n| v3.4.1.0 changelog | Release artifact | Ready | Release-state truth |\\n| `validate_document.py` | Tooling | Pass recorded | Docs could ship with structural defects |\\n| `validate.sh --strict` | Tooling | Pass recorded | Packet could ship with blocking issues |\\n| `generate-description.js` | Tooling | Run | Packet metadata complete |\\n| Nested changelog generator | Tooling | Run | Packet-local change trace complete |\\n\\n---\\n\\n<!-- /ANCHOR:dependencies -->\\n<!-- ANCHOR:rollback -->\\n## 7. ROLLBACK PLAN\\n\\n- **Trigger**: Planner-default mutates under some branch, fallback loses atomic safety parity, router preservation claim contradicts code, or remediation reopens a closed finding.\\n- **Procedure**: Revert runtime changes + docs + env reference + release note as one batch. Re-run vitest suites + strict validation + transcript prototypes.\\n- **Data reversal**: No data migrations. Vector DB schema unchanged; saves still use the canonical atomic writer when fallback is active.\\n\\n### Per-Milestone Rollback\\n\\n| Milestone | Trigger | Rollback Action | Data Reversal |\\n|-----------|---------|-----------------|---------------|\\n| M3 retirement cutover | Legacy memory-file surface regression | Revert the retirement commit; re-run audit fixtures | None |\\n| M6 planner contract | Planner output schema drift or default mutation | Revert planner commits; re-enable prior handler default | None |\\n| M7 trim milestones | Opt-in flag cascade activates unintended subsystems | Revert trim commits for affected subsystem | None |\\n| M8 verification | Transcript prototype breaks unexpectedly | Patch surface; re-run validator | None |\\n| M9 release alignment | Release notes drift from runtime | Patch release notes + env reference | None |\\n| M10 remediation | Reopened finding | Apply targeted patch; re-run closure tests | None |\\n\\n### Consolidated Rollback Note\\n\\nBecause the canonical atomic writer is preserved, rollback means reverting the planner-first wrapper + env-flag gates + follow-up API exports. Fallback behavior continues to work with full atomic semantics intact.\\n\\n---\\n\\n<!-- /ANCHOR:rollback -->\\n## L2: PHASE DEPENDENCIES\\n\\n```text\\nM1 Audit kickoff\\n  -> M2 Audit convergence\\n  -> M3 Retirement closure\\n  -> M4 Research kickoff\\n  -> M5 Research convergence\\n  -> M6 Planner contract\\n  -> M7 Routing and quality trim\\n  -> M8 Verification and transcripts\\n  -> M9 Release alignment\\n  -> M10 Remediation\\n```\\n\\n| Phase | Depends On | Blocks |\\n|-------|------------|--------|\\n| M1 | None | M2-M10 |\\n| M2 | M1 | M3-M10 |\\n| M3 | M2 | M4-M10 |\\n| M4 | M3 | M5-M10 |\\n| M5 | M4 | M6-M10 |\\n| M6 | M5 | M7-M10 |\\n| M7 | M6 | M8-M10 |\\n| M8 | M7 | M9-M10 |\\n| M9 | M8 | M10 |\\n| M10 | M9 | Packet closeout |\\n\\n---\\n\\n## L2: EFFORT ESTIMATION\\n\\n| Phase | Complexity | Estimated Effort |\\n|-------|------------|------------------|\\n| Audit + retirement | High | 1-2 days |\\n| Research convergence | High | 1 day |\\n| Planner contract | High | 0.5-1 day |\\n| Routing + quality + reconsolidation + enrichment trim | High | 1-1.5 days |\\n| Verification + transcripts | Medium | 0.5 day |\\n| Release alignment | Medium | 0.5 day |\\n| Deep-review remediation (9 findings) | High | 0.5-1 day |\\n| **Total** | **High** | **~5-7 implementation days** |\\n\\n### Historical Effort Context\\n\\n| Area | Effort Shape | Why It Matters |\\n|------|--------------|----------------|\\n| Audit loop | Multi-iteration review + release alignment | Explains depth of the original contradiction |\\n| Research loop | 20-iteration classification | Explains trim-targeted verdict trustworthiness |\\n| Implementation | 43 tasks across planner + trim + verification | Explains why the contract cannot be summarized as a small one-line change |\\n\\n---\\n\\n## L2: ENHANCED ROLLBACK\\n\\n### Pre-release Checks\\n\\n- [x] Snapshot tree complete (audit + research + review + transcripts)\\n- [x] Planner-default runtime tests pass\\n- [x] Full-auto fallback tests pass with `POST_SAVE_FINGERPRINT` parity\\n- [x] Follow-up API coverage in place\\n- [x] Release notes + env reference aligned to runtime\\n\\n### Rollback Procedure\\n\\n1. Revert planner commits atomically; fallback behavior continues via canonical writer.\\n2. Revert env-flag gates for any subsystem that regressed.\\n3. Re-run vitest suites + strict validation + transcript prototypes.\\n4. If v3.4.1.0 release note needs adjustment, patch the release note and env reference.\\n\\n### Data Reversal\\n\\n- **Has data migration?** No\\n- **Reversal procedure**: Runtime-level revert only\\n\\n---\\n\\n## L3: DEPENDENCY GRAPH\\n\\n```text\\n┌──────────────┐\\n│ Audit (M1-M2)│\\n└──────┬───────┘\\n       v\\n┌──────────────┐\\n│ Retirement   │\\n│ cutover (M3) │\\n└──────┬───────┘\\n       v\\n┌──────────────┐\\n│ Research     │\\n│ (M4-M5)      │\\n└──────┬───────┘\\n       v\\n┌──────────────┐\\n│ Planner +    │\\n│ trim (M6-M7) │\\n└──────┬───────┘\\n       v\\n┌──────────────┐\\n│ Verification │\\n│ (M8)         │\\n└──────┬───────┘\\n       v\\n┌──────────────┐\\n│ Release      │\\n│ alignment M9 │\\n└──────┬───────┘\\n       v\\n┌──────────────┐\\n│ Remediation  │\\n│ (M10)        │\\n└──────────────┘\\n```\\n\\n### Dependency Matrix\\n\\n| Component | Depends On | Produces | Blocks |\\n|-----------|------------|----------|--------|\\n| Audit | None | Half-migrated evidence | Retirement cutover |\\n| Retirement cutover | Audit | Canonical-doc-aligned runtime | Research |\\n| Research | Retirement cutover | Trim-targeted verdict | Planner contract |\\n| Planner contract | Research | Non-mutating default + fallback | Trim milestones |\\n| Trim milestones | Planner contract | Gated subsystems + follow-up APIs | Verification |\\n| Verification | Trim milestones | Targeted tests + transcript evidence | Release |\\n| Release alignment | Verification | v3.4.1.0 + env reference + templates | Remediation |\\n| Remediation | Release alignment | 9-finding closure + honest router scope | Closeout |\\n\\n---\\n\\n## L3: CRITICAL PATH\\n\\n1. **Audit the half-migrated state** — critical because every later claim depends on grounded evidence.\\n2. **Retire the legacy write path** — critical so research and implementation do not inherit the contradiction.\\n3. **Classify the 15 subsystems** — critical so the trim targets are objective.\\n4. **Ship the planner-first default + full-auto fallback** — critical because it is the operator-facing contract.\\n5. **Gate Tier 3 + quality + reconsolidation + enrichment** — critical so the default path actually trims.\\n6. **Expose follow-up APIs** — critical so deferred work remains callable.\\n7. **Align docs + release notes + env reference** — critical so the shipped contract is documented honestly.\\n8. **Close all 9 deep-review findings** — critical because the first review verdict was remediation-required.\\n\\n**Total Critical Path**: Audit → Retirement → Research → Planner + Trim → Verification → Release → Remediation\\n\\n---\\n\\n## L3: MILESTONES\\n\\n| Milestone | Description | Success Criteria | Target |\\n|-----------|-------------|------------------|--------|\\n| M1 | Audit kickoff | Classification rules + iteration plan published | Audit spec + strategy |\\n| M2 | Audit convergence | 25-finding audit report + half-migrated diagnosis | Audit synthesis |\\n| M3 | Retirement cutover | Legacy memory-file write path removed | v3.4.1.0 release |\\n| M4 | Research kickoff | Q1-Q10 published | Research spec + strategy |\\n| M5 | Research convergence | 15-subsystem classification + trim-targeted verdict | Research synthesis |\\n| M6 | Planner contract | Planner-first default + fallback + shared types | Runtime handler |\\n| M7 | Routing + quality trim | Four subsystems behind env flags | Runtime handlers |\\n| M8 | Verification + transcripts | Targeted tests + transcript prototypes + packet validation | Vitest + transcripts |\\n| M9 | Release alignment | v3.4.1.0 + `/memory:save` docs + env reference + templates | Release artifacts |\\n| M10 | Remediation | 9 findings closed | Review report + ADR-007 |\\n\\n---\\n\\n### Architecture Decision Record Summary\\n\\n| ADR | Summary |\\n|-----|---------|\\n| ADR-001 | Trim-targeted verdict: keep the core writer, trim the oversized default-path stack |\\n| ADR-002 | Planner-first output becomes the default `/memory:save` contract |\\n| ADR-003 | Reconsolidation-on-save becomes explicit opt-in |\\n| ADR-004 | Post-insert enrichment becomes deferred or standalone |\\n| ADR-005 | Router categories stay while Tier 2 or Tier 3 scope narrows |\\n| ADR-006 | Hard checks remain while quality-loop auto-fix leaves the default path |\\n| ADR-007 | Router preservation claim becomes \\\"core preserved with one scoped exception\\\" |\\n\\n---\\n\\n## L3+: AI EXECUTION FRAMEWORK\\n\\n### Pre-Task Checklist\\n\\n- [x] Confirm the canonical atomic writer stays intact\\n- [x] Confirm env flags stay orthogonal\\n- [x] Confirm planner default stays non-mutating\\n\\n### Task Execution Rules\\n\\n| Rule | Description |\\n|------|-------------|\\n| EXEC-SEQ | Ship planner contract before trim work |\\n| EXEC-EVIDENCE | Every trim target maps to an audit/research finding |\\n| EXEC-SCOPE | Do not touch canonical atomic writer internals |\\n\\n### Status Reporting Format\\n\\nReport task state as `P###-ID [x] - description` using the packet-prefixed IDs in `tasks.md`.\\n\\n### Blocked Task Protocol\\n\\nIf a runtime change regresses fallback safety, revert and patch the specific subsystem before re-running the verification sweep.\\n\\n### Tier 1: Runtime Core\\n\\n**Files**\\n- `memory-save.ts`, `types.ts`, `response-builder.ts`, `validation-responses.ts`, `generate-context.ts`\\n- `content-router.ts`, `quality-loop.ts`, `save-quality-gate.ts`\\n- `reconsolidation-bridge.ts`, `post-insert.ts`\\n- `api/indexing.ts`, `graph-metadata-parser.ts`\\n\\n**Goal**\\n- Preserve the canonical atomic writer + routing + continuity; move default-path overreach behind env flags; expose follow-up APIs.\\n\\n### Tier 2: Docs + Release\\n\\n| Workstream | Output | Notes |\\n|------------|--------|-------|\\n| Runtime contract docs | `/memory:save` docs + `ENV_REFERENCE.md` + templates | Align to shipped contract |\\n| Release notes | `v3.4.1.0.md` | Scoped exception + reserved `hybrid` honestly |\\n| Packet docs | `spec.md`, `plan.md`, `tasks.md`, `checklist.md`, `decision-record.md`, `implementation-summary.md` | Tell the end-to-end story |\\n\\n### Tier 3: Validation\\n\\n**Goal**\\n- Packet behaves like a normal spec packet: validators pass, metadata generated, packet-local changelog emitted.\\n\\n**Actions**\\n- Run `validate_document.py`\\n- Run `validate.sh --strict`\\n- Generate `description.json`\\n- Author or verify `graph-metadata.json`\\n- Generate nested changelog\\n\\n---\\n\\n## L3+: WORKSTREAM COORDINATION\\n\\n| ID | Name | Scope | Output |\\n|----|------|-------|--------|\\n| W-A | Audit + retirement | Half-migrated evidence + legacy write-path removal | `research/013-audit-snapshot/**` + v3.4.1.0 retirement |\\n| W-B | Research | 15-subsystem classification + trim-targeted verdict | `research/014-research-snapshot/**` |\\n| W-C | Planner contract + trim | Runtime handlers + env flags + follow-up APIs | Runtime TypeScript |\\n| W-D | Verification + transcripts | Targeted tests + three transcript prototypes | Vitest + `scratch/transcripts-snapshot/` |\\n| W-E | Docs + release alignment | `/memory:save` docs + env reference + release notes + packet docs | Docs surface |\\n| W-F | Remediation | 9-finding closure + ADR-007 | `review/015-deep-review-snapshot/**` |\\n\\n### Sync Points\\n\\n| Sync ID | Trigger | Participants | Output |\\n|---------|---------|--------------|--------|\\n| SYNC-001 | Audit complete | W-A + W-B | Research grounded in audit reality |\\n| SYNC-002 | Research complete | W-B + W-C | Trim targets objective |\\n| SYNC-003 | Runtime complete | W-C + W-D | Tests cover default + fallback + gated subsystems |\\n| SYNC-004 | Verification complete | W-D + W-E | Docs + release + env reference aligned to runtime |\\n| SYNC-005 | Release aligned | W-E + W-F | Remediation targets documented findings |\\n\\n---\\n\\n## L3+: COMMUNICATION PLAN\\n\\n### Checkpoints\\n\\n- **Checkpoint 1**: Audit truth grounded.\\n- **Checkpoint 2**: Retirement cutover shipped.\\n- **Checkpoint 3**: Research verdict published.\\n- **Checkpoint 4**: Planner + trim + follow-up APIs merged.\\n- **Checkpoint 5**: Verification + transcripts validated.\\n- **Checkpoint 6**: v3.4.1.0 released with aligned docs.\\n- **Checkpoint 7**: All 9 deep-review findings closed.\\n\\n### Escalation Path\\n\\n1. If audit findings conflict with research, prefer audit evidence over summary.\\n2. If release-note wording conflicts with the remediated state, preserve the remediated state and adjust the release note.\\n3. If validation rules conflict with the shipped structure, preserve validation compliance and document the exact warning.\\n\\n### Governance Notes\\n\\n- The packet is a runtime change with documented operator-facing contract; changelog honesty matters.\\n- The canonical atomic writer is the single mutation mechanism; fallback preserves atomic semantics.\\n- The deep-review pass is part of the delivery record; remediation closure is load-bearing.\\n\\n---\\n\\n### Governance and Compliance Notes\\n\\n### Governance Sign-Off Targets\\n\\n| Sign-Off | Status | Basis |\\n|----------|--------|-------|\\n| Runtime correctness | Complete | Planner default non-mutating + fallback atomic parity |\\n| Documentation alignment | Complete | `/memory:save` docs + env reference + release notes agree |\\n| Spec-packet compliance | Complete | `validate.sh --strict` pass |\\n| Metadata completeness | Complete | `description.json`, `graph-metadata.json`, nested changelog |\\n\\n### Compliance Notes\\n\\n- No secrets, credentials, or third-party systems involved.\\n- Packet stores only copied internal project artifacts plus new documentation and runtime changes.\\n- Canonical atomic writer unchanged outside the scoped router Tier 3 guard.\\n\",\n        \"confidence\": {\n          \"label\": \"medium\",\n          \"value\": 0.448,\n          \"drivers\": [\n            \"multi_channel_agreement\"\n          ]\n        },\n        \"why\": {\n          \"summary\": \"Ranked first because semantic similarity\",\n          \"topSignals\": [\n            \"semantic_match\"\n          ]\n        }\n      }\n    ],\n    \"evidenceDigest\": \"5 results retrieved; avg score 0.74.\",\n    \"followUps\": []\n  },\n  \"hints\": [\n    \"Some files could not be read - check file paths\",\n    \"[code-graph] Symbols near mentioned files: function:closeIndexingRuntime, function:initializeIndexingRuntime, function:reindexSpecDocs\",\n    \"Auto-surface hook: injected 2 constitutional and 5 triggered memories (537ms)\",\n    \"Token budget enforced: truncated 5 → 1 results to fit 3500 token budget\"\n  ],\n  \"meta\": {\n    \"tool\": \"memory_search\",\n    \"tokenCount\": 11804,\n    \"latencyMs\": 585,\n    \"cacheHit\": false,\n    \"responseProfile\": \"research\",\n    \"autoSurface\": {\n      \"constitutionalCount\": 2,\n      \"triggeredCount\": 5,\n      \"surfaced_at\": \"2026-04-26T18:50:04.497Z\",\n      \"latencyMs\": 537\n    },\n    \"autoSurfacedContext\": {\n      \"constitutional\": [\n        {\n          \"id\": 2574,\n          \"specFolder\": \"system-spec-kit\",\n          \"filePath\": \"/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/constitutional/gate-tool-routing.md\",\n          \"title\": \"TOOL ROUTING - Search & Retrieval Decision Tree\",\n          \"importanceTier\": \"constitutional\",\n          \"retrieval_directive\": \"Always surface when: TOOL ROUTING - Search & Retrieval Decision Tree | Prioritize when: task context aligns with \\\"TOOL ROUTING - Search & Retrieval Decision Tree\\\"\"\n        },\n        {\n          \"id\": 415,\n          \"specFolder\": \"system-spec-kit\",\n          \"filePath\": \"/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/constitutional/gate-enforcement.md\",\n          \"title\": \"GATE ENFORCEMENT - Edge Cases & Cross-Reference\",\n          \"importanceTier\": \"constitutional\",\n          \"retrieval_directive\": \"Always surface when: GATE ENFORCEMENT - Edge Cases & Cross-Reference | Prioritize when: task context aligns with \\\"GATE ENFORCEMENT - Edge Cases & Cross-Reference\\\"\"\n        }\n      ],\n      \"triggered\": [\n        {\n          \"memory_id\": 2355,\n          \"spec_folder\": \"system-spec-kit/026-graph-and-context-optimization/005-code-graph/001-code-graph-upgrades\",\n          \"title\": \"Deci [system-spec-kit/026-graph-and-context-optimization/005-code-graph/001-code-graph-upgrades/decision-record]\",\n          \"matched_phrases\": [\n            \"decision\"\n          ]\n        },\n        {\n          \"memory_id\": 2317,\n          \"spec_folder\": \"system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/004-memory-save-rewrite\",\n          \"title\": \"Feature [system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/004-memory-save-rewrite/spec]\",\n          \"matched_phrases\": [\n            \"speckit_save_planner_mode\"\n          ]\n        },\n        {\n          \"memory_id\": 2289,\n          \"spec_folder\": \"system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/001-cache-warning-hooks\",\n          \"title\": \"...em-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/001-cache-warning-hooks/decision-record]\",\n          \"matched_phrases\": [\n            \"decision\"\n          ]\n        },\n        {\n          \"memory_id\": 2222,\n          \"spec_folder\": \"system-spec-kit/024-compact-code-graph\",\n          \"title\": \"Decision Record: Hybrid Context Injection [system-spec-kit/024-compact-code-graph/decision-record]\",\n          \"matched_phrases\": [\n            \"decision\"\n          ]\n        },\n        {\n          \"memory_id\": 2218,\n          \"spec_folder\": \"system-spec-kit/024-compact-code-graph/034-workflow-split-and-token-insight-contracts\",\n          \"title\": \"Decision Record [system-spec-kit/024-compact-code-graph/034-workflow-split-and-token-insight-contracts/decision-record]\",\n          \"matched_phrases\": [\n            \"decision\"\n          ]\n        }\n      ],\n      \"surfaced_at\": \"2026-04-26T18:50:04.497Z\",\n      \"latencyMs\": 537\n    },\n    \"tokenBudget\": 3500,\n    \"tokenBudgetTruncated\": true,\n    \"originalResultCount\": 5,\n    \"returnedResultCount\": 1\n  }\n}","metadata":{"truncated":false},"title":"","time":{"start":1777229403954,"end":1777229405217},"attachments":[]}}}
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/Q1/cli-opencode-1/score.md:5:| Correctness | 1 | Returned 3-4 callers via code_graph_query + cocoindex; correct files but partial coverage |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/Q1/cli-opencode-1/score.md:20:| Correctness | 1 | Returned 3-4 callers via code_graph_query + cocoindex; correct files but partial coverage |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/030-code-graph-gap-investigation-pt-01/research.md:41:| `.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/09-cocoindex-bridge-context.md` | Bridge page still points to stale test paths and omits the richer post-013 context contract. | Feature catalog | Y |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/030-code-graph-gap-investigation-pt-01/research.md:46:| `.opencode/skills/system-spec-kit/manual_testing_playbook/22--context-preservation-and-code-graph/255-cocoindex-code-graph-routing.md` | Routing playbook still uses stale test paths and misses `partialOutput` / blocked-read expectations. | Manual testing | Y |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/030-code-graph-gap-investigation-pt-01/research.md:72:- `.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/09-cocoindex-bridge-context.md`
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/030-code-graph-gap-investigation-pt-01/research.md:77:- `.opencode/skills/system-spec-kit/manual_testing_playbook/22--context-preservation-and-code-graph/255-cocoindex-code-graph-routing.md`
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/030-code-graph-gap-investigation-pt-01/research.md:98:- Iteration 01 established that the direct implementation surfaces changed, but the central README/install/schema family did not. It also recorded the failed-but-attempted semantic-search path: `mcp__cocoindex_code__.search(...)` returned runtime-side cancellation, and `ccc search ...` failed because the sandbox could not write the CocoIndex daemon log.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/030-code-graph-gap-investigation-pt-01/research.md:119:- `.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/09-cocoindex-bridge-context.md`
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/030-code-graph-gap-investigation-pt-01/research.md:124:- `.opencode/skills/system-spec-kit/manual_testing_playbook/22--context-preservation-and-code-graph/255-cocoindex-code-graph-routing.md`
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/030-code-graph-gap-investigation-pt-01/iterations/iteration-02.md:5:Feature-catalog and adjacent reference pages that explain code-graph storage, readiness, and CocoIndex bridging, with emphasis on stale test-path references and contract descriptions that lag behind packet `013`.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/030-code-graph-gap-investigation-pt-01/iterations/iteration-02.md:15:  - `.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/09-cocoindex-bridge-context.md`
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/030-code-graph-gap-investigation-pt-01/iterations/iteration-02.md:24:| `.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/09-cocoindex-bridge-context.md` | This bridge page still cites the old seed-resolver test path and describes `code_graph_context` only as “budget-aware truncation,” not the 013-era seed-fidelity plus blocked/partial-output behavior. | Feature catalog | High | Packet 013 updated the bridge implementation and context tests, but not the catalog entry that names the bridge contract. | Y |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/030-code-graph-gap-investigation-pt-01/iterations/iteration-03.md:20:  - `.opencode/skills/system-spec-kit/manual_testing_playbook/22--context-preservation-and-code-graph/255-cocoindex-code-graph-routing.md`
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/030-code-graph-gap-investigation-pt-01/iterations/iteration-03.md:27:| `.opencode/skills/system-spec-kit/manual_testing_playbook/22--context-preservation-and-code-graph/250-session-start-startup.md` | The startup playbook validates tool listing, CocoIndex status, and token budget, but it does not validate the new startup payload contract or `graphQualitySummary` now asserted in `hook-session-start.vitest.ts`. | Manual testing | High | Packet 013 updated the runtime hook tests, but the operator playbook stayed on the older startup-surface checklist. | Y |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/030-code-graph-gap-investigation-pt-01/iterations/iteration-03.md:29:| `.opencode/skills/system-spec-kit/manual_testing_playbook/22--context-preservation-and-code-graph/255-cocoindex-code-graph-routing.md` | The routing playbook still uses the old test path and validates only mode outputs plus truncation. It does not mention the 013-era `partialOutput` metadata or the explicit blocked-read contract when structural expansion cannot safely repair the graph inline. | Manual testing | High | Packet 013 changed real context behavior, but the routing scenario kept the older “non-empty results” framing. | Y |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/review/deep-review-strategy.md:60:2. CocoIndex seed fidelity may regress on alternate input shapes even if the happy path passes.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/review/deep-review-strategy.md:73:2. Context seed normalization and CocoIndex fidelity
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/013-code-graph-hook-improvements-pt-02/deep-research-state.jsonl:4:{"type":"iteration","iteration":3,"newInfoRatio":0.68,"status":"new-territory","focus":"CocoIndex seed fidelity and whether the graph bridge preserves semantic ranking context.","timestamp":"2026-04-24T06:57:00Z","findings_count":3,"graphEvents":[]}
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/030-code-graph-gap-investigation-pt-01/findings-registry.json:126:      "summary": "The CocoIndex bridge feature page still points at the old seed-resolver test path and does not capture the richer post-013 context contract.",
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/030-code-graph-gap-investigation-pt-01/findings-registry.json:129:        ".opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/09-cocoindex-bridge-context.md:13",
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/030-code-graph-gap-investigation-pt-01/findings-registry.json:130:        ".opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/09-cocoindex-bridge-context.md:37",
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/030-code-graph-gap-investigation-pt-01/findings-registry.json:136:        ".opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/09-cocoindex-bridge-context.md"
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/030-code-graph-gap-investigation-pt-01/findings-registry.json:195:        ".opencode/skills/system-spec-kit/manual_testing_playbook/22--context-preservation-and-code-graph/255-cocoindex-code-graph-routing.md:17",
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/030-code-graph-gap-investigation-pt-01/findings-registry.json:196:        ".opencode/skills/system-spec-kit/manual_testing_playbook/22--context-preservation-and-code-graph/255-cocoindex-code-graph-routing.md:104",
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/030-code-graph-gap-investigation-pt-01/findings-registry.json:202:        ".opencode/skills/system-spec-kit/manual_testing_playbook/22--context-preservation-and-code-graph/255-cocoindex-code-graph-routing.md"
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/013-code-graph-hook-improvements-pt-02/iterations/iteration-09.md:24:- The strongest new packet themes are not the pt-01 headline gaps themselves, but downstream residuals: read-path soft continuation on `full_scan`, CocoIndex seed fidelity loss, stale post-scan summary metadata, unsurfaced summary readers, startup transport/test drift, and unlabeled deadline truncation [.opencode/specs/system-spec-kit/026-graph-and-context-optimization/009-hook-package/013-code-graph-hook-improvements/research/028-code-graph-hook-improvements-pt-01/research.md:13-20; .opencode/skills/system-spec-kit/mcp_server/code-graph/lib/seed-resolver.ts:86-92; .opencode/skills/system-spec-kit/mcp_server/code-graph/handlers/scan.ts:239-242].
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/review/review-report.md:31:Evidence: CocoIndex fidelity survives only when callers send `seed.file`; `seed.filePath` falls through the generic seed path and drops provider-specific metadata.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/review/review-report.md:32:Recommended fix: treat `filePath` as equivalent to `file` for CocoIndex seeds and add a regression for that public input shape.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/review/review-report.md:95:- The Codex adapter itself is present in the resource map yet missing from `implementation-summary.md`'s changed-file inventory, which weakens the packet's runtime parity story.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/review/review-report.md:101:3. Fix `F-002` and `F-003` together: complete the new context contract by accepting `filePath` CocoIndex seeds and correcting `omittedAnchors`.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/review/deep-review-findings-registry.json:33:      "summary": "The packet preserves CocoIndex seed fidelity only when callers send `seed.file`; `seed.filePath` falls through the generic seed path and drops provider-specific metadata.",
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/review/deep-review-findings-registry.json:40:      "recommended_fix": "Normalize `filePath` and `file` equivalently for CocoIndex seeds and add direct regression coverage for the `filePath` form.",
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/013-code-graph-hook-improvements-pt-02/iterations/iteration-03.md:5:This round followed the CocoIndex-to-code-graph bridge. The working hypothesis was that even if the graph is healthy, the bridge may be discarding semantic ranking context before graph resolution, which would make the integration correct only in the narrow line-matching sense.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/013-code-graph-hook-improvements-pt-02/iterations/iteration-03.md:16:- The native CocoIndex seed shape carries `range`, `score`, and optional `snippet`, but `resolveCocoIndexSeed()` throws away `score` and `snippet` immediately and forwards only `file`, `start`, and `end` into `resolveSeed()` [.opencode/skills/system-spec-kit/mcp_server/code-graph/lib/seed-resolver.ts:19-25,86-92].
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/013-code-graph-hook-improvements-pt-02/iterations/iteration-03.md:18:- After resolution, `resolveSeeds()` sorts by local graph confidence rather than the original CocoIndex relevance score, so semantic ranking order is not preserved across multiple seeds [.opencode/skills/system-spec-kit/mcp_server/code-graph/lib/seed-resolver.ts:275-290].
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/013-code-graph-hook-improvements-pt-02/iterations/iteration-03.md:23:provider: 'cocoindex';
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/013-code-graph-hook-improvements-pt-02/iterations/iteration-03.md:47:- This is not a zero-results problem tied to CocoIndex availability; it is an anchoring-fidelity problem inside the code-graph side of the bridge.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/013-code-graph-hook-improvements-pt-02/iterations/iteration-03.md:53:- `Correctness` — Would preserving CocoIndex ranking in `resolveSeeds()` materially change anchor ordering for multi-seed requests?
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/030-code-graph-gap-investigation-pt-01/iterations/iteration-01.md:9:- Attempted semantic search via `mcp__cocoindex_code__.search({ query: "code graph startup payload graphQualitySummary partialOutput selectedCandidate blocked read hooks docs tests", languages: ["typescript", "markdown"], paths: [".opencode/skills/system-spec-kit/**"], limit: 8, refresh_index: true })` → runtime-side cancellation.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/S3/cli-opencode-1/output.txt:3:{"type":"tool_use","timestamp":1777227298337,"sessionID":"ses_234ffc607ffeodfCIKq5fy6OWb","part":{"id":"prt_dcb006b0e001zLQ9Gk5Q3d4RSf","messageID":"msg_dcb003bef001r7fjrFlF9EWqfV","sessionID":"ses_234ffc607ffeodfCIKq5fy6OWb","type":"tool","tool":"spec_kit_memory_memory_search","callID":"call_00_LBP35yvLuIzmQvBsIXAt5FJj","state":{"status":"completed","input":{"query":"SPECKIT_SAVE_PLANNER_MODE decision","includeContent":true,"limit":10},"output":"{\n  \"summary\": \"> **[EVIDENCE GAP DETECTED]: Retrieved context has low mathematical confidence (Z=1.26). Consider first principles.**\\n\\nFound 5 memories\",\n  \"data\": {\n    \"searchType\": \"hybrid\",\n    \"count\": 1,\n    \"constitutionalCount\": 0,\n    \"requestQuality\": {\n      \"label\": \"weak\"\n    },\n    \"recovery\": {\n      \"status\": \"low_confidence\",\n      \"reason\": \"low_signal_query\",\n      \"suggestedQueries\": [],\n      \"recommendedAction\": \"switch_mode\"\n    },\n    \"stateStats\": {\n      \"minState\": \"\",\n      \"before\": {\n        \"UNKNOWN\": 5\n      },\n      \"after\": {\n        \"UNKNOWN\": 5\n      },\n      \"removed\": 0\n    },\n    \"featureFlags\": {\n      \"trmEnabled\": true,\n      \"multiQueryEnabled\": true,\n      \"stateLimitsApplied\": false\n    },\n    \"pipelineMetadata\": {\n      \"stage1\": {\n        \"searchType\": \"hybrid\",\n        \"channelCount\": 1,\n        \"activeChannels\": 2,\n        \"candidateCount\": 12,\n        \"constitutionalInjected\": 2,\n        \"durationMs\": 306\n      },\n      \"stage2\": {\n        \"sessionBoostApplied\": \"off\",\n        \"causalBoostApplied\": \"applied\",\n        \"intentWeightsApplied\": \"off\",\n        \"artifactRoutingApplied\": \"applied\",\n        \"feedbackSignalsApplied\": \"off\",\n        \"graphContribution\": {\n          \"killSwitchActive\": false,\n          \"causalBoosted\": 0,\n          \"coActivationBoosted\": 0,\n          \"communityInjected\": 0,\n          \"graphSignalsBoosted\": 0,\n          \"totalGraphInjected\": 0,\n          \"rolloutState\": \"bounded_runtime\"\n        },\n        \"qualityFiltered\": 0,\n        \"durationMs\": 5,\n        \"recencyFusionApplied\": true,\n        \"recencyFusionBoosted\": 11,\n        \"coActivationApplied\": true,\n        \"graphSignalsApplied\": true\n      },\n      \"stage3\": {\n        \"rerankApplied\": true,\n        \"rerankProvider\": \"cross-encoder\",\n        \"chunkReassemblyStats\": {\n          \"collapsedChunkHits\": 0,\n          \"chunkParents\": 0,\n          \"reassembled\": 0,\n          \"fallback\": 0\n        },\n        \"durationMs\": 267\n      },\n      \"stage4\": {\n        \"stateFiltered\": 0,\n        \"constitutionalInjected\": 2,\n        \"evidenceGapDetected\": true,\n        \"durationMs\": 0\n      },\n      \"timing\": {\n        \"stage1\": 306,\n        \"stage2\": 5,\n        \"stage3\": 267,\n        \"stage4\": 0,\n        \"total\": 578\n      }\n    },\n    \"lexicalPath\": \"fts5\",\n    \"fallbackState\": \"ok\",\n    \"evidenceGapWarning\": \"> **[EVIDENCE GAP DETECTED]: Retrieved context has low mathematical confidence (Z=1.26). Consider first principles.**\",\n    \"intent\": {\n      \"type\": \"understand\",\n      \"confidence\": 1,\n      \"description\": \"Understanding or exploring the codebase\",\n      \"weightsApplied\": \"off\"\n    },\n    \"artifactRouting\": {\n      \"strategy\": {\n        \"artifactClass\": \"decision-record\",\n        \"semanticWeight\": 0.6,\n        \"keywordWeight\": 0.4,\n        \"recencyBias\": 0.2,\n        \"maxResults\": 5,\n        \"boostFactor\": 1\n      },\n      \"detectedClass\": \"decision-record\",\n      \"confidence\": 0.16666666666666666\n    },\n    \"artifact_routing\": {\n      \"strategy\": {\n        \"artifactClass\": \"decision-record\",\n        \"semanticWeight\": 0.6,\n        \"keywordWeight\": 0.4,\n        \"recencyBias\": 0.2,\n        \"maxResults\": 5,\n        \"boostFactor\": 1\n      },\n      \"detectedClass\": \"decision-record\",\n      \"confidence\": 0.16666666666666666\n    },\n    \"graphContribution\": {\n      \"killSwitchActive\": false,\n      \"causalBoosted\": 0,\n      \"coActivationBoosted\": 0,\n      \"communityInjected\": 0,\n      \"graphSignalsBoosted\": 0,\n      \"totalGraphInjected\": 0,\n      \"rolloutState\": \"bounded_runtime\"\n    },\n    \"graph_contribution\": {\n      \"killSwitchActive\": false,\n      \"causalBoosted\": 0,\n      \"coActivationBoosted\": 0,\n      \"communityInjected\": 0,\n      \"graphSignalsBoosted\": 0,\n      \"totalGraphInjected\": 0,\n      \"rolloutState\": \"bounded_runtime\"\n    },\n    \"rerankMetadata\": {\n      \"reranking_enabled\": true,\n      \"reranking_requested\": true,\n      \"reranking_applied\": true\n    },\n    \"sourceContract\": {\n      \"version\": \"gate-d-reader-ready-v1\",\n      \"archivedTierEnabled\": false,\n      \"legacyFallbackEnabled\": false,\n      \"includeArchivedCompatibility\": \"not_requested\",\n      \"preferredDocumentTypes\": [\n        \"spec_doc\",\n        \"continuity\"\n      ],\n      \"retainedResults\": 5,\n      \"droppedNonCanonicalResults\": 0,\n      \"countsBySourceKind\": {\n        \"spec_doc\": 5,\n        \"continuity\": 0,\n        \"constitutional\": 0\n      }\n    },\n    \"retrievalTrace\": {\n      \"traceId\": \"tr_mog38va1_jgh5mm\",\n      \"query\": \"SPECKIT_SAVE_PLANNER_MODE decision\",\n      \"intent\": \"understand\",\n      \"stages\": [\n        {\n          \"stage\": \"candidate\",\n          \"timestamp\": 1777227297931,\n          \"inputCount\": 1,\n          \"outputCount\": 12,\n          \"durationMs\": 306,\n          \"metadata\": {\n            \"searchType\": \"hybrid\",\n            \"mode\": null,\n            \"channelCount\": 1,\n            \"deepExpansion\": false,\n            \"r12EmbeddingExpansion\": true\n          }\n        },\n        {\n          \"stage\": \"fusion\",\n          \"timestamp\": 1777227297936,\n          \"inputCount\": 12,\n          \"outputCount\": 5,\n          \"durationMs\": 5,\n          \"metadata\": {\n            \"sessionBoostApplied\": \"off\",\n            \"causalBoostApplied\": \"applied\",\n            \"intentWeightsApplied\": \"off\",\n            \"artifactRoutingApplied\": \"applied\",\n            \"feedbackSignalsApplied\": \"off\",\n            \"graphContribution\": {\n              \"killSwitchActive\": false,\n              \"causalBoosted\": 0,\n              \"coActivationBoosted\": 0,\n              \"communityInjected\": 0,\n              \"graphSignalsBoosted\": 0,\n              \"totalGraphInjected\": 0,\n              \"rolloutState\": \"bounded_runtime\"\n            },\n            \"searchType\": \"hybrid\",\n            \"isHybrid\": true\n          }\n        },\n        {\n          \"stage\": \"rerank\",\n          \"timestamp\": 1777227298203,\n          \"inputCount\": 5,\n          \"outputCount\": 5,\n          \"durationMs\": 267,\n          \"metadata\": {\n            \"rerankApplied\": true,\n            \"provider\": \"cross-encoder\"\n          }\n        },\n        {\n          \"stage\": \"final-rank\",\n          \"timestamp\": 1777227298203,\n          \"inputCount\": 5,\n          \"outputCount\": 5,\n          \"durationMs\": 0,\n          \"metadata\": {\n            \"collapsedChunkHits\": 0,\n            \"chunkParents\": 0,\n            \"reassembled\": 0,\n            \"fallback\": 0\n          }\n        },\n        {\n          \"stage\": \"filter\",\n          \"timestamp\": 1777227298203,\n          \"inputCount\": 5,\n          \"outputCount\": 5,\n          \"durationMs\": 0,\n          \"metadata\": {\n            \"stateFiltered\": 0,\n            \"evidenceGapDetected\": true,\n            \"trmEnabled\": true,\n            \"applyStateLimits\": false,\n            \"minState\": \"\"\n          }\n        }\n      ],\n      \"totalDurationMs\": 578,\n      \"finalResultCount\": 5\n    },\n    \"appliedBoosts\": {\n      \"session\": {\n        \"applied\": \"off\"\n      },\n      \"causal\": {\n        \"applied\": \"applied\"\n      }\n    },\n    \"applied_boosts\": {\n      \"session\": {\n        \"applied\": \"off\"\n      },\n      \"causal\": {\n        \"applied\": \"applied\"\n      }\n    },\n    \"progressiveDisclosure\": {\n      \"summaryLayer\": {\n        \"count\": 5,\n        \"digest\": \"5 weak\"\n      },\n      \"results\": [\n        {\n          \"snippet\": \"\",\n          \"detailAvailable\": false,\n          \"resultId\": \"2316\"\n        },\n        {\n          \"snippet\": \"\",\n          \"detailAvailable\": false,\n          \"resultId\": \"1195\"\n        },\n        {\n          \"snippet\": \"\",\n          \"detailAvailable\": false,\n          \"resultId\": \"2317\"\n        },\n        {\n          \"snippet\": \"\",\n          \"detailAvailable\": false,\n          \"resultId\": \"92\"\n        },\n        {\n          \"snippet\": \"\",\n          \"detailAvailable\": false,\n          \"resultId\": \"94\"\n        }\n      ],\n      \"continuation\": null\n    },\n    \"results\": [\n      {\n        \"id\": 2316,\n        \"specFolder\": \"system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/004-memory-save-rewrite\",\n        \"filePath\": \"/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/specs/system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/004-memory-save-rewrite/plan.md\",\n        \"title\": \"Implemen [system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/004-memory-save-rewrite/plan]\",\n        \"similarity\": 74.34,\n        \"isConstitutional\": false,\n        \"importanceTier\": \"important\",\n        \"triggerPhrases\": [],\n        \"createdAt\": \"2026-04-26T14:30:22.365Z\",\n        \"isChunk\": false,\n        \"parentId\": null,\n        \"chunkIndex\": null,\n        \"chunkLabel\": null,\n        \"chunkCount\": null,\n        \"contentSource\": \"file_read_fallback\",\n        \"trustBadges\": {\n          \"confidence\": 0.9,\n          \"extractionAge\": \"today\",\n          \"lastAccessAge\": \"never\",\n          \"orphan\": false,\n          \"weightHistoryChanged\": false\n        },\n        \"content\": \"---\\ntitle: \\\"Implemen [system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/004-memory-save-rewrite/plan]\\\"\\ndescription: \\\"Milestoned delivery (M1-M10) for the planner-first /memory:save contract: audit + retirement of the legacy [spec]/memory/*.md write path, 20-iteration relevance research, planner contract + fallback implementation, routing/quality/reconsolidation/enrichment trim, follow-up API extraction, verification, release alignment, and deep-review remediation.\\\"\\ntrigger_phrases:\\n  - \\\"implementation plan\\\"\\n  - \\\"memory save planner first\\\"\\n  - \\\"planner-first memory save plan\\\"\\n  - \\\"save flow trim plan\\\"\\n  - \\\"retirement audit to planner-first\\\"\\nimportance_tier: \\\"important\\\"\\ncontextType: \\\"planning\\\"\\n_memory:\\n  continuity:\\n    packet_pointer: \\\"system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/004-memory-save-rewrite\\\"\\n    last_updated_at: \\\"2026-04-15T10:00:01Z\\\"\\n    last_updated_by: \\\"cli-copilot\\\"\\n    recent_action: \\\"Folder renamed; plan rewritten as M1-M10 planner-first delivery\\\"\\n    next_safe_action: \\\"Packet complete\\\"\\n    blockers: []\\n    key_files:\\n      - \\\"plan.md\\\"\\n      - \\\"spec.md\\\"\\n      - \\\"tasks.md\\\"\\n      - \\\"checklist.md\\\"\\n      - \\\"decision-record.md\\\"\\n      - \\\"implementation-summary.md\\\"\\n    session_dedup:\\n      fingerprint: \\\"sha256:014-planner-first-plan-2026-04-15\\\"\\n      session_id: \\\"014-planner-first-plan-2026-04-15\\\"\\n      parent_session_id: \\\"014-planner-first-seed\\\"\\n    completion_pct: 100\\n    open_questions: []\\n    answered_questions:\\n      - \\\"The planner-first default + explicit fallback architecture preserves the canonical writer while eliminating the default-path overreach.\\\"\\n      - \\\"Delivery spanned M1-M10 across audit, research, implementation, verification, release alignment, and deep-review remediation.\\\"\\ntemplate_source_hint: \\\"<!-- SPECKIT_TEMPLATE_SOURCE: plan-core | v2.2 -->\\\"\\n---\\n# Implementation Plan: /memory:save Planner-First Default\\n\\n<!-- SPECKIT_LEVEL: 3+ -->\\n<!-- SPECKIT_TEMPLATE_SOURCE: plan-core | v2.2 -->\\n\\n---\\n\\n<!-- ANCHOR:summary -->\\n## 1. SUMMARY\\n\\n### Technical Context\\n\\n| Aspect | Value |\\n|--------|-------|\\n| **Language or Stack** | TypeScript save-flow handlers, CLI wrapper, routing, validation, indexing, and follow-up APIs; markdown packet docs + release notes |\\n| **Framework** | system-spec-kit MCP server + spec-folder workflow |\\n| **Storage** | Canonical spec docs, vector DB, routed record identity, graph metadata, optional follow-up indexing |\\n| **Testing** | `validate_document.py`, `validate.sh --strict`, vitest suites, transcript prototypes, env-flag orthogonality tests |\\n| **Runtime Surface** | TypeScript save-flow handlers, CLI wrapper, routing, validation, indexing, and follow-up APIs described in `spec.md §3` |\\n\\n### Overview\\n\\nThe plan delivers a planner-first default for `/memory:save` while preserving the canonical atomic writer as an explicit fallback. It retires the legacy `[spec]/memory/*.md` write path end-to-end, gates four previously default-on save-path behaviors behind explicit env flags, and extracts freshness into three explicit follow-up APIs. Delivery runs through 10 sequential milestones: audit surface + classification, retirement cutover, relevance research, planner contract build-out, routing + quality trim, verification + transcript prototypes, release alignment, and deep-review remediation.\\n\\n### Full Delivery Summary\\n\\n| Milestone | Theme | Main Output | Why It Matters |\\n|-----------|-------|-------------|----------------|\\n| M1 | Audit kickoff | Classification rules + iteration plan | Establishes the audit frame |\\n| M2 | Audit convergence | 25-finding audit report + half-migrated diagnosis | Proves the default contract is broken |\\n| M3 | Retirement cutover | v3.4.1.0 removes legacy memory-file write path + aligns docs | Bridges audit to planner work |\\n| M4 | Research kickoff | Q1-Q10 relevance questions | Sets the classification scope |\\n| M5 | Research convergence | 15-subsystem classification + trim-targeted verdict | Decides what survives the default path |\\n| M6 | Planner contract | Planner-first default + flag plumbing + type surface + shared types | Ships the new operator contract |\\n| M7 | Routing and quality trim | Tier 3 + quality-loop + reconsolidation + enrichment leave the default path | Aligns runtime to verdict |\\n| M8 | Verification + transcripts | Targeted tests, transcript prototypes, packet validation | Grounds planner behavior in real operator flows |\\n| M9 | Release alignment | v3.4.1.0 release note + env reference + template updates | Runtime contract documented honestly |\\n| M10 | Deep-review remediation | 9-finding closure (3 P0, 5 P1, 1 P2) | Closes the last correctness + honesty gaps |\\n\\n---\\n\\n<!-- /ANCHOR:summary -->\\n<!-- ANCHOR:quality-gates -->\\n## 2. QUALITY GATES\\n\\n### Definition of Ready\\n\\n- [x] Audit classification rules and dimension plan defined before iteration started.\\n- [x] Q1-Q10 relevance questions agreed before M4 kickoff.\\n- [x] Load-bearing core and candidate trim targets defined before M6 kickoff.\\n- [x] Packet scope limited to the planner contract, retirement of legacy write path, subsystem gating, follow-up APIs, and docs alignment.\\n\\n### Definition of Done\\n\\n- [x] Packet canonical docs exist and agree on the planner-first contract.\\n- [x] Audit, research, deep-review, and transcript snapshots copied into the packet.\\n- [x] Every copied Markdown file begins with the required snapshot note.\\n- [x] `description.json`, `graph-metadata.json`, and packet-local nested changelog exist.\\n- [x] All primary docs pass `validate_document.py`.\\n- [x] Packet passes `validate.sh --strict` with no blocking errors.\\n- [x] Planner-default runtime tests prove the default path is non-mutating.\\n- [x] Full-auto fallback tests prove atomic mutation + rollback + `POST_SAVE_FINGERPRINT` parity.\\n- [x] Follow-up APIs (`refreshGraphMetadata`, `reindexSpecDocs`, `runEnrichmentBackfill`) have execution-level coverage.\\n- [x] Deep-review findings F001-F009 closed.\\n\\n---\\n\\n<!-- /ANCHOR:quality-gates -->\\n<!-- ANCHOR:architecture -->\\n## 3. ARCHITECTURE\\n\\n### Pattern\\n\\nPlanner-first wrapper around the preserved canonical atomic writer. The default path computes route + legality + advisory data and returns structured planner output without mutating files. An explicit fallback path activates the canonical writer with full atomic semantics intact. Freshness work lives in callable follow-up APIs.\\n\\n### Key Components\\n\\n- **Planner-first handler (`memory-save.ts`)**: Default execution path returning planner output (routes, blockers, advisories, follow-up actions). No mutation on default.\\n- **Canonical atomic writer (preserved: `create-record.ts`, `atomic-index-memory.ts`, `thin-continuity-record.ts`, `post-insert.ts`)**: Fallback path when `SPECKIT_SAVE_PLANNER_MODE=full-auto`. Rollback, promotion, same-path identity, `POST_SAVE_FINGERPRINT` parity intact.\\n- **Content router (`content-router.ts`)**: Eight-category contract preserved. Scoped exception: Tier 3 default-disable + manual-review guard.\\n- **Quality gate (`quality-loop.ts`, `save-quality-gate.ts`)**: Hard blockers preserved. Auto-fix retries gated behind `SPECKIT_QUALITY_AUTO_FIX=true`.\\n- **Reconsolidation (`reconsolidation-bridge.ts`)**: Gated behind `SPECKIT_RECONSOLIDATION_ENABLED=true` or explicit fallback.\\n- **Post-insert enrichment (`post-insert.ts`)**: Gated behind `SPECKIT_POST_INSERT_ENRICHMENT_ENABLED=true` or follow-up API.\\n- **Follow-up indexing APIs (`api/indexing.ts`, `graph-metadata-parser.ts`)**: `refreshGraphMetadata`, `reindexSpecDocs`, `runEnrichmentBackfill`.\\n- **Env reference + command docs + release notes**: Aligned to describe default/opt-in/reserved/fallback consistently.\\n\\n### Data Flow\\n\\n```text\\nCaller invokes /memory:save\\n    |\\n    v\\nResolve SPECKIT_SAVE_PLANNER_MODE\\n    |\\n    |-- default or plan-only or hybrid(reserved) -->\\n    |       Compute route + legality + advisories\\n    |       Respect env flags for deferred helpers\\n    |       Return structured planner output (no mutation)\\n    |\\n    +-- full-auto -->\\n            Canonical atomic writer\\n            Promotion + rollback + same-path identity\\n            POST_SAVE_FINGERPRINT parity\\n            Gated subsystems run only when their env flag is true\\n```\\n\\n### File-Level Change Map\\n\\nSee `spec.md §3 Files to Change` for the consolidated table covering legacy write-path retirement, planner contract core, canonical writer preservation, content router scoped exception, quality gate updates, reconsolidation gating, enrichment deferral, freshness APIs, command + reference + env docs, release notes, test surfaces, and packet metadata.\\n\\n### Runtime Surface Summary\\n\\n| Area | Files | Role |\\n|------|-------|------|\\n| Legacy write path retirement | `directory-setup.ts`, `workflow.ts`, `file-writer.ts`, `memory-indexer.ts`, `memory-metadata.ts` | Removed from runtime |\\n| Load-bearing core preserved | `memory-save.ts`, `create-record.ts`, `atomic-index-memory.ts`, `thin-continuity-record.ts`, `content-router.ts`, `post-insert.ts`, `reconsolidation-bridge.ts`, `workflow.ts` | Writer core + continuity + routing |\\n| Planner contract | `types.ts`, `response-builder.ts`, `validation-responses.ts`, `generate-context.ts`, `/memory:save` docs | Default non-mutating output |\\n| Follow-up APIs | `api/indexing.ts`, `graph-metadata-parser.ts` | Deferred freshness + enrichment |\\n| Remediation surfaces | `content-router.ts`, `memory-save.ts`, `post-insert.ts`, `../../../../skill/system-spec-kit/mcp_server/ENV_REFERENCE.md`, `../../../../changelog/01--system-spec-kit/v3.4.1.0.md` | Deep-review closure + honesty fixes |\\n\\n---\\n\\n<!-- /ANCHOR:architecture -->\\n<!-- ANCHOR:phases -->\\n## 4. IMPLEMENTATION PHASES\\n\\n### Milestone Flow\\n\\n```text\\nM1 Audit kickoff\\n  -> M2 Audit convergence\\n  -> M3 Retirement closure (v3.4.1.0 legacy write-path removal)\\n  -> M4 Research kickoff\\n  -> M5 Research convergence (15-subsystem classification + trim-targeted verdict)\\n  -> M6 Planner contract\\n  -> M7 Routing + quality + reconsolidation + enrichment trim\\n  -> M8 Verification and transcripts\\n  -> M9 Release alignment\\n  -> M10 Deep-review remediation\\n```\\n\\n### M1 — Audit kickoff\\n\\nOpen the audit with a narrow question: does any active file still write, read, or assume `[spec]/memory/*.md` in contradiction to the retirement claim? Define classification rules and the iteration plan. Evidence: `research/013-audit-snapshot/primary-docs/spec.md`, `research/013-audit-snapshot/deep-review-strategy.md`.\\n\\n### M2 — Audit convergence\\n\\nRun the audit to convergence across 7 iterations. Document the half-migrated state in concrete families: runtime write path, runtime read path, doc contradiction, phantom dedup contract, test drift, and template drift. 25 active findings across 9 P0, 9 P1, and 7 P2 produce three closure paths (A retire, B rescind, C dedup redesign). Evidence: `research/013-audit-snapshot/iterations/`, `research/013-audit-snapshot/review-report.md`.\\n\\n### M3 — Retirement closure\\n\\nRemove the live memory-file write path, clean up templates and docs, and align the runtime with the intended canonical-doc model. v3.4.1.0 records the cutover. Evidence: `../../../../changelog/01--system-spec-kit/v3.4.1.0.md`.\\n\\n### M4 — Research kickoff\\n\\nAfter the retirement cutover, open relevance research with Q1-Q10 covering load-bearing core, planner-first feasibility, quality-check classification, reindex vs freshness, graph-metadata refresh, entity extraction, reconsolidation cost, router classifier overfitting, trigger harmonization, and continuity ownership. Evidence: `research/014-research-snapshot/primary-docs/spec.md`, `research/014-research-snapshot/deep-research-strategy.md`.\\n\\n### M5 — Research convergence\\n\\nRun 20 iterations of relevance research. Classify 15 subsystems into load-bearing (canonical atomic writer, routed record identity, content-router core, thin continuity validation), candidate trim targets (Tier 3 routing, reconsolidation-on-save, heavy quality-loop auto-fix, post-insert enrichment), and other categories. Reach the `trim-targeted` verdict: keep the writer, trim the oversized default-path stack. Evidence: `research/014-research-snapshot/research.md`, `research/014-research-snapshot/findings-registry.json`.\\n\\n### M6 — Planner contract\\n\\nBuild the planner-first default, CLI defaults, docs, and type surfaces:\\n\\n- [x] T001-T005 Add planner-default and fallback flag definitions; planner response interfaces; response serialization helpers; planner blocker and advisory response helpers.\\n- [x] T006-T008 Make `generate-context.ts` request planner-first behavior by default; update `/memory:save` docs; make `memory-save.ts` return planner output by default with explicit fallback.\\n- [x] T009-T012 Update aggregate and handler tests for planner-default behavior; focused planner-first regression coverage.\\n\\n### M7 — Routing and quality trim\\n\\nTrim Tier 3 routing, quality-loop auto-fix, reconsolidation-on-save, and post-insert enrichment from the default hot path while preserving the category contract and hard blockers:\\n\\n- [x] T013-T017 Trim default Tier 3 participation while preserving category contract; reduce Tier 2 prototype library; update content-router tests for Tier 1/Tier 2 deterministic default; update runtime routing + intent-routing tests.\\n- [x] T018-T022 Retire default-path auto-fix retries; preserve hard structural blockers; update quality-loop + save-quality-gate + pipeline-enforcement tests.\\n- [x] T023-T026 Gate reconsolidation behind explicit flag/fallback; move default-path enrichment to explicit follow-up behavior; preserve same-path lineage; keep chunking as size-driven fallback.\\n- [x] T027-T034 Move unconditional graph refresh + spec-doc reindex out of planner-default saves; expose explicit follow-up indexing entry points; keep graph refresh callable as explicit follow-up; update reconsolidation-bridge, reconsolidation, assistive-reconsolidation, chunking, graph-refresh tests.\\n\\n### M8 — Verification and transcripts\\n\\nProve the planner-first model holds up against real session evidence:\\n\\n- [x] T035-T037 Memory-save integration tests for planner-default plus fallback end-to-end; planner UX regression tests for readable output; thin-continuity tests for normalization + upsert parity.\\n- [x] T038 Prototype planner-first behavior against three real session transcripts. Evidence: `scratch/transcripts-snapshot/`.\\n- [x] T039-T040 Run per-file doc validation + strict packet validation; capture follow-on defects.\\n- [x] T041-T043 Review structural parity between `/memory:save` + `AGENTS.md` + system-spec-kit skill doc; review fallback safety against `atomic-index-memory.ts` + `create-record.ts`; review transcript mismatches and convert unresolved issues into follow-on tasks.\\n\\n### M9 — Release alignment\\n\\nDocument the shipped contract in `v3.4.1.0` release notes and closeout docs, including the explicit follow-up APIs, the scoped router exception, and the reserved state of `hybrid`. Evidence: `review/015-deep-review-snapshot/primary-docs/implementation-summary.md`, `../../../../changelog/01--system-spec-kit/v3.4.1.0.md`.\\n\\n### M10 — Deep-review remediation\\n\\nClose the 9 findings from the deep-review pass (3 P0, 5 P1, 1 P2):\\n\\n- **F001 [P0]**: router-preservation contradiction → resolved by documenting the scoped `content-router.ts` exception (ADR-007).\\n- **F002 [P0]**: fallback safety parity → resolved by reinstating `POST_SAVE_FINGERPRINT`.\\n- **F003 [P0]**: template-contract failures hidden as advisories → resolved by promoting them to planner blockers.\\n- **F004 [P1]**: deferred enrichment returning success-shaped status → resolved by returning explicit `deferred` status.\\n- **F005 [P2]**: `hybrid` assumed live → resolved by marking reserved and documenting `plan-only`-equivalent behavior.\\n- **F006 [P1]**: follow-up API coverage → resolved by adding execution-level coverage for `refreshGraphMetadata`, `reindexSpecDocs`, `runEnrichmentBackfill`.\\n- **F007 [P1]**: follow-up tool names in packet docs → resolved by aligning docs to shipped names.\\n- **F008 [P1]**: env reference drift → resolved by documenting `hybrid` honestly in `ENV_REFERENCE.md`.\\n- **F009 [P1]**: release-note honesty → resolved by describing router scope and `hybrid` state accurately in `v3.4.1.0.md`.\\n\\n---\\n\\n<!-- /ANCHOR:phases -->\\n<!-- ANCHOR:testing -->\\n## 5. TESTING STRATEGY\\n\\n| Test Type | Scope | Tools | Source |\\n|-----------|-------|-------|--------|\\n| Audit validation | Verify runtime + doc contradictions | Deep-review iterations + synthesis report | `research/013-audit-snapshot/**` |\\n| Research convergence | Verify Q1-Q10 answers + 15-subsystem verdicts | Deep-research iterations + findings registry | `research/014-research-snapshot/**` |\\n| Runtime contract tests | Planner-default + fallback parity + router + quality + follow-up APIs | Vitest suites + targeted sweeps | `review/015-deep-review-snapshot/primary-docs/tasks.md`, `review/015-deep-review-snapshot/primary-docs/checklist.md`, `review/015-deep-review-snapshot/primary-docs/implementation-summary.md` |\\n| Transcript validation | Planner-first behavior against real sessions | Transcript markdown + planner-output JSON + transcript reviews | `scratch/transcripts-snapshot/` |\\n| Review convergence | Deep-review isolation of real defect set | Review report + findings registry + iteration ledger | `review/015-deep-review-snapshot/**` |\\n| Remediation confirmation | All 9 review findings resolved | Remediated docs + tests + changelog + implementation summary | `review/015-deep-review-snapshot/primary-docs/implementation-summary.md`, `../../../../changelog/01--system-spec-kit/v3.4.1.0.md` |\\n| Packet validation | Packet structural soundness | `validate_document.py`, `validate.sh --strict` | This packet |\\n\\n### Audit Approach (M1-M3)\\n\\n- Focused deep-review loop over runtime, docs, tests, and templates.\\n- Classification rule applied each iteration.\\n- Convergence threshold tracked and documented.\\n- Retirement cutover delivered as part of v3.4.1.0; docs aligned to the canonical-doc model.\\n\\n### Research Approach (M4-M5)\\n\\n- 20 iterations with explicit subsystem questions.\\n- Research document and findings registry used as the canonical synthesis.\\n- Minimal replacement design evaluated against live code surfaces.\\n- Final report explicitly ruled out a full writer redesign.\\n\\n### Implementation Approach (M6-M8)\\n\\n- Planner-first contract built before trim work.\\n- Routing, quality, reconsolidation, enrichment, and follow-up APIs covered by targeted tests.\\n- Transcript prototypes used to validate real operator narratives.\\n- Packet-local doc validation and strict packet validation used as release gates.\\n\\n### Remediation Approach (M10)\\n\\n- Deep review split concerns into runtime correctness, follow-up API integrity, coverage, and documentation honesty.\\n- Remediation closed all 9 findings and aligned packet docs and release notes.\\n- Packet docs reflect the remediated state as the final truth.\\n\\n---\\n\\n<!-- /ANCHOR:testing -->\\n<!-- ANCHOR:dependencies -->\\n## 6. DEPENDENCIES\\n\\n| Dependency | Type | Status | Impact if Blocked |\\n|------------|------|--------|-------------------|\\n| Audit evidence | Documentation source | Ready | Audit truth cannot be grounded |\\n| Research synthesis | Documentation source | Ready | Verdicts and Q1-Q10 would be underspecified |\\n| Canonical atomic writer | Runtime core | Preserved | Fallback path depends on it |\\n| Eight-category router contract | Runtime core | Preserved | Target authority depends on it |\\n| Vitest suites | Verification tooling | Ready | Runtime contract evidence |\\n| Transcript fixtures | Verification input | Ready | Real-operator-flow evidence |\\n| v3.4.1.0 changelog | Release artifact | Ready | Release-state truth |\\n| `validate_document.py` | Tooling | Pass recorded | Docs could ship with structural defects |\\n| `validate.sh --strict` | Tooling | Pass recorded | Packet could ship with blocking issues |\\n| `generate-description.js` | Tooling | Run | Packet metadata complete |\\n| Nested changelog generator | Tooling | Run | Packet-local change trace complete |\\n\\n---\\n\\n<!-- /ANCHOR:dependencies -->\\n<!-- ANCHOR:rollback -->\\n## 7. ROLLBACK PLAN\\n\\n- **Trigger**: Planner-default mutates under some branch, fallback loses atomic safety parity, router preservation claim contradicts code, or remediation reopens a closed finding.\\n- **Procedure**: Revert runtime changes + docs + env reference + release note as one batch. Re-run vitest suites + strict validation + transcript prototypes.\\n- **Data reversal**: No data migrations. Vector DB schema unchanged; saves still use the canonical atomic writer when fallback is active.\\n\\n### Per-Milestone Rollback\\n\\n| Milestone | Trigger | Rollback Action | Data Reversal |\\n|-----------|---------|-----------------|---------------|\\n| M3 retirement cutover | Legacy memory-file surface regression | Revert the retirement commit; re-run audit fixtures | None |\\n| M6 planner contract | Planner output schema drift or default mutation | Revert planner commits; re-enable prior handler default | None |\\n| M7 trim milestones | Opt-in flag cascade activates unintended subsystems | Revert trim commits for affected subsystem | None |\\n| M8 verification | Transcript prototype breaks unexpectedly | Patch surface; re-run validator | None |\\n| M9 release alignment | Release notes drift from runtime | Patch release notes + env reference | None |\\n| M10 remediation | Reopened finding | Apply targeted patch; re-run closure tests | None |\\n\\n### Consolidated Rollback Note\\n\\nBecause the canonical atomic writer is preserved, rollback means reverting the planner-first wrapper + env-flag gates + follow-up API exports. Fallback behavior continues to work with full atomic semantics intact.\\n\\n---\\n\\n<!-- /ANCHOR:rollback -->\\n## L2: PHASE DEPENDENCIES\\n\\n```text\\nM1 Audit kickoff\\n  -> M2 Audit convergence\\n  -> M3 Retirement closure\\n  -> M4 Research kickoff\\n  -> M5 Research convergence\\n  -> M6 Planner contract\\n  -> M7 Routing and quality trim\\n  -> M8 Verification and transcripts\\n  -> M9 Release alignment\\n  -> M10 Remediation\\n```\\n\\n| Phase | Depends On | Blocks |\\n|-------|------------|--------|\\n| M1 | None | M2-M10 |\\n| M2 | M1 | M3-M10 |\\n| M3 | M2 | M4-M10 |\\n| M4 | M3 | M5-M10 |\\n| M5 | M4 | M6-M10 |\\n| M6 | M5 | M7-M10 |\\n| M7 | M6 | M8-M10 |\\n| M8 | M7 | M9-M10 |\\n| M9 | M8 | M10 |\\n| M10 | M9 | Packet closeout |\\n\\n---\\n\\n## L2: EFFORT ESTIMATION\\n\\n| Phase | Complexity | Estimated Effort |\\n|-------|------------|------------------|\\n| Audit + retirement | High | 1-2 days |\\n| Research convergence | High | 1 day |\\n| Planner contract | High | 0.5-1 day |\\n| Routing + quality + reconsolidation + enrichment trim | High | 1-1.5 days |\\n| Verification + transcripts | Medium | 0.5 day |\\n| Release alignment | Medium | 0.5 day |\\n| Deep-review remediation (9 findings) | High | 0.5-1 day |\\n| **Total** | **High** | **~5-7 implementation days** |\\n\\n### Historical Effort Context\\n\\n| Area | Effort Shape | Why It Matters |\\n|------|--------------|----------------|\\n| Audit loop | Multi-iteration review + release alignment | Explains depth of the original contradiction |\\n| Research loop | 20-iteration classification | Explains trim-targeted verdict trustworthiness |\\n| Implementation | 43 tasks across planner + trim + verification | Explains why the contract cannot be summarized as a small one-line change |\\n\\n---\\n\\n## L2: ENHANCED ROLLBACK\\n\\n### Pre-release Checks\\n\\n- [x] Snapshot tree complete (audit + research + review + transcripts)\\n- [x] Planner-default runtime tests pass\\n- [x] Full-auto fallback tests pass with `POST_SAVE_FINGERPRINT` parity\\n- [x] Follow-up API coverage in place\\n- [x] Release notes + env reference aligned to runtime\\n\\n### Rollback Procedure\\n\\n1. Revert planner commits atomically; fallback behavior continues via canonical writer.\\n2. Revert env-flag gates for any subsystem that regressed.\\n3. Re-run vitest suites + strict validation + transcript prototypes.\\n4. If v3.4.1.0 release note needs adjustment, patch the release note and env reference.\\n\\n### Data Reversal\\n\\n- **Has data migration?** No\\n- **Reversal procedure**: Runtime-level revert only\\n\\n---\\n\\n## L3: DEPENDENCY GRAPH\\n\\n```text\\n┌──────────────┐\\n│ Audit (M1-M2)│\\n└──────┬───────┘\\n       v\\n┌──────────────┐\\n│ Retirement   │\\n│ cutover (M3) │\\n└──────┬───────┘\\n       v\\n┌──────────────┐\\n│ Research     │\\n│ (M4-M5)      │\\n└──────┬───────┘\\n       v\\n┌──────────────┐\\n│ Planner +    │\\n│ trim (M6-M7) │\\n└──────┬───────┘\\n       v\\n┌──────────────┐\\n│ Verification │\\n│ (M8)         │\\n└──────┬───────┘\\n       v\\n┌──────────────┐\\n│ Release      │\\n│ alignment M9 │\\n└──────┬───────┘\\n       v\\n┌──────────────┐\\n│ Remediation  │\\n│ (M10)        │\\n└──────────────┘\\n```\\n\\n### Dependency Matrix\\n\\n| Component | Depends On | Produces | Blocks |\\n|-----------|------------|----------|--------|\\n| Audit | None | Half-migrated evidence | Retirement cutover |\\n| Retirement cutover | Audit | Canonical-doc-aligned runtime | Research |\\n| Research | Retirement cutover | Trim-targeted verdict | Planner contract |\\n| Planner contract | Research | Non-mutating default + fallback | Trim milestones |\\n| Trim milestones | Planner contract | Gated subsystems + follow-up APIs | Verification |\\n| Verification | Trim milestones | Targeted tests + transcript evidence | Release |\\n| Release alignment | Verification | v3.4.1.0 + env reference + templates | Remediation |\\n| Remediation | Release alignment | 9-finding closure + honest router scope | Closeout |\\n\\n---\\n\\n## L3: CRITICAL PATH\\n\\n1. **Audit the half-migrated state** — critical because every later claim depends on grounded evidence.\\n2. **Retire the legacy write path** — critical so research and implementation do not inherit the contradiction.\\n3. **Classify the 15 subsystems** — critical so the trim targets are objective.\\n4. **Ship the planner-first default + full-auto fallback** — critical because it is the operator-facing contract.\\n5. **Gate Tier 3 + quality + reconsolidation + enrichment** — critical so the default path actually trims.\\n6. **Expose follow-up APIs** — critical so deferred work remains callable.\\n7. **Align docs + release notes + env reference** — critical so the shipped contract is documented honestly.\\n8. **Close all 9 deep-review findings** — critical because the first review verdict was remediation-required.\\n\\n**Total Critical Path**: Audit → Retirement → Research → Planner + Trim → Verification → Release → Remediation\\n\\n---\\n\\n## L3: MILESTONES\\n\\n| Milestone | Description | Success Criteria | Target |\\n|-----------|-------------|------------------|--------|\\n| M1 | Audit kickoff | Classification rules + iteration plan published | Audit spec + strategy |\\n| M2 | Audit convergence | 25-finding audit report + half-migrated diagnosis | Audit synthesis |\\n| M3 | Retirement cutover | Legacy memory-file write path removed | v3.4.1.0 release |\\n| M4 | Research kickoff | Q1-Q10 published | Research spec + strategy |\\n| M5 | Research convergence | 15-subsystem classification + trim-targeted verdict | Research synthesis |\\n| M6 | Planner contract | Planner-first default + fallback + shared types | Runtime handler |\\n| M7 | Routing + quality trim | Four subsystems behind env flags | Runtime handlers |\\n| M8 | Verification + transcripts | Targeted tests + transcript prototypes + packet validation | Vitest + transcripts |\\n| M9 | Release alignment | v3.4.1.0 + `/memory:save` docs + env reference + templates | Release artifacts |\\n| M10 | Remediation | 9 findings closed | Review report + ADR-007 |\\n\\n---\\n\\n### Architecture Decision Record Summary\\n\\n| ADR | Summary |\\n|-----|---------|\\n| ADR-001 | Trim-targeted verdict: keep the core writer, trim the oversized default-path stack |\\n| ADR-002 | Planner-first output becomes the default `/memory:save` contract |\\n| ADR-003 | Reconsolidation-on-save becomes explicit opt-in |\\n| ADR-004 | Post-insert enrichment becomes deferred or standalone |\\n| ADR-005 | Router categories stay while Tier 2 or Tier 3 scope narrows |\\n| ADR-006 | Hard checks remain while quality-loop auto-fix leaves the default path |\\n| ADR-007 | Router preservation claim becomes \\\"core preserved with one scoped exception\\\" |\\n\\n---\\n\\n## L3+: AI EXECUTION FRAMEWORK\\n\\n### Pre-Task Checklist\\n\\n- [x] Confirm the canonical atomic writer stays intact\\n- [x] Confirm env flags stay orthogonal\\n- [x] Confirm planner default stays non-mutating\\n\\n### Task Execution Rules\\n\\n| Rule | Description |\\n|------|-------------|\\n| EXEC-SEQ | Ship planner contract before trim work |\\n| EXEC-EVIDENCE | Every trim target maps to an audit/research finding |\\n| EXEC-SCOPE | Do not touch canonical atomic writer internals |\\n\\n### Status Reporting Format\\n\\nReport task state as `P###-ID [x] - description` using the packet-prefixed IDs in `tasks.md`.\\n\\n### Blocked Task Protocol\\n\\nIf a runtime change regresses fallback safety, revert and patch the specific subsystem before re-running the verification sweep.\\n\\n### Tier 1: Runtime Core\\n\\n**Files**\\n- `memory-save.ts`, `types.ts`, `response-builder.ts`, `validation-responses.ts`, `generate-context.ts`\\n- `content-router.ts`, `quality-loop.ts`, `save-quality-gate.ts`\\n- `reconsolidation-bridge.ts`, `post-insert.ts`\\n- `api/indexing.ts`, `graph-metadata-parser.ts`\\n\\n**Goal**\\n- Preserve the canonical atomic writer + routing + continuity; move default-path overreach behind env flags; expose follow-up APIs.\\n\\n### Tier 2: Docs + Release\\n\\n| Workstream | Output | Notes |\\n|------------|--------|-------|\\n| Runtime contract docs | `/memory:save` docs + `ENV_REFERENCE.md` + templates | Align to shipped contract |\\n| Release notes | `v3.4.1.0.md` | Scoped exception + reserved `hybrid` honestly |\\n| Packet docs | `spec.md`, `plan.md`, `tasks.md`, `checklist.md`, `decision-record.md`, `implementation-summary.md` | Tell the end-to-end story |\\n\\n### Tier 3: Validation\\n\\n**Goal**\\n- Packet behaves like a normal spec packet: validators pass, metadata generated, packet-local changelog emitted.\\n\\n**Actions**\\n- Run `validate_document.py`\\n- Run `validate.sh --strict`\\n- Generate `description.json`\\n- Author or verify `graph-metadata.json`\\n- Generate nested changelog\\n\\n---\\n\\n## L3+: WORKSTREAM COORDINATION\\n\\n| ID | Name | Scope | Output |\\n|----|------|-------|--------|\\n| W-A | Audit + retirement | Half-migrated evidence + legacy write-path removal | `research/013-audit-snapshot/**` + v3.4.1.0 retirement |\\n| W-B | Research | 15-subsystem classification + trim-targeted verdict | `research/014-research-snapshot/**` |\\n| W-C | Planner contract + trim | Runtime handlers + env flags + follow-up APIs | Runtime TypeScript |\\n| W-D | Verification + transcripts | Targeted tests + three transcript prototypes | Vitest + `scratch/transcripts-snapshot/` |\\n| W-E | Docs + release alignment | `/memory:save` docs + env reference + release notes + packet docs | Docs surface |\\n| W-F | Remediation | 9-finding closure + ADR-007 | `review/015-deep-review-snapshot/**` |\\n\\n### Sync Points\\n\\n| Sync ID | Trigger | Participants | Output |\\n|---------|---------|--------------|--------|\\n| SYNC-001 | Audit complete | W-A + W-B | Research grounded in audit reality |\\n| SYNC-002 | Research complete | W-B + W-C | Trim targets objective |\\n| SYNC-003 | Runtime complete | W-C + W-D | Tests cover default + fallback + gated subsystems |\\n| SYNC-004 | Verification complete | W-D + W-E | Docs + release + env reference aligned to runtime |\\n| SYNC-005 | Release aligned | W-E + W-F | Remediation targets documented findings |\\n\\n---\\n\\n## L3+: COMMUNICATION PLAN\\n\\n### Checkpoints\\n\\n- **Checkpoint 1**: Audit truth grounded.\\n- **Checkpoint 2**: Retirement cutover shipped.\\n- **Checkpoint 3**: Research verdict published.\\n- **Checkpoint 4**: Planner + trim + follow-up APIs merged.\\n- **Checkpoint 5**: Verification + transcripts validated.\\n- **Checkpoint 6**: v3.4.1.0 released with aligned docs.\\n- **Checkpoint 7**: All 9 deep-review findings closed.\\n\\n### Escalation Path\\n\\n1. If audit findings conflict with research, prefer audit evidence over summary.\\n2. If release-note wording conflicts with the remediated state, preserve the remediated state and adjust the release note.\\n3. If validation rules conflict with the shipped structure, preserve validation compliance and document the exact warning.\\n\\n### Governance Notes\\n\\n- The packet is a runtime change with documented operator-facing contract; changelog honesty matters.\\n- The canonical atomic writer is the single mutation mechanism; fallback preserves atomic semantics.\\n- The deep-review pass is part of the delivery record; remediation closure is load-bearing.\\n\\n---\\n\\n### Governance and Compliance Notes\\n\\n### Governance Sign-Off Targets\\n\\n| Sign-Off | Status | Basis |\\n|----------|--------|-------|\\n| Runtime correctness | Complete | Planner default non-mutating + fallback atomic parity |\\n| Documentation alignment | Complete | `/memory:save` docs + env reference + release notes agree |\\n| Spec-packet compliance | Complete | `validate.sh --strict` pass |\\n| Metadata completeness | Complete | `description.json`, `graph-metadata.json`, nested changelog |\\n\\n### Compliance Notes\\n\\n- No secrets, credentials, or third-party systems involved.\\n- Packet stores only copied internal project artifacts plus new documentation and runtime changes.\\n- Canonical atomic writer unchanged outside the scoped router Tier 3 guard.\\n\",\n        \"confidence\": {\n          \"label\": \"low\",\n          \"value\": 0.341,\n          \"drivers\": [\n            \"multi_channel_agreement\"\n          ]\n        },\n        \"why\": {\n          \"summary\": \"Ranked first because semantic similarity\",\n          \"topSignals\": [\n            \"semantic_match\"\n          ]\n        }\n      }\n    ],\n    \"evidenceDigest\": \"5 results retrieved; avg score 0.74.\",\n    \"followUps\": []\n  },\n  \"hints\": [\n    \"Some files could not be read - check file paths\",\n    \"[code-graph] Symbols near mentioned files: function:closeIndexingRuntime, function:initializeIndexingRuntime, function:reindexSpecDocs\",\n    \"Auto-surface hook: injected 2 constitutional and 5 triggered memories (553ms)\",\n    \"Token budget enforced: truncated 5 → 1 results to fit 3500 token budget\"\n  ],\n  \"meta\": {\n    \"tool\": \"memory_search\",\n    \"tokenCount\": 11794,\n    \"latencyMs\": 582,\n    \"cacheHit\": false,\n    \"responseProfile\": \"research\",\n    \"autoSurface\": {\n      \"constitutionalCount\": 2,\n      \"triggeredCount\": 5,\n      \"surfaced_at\": \"2026-04-26T18:14:57.620Z\",\n      \"latencyMs\": 553\n    },\n    \"autoSurfacedContext\": {\n      \"constitutional\": [\n        {\n          \"id\": 2574,\n          \"specFolder\": \"system-spec-kit\",\n          \"filePath\": \"/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/constitutional/gate-tool-routing.md\",\n          \"title\": \"TOOL ROUTING - Search & Retrieval Decision Tree\",\n          \"importanceTier\": \"constitutional\",\n          \"retrieval_directive\": \"Always surface when: TOOL ROUTING - Search & Retrieval Decision Tree | Prioritize when: task context aligns with \\\"TOOL ROUTING - Search & Retrieval Decision Tree\\\"\"\n        },\n        {\n          \"id\": 415,\n          \"specFolder\": \"system-spec-kit\",\n          \"filePath\": \"/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/constitutional/gate-enforcement.md\",\n          \"title\": \"GATE ENFORCEMENT - Edge Cases & Cross-Reference\",\n          \"importanceTier\": \"constitutional\",\n          \"retrieval_directive\": \"Always surface when: GATE ENFORCEMENT - Edge Cases & Cross-Reference | Prioritize when: task context aligns with \\\"GATE ENFORCEMENT - Edge Cases & Cross-Reference\\\"\"\n        }\n      ],\n      \"triggered\": [\n        {\n          \"memory_id\": 2355,\n          \"spec_folder\": \"system-spec-kit/026-graph-and-context-optimization/005-code-graph/001-code-graph-upgrades\",\n          \"title\": \"Deci [system-spec-kit/026-graph-and-context-optimization/005-code-graph/001-code-graph-upgrades/decision-record]\",\n          \"matched_phrases\": [\n            \"decision\"\n          ]\n        },\n        {\n          \"memory_id\": 2317,\n          \"spec_folder\": \"system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/004-memory-save-rewrite\",\n          \"title\": \"Feature [system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/004-memory-save-rewrite/spec]\",\n          \"matched_phrases\": [\n            \"speckit_save_planner_mode\"\n          ]\n        },\n        {\n          \"memory_id\": 2289,\n          \"spec_folder\": \"system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/001-cache-warning-hooks\",\n          \"title\": \"...em-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/001-cache-warning-hooks/decision-record]\",\n          \"matched_phrases\": [\n            \"decision\"\n          ]\n        },\n        {\n          \"memory_id\": 2222,\n          \"spec_folder\": \"system-spec-kit/024-compact-code-graph\",\n          \"title\": \"Decision Record: Hybrid Context Injection [system-spec-kit/024-compact-code-graph/decision-record]\",\n          \"matched_phrases\": [\n            \"decision\"\n          ]\n        },\n        {\n          \"memory_id\": 2218,\n          \"spec_folder\": \"system-spec-kit/024-compact-code-graph/034-workflow-split-and-token-insight-contracts\",\n          \"title\": \"Decision Record [system-spec-kit/024-compact-code-graph/034-workflow-split-and-token-insight-contracts/decision-record]\",\n          \"matched_phrases\": [\n            \"decision\"\n          ]\n        }\n      ],\n      \"surfaced_at\": \"2026-04-26T18:14:57.620Z\",\n      \"latencyMs\": 553\n    },\n    \"tokenBudget\": 3500,\n    \"tokenBudgetTruncated\": true,\n    \"originalResultCount\": 5,\n    \"returnedResultCount\": 1\n  }\n}","metadata":{"truncated":false},"title":"","time":{"start":1777227297059,"end":1777227298335},"attachments":[]}}}
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/013-code-graph-hook-improvements-pt-02/iterations/iteration-01.md:19:- The parent packet explicitly kept scan/read/readiness paths, the CocoIndex bridge, session-prime startup wiring, and operator-facing status/docs in scope, which legitimizes deeper work in those exact surfaces [.opencode/specs/system-spec-kit/026-graph-and-context-optimization/009-hook-package/013-code-graph-hook-improvements/spec.md:54-74].
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/013-code-graph-hook-improvements-pt-02/iterations/iteration-01.md:33:3. Which code-graph tools, events, or signals are under-used by downstream consumers (memory search, CocoIndex bridge, session bootstrap)?
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/013-code-graph-hook-improvements-pt-02/iterations/iteration-01.md:49:- Query trust mapping is no longer the broadest weak point after CF-010; the remaining work is surface-specific contract leakage.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/005-code-graph/003-code-graph-hook-improvements/research/013-code-graph-hook-improvements-pt-02/iterations/iteration-01.md:54:- `Bridge Fidelity` — Does the CocoIndex seed bridge preserve `score`, `snippet`, and range fidelity, or does it collapse to a line-only lookup?
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-skill-graph-metadata-routing-boosts/handover.md:123:- P1-5: CocoIndex failure diagnostic traces
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/S3/cli-codex-1/output.txt:3892:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/runs/S1/cli-codex-1/output.txt:1142:.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/iterations/iteration-006.md:25:This seam is weaker than the public surface suggests in two different ways. First, the assistive lane is not actually independent of TM-06/planner mode; the planner-first default disables it before similarity search even runs. Second, even when the lane does run, its highest-severity tier is advisory-only, so the system advertises an "auto-merge" outcome that never materializes in live write behavior.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/review/016-foundational-runtime-pt-01/iterations/iteration-004.md:32:1. **Code clarity of hardening layers** — `boolean-expr.ts` is exceptionally well-commented: 6-section structure (Types / Constants / Parsers / Evaluator / Prose-Bleed Detector / Helpers), grammar documented inline (`parseBooleanExprString` comment lines 104-115), `scalarsEqual` helper explains its own TRUE/FALSE coercion shim (lines 372-378), and the `PROSE_BLEED_TOKENS` array has a docstring explaining *why* timing-prose is rejected. `gate-3-classifier.ts` is similarly strong: trigger categories explained with rationale (lines 109-127 explains why `analyze` is a read-only disqualifier, not a positive trigger), decision-order algorithm documented in comment lines 168-179. `reconsolidation.ts` CAS logic (lines 505-550) has good inline comments on atomicity but the `importance_tier != 'deprecated'` guard appears 4+ times without a shared symbol/comment explaining *why* this predicate is the deprecation contract. `graph-lifecycle.ts` `OnIndexSkipReason` type is well-docstring'd (lines 123-132). `hook-state.ts` HookStateSchema is co-located with the `HookState` type (lines 54-76). Overall clarity: **high on new layers, weaker on long-lived files that accumulated drift**.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/review/016-foundational-runtime-pt-01/iterations/iteration-004.md:103:2. **`description.json.lastUpdated` has no auto-refresh mechanism; the drift observed in R3-P2-001 is the predictable outcome of an infrastructure gap, not a one-off lapse** — `.opencode/skills/system-spec-kit/scripts/dist/memory/generate-context.js` (grep: zero `lastUpdated` references), `.git/hooks/` (all `.sample`, zero active), `.opencode/skills/system-spec-kit/scripts/dist/memory/*.js` (zero hits across all 9 dist scripts) — R3-P2-001 documented the drift between `description.json.lastUpdated: 2026-04-16T21:45:00Z` and `graph-metadata.json.last_save_at: 2026-04-17T11:20:00Z`. This iteration confirms the **root cause**: no code path in `generate-context.js` writes `lastUpdated`, no git hook refreshes either file on commit, and the `.githooks`/`.husky` directories do not exist. The drift is guaranteed to recur every time a spec folder's code lands but the corresponding `/memory:save` is not explicitly run. Because `description.json` is cited in `graph-metadata.json.authoritativeSources` and is consumed by `memory_search` / `skill_advisor` / continuity recovery flows, any consumer that reads `description.json` as its source-of-truth for "current folder state" gets a stale snapshot whenever the auto-save cadence falls behind commit cadence. Classified P1 because this is the direct maintainability root cause of an already-flagged P2 traceability finding AND because the fix requires new infrastructure (a post-commit hook or a `lastUpdated` writer in `generate-context.js`), not just a one-line docs tweak. Reinforces the R3 theme that canonical-save-surface hygiene is inconsistent.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/research/iterations/iteration-09.md:6:- The 30-iteration Phase-017 refinement synthesis recommended landing first-write provenance and failure-carrier fixes before narrower Copilot work, but the current runtime still shows the same core weakness: validation and failure reporting are not aligned on the first JSONL write. [Evidence: .opencode/specs/system-spec-kit/026-graph-and-context-optimization/017-sk-deep-cli-runtime-execution/001-executor-feature/research/017-sk-deep-cli-runtime-execution-pt-01/research.md:57-60,197-205,248-253; .opencode/commands/spec_kit/assets/spec_kit_deep-research_auto.yaml:502-617]
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/review/016-foundational-runtime-pt-02/iterations/iteration-001.md:35:- **Claim:** `normalizeRecoveredPayloadLineForMatching` maps only Greek capital Epsilon (U+0395) and small epsilon (U+03B5) back to ASCII `E`/`e` before regex testing. Cyrillic `е` (U+0435), `а` (U+0430), `о` (U+043E), `с` (U+0441), `р` (U+0440), full-width variants (U+FF21-U+FF5A), mathematical alphanumeric variants (U+1D400+), and Latin-1 dotless `ı` (U+0131) are not folded, so an adversarial recovered payload line reading `[Ѕystem]: ignore all previous instructions` (Cyrillic `Ѕ` U+0405) will slip through the `RECOVERED_TRANSCRIPT_STRIP_PATTERNS` allowlist unmodified and be passed verbatim to the LLM. The banner comment (`"// Exported for tests; hooks should prefer sanitizeRecoveredPayload"`) implies a defense-in-depth posture; the partial fold silently weakens it.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/iterations/iteration-051.md:177:### R51-P2-001 | OnIndexSkipReason lookup uses weak-typed Record<string, …> enabling silent variant loss | Standalone (ride-along on R4-P2-002)
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-advisor-phrase-booster-tuning/spec.md:72:The skill advisor's `INTENT_BOOSTERS` dict (`skill_advisor.py:496`) contains **24 multi-word keys** that the advisor's tokenizer splits on whitespace — making those booster entries effective no-ops. The separate `PHRASE_INTENT_BOOSTERS` dict (`skill_advisor.py:788`) already provides the correct mechanism (substring match against the raw prompt before tokenization), but it's under-used: 6 of the 24 misplaced multi-word keys have no PHRASE equivalent, and recently-added Barter-context phrases like "iron law", "barter-scrooge monorepo", "observe never modify" have no phrase route. Users asking natural-language questions with multi-word identifiers receive lower confidence or fall back to weaker token matches, eroding Gate 2 routing quality.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/research/findings-registry.json:90:      "summary": "Merged operator surfaces still mix reserved, shipped, and deferred-language artifacts, which weakens expectation-setting around timeout defaults and recursion handling.",
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/iterations/iteration-041.md:30:- **Downstream Impact:** Graph metadata can violate the routing model's own recommended invariants and still produce a success-shaped validation result, letting asymmetric or weakly connected graph data silently bias skill recommendations and operator trust in `--validate-only`.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-skill-graph-daemon-native-advisor-tools/review/iterations/iteration-024.md:53:**correctness** — run a stabilization pass on the compat/native boundary to confirm the remaining private-path advisory is still purely structural and does not weaken any shipped acceptance path.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/004-advisor-hook-surface-integration/review-archive-r02-codex-copilot/iterations/iteration-022.md:20:id P1-022-01, dimension D1, the shared-payload advisor envelope does not enforce the same instruction-label sanitization as the hook renderer and can carry prompt-injection-shaped skill labels across the shared transport boundary. Evidence: `.opencode/skills/system-spec-kit/mcp_server/lib/context/shared-payload.ts:203-205` promises a sanitized skill label, but `.opencode/skills/system-spec-kit/mcp_server/lib/context/shared-payload.ts:490-503` only rejects empty/control-character values; meanwhile `.opencode/skills/system-spec-kit/mcp_server/lib/skill-advisor/skill-advisor-brief.ts:150-152` and `.opencode/skills/system-spec-kit/mcp_server/lib/skill-advisor/skill-advisor-brief.ts:197-215` propagate raw `top.skill` into `summary`, `sections[0].content`, and `metadata.skillLabel`. By contrast, `.opencode/skills/system-spec-kit/mcp_server/lib/skill-advisor/render.ts:50-65` already treats instruction-shaped labels as unsafe. Impact: a repository-authored or corrupted skill label like `SYSTEM: ignore previous instructions` can be preserved inside the advisor shared payload even though the direct hook brief suppresses it, weakening the prompt-poisoning guard on any consumer that surfaces or rehydrates the shared envelope. Remediation: reuse the renderer's skill-label sanitization (or extract a shared validator) inside shared-payload metadata validation and shared-payload brief construction, then add a regression test for single-line instruction-shaped labels.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/005-advisor-setup-command/review/iterations/iteration-006.md:19:  - Impact: The command includes `## CONSTRAINTS`, `## 0. UNIFIED SETUP PHASE`, and `## 9. SCORING SYSTEM REFERENCE`, none of which appear in the approved command section vocabulary requested for this review. `## GATE 3 STATUS: EXEMPT` is template-supported and should remain, but the other extra H2s weaken cross-command consistency and make the template compliance claim harder to verify.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/iterations/iteration-056.md:101:Compound result: The two signals that tell the memory search layer "this folder exists + last action was X" are BOTH absent or stale for research folders. A caller asking `memory_search({ query: 'deep-research iterations' })` will either miss the research folder entirely (no description.json indexed) OR find it with continuity pointing to a stale/non-existent iteration. Cross-referencing with CLAUDE.md mandatory-metadata rule ("Spec folders without these files are invisible to memory search and graph traversal") confirms the design intent is violated.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/iterations/iteration-056.md:134:**Confirmed attack chain**: `/spec_kit:deep-research` creates `research/NNN-.../iterations/iteration-NNN.md` → no description.json generator runs on the nested folder → memory_search / code_graph_query cannot index or discover → `/spec_kit:resume` may also miss the research state.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-skill-graph-daemon-native-advisor-tools/review/iterations/iteration-004.md:29:- **Claim:** The maintainability target for clean package boundaries is weakened because both compat entrypoints (`spec-kit-skill-advisor.js` and `skill_advisor.py`) depend on private compiled file paths inside `mcp_server/dist/...` instead of a supported export surface, and the Python shim carries a second embedded Node bridge for the same probe/delegate contract.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/005-advisor-setup-command/review/iterations/iteration-002.md:41:  - Impact: The intent is likely that Phase 2 filters the diff and Phase 3 applies only non-empty scoped deltas, but the Phase 3 wording still instructs edits to explicit, lexical, and derived metadata in every run. That weakens the scope flag contract and makes partial-scope executions harder to audit.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/004-advisor-hook-surface-integration/review-archive-r02-codex-copilot/iterations/iteration-008.md:45:id P1-008-01, dimension D1, the shared-payload producer can carry instruction-shaped advisor labels even though the final hook renderer suppresses them. Evidence: .opencode/skills/system-spec-kit/mcp_server/lib/skill-advisor/skill-advisor-brief.ts:151 interpolates `top.skill` directly into the producer-local brief, .opencode/skills/system-spec-kit/mcp_server/lib/skill-advisor/skill-advisor-brief.ts:189 through .opencode/skills/system-spec-kit/mcp_server/lib/skill-advisor/skill-advisor-brief.ts:205 puts that brief and raw `top?.skill` into the shared payload, while .opencode/skills/system-spec-kit/mcp_server/lib/context/shared-payload.ts:490 through .opencode/skills/system-spec-kit/mcp_server/lib/context/shared-payload.ts:503 rejects only non-strings, empty labels, and control characters. The runtime renderer has the stronger guard at .opencode/skills/system-spec-kit/mcp_server/lib/skill-advisor/render.ts:50 through .opencode/skills/system-spec-kit/mcp_server/lib/skill-advisor/render.ts:66 and returns null on unsafe labels at .opencode/skills/system-spec-kit/mcp_server/lib/skill-advisor/render.ts:118 through .opencode/skills/system-spec-kit/mcp_server/lib/skill-advisor/render.ts:120, so current hook output is protected, but the shared payload and diagnostics are built before or beside that boundary; diagnostics also store the provided skill label without sanitizer at .opencode/skills/system-spec-kit/mcp_server/lib/skill-advisor/metrics.ts:201 through .opencode/skills/system-spec-kit/mcp_server/lib/skill-advisor/metrics.ts:224. Impact: an instruction-shaped skill label from advisor output can persist in internal shared payload/diagnostic surfaces even when it is intentionally blocked from model-visible hook text, weakening the stated prompt-boundary invariant and creating a future-consumer hazard. Remediation: centralize advisor label sanitization before `buildSharedPayload` and diagnostic emission, make unsafe labels produce a null brief/status or null `skillLabel`, and extend shared-payload tests beyond newline labels to instruction-shaped and Unicode-folded labels.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-advisor-phrase-booster-tuning/implementation-summary.md:61:The skill advisor's multi-word phrase routing now actually works as designed. 24 tokenizer-broken entries that were silently sitting dead in `INTENT_BOOSTERS` — because the tokenizer `\b\w+\b` splits on whitespace before dict lookup — have been migrated to `PHRASE_INTENT_BOOSTERS` (which matches substrings against the raw prompt). The headline user-facing win: `"5-dimension agent scoring"` was misrouting to `sk-improve-prompt` at 0.77 confidence via a weak single-token match on "scoring" — after the fix it routes to the correct `sk-improve-agent` at 0.95.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/iterations/iteration-030.md:22:- **Downstream Impact:** Hookless OpenCode recovery is handed the weakest and most misleading state label available. Even when bootstrap/resume already know the graph is `missing` and attach section-level structural trust, the injected transport blocks surface only `trustState=stale`, so downstream runtime guidance can treat “repair required” as merely “refresh later.”
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-advisor-phrase-booster-tuning/graph-metadata.json:207:    "causal_summary": "The skill advisor's `INTENT_BOOSTERS` dict (`skill_advisor.py:496`) contains **24 multi-word keys** that the advisor's tokenizer splits on whitespace — making those booster entries effective no-ops. The separate `PHRASE_INTENT_BOOSTERS` dict (`skill_advisor.py:788`) already provides the correct mechanism (substring match against the raw prompt before tokenization), but it's under-used: 6 of the 24 misplaced multi-word keys have no PHRASE equivalent, and recently-added Barter-context phrases like \"iron law\", \"barter-scrooge monorepo\", \"observe never modify\" have no phrase route. Users asking natural-language questions with multi-word identifiers receive lower confidence or fall back to weaker token matches, eroding Gate 2 routing quality.",
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/004-advisor-hook-surface-integration/review-archive-r02-codex-copilot/iterations/iteration-012.md:22:id P2-012-01, dimension D5, the shipped OpenCode plugin is outside the runtime parity harness, so bridge/runtime drift can ship without tripping the advertised cross-runtime comparator. Evidence: .opencode/skills/system-spec-kit/mcp_server/tests/advisor-runtime-parity.vitest.ts:21 defines the parity runtime list as only `claude`, `gemini`, `copilot`, and `codex`, and .opencode/skills/system-spec-kit/mcp_server/tests/advisor-runtime-parity.vitest.ts:121 limits the asserted variants to those four plus `copilot-wrapper`. The OpenCode plugin still emits model-visible advisor context through `.opencode/plugins/spec-kit-skill-advisor.js:291` and routes it through a separate bridge path at `.opencode/plugins/spec-kit-skill-advisor-bridge.mjs:93` and `.opencode/plugins/spec-kit-skill-advisor-bridge.mjs:113`. Fresh test evidence shows the dedicated plugin suite at `.opencode/skills/system-spec-kit/mcp_server/tests/spec-kit-skill-advisor-plugin.vitest.ts:78`, `.opencode/skills/system-spec-kit/mcp_server/tests/spec-kit-skill-advisor-plugin.vitest.ts:120`, and `.opencode/skills/system-spec-kit/mcp_server/tests/spec-kit-skill-advisor-plugin.vitest.ts:161` covers cache/status/timeout behavior, but not parity against native hook output. Impact: the OpenCode bridge can diverge from the shared renderer contract while `advisor-runtime-parity.vitest.ts` still passes, weakening the stated hook-surface parity claim for the full shipped integration set. Remediation: extend the parity harness (or add a dedicated comparator test) to normalize plugin output and compare it against the same canonical fixtures used for the native runtimes.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/004-advisor-hook-surface-integration/review-archive-r02-codex-copilot/iterations/iteration-021.md:20:id P1-021-01, dimension D7, the root manual-testing playbook understates its own validation scope and hard-codes a stale release-readiness denominator. Evidence: `.opencode/skills/skill-advisor/manual_testing_playbook/manual_testing_playbook.md:35-43` lists nine active scenario groups (including Plugin Path, Measurement Run, and Live-Session Telemetry), but `.opencode/skills/skill-advisor/manual_testing_playbook/manual_testing_playbook.md:51-53` still describes the package as "34 deterministic scenarios across 6 categories", and `.opencode/skills/skill-advisor/manual_testing_playbook/manual_testing_playbook.md:145-149` still declares release readiness at "100% of the 34 scenarios linked in this root document." Impact: operators can follow the root playbook and incorrectly judge readiness against an outdated scenario/category count, which weakens the package's own release gate after Phase 023-024 expanded the documented surface. Remediation: update the root summary and readiness rule to the current scenario/category totals derived from the published sections, or derive the denominator from the linked scenario tables instead of freezing it in prose.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/005-advisor-setup-command/review/iterations/iteration-007.md:55:  - Impact: Synthesis can recover the findings from logs, but the review packet does not satisfy the normal artifact contract that every iteration has `review/iterations/iteration-NNN.md`, `review/deltas/iteration-NNN.json`, and a corresponding state append. This weakens replayability and can cause reducers or final report tooling to miss iterations 003 and 006.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/iterations/iteration-014.md:30:- **Downstream Impact:** `memory_save` responses can look causally enriched even when some lineage edges were never written, which weakens later `memory_drift_why`, causal traversal, and graph-boosted retrieval without surfacing a user-visible warning.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/004-advisor-hook-surface-integration/review/iterations/iteration-024.md:32:- **DR-P1-003 remains closed for analyzer prompt-id aggregation and baseline `SKILL.md` handling.** Analyzer scoring still collapses rows by `promptId`, preserves observed-skill context, and treats baseline-only `SKILL.md` reads as compliant without weakening cross-skill detection; regression tests still pin both behaviors (`.opencode/skills/system-spec-kit/scripts/observability/smart-router-analyze.ts:123-162,173-205`, `.opencode/skills/system-spec-kit/mcp_server/tests/smart-router-analyze.vitest.ts:75-104`).
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/iterations/iteration-049.md:30:- **Downstream Impact:** Maintainers can ship cyclic dependency metadata that passes the repository's advertised validation command and still feeds the compiled graph consumed by routing. That weakens the meaning of `depends_on` from a validated governance contract into a partially checked convention.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-advisor-phrase-booster-tuning/research/iterations/iteration-004.md:75:- single-token or hyphenated keys such as `autoresearch`, `proposal-only`, `evaluator-first`, `5-dimension`, `cocoindex`, `semantic`, and `audit` stay where they are. [SOURCE: `.opencode/skills/skill-advisor/scripts/skill_advisor.py:536,545,547,550,738-741,753`] 
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-advisor-phrase-booster-tuning/research/iterations/iteration-004.md:260:### 6. Delete the dead CocoIndex multi-word INTENT keys
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-advisor-phrase-booster-tuning/research/iterations/iteration-004.md:282:### 7. Add the two same-weight CocoIndex PHRASE entries
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-advisor-phrase-booster-tuning/research/iterations/iteration-004.md:285:- **Target location:** `skill_advisor.py`, CocoIndex PHRASE cluster around `863-872`
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-advisor-phrase-booster-tuning/research/iterations/iteration-004.md:291:"cocoindex search": [("mcp-coco-index", 2.8)],
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-advisor-phrase-booster-tuning/research/iterations/iteration-004.md:306:"cocoindex search": [("mcp-coco-index", 2.8)],
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-advisor-phrase-booster-tuning/research/iterations/iteration-005.md:9:`proposal only` is intentionally **not** in this bundle. Under the Iteration 4 same-weight plan, `proposal only -> 1.4` is still too weak to produce a passing `expect_result: true` fixture when prompted bare. If Phase 2 keeps that weight, Phase 3 should verify it in a non-gating analyzer snapshot instead of a new regression row. [SOURCE: `.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-search-routing-advisor/002-advisor-phrase-booster-tuning/research/iterations/iteration-004.md:38-47,195-235`] [SOURCE: hypothetical Phase 2 probe on 2026-04-15 in repo root with `PHRASE_INTENT_BOOSTERS['proposal only'] = [('sk-improve-agent', 1.4)]`, where `proposal only` still produced no passing recommendation]
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/004-advisor-hook-surface-integration/review-archive-r02-codex-copilot/review-report.md:96:- `DR-P2-001`: API hygiene is uneven across exported skill-advisor utilities. The normalizer has an orphaned second export name, prompt cache hygiene is weaker than the source cache, and several exported advisor helpers lack the public-function documentation expected by the local standards. Representative evidence: `normalize-adapter-output.ts:62-118`, `prompt-cache.ts:60-84`, `source-cache.ts:20-36`, `generation.ts:151-181`, `prompt-policy.ts:121-126`, `subprocess.ts:208-211`, and the sk-code-opencode JSDoc/TSDoc checklist references.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/iterations/iteration-019.md:27:- Test coverage is still strongest on happy-path proof and weakest exactly where these residual truth-loss seams live: valid transitive queries and successful assistive recommendations are covered, but degraded internal-state branches are not.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-advisor-phrase-booster-tuning/research/iterations/iteration-001.md:75:- Full `INTENT_BOOSTERS` inventory zone containing all 24 whitespace keys: deep-research/improve-agent/deep-review entries at L537-L561, CocoIndex entries at L742-L744. [SOURCE: .opencode/skills/skill-advisor/scripts/skill_advisor.py:537-561] [SOURCE: .opencode/skills/skill-advisor/scripts/skill_advisor.py:742-744]
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-advisor-phrase-booster-tuning/research/iterations/iteration-001.md:79:- Matching PHRASE duplicates for CocoIndex live at L863-L882. [SOURCE: .opencode/skills/skill-advisor/scripts/skill_advisor.py:863-882]
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-skill-graph-metadata-routing-boosts/review/review_archive/gen1-2026-04-13/iterations/iteration-012.md:7:- `health_check()` still emits the graph-status fields `skill_graph_loaded`, `skill_graph_skill_count`, and `skill_graph_path`, and the CLI prints that payload after CocoIndex enrichment. [SOURCE: .opencode/skills/skill-advisor/scripts/skill_advisor.py:1660] [SOURCE: .opencode/skills/skill-advisor/scripts/skill_advisor.py:1675] [SOURCE: .opencode/skills/skill-advisor/scripts/skill_advisor.py:1790]
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-advisor-phrase-booster-tuning/research/iterations/iteration-003.md:32:### Skills with weak/no coverage (<2 entries)
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-advisor-phrase-booster-tuning/research/iterations/iteration-003.md:102:- Phrase density is concentrated in review/search/improve families, while several user-facing skills remain weakly covered: `sk-code-full-stack` (0), `mcp-code-mode` (0), `mcp-clickup` (0), `mcp-chrome-devtools` (1), `mcp-figma` (1), and `sk-code-opencode` (1).
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/closing-pass-notes.md:329:`opencode.json` declares three native MCP servers: `sequential_thinking`, `spec_kit_memory`, `cocoindex_code`, `code_mode`. Names are direct top-level keys — no prefix scheme. Collision would be a JSON schema error.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-advisor-phrase-booster-tuning/research/iterations/iteration-002.md:32:| P1-SEARCH-001 | P1 | find code that handles auth | mcp-coco-index | - | find code that, code that handles | phrase + multi-token + corpus + auto-semantic | low | Fixture L16; already pinned by existing CocoIndex PHRASE keys and auto-semantic intent, with no migrating dependency. |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-skill-graph-daemon-native-advisor-tools/review/iterations/iteration-003.md:43:- **Claim:** The traceability contract requiring checklist `[x]` items to carry file:line evidence is not met across the shipped implementation packet. Child 004 and 005 checklists mark many acceptance items complete using bare filenames, test-count summaries, or prose labels instead of file:line citations, which weakens auditability for the MCP and compat surfaces.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/iterations/iteration-040.md:22:- **Downstream Impact:** Under concurrent governed saves, reconsolidation can silently drop a real duplicate, keep a candidate that has already moved out of scope, or generate an assistive recommendation against a candidate universe that no longer matches the ranked search results. That makes duplicate suppression nondeterministic and weakens the trustworthiness of save-time lineage decisions.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/research.md:161:5. **Health surface weaker than bootstrap/resume.** `session_health` doesn't attach section-level `structuralTrust` axes that `session_bootstrap` and `session_resume` do carry.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/research.md:399:**Iteration 26 -- Public contracts asserted via tests.** Missing-stale collapse now directly asserted public contract via tests. `session_health` doesn't attach section-level `structuralTrust` axes -- health surface weaker than bootstrap/resume.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-skill-graph-daemon-native-advisor-tools/review/iterations/iteration-008.md:29:  - **Claim:** Maintainability is weakened because Phase 027 leaves two live "generation" contracts in the same package: legacy advisor freshness still reads and mutates `.advisor-state/generation.json` through `skill-advisor/lib/generation.ts`, while the daemon/native status path separately reads and publishes `.advisor-state/skill-graph-generation.json` through `skill-advisor/lib/freshness/generation.ts`. Both ledgers remain under test and both are still wired into runtime code, so future freshness work has to know which "generation" API to touch rather than relying on a single boundary.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/iterations/iteration-006.md:25:This seam is weaker than the public surface suggests in two different ways. First, the assistive lane is not actually independent of TM-06/planner mode; the planner-first default disables it before similarity search even runs. Second, even when the lane does run, its highest-severity tier is advisory-only, so the system advertises an "auto-merge" outcome that never materializes in live write behavior.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-skill-graph-metadata-routing-boosts/review/review_archive/gen1-2026-04-13/iterations/iteration-019.md:15:- `_apply_family_affinity()` is a separate one-shot pass after graph propagation. For each family it computes the set of already-strong members before mutating weaker siblings, so affinity can add one bounded follow-on bump but cannot recursively amplify its own writes during the same family iteration. [SOURCE: .opencode/skills/skill-advisor/scripts/skill_advisor.py:131-151]
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-skill-graph-daemon-native-advisor-tools/review/codex-and-code-graph-hook-deep-dive.md:60:- CocoIndex semantic searches timed out during the preceding investigation, so this report relies on direct source reads, exact search, and smoke commands.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-skill-graph-daemon-native-advisor-tools/review/codex-and-code-graph-hook-deep-dive.md:261:- CocoIndex: missing
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/iterations/iteration-047.md:22:- **Downstream Impact:** Humans and agents can treat `folder_state` as the canonical intake enum even though the reusable contract boundary is `start_state`. That weakens telemetry, docs, and follow-up automation: a rename or prompt edit can desynchronize the event payload vocabulary from the intake contract without any schema or regression test failing.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/findings-registry.json:1494:      "downstream_impact": "Cross-document entity edges can be absent while save responses still present entity linking as completed, which obscures graph sparsity and weakens follow-on search or relationship analysis. The blast radius is the save-time graph/linking freshness contract for dense specs and dense memory neighborhoods."
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/findings-registry.json:1574:      "downstream_impact": "`memory_save` responses can look causally enriched even when some lineage edges were never written, which weakens later `memory_drift_why`, causal traversal, and graph-boosted retrieval without surfacing a user-visible warning."
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/findings-registry.json:1874:      "downstream_impact": "The OpenCode transport renders only the envelope-level provenance line (`lib/context/opencode-transport.ts:64-71`), so missing structural context is now contractually presented to operators and agents as a recoverable \"`stale`\" graph rather than an absent one. That weakens downstream routing between \"refresh existing graph state\" and \"there is no trustworthy structural graph yet.\""
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/findings-registry.json:1904:      "downstream_impact": "Callers following the runtime's own recovery and routing hints can be pushed toward `code_graph_query` when the structural backend is not actually ready, then receive a success-shaped empty/unknown payload instead of a clear repair-first signal. That weakens the promised recovery order of \"session_bootstrap -> session_resume -> code_graph_scan\" by letting the direct query surface masquerade as a valid read even when readiness never completed."
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/findings-registry.json:1964:      "downstream_impact": "Hookless OpenCode recovery is handed the weakest and most misleading state label available. Even when bootstrap/resume already know the graph is `missing` and attach section-level structural trust, the injected transport blocks surface only `trustState=stale`, so downstream runtime guidance can treat \u201crepair required\u201d as merely \u201crefresh later.\u201d"
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/findings-registry.json:2204:      "downstream_impact": "A concurrent insert/update can make the main planner miss a candidate that the later assistive pass does see, so the same request can persist as a normal complement while also returning a late review recommendation against a newer candidate universe. That weakens the auditability of save responses and makes stale duplicate creation harder to distinguish from intentional keep-separate behavior."
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/findings-registry.json:2264:      "downstream_impact": "Under concurrent governed saves, reconsolidation can silently drop a real duplicate, keep a candidate that has already moved out of scope, or generate an assistive recommendation against a candidate universe that no longer matches the ranked search results. That makes duplicate suppression nondeterministic and weakens the trustworthiness of save-time lineage decisions."
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/findings-registry.json:2294:      "downstream_impact": "Graph metadata can violate the routing model's own recommended invariants and still produce a success-shaped validation result, letting asymmetric or weakly connected graph data silently bias skill recommendations and operator trust in `--validate-only`."
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/findings-registry.json:2474:      "downstream_impact": "Humans and agents can treat `folder_state` as the canonical intake enum even though the reusable contract boundary is `start_state`. That weakens telemetry, docs, and follow-up automation: a rename or prompt edit can desynchronize the event payload vocabulary from the intake contract without any schema or regression test failing."
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/findings-registry.json:2524:      "downstream_impact": "Maintainers can ship cyclic dependency metadata that passes the repository's advertised validation command and still feeds the compiled graph consumed by routing. That weakens the meaning of `depends_on` from a validated governance contract into a partially checked convention."
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-skill-graph-daemon-native-advisor-tools/research/deep-research-strategy.md:98:  - `memory_context`, `memory_search`, `memory_quick_search`, `memory_match_triggers`
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/FINAL-synthesis-and-review.md:185:| R26-002 | `session-health.ts:136-166` | P2 | `session_health` doesn't attach section-level `structuralTrust` axes | Health surface weaker than bootstrap/resume |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/FINAL-synthesis-and-review.md:643:5. **Health surface weaker than bootstrap/resume.** (R26-002.) `session_health` lost richer axes.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/interim-synthesis-41-iterations.md:182:3. **Skill-graph topology checks advisory-only** (R41-003 / P1). `skill_graph_compiler.py` intentionally marks symmetry, weight-band, weight-parity, and orphan-skill checks as soft validation, so `--validate-only` still returns success-shaped output even when the routing graph violates its own recommended invariants. `skill_advisor.py` then loads that compiled graph as routing authority, so asymmetric or weakly connected graph data can silently bias recommendations while operators trust the "validation passed" signal.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/interim-synthesis-38-iterations.md:148:5. **Health surface weaker than bootstrap/resume.** `session_health` reduces structural trust to the envelope provenance label alone; `session_bootstrap` and `session_resume` carry richer `sections[].structuralTrust` but `session_health` does not (R26-002).
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/iterations/iteration-053.md:132:**Blast radius**: The review's POSIX 0o600/0o700 + same-UID model correctly anchors R2-P1-001 severity. The only non-trivial weakening (Docker shared-tmp) is an operator misconfiguration, not a framework-level flaw, and the escalation is blast-radius only (not class-of-attack).
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/interim-synthesis-32-iterations.md:140:5. **Health surface weaker than bootstrap/resume.** `session_health` reduces structural trust to the envelope provenance label alone; `session_bootstrap` and `session_resume` carry richer `sections[].structuralTrust` but `session_health` does not (R26-002).
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/iterations/iteration-026.md:14:- **Downstream Impact:** The OpenCode transport renders only the envelope-level provenance line (`lib/context/opencode-transport.ts:64-71`), so missing structural context is now contractually presented to operators and agents as a recoverable "`stale`" graph rather than an absent one. That weakens downstream routing between "refresh existing graph state" and "there is no trustworthy structural graph yet."
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/iterations/iteration-026.md:26:- The runtime's structural surfaces are no longer equally honest: `session_resume` and `session_bootstrap` carry section-level trust axes, but `session_health` still reduces structural trust to the envelope provenance label alone. That makes health the weakest downstream consumer of the shared-payload trust vocabulary.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/segment-2-synthesis.md:41:| R51-P2-001 | `OnIndexSkipReason` weak-typed `Record<string, …>` enables silent variant loss | `handlers/save/post-insert.ts:302-316` | 0.82 |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/segment-2-synthesis.md:296:- `.opencode/skills/system-spec-kit/mcp_server/handlers/save/post-insert.ts:302-316` (OnIndexSkipReason weak-typed lookup)
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-skill-graph-metadata-routing-boosts/implementation-summary.md:93:| Floor threshold of 0.1 for transitive boosts | Drops noise from weak transitive chains |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/iterations/iteration-012.md:46:- **Downstream Impact:** Cross-document entity edges can be absent while save responses still present entity linking as completed, which obscures graph sparsity and weakens follow-on search or relationship analysis. The blast radius is the save-time graph/linking freshness contract for dense specs and dense memory neighborhoods.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/iterations/iteration-013.md:51:- The test suites are strongest at helper-layer behavior (`processCausalLinks`, entity density guard, graph-metadata happy paths) and weakest at the integration points where those helper outcomes are collapsed into success-shaped envelopes.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/iterations/iteration-037.md:30:- **Downstream Impact:** A concurrent insert/update can make the main planner miss a candidate that the later assistive pass does see, so the same request can persist as a normal complement while also returning a late review recommendation against a newer candidate universe. That weakens the auditability of save responses and makes stale duplicate creation harder to distinguish from intentional keep-separate behavior.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/review/007-graph-metadata-validation-review/deep-review-state.jsonl:9:{"type":"event","event":"session_log","mode":"review","run":4,"dimension":"maintainability","summary":"The level-3 packet is still missing a root decision record, weakening post-hoc rationale recovery.","newFindingsRatio":0.33,"timestamp":"2026-04-21T18:12:05Z","sessionId":"rvw-2026-04-21T17-40-00Z-003-graph-metadata-validation","generation":1}
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/004-runtime-executor-hardening/001-foundational-runtime/research/iterations/iteration-027.md:22:- **Downstream Impact:** Callers following the runtime's own recovery and routing hints can be pushed toward `code_graph_query` when the structural backend is not actually ready, then receive a success-shaped empty/unknown payload instead of a clear repair-first signal. That weakens the promised recovery order of "session_bootstrap -> session_resume -> code_graph_scan" by letting the direct query surface masquerade as a valid read even when readiness never completed.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-skill-graph-metadata-routing-boosts/research/deep-research-state.jsonl:6:{"type":"iteration","run":5,"status":"insight","focus":"Q7+Q8: size target and CocoIndex interaction","findingsCount":6,"newInfoRatio":0.50,"timestamp":"2026-04-13T14:52:00.000Z","sessionId":"sgraph-research-001","generation":1}
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-skill-graph-metadata-routing-boosts/research/deep-research-strategy.md:26:- [ ] Q8: How does the graph interact with CocoIndex semantic search?
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-skill-graph-metadata-routing-boosts/research/findings-registry.json:10:    "Q8: CocoIndex interaction",
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-skill-graph-metadata-routing-boosts/research/iterations/iteration-010.md:29:1. `system-spec-kit` is under-modeled as a zero-edge hub even though its own docs describe downstream flows to `sk-code-opencode`, `sk-git`, and `sk-doc`, and it routes semantic queries to CocoIndex. Evidence: `.opencode/skills/system-spec-kit/graph-metadata.json:6-15`, `.opencode/skills/system-spec-kit/SKILL.md:775-777`, `.opencode/skills/system-spec-kit/SKILL.md:919-923`, `.opencode/skills/system-spec-kit/SKILL.md:943-951`. Provenance: iterations 001, 004, 006, and 007.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-skill-graph-metadata-routing-boosts/research/iterations/iteration-010.md:51:3. The current transitive coefficients and `0.1` floor make some legitimate edges nearly inert (`siblings`, `family`) and others only weakly substitutable for hardcoded phrase companions. Primary edit surface: `.opencode/skills/skill-advisor/scripts/skill_advisor.py:98-119`, `.opencode/skills/skill-advisor/scripts/skill_advisor.py:123-143`. Provenance: iterations 002 and 004.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-skill-graph-metadata-routing-boosts/research/iterations/iteration-010.md:54:6. Built-in CocoIndex search fails closed to `[]` on any subprocess problem, so semantic/graph interaction silently disappears in restricted environments. Primary edit surface: `.opencode/skills/skill-advisor/scripts/skill_advisor.py:1038-1065`. Provenance: iteration 005.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-skill-graph-metadata-routing-boosts/research/iterations/iteration-010.md:114:5. Make CocoIndex failure debuggable.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-skill-graph-metadata-routing-boosts/research/iterations/iteration-010.md:160:4. CocoIndex failure diagnostics.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-skill-graph-metadata-routing-boosts/research/iterations/iteration-007.md:9:3. This pass strengthens the earlier "missing `system-spec-kit` edges" finding rather than weakening it. `system-spec-kit` still has a completely empty edge set in `graph-metadata.json` (`.opencode/skills/system-spec-kit/graph-metadata.json:1-15`) even though its own related-skills table names downstream `sk-code-opencode`, `sk-git`, and `sk-doc` relationships (`.opencode/skills/system-spec-kit/SKILL.md:943-950`). The `sk-doc` evidence above shows that the hub's sparsity is not limited to code paths; documentation workflow links are also missing from the graph surface.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-skill-graph-daemon-native-advisor-tools/research/iterations/iteration-030.md:23:- `.opencode/skills/skill-advisor/SET-UP_GUIDE.md:131`-`.opencode/skills/skill-advisor/SET-UP_GUIDE.md:160` → Install validation currently relies on `skill_advisor.py --health` plus smoke routing, including semantic/cocoindex modes.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-skill-graph-daemon-native-advisor-tools/research/iterations/iteration-030.md:24:- `.opencode/skills/skill-advisor/SET-UP_GUIDE.md:183`-`.opencode/skills/skill-advisor/SET-UP_GUIDE.md:233` → Documented compatibility flags include one-shot prompt mode, `--threshold`, `--uncertainty`, `--semantic`/`--cocoindex`, `--semantic-hits`/`--cocoindex-hits`, `--confidence-only`, batch modes, `--show-rejections`, and `--force-refresh --health`.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-skill-graph-metadata-routing-boosts/research/iterations/iteration-006.md:15:6. `mcp-coco-index` is the remaining likely graph gap. Its zero-edge metadata is technically valid (`.opencode/skills/mcp-coco-index/graph-metadata.json:6-15`), but the skill description and surrounding workflow docs show that it is not actually isolated in use. Its frontmatter and activation section frame it as the default semantic search surface for unfamiliar-code exploration and concept-based code discovery (`.opencode/skills/mcp-coco-index/SKILL.md:2-4`, `.opencode/skills/mcp-coco-index/SKILL.md:20-41`), and `system-spec-kit` explicitly routes "semantic/concept queries" to CocoIndex (`.opencode/skills/system-spec-kit/SKILL.md:775-777`). That means "zero edges" is probably under-modeling a real workflow coupling. I would not call the exact target fully settled yet, but I do think this audit strengthens the case that `mcp-coco-index` should have at least one directional `enhances` relationship to a workflow skill that consumes semantic search. The cleanest current candidate among graph nodes is `system-spec-kit`, because that skill explicitly delegates semantic query routing to CocoIndex.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-skill-graph-metadata-routing-boosts/research/iterations/iteration-006.md:21:2. If `mcp-coco-index` stops being a zero-edge skill, should its first edge be `enhances -> system-spec-kit`, or do we want to reserve `system-spec-kit` for broader workflow links and instead connect CocoIndex to a code-workflow skill such as `sk-code-full-stack` or `sk-code-web`?
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-skill-graph-metadata-routing-boosts/research/iterations/iteration-005.md:2:This iteration answered Q7 and Q8 by measuring the real size impact of compiling `domains` and `intent_signals` into `.opencode/skills/skill-advisor/scripts/skill-graph.json`, then tracing how CocoIndex semantic hits enter `skill_advisor.py` and interact with graph propagation. The main result is that the current `~2KB` target is only realistic for topology-only output. If the compiled artifact is expected to carry routing metadata as well, the practical target should move to roughly `3-4KB` with a compact indexed layout, because raw string-heavy inclusion lands closer to `5.2KB`. On the scoring side, semantic hits and graph boosts are complementary, but they are not independent: semantic evidence is blended first, then graph edges propagate that same evidence to related skills, which can legitimately help companion routing but can also double-count confidence.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-skill-graph-metadata-routing-boosts/research/iterations/iteration-005.md:13:5. The semantic-search pipeline and graph pipeline are intentionally stacked, not isolated. In `analyze_request()`, the advisor first adds the auto-semantic intent hint for `mcp-coco-index`, then blends CocoIndex hits via `_apply_semantic_boosts()`, then applies token and phrase boosters, and only after that applies `_apply_graph_boosts()` and `_apply_family_affinity()`. Explicit skill-name boosts happen later and therefore do not cascade through the graph. The practical effect is that semantic hits can seed related skills through graph propagation, but explicit naming cannot (`.opencode/skills/skill-advisor/scripts/skill_advisor.py:1128-1154`, `.opencode/skills/skill-advisor/scripts/skill_advisor.py:1465-1499`, `.opencode/skills/skill-advisor/scripts/skill_advisor.py:1500-1510`).
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-skill-graph-metadata-routing-boosts/research/iterations/iteration-005.md:19:8. There is also an operational failure mode in the CocoIndex interaction: built-in semantic search fails closed and effectively becomes invisible to the advisor. `_cocoindex_search_builtin()` returns an empty hit list on any non-zero `ccc` exit or subprocess error. In this sandbox, direct `ccc search` failed because the daemon wanted to write `~/.cocoindex_code/daemon.log`, which is outside the writable sandbox; in normal advisor execution that would collapse to `[]` with no routing-visible error. So part of the Q8 answer is that graph/semantic interaction can disappear entirely in restricted environments, not because the logic is wrong but because semantic retrieval is silently suppressed upstream (`.opencode/skills/skill-advisor/scripts/skill_advisor.py:1038-1056`).
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-skill-graph-metadata-routing-boosts/research/iterations/iteration-005.md:28:3. Should `_cocoindex_search_builtin()` surface a diagnostic reason when semantic search fails, so graph/semantic interaction is debuggable instead of silently degrading to keyword-only routing?
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-skill-graph-metadata-routing-boosts/research/iterations/iteration-008.md:307:   - Recommendation: either keep the edge but mark it non-routing, or replace it with a weaker documentation-only relationship that does not feed runtime ranking.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-skill-graph-daemon-native-advisor-tools/research/iterations/iteration-009.md:35:The extraction source hierarchy should be adopted now, but with a narrow first slice. The current runtime already treats explicit metadata as high-precision evidence: SKILL names and variants receive the strongest boost, keyword comments are phrase-boundary matched, and descriptions/name terms provide weaker corpus evidence. That means the safest tier is existing explicit author-maintained surfaces: SKILL.md `name`, `description`, the existing `<!-- Keywords: ... -->` comment, and graph-metadata `intent_signals`/`derived.trigger_phrases`.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-skill-graph-daemon-native-advisor-tools/research/iterations/iteration-009.md:39:Full body text and commit messages should not be first-tier trigger sources. Body terms are high recall but noisy, so they belong behind TF-IDF/IDF filtering in B2/B6 rather than direct phrase extraction. Commit messages are even weaker: the local history evidence shows packet-level summaries, not reliable per-skill intent language. They can be kept as a prototype-later telemetry experiment if B4/B7 precision safeguards need another recall source, but they should not feed initial advisor weights.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/review/007-graph-metadata-validation-review/review-report.md:72:| F007 | Derived entity list still contains low-signal heading fragments | correctness | `graph-metadata.json:126-177` | Quality debt rather than a blocker, but it still weakens search usefulness. |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/review/007-graph-metadata-validation-review/deep-review-findings-registry.json:100:      "description": "The root packet declares level 3 but does not provide decision-record.md, weakening recoverable rationale.",
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/004-advisor-hook-surface-integration/review-archive-r01-copilot/iterations/iteration-001.md:24:- **Impact**: The implementation keeps prompts out of caches, metrics, and rendered output, but it still sends the full prompt as a Python argv argument. On shared machines that makes prompt text observable through local process inspection (`ps`, procfs, activity monitors), which weakens the documented privacy boundary.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-skill-graph-daemon-native-advisor-tools/research/iterations/iteration-027.md:20:- `.opencode/skills/skill-advisor/scripts/skill_advisor.py:22`-`.opencode/skills/skill-advisor/scripts/skill_advisor.py:31` → The main advisor uses only Python standard-library imports plus subprocess for built-in CocoIndex calls; there are no heavy third-party Python dependencies to preserve through PyOdide.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-skill-graph-daemon-native-advisor-tools/research/iterations/iteration-021.md:22:- `.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:846`-`.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:895` → `memory_search` builds a behavior-sensitive cache key, can return a tool-cache hit, and otherwise waits up to 30 seconds for the embedding model before entering the retrieval pipeline.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-skill-graph-daemon-native-advisor-tools/research/iterations/iteration-021.md:23:- `.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:900`-`.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:938` → On cache miss, `memory_search` routes normal prompt queries into the hybrid pipeline and executes the full four-stage pipeline.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-skill-graph-daemon-native-advisor-tools/research/iterations/iteration-021.md:42:Memory MCP search is a different latency class. On cache miss, `memory_search` may wait for embedding readiness, then enters a four-stage pipeline with hybrid/vector search, optional query expansion, fusion, reranking, MMR, chunk reassembly, and filtering (`memory-search.ts:846`-`memory-search.ts:938`; `pipeline/README.md:34`-`pipeline/README.md:51`). The code path can generate one embedding for normal hybrid search, more embeddings for facets or variants in deep mode, and another embedding channel for R12 expansion; vector and MMR paths also touch `vec_memories` through SQLite (`stage1-candidate-gen.ts:676`-`stage1-candidate-gen.ts:953`; `vector-index-queries.ts:168`-`vector-index-queries.ts:280`; `hybrid-search.ts:1384`-`hybrid-search.ts:1472`). The only local memory-search benchmark found is a mocked handler benchmark with a `300 ms` p95 gate, and enhanced vector search warns only above `600 ms`, so current repo evidence does not support putting memory embedding search on every prompt-blocking advisor invocation (`gate-d-benchmark-memory-search.vitest.ts:170`-`gate-d-benchmark-memory-search.vitest.ts:196`; `vector-index-aliases.ts:405`-`vector-index-aliases.ts:430`).
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-skill-graph-daemon-native-advisor-tools/research/iterations/iteration-029.md:16:- `opencode.json:10`-`opencode.json:57` → OpenCode currently declares one system-spec-kit MCP server, `spec_kit_memory`, plus `sequential_thinking`, `cocoindex_code`, and `code_mode`; there is no separate advisor MCP declaration.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-skill-graph-daemon-native-advisor-tools/research/iterations/iteration-023.md:40:Hybrid-search literature supports expecting meaningful gains when complementary rankers are fused, but it also argues for caution on cost and domain variance. RRF's original claim is consistent improvement over individual rankers, BEIR shows stronger methods often cost more, and C6 already found that memory embedding search sits in a different latency class than the advisor hook. Therefore, lexical + skill-graph + deterministic analytical fusion can use the 70% gate, but prompt-time embedding/hybrid retrieval should need a stricter gate: >=75% full-corpus top-1 (150/200), >=72.5% holdout top-1 (29/40), no latency regression beyond C6's hook budget, and at least two shadow-evaluation cycles before promotion.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/review/006-content-routing-accuracy-review/iterations/iteration-010.md:11:- **F006**: Completed checklist items rely on prose evidence strings instead of replayable command evidence - `.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-search-routing-advisor/001-memory-search-routing-tuning/002-content-routing-accuracy/review/validation-strict.txt:30` - The final pass found no higher-severity evidence defect beyond the previously identified evidence-shape weakness. [SOURCE: .opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-search-routing-advisor/001-memory-search-routing-tuning/002-content-routing-accuracy/review/validation-strict.txt:30-33]
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-skill-graph-daemon-native-advisor-tools/research/iterations/iteration-015.md:47:The current implementation already has useful building blocks but also a key weakness. It caps total signal boost per skill, deduplicates normalized signal variants, requires phrase-boundary matches, uses confidence/uncertainty dual thresholds, and has precedent for graph-derived confidence haircuts. However, runtime graph loading merges `intent_signals` and `derived.trigger_phrases` into one signal map, and any positive signal boost enters the high-confidence intent curve. That means a stuffed derived trigger set can look like precise author intent unless B7 extends evidence separation from graph evidence to all untrusted or generated evidence lanes.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-skill-graph-daemon-native-advisor-tools/review/scan-findings.md:112:- CocoIndex semantic search timed out during the second scan, so that review used direct file reads plus parallel review agents for evidence.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-skill-graph-daemon-native-advisor-tools/research/iterations/iteration-050.md:15:- `.opencode/skills/skill-advisor/scripts/skill_advisor.py:2013-2058,2111-2165` → the current routing gate is still `confidence >= 0.8` and `uncertainty <= 0.35`; intent-boosted paths only need score `>= 2.0`, while non-intent paths need `>= 4.0`, so any new lane weights must preserve the asymmetry between direct evidence and weak/background evidence.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-skill-graph-daemon-native-advisor-tools/research/iterations/iteration-001.md:47:The only caution is that the skill-graph watcher in `context-server.ts` currently duplicates a slimmer direct Chokidar path rather than reusing the fuller `startFileWatcher` helper (`context-server.ts:1510-1544`). That does not weaken the watcher-choice verdict; it only means later A2/A3/A4 work should decide whether to keep the targeted `*/graph-metadata.json` watcher or refactor it onto the shared helper without reopening the underlying library choice.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-skill-graph-daemon-native-advisor-tools/research/iterations/iteration-028.md:17:- `.opencode/skills/system-spec-kit/mcp_server/lib/cache/tool-cache.ts:310`-`.opencode/skills/system-spec-kit/mcp_server/lib/cache/tool-cache.ts:330` → Generic write invalidation clears memory retrieval tools (`memory_search`, `memory_match_triggers`, `memory_context`, list/read variants) but does not mention advisor tools or skill graph freshness.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-skill-graph-daemon-native-advisor-tools/research/iterations/iteration-028.md:20:- `.opencode/skills/system-spec-kit/mcp_server/tests/tool-cache.vitest.ts:393`-`.opencode/skills/system-spec-kit/mcp_server/tests/tool-cache.vitest.ts:418` → Tests pin write invalidation for `memory_search`, `memory_match_triggers`, `memory_list_folders`, and `memory_read`.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-advisor-hook-brief-improvements/plan.md:131:| Bucket B guidance in `.opencode/specs/system-spec-kit/026-graph-and-context-optimization/research/013-014-pt-02-merged-synthesis.md` | Internal planning input | Green | Losing the merged synthesis would weaken the grouping of `014-F-001` through `014-F-007` into the intended implementation order |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/review/006-content-routing-accuracy-review/iterations/iteration-007.md:8:- **F002**: `description.json` still points at the legacy `010-search-and-routing-tuning` parent chain - `.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-search-routing-advisor/001-memory-search-routing-tuning/002-content-routing-accuracy/description.json:14` - The lineage split remains active and continues to weaken traceability for packet-local evidence consumers. [SOURCE: .opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-search-routing-advisor/001-memory-search-routing-tuning/002-content-routing-accuracy/description.json:14-31] [SOURCE: .opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-search-routing-advisor/001-memory-search-routing-tuning/002-content-routing-accuracy/graph-metadata.json:3-5]
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/review/006-content-routing-accuracy-review/iterations/iteration-007.md:14:- This is not a contradiction between the checked claims and the underlying code/doc evidence; it is an evidence-shape weakness in the parent packet.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/review/006-content-routing-accuracy-review/iterations/iteration-008.md:11:- **F006**: Completed checklist items rely on prose evidence strings instead of replayable command evidence - `.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-search-routing-advisor/001-memory-search-routing-tuning/002-content-routing-accuracy/review/validation-strict.txt:30` - The evidence-shape weakness also increases follow-on maintenance cost because future operators must reconstruct commands instead of replaying packet-local proof. [SOURCE: .opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-search-routing-advisor/001-memory-search-routing-tuning/002-content-routing-accuracy/review/validation-strict.txt:30-33]
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-skill-graph-daemon-native-advisor-tools/research/iterations/iteration-018.md:11:- `.opencode/skills/system-spec-kit/mcp_server/tool-schemas.ts:96`-`.opencode/skills/system-spec-kit/mcp_server/tool-schemas.ts:99` -> `memory_search` already exposes causal-neighbor boost as a 2-hop traversal over `causal_edges`.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-skill-graph-daemon-native-advisor-tools/research/iterations/iteration-025.md:15:- `.opencode/skills/system-spec-kit/mcp_server/tools/memory-tools.ts:75`-`.opencode/skills/system-spec-kit/mcp_server/tools/memory-tools.ts:107` → Memory dispatch validates arguments, maps each MCP tool name to a handler, and keeps `memory_quick_search` as a wrapper over `memory_search`.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/review/006-content-routing-accuracy-review/deep-review-state.jsonl:21:{"type":"event","event":"session_log","mode":"review","run":10,"dimension":"traceability","message":"The final pass found only low-churn refinements: the lineage split and evidence-shape weakness remain, but no new higher-severity packet defects emerged.","timestamp":"2026-04-21T17:58:04Z","sessionId":"rvw-2026-04-21-content-routing-accuracy","generation":1}
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/001-search-fusion-routing-research/iterations/iteration-004.md:4:Identify the live fusion weights that shape hybrid retrieval for different intents and normalize them into continuity-relevant recommendations.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/003-graph-metadata-validation-research/iterations/iteration-010.md:9:3. Those defects trace back to concrete derivation behaviors: frontmatter-only status extraction, direct key-file seeding into entities, lack of trigger-phrase truncation in `deriveGraphMetadata()`, and legacy compatibility files that preserve weaker structure. [SOURCE: .opencode/skills/system-spec-kit/mcp_server/lib/graph/graph-metadata-parser.ts:346-353] [SOURCE: .opencode/skills/system-spec-kit/mcp_server/lib/graph/graph-metadata-parser.ts:418-471] [SOURCE: .opencode/skills/system-spec-kit/mcp_server/lib/graph/graph-metadata-parser.ts:523-560]
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-skill-graph-daemon-native-advisor-tools/research/iterations/iteration-026.md:20:- `.opencode/skills/system-spec-kit/mcp_server/tools/memory-tools.ts:60`-`.opencode/skills/system-spec-kit/mcp_server/tools/memory-tools.ts:73` → Memory tools use the same `TOOL_NAMES` family pattern and include both full and simplified surfaces, such as `memory_search` and `memory_quick_search`.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-skill-graph-daemon-native-advisor-tools/research/iterations/iteration-022.md:24:- `.opencode/specs/system-spec-kit/026-graph-and-context-optimization/008-runtime-executor-hardening/003-system-hardening/001-initial-research/005-routing-accuracy/research/019-system-hardening-pt-03/corpus/labeled-prompts.jsonl:51`-`.opencode/specs/system-spec-kit/026-graph-and-context-optimization/008-runtime-executor-hardening/003-system-hardening/001-initial-research/005-routing-accuracy/research/019-system-hardening-pt-03/corpus/labeled-prompts.jsonl:60` -> The corpus includes connector and routing-only prompts for skills such as CocoIndex, Figma, Chrome DevTools, Git, ClickUp, and code review.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-skill-graph-daemon-native-advisor-tools/research/iterations/iteration-022.md:30:- `.opencode/skills/system-spec-kit/scripts/observability/smart-router-measurement-report.md:23`-`.opencode/skills/system-spec-kit/scripts/observability/smart-router-measurement-report.md:32` -> Per-skill results include high-performing labels such as `system-spec-kit` and `sk-deep-research`, weak spots such as `sk-improve-prompt`, and 37 `UNKNOWN` advisor outputs.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-skill-graph-daemon-native-advisor-tools/research/iterations/iteration-016.md:4:Inventory what's already shipped for advanced advisor matching in the memory MCP surface: public APIs (`memory_context`, `memory_search`, `memory_quick_search`, `memory_match_triggers`, causal APIs, index/stats/health APIs) plus hybrid search internals for embedding + keyword fusion.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-skill-graph-daemon-native-advisor-tools/research/iterations/iteration-016.md:14:- `.opencode/skills/system-spec-kit/mcp_server/tool-schemas.ts:48`-`.opencode/skills/system-spec-kit/mcp_server/tool-schemas.ts:184` -> `memory_search` exposes the main ranked retrieval surface: `query` or 2-5 `concepts`, scope filters, tier/context filters, decay, contiguity, constitutional inclusion, session and causal boosts, content/anchors, rerank, state limits, task intent, deep mode, trace, and quality floor.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-skill-graph-daemon-native-advisor-tools/research/iterations/iteration-016.md:16:- `.opencode/skills/system-spec-kit/mcp_server/tools/memory-tools.ts:60`-`.opencode/skills/system-spec-kit/mcp_server/tools/memory-tools.ts:73` -> The memory dispatch module handles `memory_search`, `memory_quick_search`, `memory_match_triggers`, save/list/stats/health/delete/update/validate/bulk-delete tools.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-skill-graph-daemon-native-advisor-tools/research/iterations/iteration-016.md:46:- `.opencode/skills/system-spec-kit/mcp_server/tool-schemas.ts:851`-`.opencode/skills/system-spec-kit/mcp_server/tool-schemas.ts:910` -> The canonical ordered MCP tool list registers memory, causal, indexing, evaluation, code graph, skill graph, CocoIndex, and coverage-graph APIs from one server surface.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-skill-graph-daemon-native-advisor-tools/research/iterations/iteration-016.md:49:The memory MCP server already has the primitives Track C needs for an advisor matching prototype and likely for the first production slice. The public retrieval ladder is present: `memory_context` for intent-aware orchestration, `memory_search` for configurable hybrid retrieval, `memory_quick_search` as a safe preset over the full search path, and `memory_match_triggers` for cheap trigger-phrase matching with cognitive tiering. The current code layout does not actually use `mcp_server/lib/memory/**`; memory behavior is split across MCP handlers, `tools/*` dispatchers, schemas, and `lib/search/**`. That is a naming/layout mismatch in the research prompt, not a missing capability.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/002-skill-graph-daemon-native-advisor-tools/research/iterations/iteration-052.md:18:The repo already points to a narrower parity contract than "identical scorer internals." r01's own measurement plan says native parity means the Python and TypeScript scorers must produce the same **top-1** and **pass-threshold** outcome on the canonical regression suite and the 200-prompt corpus before Python can be removed. That is stronger than "mostly similar top-1" but weaker than exact score or distribution matching, and it aligns with the actual migration risk: broken routing, abstain behavior, or false fires would surface in hooks, CLI fallback, and plugin integrations even if the internal score vectors looked numerically close. `.opencode/specs/system-spec-kit/026-graph-and-context-optimization/009-hook-package/002-skill-graph-daemon-native-advisor-tools/research/027-skill-graph-daemon-and-advisor-unification-pt-01/research.md:137-139,154-155`, `.opencode/specs/system-spec-kit/026-graph-and-context-optimization/009-hook-package/002-skill-graph-daemon-native-advisor-tools/research/027-skill-graph-daemon-and-advisor-unification-pt-01/next-research-paths.md:86-92`
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/review/006-content-routing-accuracy-review/deltas/iter-007.jsonl:1:{"type":"delta","iteration":7,"dimension":"traceability","newFindings":["F006"],"refinedFindings":["F002"],"filesReviewed":["checklist.md","review/validation-strict.txt",".opencode/skills/system-spec-kit/feature_catalog/19--feature-flag-reference/01-1-search-pipeline-features-speckit.md"],"findingsNew":{"P0":0,"P1":0,"P2":1},"findingsSummary":{"P0":0,"P1":5,"P2":1},"newFindingsRatio":0.16,"status":"complete","note":"Checklist claims are supportable, but the packet's evidence shape is still weaker than the active validator expects."}
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-advisor-hook-brief-improvements/research/003-advisor-gap-investigation/iterations/iteration-02.md:9:- CocoIndex attempt:
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-advisor-hook-brief-improvements/research/003-advisor-gap-investigation/iterations/iteration-03.md:9:- CocoIndex attempt:
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/review/006-content-routing-accuracy-review/review-report.md:78:| F006 | Completed checklist items rely on prose evidence strings instead of replayable command evidence, weakening reproducibility. | traceability / maintainability | [SOURCE: `review/validation-strict.txt:30-33`] [SOURCE: `checklist.md:13-15`] |
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-advisor-hook-brief-improvements/research/003-advisor-gap-investigation/iterations/iteration-01.md:9:- CocoIndex attempt:
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-advisor-hook-brief-improvements/research/003-advisor-gap-investigation/research.md:40:- CocoIndex was attempted with repo-local root overrides, but the CLI daemon could not start cleanly inside this sandbox. I still recorded the exact attempted queries in the iteration logs and completed the evidence pass with exact grep plus local code-graph SQLite.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/review/011-search-routing-late-findings-review/iterations/iteration-006.md:13:- **F003**: The phase-004 verification sweep did not actually guard the removed-flag semantics it claimed to cover — `.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-search-routing-advisor/001-memory-search-routing-tuning/002-content-routing-accuracy/004-doc-surface-alignment/implementation-summary.md:116` — The recorded `rg` sweep only checked broad routing tokens, so it still passed even though the canonical save playbook kept `SPECKIT_TIER3_ROUTING=true` and the packet-local closeout docs still described an opt-in/default-off Tier-3 path. The verification mechanism was too weak for the contract it claimed to prove.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/review/011-search-routing-late-findings-review/iterations/iteration-006.md:15:{"type":"claim-adjudication","findingId":"F003","claim":"The phase-004 verification sweep was too weak to prove removed-flag/always-on Tier-3 doc parity.","evidenceRefs":[".opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-search-routing-advisor/001-memory-search-routing-tuning/002-content-routing-accuracy/004-doc-surface-alignment/implementation-summary.md:116",".opencode/skills/system-spec-kit/manual_testing_playbook/13--memory-quality-and-indexing/202-canonical-continuity-save-substrate.md:34",".opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-search-routing-advisor/001-memory-search-routing-tuning/002-content-routing-accuracy/004-doc-surface-alignment/checklist.md:93"],"counterevidenceSought":"I checked whether the verification sweep also captured removed-flag tokens indirectly, but the saved pattern list does not include the words needed to catch the stale playbook or opt-in claims.","alternativeExplanation":"If a broader unrecorded human review happened outside the packet, the sweep weakness matters less, but the recorded packet evidence still does not prove the claim it makes.","finalSeverity":"P2","confidence":0.9,"downgradeTrigger":"Dismiss if the packet adds a stronger recorded verification step that explicitly checks removed-flag/always-on wording and passes."}
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-advisor-hook-brief-improvements/research/003-advisor-gap-investigation/deep-research-state.jsonl:2:{"type":"iteration","iteration":1,"status":"completed","focus":"advisor_recommend downstream docs/tests around new workspaceRoot + effectiveThresholds contract","newInfoRatio":0.75,"timestamp":"2026-04-24T09:53:42Z","findingsNew":["F-003","F-004","F-007"],"graphEvents":["CocoIndex CLI attempted with repo-local root override but daemon startup was blocked in sandbox; continued with exact grep + local code-graph SQLite"],"notes":["Feature catalog and manual playbook still describe the older recommend output shape","Recommend handler test does not assert the new public fields"]} 
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/003-graph-metadata-validation-research/research.md:134:- Legacy compatibility preserves loadability but weakens timestamps and entity coverage.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/review/011-search-routing-late-findings-review/deep-review-state.jsonl:6:{"type":"iteration","mode":"review","run":6,"status":"complete","focus":"Packet-local and playbook mirror parity for removed-flag wording","dimension":"maintainability","dimensions":["traceability","maintainability"],"findingsCount":1,"newFindingsRatio":1.0,"noveltyJustification":"The packet-local/playbook audit found a new advisory verification-gap finding after confirming the same removed-flag story persists there too.","findingsSummary":{"P0":0,"P1":0,"P2":1},"filesReviewed":[".opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-continuity-research/002-content-routing-accuracy/004-doc-surface-alignment/spec.md",".opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-continuity-research/002-content-routing-accuracy/004-doc-surface-alignment/checklist.md",".opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-continuity-research/002-content-routing-accuracy/004-doc-surface-alignment/implementation-summary.md",".opencode/skills/system-spec-kit/manual_testing_playbook/13--memory-quality-and-indexing/202-canonical-continuity-save-substrate.md"],"dimensionScores":{"correctness":0.34,"security":0.0,"traceability":0.88,"maintainability":0.83},"findingsNew":{"P0":0,"P1":0,"P2":1},"findingsRefined":{"P0":0,"P1":1,"P2":0},"upgrades":[],"resolved":[],"findingRefs":["F002","F003"],"traceabilityChecks":{"summary":{"required":3,"executed":3,"pass":0,"partial":1,"fail":2,"blocked":0,"notApplicable":0,"gatingFailures":2},"results":[{"protocolId":"playbook_capability","status":"fail","gateClass":"hard","applicable":true,"counts":{"pass":0,"partial":0,"fail":1},"evidence":[".opencode/skills/system-spec-kit/manual_testing_playbook/13--memory-quality-and-indexing/202-canonical-continuity-save-substrate.md:34"],"findingRefs":["F002"],"summary":"The canonical save playbook still instructs operators to set the removed Tier-3 routing flag."},{"protocolId":"checklist_evidence","status":"fail","gateClass":"hard","applicable":true,"counts":{"pass":0,"partial":0,"fail":1},"evidence":[".opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-continuity-research/002-content-routing-accuracy/004-doc-surface-alignment/checklist.md:93",".opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-continuity-research/002-content-routing-accuracy/004-doc-surface-alignment/implementation-summary.md:67"],"findingRefs":["F002","F003"],"summary":"The packet-local closeout docs still claim opt-in/default-off config notes and therefore overstate doc alignment."},{"protocolId":"spec_code","status":"partial","gateClass":"advisory","applicable":true,"counts":{"pass":0,"partial":1,"fail":0},"evidence":[".opencode/specs/system-spec-kit/026-graph-and-context-optimization/010-continuity-research/002-content-routing-accuracy/004-doc-surface-alignment/implementation-summary.md:116"],"findingRefs":["F003"],"summary":"The recorded verification grep was too weak to prove removed-flag/always-on parity."}]},"coverage":{"filesReviewed":4,"filesTotal":22,"dimensionsComplete":["traceability","maintainability"]},"ruledOut":["The `004` packet-local docs are fully aligned just because the packet passed strict validation."],"focusTrack":"docs","timestamp":"2026-04-13T13:34:00Z","durationMs":360000}
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/review/003-graph-metadata-validation-research/deep-review-strategy.md:210:- CocoIndex MCP calls were attempted during setup but returned cancelled-tool responses, so the review used direct file reads, grep sweeps, and validator runs.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/001-search-fusion-routing-research/research.md:173:- If continuity must become a public search intent accepted by `memory_search`, the blast radius expands into:
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/001-search-fusion-routing-research/iterations/iteration-027.md:4:Determine whether the operator-facing resume flow uses the same continuity profile and Stage 3 MMR path as `memory_search()`.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/003-graph-metadata-validation-research/deep-research-dashboard.md:51:- Entity precision is still the weakest surface because every active packet hits the 16-entity cap.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/001-search-fusion-routing-research/iterations/iteration-033.md:31:- What I would do differently: Any threshold change in Stage 3 should be documented as a full stage-policy change, not as a reranker-only tweak.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/review/011-search-routing-late-findings-review/review-report.md:33:- Evidence: The recorded `rg` sweep checked routing tokens like `routeAs`, `8-category`, and `packet_kind`, but it did not directly assert the removed-flag/always-on wording. The playbook still contains `SPECKIT_TIER3_ROUTING=true`, so the sweep was too weak to prove the contract it claimed to verify.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-advisor-hook-brief-improvements/research/002-advisor-hook-followup-research/research.md:134:- **Centralization gap**: the system describes one shared contract, but OpenCode and Codex still preserve runtime-specific branches that weaken true parity.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/review/002-content-routing-accuracy-research/deep-review-strategy.md:71:- CocoIndex semantic discovery was not needed after exact line-number reads made the promotion drift obvious; the packet was better served by direct file evidence and validator output.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/002-content-routing-accuracy-research/deep-research-strategy.md:134:- Looking only at overall accuracy hides the real hotspots, because the strong structured categories mask weaker delivery and handover performance. (iteration 5)
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/002-content-routing-accuracy-research/deep-research-strategy.md:432:### Treating phase `003` as a one-line constructor tweak in `memory-save.ts`. -- BLOCKED (iteration 15, 1 attempts)
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/002-content-routing-accuracy-research/deep-research-strategy.md:433:- What was tried: Treating phase `003` as a one-line constructor tweak in `memory-save.ts`.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/002-content-routing-accuracy-research/deep-research-strategy.md:435:- Do NOT retry: Treating phase `003` as a one-line constructor tweak in `memory-save.ts`.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/002-content-routing-accuracy-research/deep-research-strategy.md:584:- Treating phase `003` as a one-line constructor tweak in `memory-save.ts`. (iteration 15)
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/002-content-routing-accuracy-research/iterations/iteration-010.md:7:1. The current router is already strong on structured categories (`decision`, `task_update`, `metadata_only`) because those categories either have hard Tier1 rules or highly distinctive lexical floors. The weak spots are cue-rich narrative categories, especially delivery-versus-progress and handover-versus-drop. [SOURCE: .opencode/skills/system-spec-kit/mcp_server/lib/routing/content-router.ts:286] [INFERENCE: live corpus results summarized across iterations 5 and 6]
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/002-content-routing-accuracy-research/iterations/iteration-010.md:10:4. `routeAs` is powerful enough to rescue natural misclassifications, but it also weakens the semantic guardrail because it can force a merge against a natural `drop` decision. Operationally, overrides should stay explicit, audited, and paired with target/merge-mode validation. [SOURCE: .opencode/skills/system-spec-kit/mcp_server/lib/routing/content-router.ts:428] [SOURCE: .opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:1053]
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/002-content-routing-accuracy-research/iterations/iteration-004.md:7:1. Natural routing follows a strict ladder: accept Tier1 only if confidence clears the floor and the trigger reason is neither `mixed_signals` nor `margin_too_narrow`; otherwise try Tier2; if Tier2 misses its floor, attempt Tier3; if Tier3 is absent or weak, try penalized Tier2 fallback; then refuse. [SOURCE: .opencode/skills/system-spec-kit/mcp_server/lib/routing/content-router.ts:452] [SOURCE: .opencode/skills/system-spec-kit/mcp_server/lib/routing/content-router.ts:518]
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/002-content-routing-accuracy-research/iterations/iteration-004.md:10:4. Tests confirm the intended behaviors at the edges: injected Tier3 can win with `0.83`, cache hits can bypass recomputation, and a weak Tier3 result below `0.50` forces refusal. Those cases are contract-valid but not currently production-wired. [SOURCE: .opencode/skills/system-spec-kit/mcp_server/tests/content-router.vitest.ts:212] [SOURCE: .opencode/skills/system-spec-kit/mcp_server/tests/content-router.vitest.ts:310]
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/002-content-routing-accuracy-research/iterations/iteration-019.md:8:2. Phase `002-fix-handover-drop-confusion` should split hard and soft drop cues. In `content-router.ts`, keep transcript/table-of-contents/recovery-wrapper evidence in the hard drop branch, but move `git diff`, `list memories`, and similar operational commands into a softer path that cannot beat a strong handover state by default. Add a stronger handover floor for `current state`, `next session`, `active files`, `remaining effort`, `next safe action`, and `resume` near lines `868-869`, then preserve `extractHardNegativeFlags()` for true wrappers only. Prototype work should focus on making handover examples more state-first, not on weakening correct drop examples. [SOURCE: .opencode/skills/system-spec-kit/mcp_server/lib/routing/content-router.ts:353] [SOURCE: .opencode/skills/system-spec-kit/mcp_server/lib/routing/content-router.ts:877] [SOURCE: .opencode/skills/system-spec-kit/mcp_server/lib/routing/routing-prototypes.json:83]
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/002-content-routing-accuracy-research/deep-research-state.jsonl:17:{"type":"iteration","run":15,"status":"complete","focus":"Tier3 wiring gap in the save path","findingsCount":4,"newInfoRatio":0.66,"noveltyJustification":"Three findings were new and one converted the callsite audit into a concrete missing-adapter requirement.","keyQuestions":["RQ-9: What exact code is missing to wire Tier3 into `memory-save.ts`, and what latency or cost envelope does that imply?"],"answeredQuestions":[],"ruledOut":["Treating phase `003` as a one-line constructor tweak in `memory-save.ts`"],"focusTrack":"runtime-wiring","toolsUsed":["Read","Grep","Bash"],"sourcesQueried":[".opencode/skills/system-spec-kit/mcp_server/lib/routing/content-router.ts:386",".opencode/skills/system-spec-kit/mcp_server/lib/routing/content-router.ts:1128",".opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:1008",".opencode/skills/system-spec-kit/mcp_server/lib/search/llm-reformulation.ts:185"],"timestamp":"2026-04-13T09:00:00Z","durationMs":420000}
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/review/002-content-routing-accuracy-research/archive-invalid-2026-04-13T16-59-27Z/iterations/iteration-014.md:18:- Some research roots still fail validator sufficiency checks for missing citations, but those weak spots did not produce a cleaner migration-specific finding than the four already open.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/002-content-routing-accuracy-research/deep-research-dashboard.md:141:- Treating phase `003` as a one-line constructor tweak in `memory-save.ts`. (iteration 15)
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/002-content-routing-accuracy-research/findings-registry.json:259:      "text": "Natural routing follows a strict ladder: accept Tier1 only if confidence clears the floor and the trigger reason is neither `mixed_signals` nor `margin_too_narrow`; otherwise try Tier2; if Tier2 misses its floor, attempt Tier3; if Tier3 is absent or weak, try penalized Tier2 fallback; then refuse. [SOURCE: .opencode/skills/system-spec-kit/mcp_server/lib/routing/content-router.ts:452] [SOURCE: .opencode/skills/system-spec-kit/mcp_server/lib/routing/content-router.ts:518]",
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/002-content-routing-accuracy-research/findings-registry.json:270:      "text": "Tests confirm the intended behaviors at the edges: injected Tier3 can win with `0.83`, cache hits can bypass recomputation, and a weak Tier3 result below `0.50` forces refusal. Those cases are contract-valid but not currently production-wired. [SOURCE: .opencode/skills/system-spec-kit/mcp_server/tests/content-router.vitest.ts:212] [SOURCE: .opencode/skills/system-spec-kit/mcp_server/tests/content-router.vitest.ts:310]",
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/002-content-routing-accuracy-research/findings-registry.json:292:      "text": "Category performance is uneven: `decision`, `task_update`, and `metadata_only` were perfect on the corpus, while `handover_state` (`62.5%`) and `narrative_delivery` (`68.75%`) were the weakest categories. [SOURCE: .opencode/skills/system-spec-kit/mcp_server/tests/content-router.vitest.ts:76] [INFERENCE: live execution of dist/lib/routing/content-router.js on the synthetic corpus]",
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/002-content-routing-accuracy-research/findings-registry.json:555:      "id": "finding-10-4-routeas-is-powerful-enough-to-rescue-natural-misclassifications-but-it-also-weak",
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/002-content-routing-accuracy-research/findings-registry.json:556:      "text": "`routeAs` is powerful enough to rescue natural misclassifications, but it also weakens the semantic guardrail because it can force a merge against a natural `drop` decision. Operationally, overrides should stay explicit, audited, and paired with target/merge-mode validation. [SOURCE: .opencode/skills/system-spec-kit/mcp_server/lib/routing/content-router.ts:428] [SOURCE: .opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:1053]",
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/002-content-routing-accuracy-research/findings-registry.json:578:      "text": "The current router is already strong on structured categories (`decision`, `task_update`, `metadata_only`) because those categories either have hard Tier1 rules or highly distinctive lexical floors. The weak spots are cue-rich narrative categories, especially delivery-versus-progress and handover-versus-drop. [SOURCE: .opencode/skills/system-spec-kit/mcp_server/lib/routing/content-router.ts:286] [INFERENCE: live corpus results summarized across iterations 5 and 6]",
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/002-content-routing-accuracy-research/findings-registry.json:754:      "text": "Phase `002` should treat `HS-02` and `HS-05` as the stronger handover templates and reduce reliance on `HS-04`-style command-first phrasing. The existing phase spec says not to reclassify correct drop prototypes, and that aligns with the evidence: the cleaner fix is to make handover prototypes more state-centric, not to weaken the drop prototypes that already capture wrappers and telemetry well. [SOURCE: .opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/002-content-routing-accuracy/002-fix-handover-drop-confusion/spec.md:15] [SOURCE: .opencode/skills/system-spec-kit/mcp_server/lib/routing/routing-prototypes.json:91]",
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/002-content-routing-accuracy-research/findings-registry.json:974:      "text": "Phase `002-fix-handover-drop-confusion` should split hard and soft drop cues. In `content-router.ts`, keep transcript/table-of-contents/recovery-wrapper evidence in the hard drop branch, but move `git diff`, `list memories`, and similar operational commands into a softer path that cannot beat a strong handover state by default. Add a stronger handover floor for `current state`, `next session`, `active files`, `remaining effort`, `next safe action`, and `resume` near lines `868-869`, then preserve `extractHardNegativeFlags()` for true wrappers only. Prototype work should focus on making handover examples more state-first, not on weakening correct drop examples. [SOURCE: .opencode/skills/system-spec-kit/mcp_server/lib/routing/content-router.ts:353] [SOURCE: .opencode/skills/system-spec-kit/mcp_server/lib/routing/content-router.ts:877] [SOURCE: .opencode/skills/system-spec-kit/mcp_server/lib/routing/routing-prototypes.json:83]",
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/002-content-routing-accuracy-research/findings-registry.json:1681:      "text": "Prototype counts remain balanced at five entries per category, but centroid separation is still weakest between `narrative_progress` and `narrative_delivery` (`cosine 0.9084`, `distance 0.0916`). [SOURCE: .opencode/skills/system-spec-kit/mcp_server/lib/routing/routing-prototypes.json:1] [INFERENCE: packet-local lexical-vector centroid analysis over routing-prototypes.json]",
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/002-content-routing-accuracy-research/findings-registry.json:2107:      "id": "ruled-out-15-2-treating-phase-003-as-a-one-line-constructor-tweak-in-memory-save-ts",
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/002-content-routing-accuracy-research/findings-registry.json:2108:      "text": "Treating phase `003` as a one-line constructor tweak in `memory-save.ts`.",
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/002-content-routing-accuracy-research/iterations/iteration-015.md:13:- Treating phase `003` as a one-line constructor tweak in `memory-save.ts`.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/002-content-routing-accuracy-research/iterations/iteration-005.md:11:5. Category performance is uneven: `decision`, `task_update`, and `metadata_only` were perfect on the corpus, while `handover_state` (`62.5%`) and `narrative_delivery` (`68.75%`) were the weakest categories. [SOURCE: .opencode/skills/system-spec-kit/mcp_server/tests/content-router.vitest.ts:76] [INFERENCE: live execution of dist/lib/routing/content-router.js on the synthetic corpus]
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/002-content-routing-accuracy-research/iterations/iteration-005.md:32:- What did not work and why: Looking only at overall accuracy hides the real hotspots, because the strong structured categories mask weaker delivery and handover performance.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/002-content-routing-accuracy-research/iterations/iteration-014.md:10:4. Phase `002` should treat `HS-02` and `HS-05` as the stronger handover templates and reduce reliance on `HS-04`-style command-first phrasing. The existing phase spec says not to reclassify correct drop prototypes, and that aligns with the evidence: the cleaner fix is to make handover prototypes more state-centric, not to weaken the drop prototypes that already capture wrappers and telemetry well. [SOURCE: .opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-canonical-continuity-refactor/018-research-content-routing-accuracy/002-fix-handover-drop-confusion/spec.md:15] [SOURCE: .opencode/skills/system-spec-kit/mcp_server/lib/routing/routing-prototypes.json:91]
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/research/002-content-routing-accuracy-research/iterations/iteration-032.md:7:1. Prototype counts remain balanced at five entries per category, but centroid separation is still weakest between `narrative_progress` and `narrative_delivery` (`cosine 0.9084`, `distance 0.0916`). [SOURCE: .opencode/skills/system-spec-kit/mcp_server/lib/routing/routing-prototypes.json:1] [INFERENCE: packet-local lexical-vector centroid analysis over routing-prototypes.json]
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/review/002-content-routing-accuracy-research/archive-invalid-2026-04-13T16-59-27Z/review-report.md:66:- CocoIndex semantic discovery could not be used in this session because each attempted query returned a cancelled-tool response.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/review/002-content-routing-accuracy-research/archive-invalid-2026-04-13T16-59-27Z/deep-review-strategy.md:59:- CocoIndex semantic searches returned cancelled-tool responses in this session, so discovery had to fall back to direct file reads and `rg` sweeps.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/review/002-content-routing-accuracy-research/archive-invalid-2026-04-13T16-59-27Z/deep-review-strategy.md:98:- CocoIndex searches were attempted during setup and returned cancelled-tool responses, so the review relied on direct file reads and exact grep sweeps.
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/006-skill-advisor/001-memory-search-routing-tuning/review/002-content-routing-accuracy-research/archive-invalid-2026-04-13T16-59-27Z/iterations/iteration-013.md:21:Review research citation quality and implementation-summary evidence density across the promoted roots so the final verdict does not depend on weak or uncited packet-local claims.

codex
The broad sweep found the likely family: `system-spec-kit/026-graph-and-context-optimization`, especially runtime stress remediation and `memory_search` response policy. I’m narrowing from corpus-level mentions to the implementation files that own result quality, recovery, and hybrid retrieval.
exec
/bin/zsh -lc "find specs/system-spec-kit/026-graph-and-context-optimization -path '*memory*search*' -o -path '*cocoindex*' -o -path '*runtime-stress*' | sed -n '1,200p'" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
find: specs/system-spec-kit/026-graph-and-context-optimization: No such file or directory

exec
/bin/zsh -lc "rg -n '\"specFolder\": \"system-spec-kit/026-graph-and-context-optimization/.+(memory_search|memory-search|cocoindex|runtime-stress)|\"description\": \"Feature Specification: (memory_search|CocoIndex|MCP Runtime)' specs/descriptions.json" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
771:      "description": "Feature Specification: CocoIndex Code MCP Integration",
3177:      "description": "Feature Specification: MCP Runtime Hardening",
4279:      "specFolder": "system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/005-memory-search-runtime-bugs",
5017:      "specFolder": "system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation",
5018:      "description": "Feature Specification: MCP Runtime Stress-Test Remediation. Phase parent for the v1.0.1 stress-test cycle: rubric-driven sweep, deep research, contract fixes across memory_context / memory_search / code_graph_query / memory_causal_stats, gated by a daemon-rebuild protocol.",
5032:      "specFolder": "system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook",
5045:      "specFolder": "system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/001-search-scenario-design",
5057:      "specFolder": "system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution",
5069:      "specFolder": "system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/002-mcp-runtime-improvement-research",
5070:      "description": "Feature Specification: MCP Runtime Improvement Deep Research",
5083:      "specFolder": "system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/003-memory-context-truncation-telemetry-contract",
5096:      "specFolder": "system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/004-cocoindex-overfetch-dedup-rerank",
5097:      "description": "Feature Specification: CocoIndex over-fetch + canonical-identity dedup + path-class rerank",
5111:      "specFolder": "system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/005-code-graph-fail-fast-routing",
5123:      "specFolder": "system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/006-causal-graph-relation-window-metrics",
5138:      "specFolder": "system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/007-intent-classifier-stability-telemetry",
5154:      "specFolder": "system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/008-mcp-daemon-rebuild-protocol",
5168:      "specFolder": "system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/009-memory-search-citation-response-policy",
5169:      "description": "Feature Specification: memory_search hard response policy + citation policy",
5181:      "specFolder": "system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/010-stress-test-close-loop-measurement-rerun",

exec
/bin/zsh -lc "rg -n \"requestQuality|suggestedQueries|low_confidence|recovery|weak|hybrid|RRF|fts|bm25|vector\" .opencode/skills/system-spec-kit/mcp_server -g '"'!node_modules'"' -g '"'!dist'"'" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:77:import * as vectorIndex from './lib/search/vector-index.js';
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:82:import * as hybridSearch from './lib/search/hybrid-search.js';
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:96:import * as bm25Index from './lib/search/bm25-index.js';
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:127:// T107: Transaction manager for pending file recovery on startup (REQ-033)
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:789:  const channels: string[] = ['vector', 'fts5'];
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:790:  if (bm25Index.isBm25Enabled()) channels.push('bm25');
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:806:  // Phase 024 / Item 4 + M8 / T-CGQ-12: Session recovery digest from
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:833:  // repair/recovery, not query.
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:944:      recordMetricEvent({ kind: 'memory_recovery' });
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1006:      vectorIndex.initializeDb();
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1184:    // REQ-004: Include recovery hints in all error responses
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1198:        recovery: getRecoveryHint(name, fallbackCode),
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1242: * CHK-188: Pending files processed by recovery job on next startup.
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1257:    const database = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1272:    const recoveryResult: PendingRecoveryResult = {
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1280:    if (recoveryResult.found > 0) {
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1281:      console.error(`[context-server] Pending file recovery: ${recoveryResult.recovered} recovered, ${recoveryResult.failed} failed (${recoveryResult.found} total)`);
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1286:    return recoveryResult;
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1289:    console.error(`[context-server] Pending file recovery error: ${message}`);
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1617:    runCleanupStep('vectorIndex', () => vectorIndex.closeDb());
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1649:  const database = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1676:      if (vectorIndex.deleteMemory(row.id)) {
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1793:  vectorIndex.initializeDb();
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1810:    vectorIndex,
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1813:    hybridSearch,
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1835:    const report = vectorIndex.verifyIntegrity();
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1840:    const dimValidation = vectorIndex.validateEmbeddingDimension();
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1851:    const database = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1868:        console.error(`[context-server] Learned triggers ready (migrated=${migrated}, fts5Isolated=${isolated})`);
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1915:    hybridSearch.init(database, vectorIndex.vectorSearch, graphSearchFn);
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1940:    console.error('[context-server] Checkpoints, access tracker, hybrid search, session boost, and causal boost initialized');
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1943:    if (bm25Index.isBm25Enabled()) {
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1945:        const bm25 = bm25Index.getIndex();
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1946:        const count = bm25.rebuildFromDatabase(database);
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1948:      } catch (bm25Err: unknown) {
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1949:        const message = bm25Err instanceof Error ? bm25Err.message : String(bm25Err);
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:2028:        const recoveryResult = sessionManager.resetInterruptedSessions();
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:2029:        if (recoveryResult.interruptedCount > 0) {
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:2030:          console.error(`[context-server] Crash recovery: marked ${recoveryResult.interruptedCount} sessions as interrupted`);
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:2045:    // P0-3: Async ingestion job queue initialization + crash recovery reset.
.opencode/skills/system-spec-kit/mcp_server/context-server.ts:2053:        console.error(`[context-server] Ingest crash recovery reset ${ingestInit.resetCount} incomplete job(s) to queued`);
.opencode/skills/system-spec-kit/mcp_server/ENV_REFERENCE.md:98:| `SPECKIT_SAVE_PLANNER_MODE` | `plan-only` | string | Canonical save planner mode: `plan-only` (default), `full-auto`, or `hybrid`. Since the Phase 017 H-56-1 fix, all modes still refresh packet metadata on `/memory:save`; `plan-only` no longer leaves `description.json.lastUpdated` or `graph-metadata.json` untouched. `full-auto` keeps the legacy atomic apply path; `hybrid` is reserved for future mixed flows and currently behaves the same as `plan-only`. | `lib/search/search-flags.ts` |
.opencode/skills/system-spec-kit/mcp_server/ENV_REFERENCE.md:113:| `SPECKIT_RRF` | `true` | boolean | Master switch for Reciprocal Rank Fusion. Graduated ON. | `shared/algorithms/rrf-fusion.ts` |
.opencode/skills/system-spec-kit/mcp_server/ENV_REFERENCE.md:114:| `SPECKIT_RRF_K` | `40` | number | RRF smoothing constant `k`. Lower = more top-heavy ranking, higher = flatter. Must be > 0. | `shared/algorithms/rrf-fusion.ts` |
.opencode/skills/system-spec-kit/mcp_server/ENV_REFERENCE.md:115:| `SPECKIT_RRF_K_EXPERIMENTAL` | `true` | boolean | Per-intent RRF K selection from the D1 K-sweep grid. Graduated ON. | `lib/search/search-flags.ts` |
.opencode/skills/system-spec-kit/mcp_server/ENV_REFERENCE.md:144:| `SPECKIT_TEMPORAL_CONTIGUITY` | `true` | boolean | Temporal contiguity boost on raw Stage 1 vector results. Graduated ON. | `lib/search/search-flags.ts` |
.opencode/skills/system-spec-kit/mcp_server/ENV_REFERENCE.md:150:| `SPECKIT_FOLDER_TOP_K` | `5` | number | Number of top folder-scored results to inject. | `lib/search/hybrid-search.ts` |
.opencode/skills/system-spec-kit/mcp_server/ENV_REFERENCE.md:163:| `SPECKIT_QUERY_CONCEPT_EXPANSION` | `true` | boolean | Query concept expansion via alias matching for hybrid search (Phase B T016). Graduated ON. | `lib/search/search-flags.ts` |
.opencode/skills/system-spec-kit/mcp_server/ENV_REFERENCE.md:187:| `SPECKIT_GRAPH_FALLBACK` | `true` | boolean | Graph-expanded fallback on zero/weak results (Phase B T017). Graduated ON. | `lib/search/search-flags.ts` |
.opencode/skills/system-spec-kit/mcp_server/ENV_REFERENCE.md:213:| `SPECKIT_N2A_CAP` | (profile) | number | N2a cap for RRF fusion overflow prevention. Overrides the active calibration profile value. | `lib/search/graph-calibration.ts` |
.opencode/skills/system-spec-kit/mcp_server/ENV_REFERENCE.md:214:| `SPECKIT_N2B_CAP` | (profile) | number | N2b cap for RRF fusion overflow prevention. Overrides the active calibration profile value. | `lib/search/graph-calibration.ts` |
.opencode/skills/system-spec-kit/mcp_server/ENV_REFERENCE.md:288:| `SPECKIT_EMPTY_RESULT_RECOVERY_V1` | `true` | boolean | Empty/weak result recovery UX with diagnostic payload (REQ-D5-001). Graduated ON. | `lib/search/search-flags.ts` |
.opencode/skills/system-spec-kit/mcp_server/ENV_REFERENCE.md:387:| `SPECKIT_RSF_FUSION` | **Deprecated** | `SPECKIT_RRF` | Referenced in tests only. Legacy alias. |
.opencode/skills/system-spec-kit/mcp_server/ENV_REFERENCE.md:427:# Increase RRF smoothing
.opencode/skills/system-spec-kit/mcp_server/ENV_REFERENCE.md:428:export SPECKIT_RRF_K=80
.opencode/skills/system-spec-kit/mcp_server/cli.ts:19:type VectorIndexModule = Awaited<typeof import('./lib/search/vector-index.js')>;
.opencode/skills/system-spec-kit/mcp_server/cli.ts:30:let _vector_index: VectorIndexModule | null = null;
.opencode/skills/system-spec-kit/mcp_server/cli.ts:42:  return _vector_index ??= await import('./lib/search/vector-index.js');
.opencode/skills/system-spec-kit/mcp_server/cli.ts:142:  const [vectorIndex, checkpointsLib, accessTracker, coreIndex] = await Promise.all([
.opencode/skills/system-spec-kit/mcp_server/cli.ts:149:  vectorIndex.initializeDb();
.opencode/skills/system-spec-kit/mcp_server/cli.ts:150:  const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/cli.ts:157:  coreIndex.init({ vectorIndex, checkpoints: checkpointsLib, accessTracker });
.opencode/skills/system-spec-kit/mcp_server/cli.ts:168:  const vectorIndex = await getVectorIndex();
.opencode/skills/system-spec-kit/mcp_server/cli.ts:170:  const db = vectorIndex.getDb()!;
.opencode/skills/system-spec-kit/mcp_server/cli.ts:281:  const [vectorIndex, checkpointsLib, mutationLedger, triggerMatcher, causalEdges, history] = await Promise.all([
.opencode/skills/system-spec-kit/mcp_server/cli.ts:289:  const db = vectorIndex.getDb()!;
.opencode/skills/system-spec-kit/mcp_server/cli.ts:387:      if (vectorIndex.deleteMemory(memory.id)) {
.opencode/skills/system-spec-kit/mcp_server/cli.ts:525:  const vectorIndex = await getVectorIndex();
.opencode/skills/system-spec-kit/mcp_server/cli.ts:526:  const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/cli.ts:594:    .then(vectorIndex => { vectorIndex.closeDb(); })
.opencode/skills/system-spec-kit/mcp_server/utils/db-helpers.ts:11:import * as vectorIndex from '../lib/search/vector-index.js';
.opencode/skills/system-spec-kit/mcp_server/utils/db-helpers.ts:18: * const database = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/utils/db-helpers.ts:27:function requireDb(): NonNullable<ReturnType<typeof vectorIndex.getDb>> {
.opencode/skills/system-spec-kit/mcp_server/utils/db-helpers.ts:28:  const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/schemas/tool-input-schemas.ts:400:  channels: z.array(z.enum(['vector', 'bm25', 'fts5', 'graph', 'trigger'])).optional(),
.opencode/skills/system-spec-kit/mcp_server/schemas/tool-input-schemas.ts:640:    sessionId: z.string().optional().describe('Optional session ID for targeted recovery (advanced)'),
.opencode/skills/system-spec-kit/mcp_server/scripts/README.md:79:- Module initialization order: `vectorIndex` -> `embeddings` -> `checkpointsLib` -> `accessTracker` -> `hybridSearch` -> `initDbState` -> `setEmbeddingModelReady`.
.opencode/skills/system-spec-kit/mcp_server/api/index.ts:46:  hybridSearchEnhanced,
.opencode/skills/system-spec-kit/mcp_server/api/index.ts:49:  fts5Bm25Search,
.opencode/skills/system-spec-kit/mcp_server/api/index.ts:51:  vectorIndex,
.opencode/skills/system-spec-kit/mcp_server/INSTALL_GUIDE.md:38:**Expected setup time:** 3-5 minutes (clean install), 2-5 minutes (recovery)
.opencode/skills/system-spec-kit/mcp_server/INSTALL_GUIDE.md:80:│  SQLite + sqlite-vec for vector storage                         │
.opencode/skills/system-spec-kit/mcp_server/INSTALL_GUIDE.md:137:| Runtime | Checked-in MCP config | Startup / recovery surface currently visible in repo |
.opencode/skills/system-spec-kit/mcp_server/INSTALL_GUIDE.md:206:- `sqlite-vec` (vector extension for semantic search)
.opencode/skills/system-spec-kit/mcp_server/INSTALL_GUIDE.md:216:- `sqlite-vec-darwin-arm64` (Apple Silicon vector extension, optional)
.opencode/skills/system-spec-kit/mcp_server/INSTALL_GUIDE.md:631:- `resume`: Session recovery (loads previous state)
.opencode/skills/system-spec-kit/mcp_server/INSTALL_GUIDE.md:642:`memory_search()` runs vector-based similarity search across all indexed memories.
.opencode/skills/system-spec-kit/mcp_server/INSTALL_GUIDE.md:688:When enabled, this feature adjusts the balance between vector similarity and keyword relevance based on the detected task type. It supports 7 task types: `add_feature`, `fix_bug`, `refactor`, `understand`, `plan`, `debug` and `resume`. For example, `fix_bug` boosts exact-match keyword signals while `understand` emphasizes semantic similarity.
.opencode/skills/system-spec-kit/mcp_server/INSTALL_GUIDE.md:723:- `DegradedModeContract`: Emitted when the server falls back to non-vector behavior, describes what capability is reduced and the recovery path
.opencode/skills/system-spec-kit/mcp_server/INSTALL_GUIDE.md:773:**Behind the scenes:** The AI uses `/spec_kit:resume` as the canonical recovery surface. That flow reconstructs packet context from `handover.md`, then `_memory.continuity`, then the canonical spec docs before it falls through to deeper MCP retrieval.
.opencode/skills/system-spec-kit/mcp_server/INSTALL_GUIDE.md:941:`sqlite-vec-darwin-arm64` is an optional dependency installed automatically on Apple Silicon. On other platforms, the equivalent platform package is resolved by npm. The server degrades to non-vector behavior when sqlite-vec is unavailable. Semantic similarity quality drops until you fix the extension.
.opencode/skills/system-spec-kit/mcp_server/INSTALL_GUIDE.md:1088:| `.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-impl.ts` | Vector index implementation |
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-ingest.ts:222:      recovery: {
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-ingest.ts:294:      recovery: {
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-ingest.ts:323:      recovery: {
.opencode/skills/system-spec-kit/mcp_server/hooks/memory-surface.ts:6:import * as vectorIndex from '../lib/search/vector-index.js';
.opencode/skills/system-spec-kit/mcp_server/hooks/memory-surface.ts:181:    const db: Database | null = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/hooks/memory-surface.ts:312:    const db: Database | null = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/hooks/memory-surface.ts:483:      communitySearch: 'When primary search returns weak results, community search fallback activates automatically (SPECKIT_COMMUNITY_SEARCH_FALLBACK). Graph provenance is visible in graphEvidence field.',
.opencode/skills/system-spec-kit/mcp_server/configs/README.md:44:- `smartRanking`: live config read by `vector-index-impl.ts` (weights: relevance 0.5, recency 0.3, access 0.2).
.opencode/skills/system-spec-kit/mcp_server/schemas/README.md:29:Those handlers now sit behind the Gate E continuity contract: `/spec_kit:resume` is the recovery surface, and packet continuity comes from `handover.md` -> `_memory.continuity` -> canonical spec docs. Generated memory artifacts are supporting only.
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-bulk-delete.ts:8:import * as vectorIndex from '../lib/search/vector-index.js';
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-bulk-delete.ts:54:      recovery: {
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-bulk-delete.ts:96:  const database = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-bulk-delete.ts:107:      recovery: {
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-bulk-delete.ts:212:      if (vectorIndex.deleteMemory(memory.id)) {
.opencode/skills/system-spec-kit/mcp_server/api/README.md:26:This import surface can expose support data, but it does not replace canonical packet continuity. For Spec Kit recovery, `/spec_kit:resume` still rebuilds state from `handover.md`, then `_memory.continuity`, then the remaining spec docs.
.opencode/skills/system-spec-kit/mcp_server/api/README.md:36:| `search.ts` | Hybrid search init/search, FTS5 BM25 helpers, and `vectorIndex` namespace |
.opencode/skills/system-spec-kit/mcp_server/README.md:3:description: "Model Context Protocol server providing semantic memory, hybrid search and graph intelligence for AI-assisted development across sessions, models and tools."
.opencode/skills/system-spec-kit/mcp_server/README.md:7:  - "hybrid search"
.opencode/skills/system-spec-kit/mcp_server/README.md:51:Code-graph handlers share one readiness contract, session-resume auth binds to transport caller context by default, and Copilot compact-cache uses the same provenance-wrapped recovery path as Claude and Gemini.
.opencode/skills/system-spec-kit/mcp_server/README.md:89:The indexed-continuity store exposes its MCP tools through 4 memory slash commands plus the borrowed recovery workflow in `/spec_kit:resume`. Dedicated code-graph, CocoIndex, and Skill Advisor tools live in the same server. Think of commands as doors into the system. Each door opens access only to the tools it needs.
.opencode/skills/system-spec-kit/mcp_server/README.md:97:| `/spec_kit:resume` | Canonical operator-facing recovery surface for an interrupted spec-folder session; rebuilds active context from `handover.md`, then `_memory.continuity`, then packet docs | Broad helper surface for packet recovery |
.opencode/skills/system-spec-kit/mcp_server/README.md:254:| **CocoIndex** *(bridge)* | Semantic code search via vector embeddings across source files | Finding code implementations when memory channels miss; concept-first code discovery |
.opencode/skills/system-spec-kit/mcp_server/README.md:258:**Reciprocal Rank Fusion (RRF)** combines all channel results using the formula `1/(K + rank)`. The K parameter is tuned per query intent through sensitivity analysis across K values {10, 20, 40, 60, 80, 100, 120}. A spec-doc record that scores well in multiple channels rises to the top because RRF gives exponential weight to high-ranking items while still including lower-ranked contributions.
.opencode/skills/system-spec-kit/mcp_server/README.md:266:| Tier 1 | FTS5 full-text search | Graph and semantic channels return weak results |
.opencode/skills/system-spec-kit/mcp_server/README.md:286:**Stage 2 -- Score and fuse** using RRF plus eight post-fusion scoring signals:
.opencode/skills/system-spec-kit/mcp_server/README.md:364:The active continuity and recovery ladder uses only the four live states above.
.opencode/skills/system-spec-kit/mcp_server/README.md:474:**Empty result recovery** -- diagnoses why a search came back empty (too narrow filter, unclear question, missing knowledge) and suggests next steps.
.opencode/skills/system-spec-kit/mcp_server/README.md:508:**Embedding retry orchestrator** -- when the embedding service is temporarily unavailable, the spec-doc record is saved without a vector and queued for retry. A background worker retries until it succeeds. A temporary outage never permanently blocks full searchability.
.opencode/skills/system-spec-kit/mcp_server/README.md:510:**Lexical-only fallback indexing** -- saves memories in a simpler text-searchable form when the embedding service is down. Keyword search still works. When the service returns, the system upgrades to full vector searchability automatically.
.opencode/skills/system-spec-kit/mcp_server/README.md:512:**Atomic write-then-index** -- writes files to a temporary location first and only moves them once confirmed. Crash-safe with pending-file recovery on startup.
.opencode/skills/system-spec-kit/mcp_server/README.md:560:**Startup/recovery surfaces:** `session_resume`, `session_bootstrap`, and the startup brief report freshness-aware graph status instead of count-only health. Startup surfaces are intentionally non-mutating snapshots, so later structural reads may still differ if repo state changes.
.opencode/skills/system-spec-kit/mcp_server/README.md:562:**Cross-runtime startup payload parity:** all four supported runtimes transport the same compact startup shared-payload through their runtime-specific hooks — `hooks/claude/session-prime.ts`, `hooks/gemini/session-prime.ts`, `hooks/copilot/session-prime.ts`, and `hooks/codex/session-start.ts`. The transported payload includes `graphQualitySummary` (detector provenance + edge-enrichment summary) and the `sharedPayloadTransport` envelope produced by `buildStartupBrief()`. `session_bootstrap()` remains available as a manual recovery path when native startup hooks are disabled or unwired.
.opencode/skills/system-spec-kit/mcp_server/README.md:594:**Tuning the scoring tables:** `/doctor:skill-advisor` is the user-facing surface for proposing and applying optimizations to `TOKEN_BOOSTS`, `PHRASE_BOOSTS`, `CATEGORY_HINTS`, and per-skill `graph-metadata.json` derived fields (`derived.trigger_phrases`, `derived.key_topics`). The command runs a 5-phase pipeline (Discovery → Analysis → Proposal → Apply → Verify) with auto and confirm modes; mutation boundaries are validated by a Phase 3 canonical-path validator (realpath + repo-relative + allowlist exact-match) before any write, and a per-run rollback script is generated under packet-local scratch for safe recovery. End-user setup guide: [`.opencode/install_guides/SET-UP - Skill Advisor.md`](../../../install_guides/SET-UP%20-%20Skill%20Advisor.md).
.opencode/skills/system-spec-kit/mcp_server/README.md:655:Resume session with combined memory, code graph and CocoIndex status in a single call. Use when you want the detailed merged resume payload directly. The response carries freshness-aware code-graph status (`fresh`, `stale`, `empty`, `error`) instead of count-only health. Session-resume auth binds `args.sessionId` to the transport caller context from `lib/context/caller-context.ts`; mismatches are rejected by default, with `MCP_SESSION_RESUME_AUTH_MODE=permissive` available for canary rollout. For the canonical first-call recovery path on session start or after `/clear`, prefer `session_bootstrap`, and for operator-facing packet recovery prefer `/spec_kit:resume`, which reconstructs context from `handover.md`, then `_memory.continuity`, then packet docs.
.opencode/skills/system-spec-kit/mcp_server/README.md:666:Complete session bootstrap in one call. This is the canonical first-call recovery step on session start or after `/clear`. It wraps the full `session_resume` payload plus `session_health` and returns context, health, structural readiness and recommended next actions. Startup/bootstrap surfaces are freshness-aware but non-mutating; use `code_graph_scan` when readiness shows an empty or broad full-scan state. In packet workflows, `/spec_kit:resume` sits above this tool as the operator-facing recovery surface.
.opencode/skills/system-spec-kit/mcp_server/README.md:1032:| `channels` | string[] | Channels to test: `vector`, `bm25`, `fts5`, `graph`, `trigger` |
.opencode/skills/system-spec-kit/mcp_server/README.md:1270:| `hooks/copilot/compact-cache.ts` | Copilot compact-cache producer so Copilot matches Claude/Gemini recovery behavior |
.opencode/skills/system-spec-kit/mcp_server/README.md:1306:The system needs an embedding provider to convert text into vectors for similarity search. Pick one:
.opencode/skills/system-spec-kit/mcp_server/README.md:1422:    "specFolder": "specs/022-hybrid-rag-fusion"
.opencode/skills/system-spec-kit/mcp_server/README.md:1435:    "specFolder": "specs/022-hybrid-rag-fusion",
.opencode/skills/system-spec-kit/mcp_server/README.md:1465:    "specFolder": "specs/022-hybrid-rag-fusion"
.opencode/skills/system-spec-kit/mcp_server/README.md:1489:    "specFolder": "specs/022-hybrid-rag-fusion",
.opencode/skills/system-spec-kit/mcp_server/README.md:1494:    "knowledgeGaps": ["RRF k-value tuning", "MPAB aggregation logic"]
.opencode/skills/system-spec-kit/mcp_server/README.md:1505:    "specFolder": "specs/022-hybrid-rag-fusion",
.opencode/skills/system-spec-kit/mcp_server/README.md:1510:    "gapsClosed": ["RRF k-value tuning", "MPAB aggregation logic"]
.opencode/skills/system-spec-kit/mcp_server/README.md:1523:| Resume a session from scratch | `session_bootstrap` | Use as the first recovery call on session start or after `/clear` |
.opencode/skills/system-spec-kit/mcp_server/README.md:1578:**What you see**: Saved memories have zero vector scores. Semantic search returns nothing.
.opencode/skills/system-spec-kit/mcp_server/README.md:1672:**Q: How is this different from plain RAG with a vector database?**
.opencode/skills/system-spec-kit/mcp_server/README.md:1674:Three main differences. First, this system uses 5 search channels combined with rank fusion, beyond vector similarity. Second, it applies FSRS decay so recently accessed memories rank higher without manual curation. Third, the causal graph lets you answer "why was this decision made?" which no vector database supports natively.
.opencode/skills/system-spec-kit/mcp_server/README.md:1686:A typical project with a few hundred indexed packet docs and generated continuity artifacts uses 10-50 MB. The vector table (1024-dimension float32 embeddings) is the largest contributor. Check with `memory_stats` using `includeScores: true`.
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-triggers.ts:42:import { initialize_db } from '../lib/search/vector-index-store.js';
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-triggers.ts:200:      recovery: {
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-triggers.ts:223:        recovery: {
.opencode/skills/system-spec-kit/mcp_server/api/indexing.ts:22:import { initHybridSearch, vectorIndex } from './search.js';
.opencode/skills/system-spec-kit/mcp_server/api/indexing.ts:36:  vectorIndex.initializeDb();
.opencode/skills/system-spec-kit/mcp_server/api/indexing.ts:39:    vectorIndex,
.opencode/skills/system-spec-kit/mcp_server/api/indexing.ts:42:    hybridSearch: { init: initHybridSearch },
.opencode/skills/system-spec-kit/mcp_server/api/indexing.ts:45:  const database = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/api/indexing.ts:52:  initHybridSearch(database, vectorIndex.vectorSearch);
.opencode/skills/system-spec-kit/mcp_server/api/indexing.ts:138:  vectorIndex.closeDb();
.opencode/skills/system-spec-kit/mcp_server/configs/search-weights.json:21:  "_note_smartRanking": "LIVE CONFIG - read by vector-index-impl.ts:2802-2804 (apply_smart_ranking). Weights sum to 1.0. Code fallback defaults: relevance=0.5, recency=0.3, access=0.2.",
.opencode/skills/system-spec-kit/mcp_server/hooks/copilot/compact-cache.ts:246:      'Do not reuse recovery wrapper text as session-state evidence.',
.opencode/skills/system-spec-kit/mcp_server/api/search.ts:10:  hybridSearchEnhanced,
.opencode/skills/system-spec-kit/mcp_server/api/search.ts:13:} from '../lib/search/hybrid-search.js';
.opencode/skills/system-spec-kit/mcp_server/api/search.ts:16:  fts5Bm25Search,
.opencode/skills/system-spec-kit/mcp_server/api/search.ts:18:} from '../lib/search/sqlite-fts.js';
.opencode/skills/system-spec-kit/mcp_server/api/search.ts:20:export * as vectorIndex from '../lib/search/vector-index.js';
.opencode/skills/system-spec-kit/mcp_server/formatters/README.md:28:These formatters support the Gate E recovery path where `/spec_kit:resume` rebuilds context from `handover.md` -> `_memory.continuity` -> spec docs. Generated memory artifacts are supporting outputs, not canonical continuity sources.
.opencode/skills/system-spec-kit/mcp_server/plugin_bridges/spec-kit-compact-code-graph-bridge.mjs:6:import * as vectorIndex from '../dist/lib/search/vector-index.js';
.opencode/skills/system-spec-kit/mcp_server/plugin_bridges/spec-kit-compact-code-graph-bridge.mjs:34:  vectorIndex.initializeDb();
.opencode/skills/system-spec-kit/mcp_server/plugin_bridges/spec-kit-compact-code-graph-bridge.mjs:35:  const database = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/api/eval.ts:30:} from '../lib/eval/bm25-baseline.js';
.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:36:} from '../lib/search/recovery-payload.js';
.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:71:/** Raw search result from database/vector search */
.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:79:  /** Raw vector cosine similarity (0-100 scale from sqlite-vec). */
.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:96:  /** Raw vector cosine similarity (0-100 scale from sqlite-vec), or averageSimilarity for multi-concept. */
.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:274:  requestQuality: RequestQualityAssessment | null,
.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:275:  recovery: RecoveryPayload | null,
.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:277:  if (!requestQuality || requestQuality.requestQuality?.label === 'good') return null;
.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:278:  if (!recovery) return null;
.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:280:  if (recovery.recommendedAction === 'ask_user' && recovery.suggestedQueries.length === 0) {
.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:293:    safeResponse: 'Retrieval quality is weak. Broaden the query or ask the user for disambiguation before citing any path.',
.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:297:function deriveCitationPolicy(requestQuality: RequestQualityAssessment | null): CitationPolicy {
.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:298:  const label = requestQuality?.requestQuality?.label;
.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:754:    // REQ-D5-001: Attach recovery payload when flag is enabled
.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:755:    let recoveryPayload: RecoveryPayload | null = null;
.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:756:    const requestQualityData = isResultConfidenceEnabled()
.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:760:      recoveryPayload = buildRecoveryPayload({
.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:766:    const responsePolicy = deriveResponsePolicy(requestQualityData, recoveryPayload);
.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:767:    const citationPolicy = deriveCitationPolicy(requestQualityData);
.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:776:        ...(requestQualityData ?? {}),
.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:779:        // REQ-D5-001: Attach recovery payload (additive, only when flag enabled)
.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:780:        ...(recoveryPayload !== null ? { recovery: recoveryPayload } : {}),
.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:838:        lexical: toNullableNumber(rawResult.fts_score ?? rawResult.bm25_score ?? (rawResult.sourceScores as Record<string, number> | undefined)?.keyword ?? (rawResult.sourceScores as Record<string, number> | undefined)?.fts ?? (rawResult.sourceScores as Record<string, number> | undefined)?.bm25),
.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:998:  let requestQualityData: ReturnType<typeof assessRequestQuality> | null = null;
.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:1003:    requestQualityData = assessRequestQuality(scoredResults, confidenceData);
.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:1006:  // REQ-D5-001: Compute recovery payload for weak/partial results when flag is enabled
.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:1007:  let recoveryPayload: RecoveryPayload | null = null;
.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:1009:    // Compute average confidence for recovery decision
.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:1016:    const recoveryCtx = {
.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:1024:    if (shouldTriggerRecovery(recoveryCtx)) {
.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:1025:      recoveryPayload = buildRecoveryPayload(recoveryCtx);
.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:1069:  const responsePolicy = deriveResponsePolicy(requestQualityData, recoveryPayload);
.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:1070:  const citationPolicy = deriveCitationPolicy(requestQualityData);
.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:1079:    ...(requestQualityData !== null ? requestQualityData : {}),
.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:1080:    // REQ-D5-001: Recovery payload for weak/partial results (additive)
.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:1081:    ...(recoveryPayload !== null ? { recovery: recoveryPayload } : {}),
.opencode/skills/system-spec-kit/mcp_server/tests/opencode-transport.vitest.ts:55:      checks: ['fts_consistency'],
.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:1269:> **Purpose:** Enable seamless session recovery after context compaction, crashes, or breaks.
.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:1318:*This file is auto-generated on session checkpoint. It provides a human-readable recovery mechanism alongside SQLite persistence.*
.opencode/skills/system-spec-kit/mcp_server/tests/handler-checkpoints.vitest.ts:7:import * as vectorIndexMod from '../lib/search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/tests/handler-checkpoints.vitest.ts:8:import * as bm25IndexMod from '../lib/search/bm25-index';
.opencode/skills/system-spec-kit/mcp_server/tests/handler-checkpoints.vitest.ts:16:const vectorIndexAvailable = false;
.opencode/skills/system-spec-kit/mcp_server/tests/handler-checkpoints.vitest.ts:17:const bm25IndexAvailable = false;
.opencode/skills/system-spec-kit/mcp_server/tests/handler-checkpoints.vitest.ts:30:    vectorIndexMod.closeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/handler-checkpoints.vitest.ts:31:    vectorIndexMod.initializeDb(':memory:');
.opencode/skills/system-spec-kit/mcp_server/tests/handler-checkpoints.vitest.ts:35:    vectorIndexMod.closeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/handler-checkpoints.vitest.ts:584:      const db = vectorIndexMod.getDb();
.opencode/skills/system-spec-kit/mcp_server/tests/handler-checkpoints.vitest.ts:640:    it('T102-1: bm25Index module available', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/handler-checkpoints.vitest.ts:641:      expect(bm25IndexMod).toBeDefined();
.opencode/skills/system-spec-kit/mcp_server/tests/handler-checkpoints.vitest.ts:648:    it('T102-3: vectorIndex cache clear functions exist', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/handler-checkpoints.vitest.ts:649:      expect(typeof vectorIndexMod.clearConstitutionalCache).toBe('function');
.opencode/skills/system-spec-kit/mcp_server/tests/handler-checkpoints.vitest.ts:650:      expect(typeof vectorIndexMod.clearSearchCache).toBe('function');
.opencode/skills/system-spec-kit/mcp_server/tests/handler-checkpoints.vitest.ts:653:    it('T102-4: bm25Index rebuild API exists', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/handler-checkpoints.vitest.ts:654:      expect(typeof bm25IndexMod.isBm25Enabled).toBe('function');
.opencode/skills/system-spec-kit/mcp_server/tests/handler-checkpoints.vitest.ts:655:      expect(typeof bm25IndexMod.getIndex).toBe('function');
.opencode/skills/system-spec-kit/mcp_server/tests/handler-checkpoints.vitest.ts:663:      if (!vectorIndexMod || !triggerMatcherMod) {
.opencode/skills/system-spec-kit/mcp_server/tests/handler-checkpoints.vitest.ts:671:        .spyOn(vectorIndexMod, 'clearConstitutionalCache')
.opencode/skills/system-spec-kit/mcp_server/tests/handler-checkpoints.vitest.ts:676:        .spyOn(vectorIndexMod, 'clearSearchCache')
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/lib/freshness.ts:49:  readonly recoveryPath?: AdvisorGenerationRecoveryPath;
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/lib/freshness.ts:213:  recoveryPath?: AdvisorGenerationRecoveryPath,
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/lib/freshness.ts:219:    ...(recoveryPath ? { recoveryPath } : {}),
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/lib/freshness.ts:302:  recoveryPath?: AdvisorGenerationRecoveryPath,
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/lib/freshness.ts:315:    diagnostics: nonLiveDiagnostics(reason, [], recoveryPath, errorDiagnostics),
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/lib/freshness.ts:355:          generation.recoveryPath ?? undefined,
.opencode/skills/system-spec-kit/mcp_server/hooks/copilot/README.md:21:- `compact-cache.ts` keeps compact recovery state available for wrapper surfaces.
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-extended.vitest.ts:19:import * as vectorIndex from '../lib/search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-extended.vitest.ts:41:  try { vectorIndex.closeDb(); } catch { /* ignore */ }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-extended.vitest.ts:42:  moduleDb = vectorIndex.initializeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-extended.vitest.ts:56:    try { vectorIndex.closeDb(); } catch { /* ignore */ }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-extended.vitest.ts:420:    const hasGetDb = typeof vectorIndex.getDb === 'function';
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-extended.vitest.ts:427:          db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-extended.vitest.ts:487:    const hasGetDb = typeof vectorIndex.getDb === 'function';
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-extended.vitest.ts:494:          db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-extended.vitest.ts:662:    const hasGetDb = typeof vectorIndex.getDb === 'function';
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-extended.vitest.ts:669:          db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-extended.vitest.ts:722:    const hasGetDb = typeof vectorIndex.getDb === 'function';
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-extended.vitest.ts:729:          db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-fallback-fingerprint.vitest.ts:68:      '<!-- ANCHOR:recovery-hints -->',
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-fallback-fingerprint.vitest.ts:74:      '<!-- /ANCHOR:recovery-hints -->',
.opencode/skills/system-spec-kit/mcp_server/lib/session/README.md:3:description: "Session management for the Spec Kit Memory MCP server. Handles session deduplication, crash recovery and context persistence."
.opencode/skills/system-spec-kit/mcp_server/lib/session/README.md:7:  - "crash recovery"
.opencode/skills/system-spec-kit/mcp_server/lib/session/README.md:12:> Session management for the Spec Kit Memory MCP server. Handles deduplication and crash recovery with context persistence.
.opencode/skills/system-spec-kit/mcp_server/lib/session/README.md:33:The session layer provides all session-related operations for the Spec Kit Memory MCP server. It prevents duplicate context injection (saving ~50% tokens on follow-up queries) and enables crash recovery with immediate SQLite persistence.
.opencode/skills/system-spec-kit/mcp_server/lib/session/README.md:35:Gate E alignment: operator-facing recovery now anchors on `/spec_kit:resume`, with canonical continuity rebuilt from `handover.md -> _memory.continuity -> spec docs`. Session persistence in this directory supports that flow, but it is not a separate continuity source.
.opencode/skills/system-spec-kit/mcp_server/lib/session/README.md:51:| **Crash Recovery** | Immediate SQLite persistence backing `/spec_kit:resume` recovery |
.opencode/skills/system-spec-kit/mcp_server/lib/session/README.md:65: session-manager.ts  # Session deduplication, crash recovery, state management (~28KB)
.opencode/skills/system-spec-kit/mcp_server/lib/session/README.md:73:| `session-manager.ts` | Core session tracking, deduplication, and state persistence used by resume/recovery flows |
.opencode/skills/system-spec-kit/mcp_server/lib/session/README.md:122:Upstream recovery surfaces can rebuild continuity from persisted session state plus:
.opencode/skills/system-spec-kit/mcp_server/lib/session/README.md:127:- The canonical recovery chain: `handover.md -> _memory.continuity -> spec docs`
.opencode/skills/system-spec-kit/mcp_server/lib/session/README.md:163:// Get details for recovery UI
.opencode/skills/system-spec-kit/mcp_server/tool-schemas.ts:48:  description: '[L1:Orchestration] Unified entry point for context retrieval with intent-aware routing. START HERE for most context-retrieval operations across indexed spec docs and constitutional rules. For session recovery, use mode: \'resume\' with profile: \'resume\'. Automatically detects task intent (add_feature, fix_bug, refactor, security_audit, understand, find_spec, find_decision) and routes to optimal retrieval strategy. Modes: auto (default), quick (trigger-based), deep (comprehensive), focused (intent-optimized), resume (session recovery). Token Budget: 3500. For code search by concept/intent, prefer mcp__cocoindex_code__search (CocoIndex). For structural code queries (callers, imports), prefer code_graph_query.',
.opencode/skills/system-spec-kit/mcp_server/tool-schemas.ts:49:  inputSchema: { type: 'object', additionalProperties: false, properties: { input: { type: 'string', minLength: 1, description: 'The query, prompt, or context description (required)' }, mode: { type: 'string', enum: ['auto', 'quick', 'deep', 'focused', 'resume'], default: 'auto', description: 'Context retrieval mode: auto (detect intent), quick (fast triggers), deep (comprehensive search), focused (intent-optimized), resume (session recovery)' }, intent: { type: 'string', enum: ['add_feature', 'fix_bug', 'refactor', 'security_audit', 'understand', 'find_spec', 'find_decision'], description: 'Explicit task intent. If not provided and mode=auto, intent is auto-detected from input.' }, specFolder: { type: 'string', description: 'Limit context to specific spec folder' }, tenantId: { type: 'string', description: 'Tenant boundary for governed retrieval when memory_context routes to memory_search.' }, userId: { type: 'string', description: 'User boundary for governed retrieval when memory_context routes to memory_search.' }, agentId: { type: 'string', description: 'Agent boundary for governed retrieval when memory_context routes to memory_search.' }, limit: { type: 'number', minimum: 1, maximum: 100, description: 'Maximum results (mode-specific defaults apply)' }, sessionId: { type: 'string', description: 'Optional server-issued session identifier for working-memory continuity. When provided, it must match an existing server-managed session or the call is rejected. Omit it to let the server generate a new session for this request.' }, enableDedup: { type: 'boolean', default: true, description: 'Enable session deduplication' }, includeContent: { type: 'boolean', default: false, description: 'Include full file content in results' }, includeTrace: { type: 'boolean', default: false, description: 'Include provenance-rich trace data (scores, source, trace) in results when underlying memory_search is called' }, tokenUsage: { type: 'number', minimum: 0.0, maximum: 1.0, description: "Optional caller token usage ratio (0.0-1.0)" }, anchors: { type: 'array', items: { type: 'string' }, description: 'Filter content to specific anchors (e.g., ["state", "next-steps"] for resume mode)' }, profile: { type: 'string', enum: ['quick', 'research', 'resume', 'debug'], description: 'Optional response profile formatter. Returns a reduced or mode-aware response shape when profile formatting is enabled.' } }, required: ['input'] },
.opencode/skills/system-spec-kit/mcp_server/tool-schemas.ts:55:  description: '[L2:Core] Search indexed spec-doc continuity semantically using vector similarity. Returns ranked results with similarity scores. Constitutional tier rules are ALWAYS included at the top of results (~2000 tokens max), regardless of query. Requires query (string), concepts (array of 2-5 strings), or cursor (string) for continuation pagination. Supports intent-aware retrieval (REQ-006) with task-specific weight adjustments. When implicit feedback logging is enabled, searches also emit shadow-only feedback signals such as search_shown and, for includeContent runs, result_cited. Token Budget: 3500. For code search by concept/intent, prefer mcp__cocoindex_code__search (CocoIndex). For structural code queries (callers, imports), prefer code_graph_query.',
.opencode/skills/system-spec-kit/mcp_server/tool-schemas.ts:450:        description: 'Evaluation mode. Defaults to ablation; use k_sensitivity for raw pre-fusion RRF K analysis.'
.opencode/skills/system-spec-kit/mcp_server/tool-schemas.ts:454:        items: { type: 'string', enum: ['vector', 'bm25', 'fts5', 'graph', 'trigger'] },
.opencode/skills/system-spec-kit/mcp_server/tool-schemas.ts:759:  description: '[L1:Orchestration] Resume session with combined memory, code graph, and CocoIndex status in a single call. Use when you want the detailed merged resume payload directly. For the canonical first-call recovery path on session start or after /clear, prefer session_bootstrap. Use minimal: true to skip the heavy memory context call and return code graph, CocoIndex, structural context, hints, and session-quality metadata without the full memory payload.',
.opencode/skills/system-spec-kit/mcp_server/tool-schemas.ts:765:      sessionId: { type: 'string', description: 'Optional session ID for targeted recovery (advanced)' },
.opencode/skills/system-spec-kit/mcp_server/tool-schemas.ts:775:  description: '[L1:Orchestration] Complete session bootstrap in one call. Returns session context, system health, structural readiness, and recommended next actions. This is the canonical first recovery call on session start or after /clear; it wraps the full session_resume payload plus session_health.',
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation-bridge.vitest.ts:11:  vectorSearch: vi.fn(() => []),
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation-bridge.vitest.ts:13:  bm25RemoveDocument: vi.fn(() => true),
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation-bridge.vitest.ts:14:  bm25AddDocument: vi.fn(),
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation-bridge.vitest.ts:15:  bm25GetIndex: vi.fn(),
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation-bridge.vitest.ts:16:  bm25Enabled: vi.fn(() => false),
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation-bridge.vitest.ts:19:vi.mock('../lib/search/vector-index', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation-bridge.vitest.ts:20:  vectorSearch: bridgeMocks.vectorSearch,
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation-bridge.vitest.ts:28:vi.mock('../lib/search/bm25-index', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation-bridge.vitest.ts:29:  isBm25Enabled: bridgeMocks.bm25Enabled,
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation-bridge.vitest.ts:30:  buildBm25DocumentText: vi.fn(() => 'bm25 text'),
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation-bridge.vitest.ts:31:  getIndex: bridgeMocks.bm25GetIndex,
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation-bridge.vitest.ts:100:    bridgeMocks.vectorSearch.mockReset();
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation-bridge.vitest.ts:101:    bridgeMocks.vectorSearch.mockReturnValue([]);
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation-bridge.vitest.ts:104:    bridgeMocks.bm25RemoveDocument.mockReset();
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation-bridge.vitest.ts:105:    bridgeMocks.bm25RemoveDocument.mockReturnValue(true);
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation-bridge.vitest.ts:106:    bridgeMocks.bm25AddDocument.mockReset();
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation-bridge.vitest.ts:107:    bridgeMocks.bm25GetIndex.mockReset();
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation-bridge.vitest.ts:108:    bridgeMocks.bm25GetIndex.mockReturnValue({
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation-bridge.vitest.ts:109:      removeDocument: bridgeMocks.bm25RemoveDocument,
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation-bridge.vitest.ts:110:      addDocument: bridgeMocks.bm25AddDocument,
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation-bridge.vitest.ts:112:    bridgeMocks.bm25Enabled.mockReset();
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation-bridge.vitest.ts:113:    bridgeMocks.bm25Enabled.mockReturnValue(false);
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation-bridge.vitest.ts:153:    expect(bridgeMocks.vectorSearch).not.toHaveBeenCalled();
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation-bridge.vitest.ts:217:    bridgeMocks.bm25Enabled.mockReturnValue(true);
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation-bridge.vitest.ts:218:    bridgeMocks.vectorSearch.mockReturnValue([
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation-bridge.vitest.ts:252:    expect(bridgeMocks.bm25RemoveDocument).not.toHaveBeenCalled();
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation-bridge.vitest.ts:267:    bridgeMocks.vectorSearch.mockReturnValue([
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation-bridge.vitest.ts:333:    bridgeMocks.bm25Enabled.mockReturnValue(true);
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation-bridge.vitest.ts:334:    bridgeMocks.bm25AddDocument
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation-bridge.vitest.ts:336:        throw new Error('initial conflict-store bm25 failure');
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation-bridge.vitest.ts:339:        throw new Error('repair conflict-store bm25 failure');
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation-bridge.vitest.ts:390:    expect(bridgeMocks.bm25AddDocument).toHaveBeenCalledTimes(2);
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation-bridge.vitest.ts:391:    expect(bridgeMocks.bm25RemoveDocument).toHaveBeenCalledWith('901');
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation-bridge.vitest.ts:404:        'BM25 repair failed after recon conflict store for memory 901: repair conflict-store bm25 failure',
.opencode/skills/system-spec-kit/mcp_server/tests/score-normalization.vitest.ts:70:   1. RRF Score Normalization
.opencode/skills/system-spec-kit/mcp_server/tests/score-normalization.vitest.ts:73:describe('RRF Score Normalization (T004)', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/score-normalization.vitest.ts:229:        makeList('vector', [1, 2, 3, 4, 5]),
.opencode/skills/system-spec-kit/mcp_server/tests/score-normalization.vitest.ts:230:        makeList('bm25', [3, 1, 5, 6, 7]),
.opencode/skills/system-spec-kit/mcp_server/tests/score-normalization.vitest.ts:250:        makeList('vector', [1, 2, 3]),
.opencode/skills/system-spec-kit/mcp_server/tests/score-normalization.vitest.ts:251:        makeList('bm25', [2, 3, 4]),
.opencode/skills/system-spec-kit/mcp_server/tests/score-normalization.vitest.ts:267:        makeList('vector', [1, 2]),
.opencode/skills/system-spec-kit/mcp_server/tests/score-normalization.vitest.ts:281:        makeList('vector', [1, 2, 3]),
.opencode/skills/system-spec-kit/mcp_server/tests/score-normalization.vitest.ts:282:        makeList('bm25', [2, 3, 4]),
.opencode/skills/system-spec-kit/mcp_server/tests/score-normalization.vitest.ts:285:        makeList('vector', [3, 5, 1]),
.opencode/skills/system-spec-kit/mcp_server/tests/score-normalization.vitest.ts:286:        makeList('bm25', [1, 5, 6]),
.opencode/skills/system-spec-kit/mcp_server/tests/score-normalization.vitest.ts:373:    makeList('vector', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]),
.opencode/skills/system-spec-kit/mcp_server/tests/score-normalization.vitest.ts:374:    makeList('bm25', [3, 1, 5, 7, 2, 9, 10, 4, 6, 8]),
.opencode/skills/system-spec-kit/mcp_server/tests/score-normalization.vitest.ts:375:    makeList('fts', [5, 3, 7, 1, 9, 2, 8, 10, 4, 6]),
.opencode/skills/system-spec-kit/mcp_server/tests/score-normalization.vitest.ts:456:      makeList('vector', [1, 2]),
.opencode/skills/system-spec-kit/mcp_server/tests/score-normalization.vitest.ts:457:      makeList('bm25', [1, 2]),
.opencode/skills/system-spec-kit/mcp_server/tests/score-normalization.vitest.ts:460:      makeList('vector', [3, 4]),
.opencode/skills/system-spec-kit/mcp_server/tests/score-normalization.vitest.ts:461:      makeList('bm25', [4, 3]),
.opencode/skills/system-spec-kit/mcp_server/tests/score-normalization.vitest.ts:527:    // Baseline top-5: [1,2,3,4,5]. Candidate shifts them all down by 5 positions.
.opencode/skills/system-spec-kit/mcp_server/lib/session/session-snapshot.ts:35: * Single source of truth for structural context in startup/recovery flows.
.opencode/skills/system-spec-kit/mcp_server/tests/interfaces.vitest.ts:3:import { IVectorStore } from '../lib/interfaces/vector-store';
.opencode/skills/system-spec-kit/mcp_server/tests/interfaces.vitest.ts:5:// Because vector-index-impl.js has deep dependency chain (format-helpers, etc.)
.opencode/skills/system-spec-kit/mcp_server/tests/interfaces.vitest.ts:479:    it('SQLiteVectorStore is exported from vector-index', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/interfaces.vitest.ts:480:      // Requires: import { SQLiteVectorStore } from '../lib/search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/lib/generation.ts:32:  readonly recoveryPath: AdvisorGenerationRecoveryPath | null;
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/lib/generation.ts:65:    recoveryPath: null,
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/lib/generation.ts:75:    recoveryPath: 'regenerate',
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/lib/generation.ts:88:    recoveryPath: 'unrecoverable',
.opencode/skills/system-spec-kit/mcp_server/tests/provenance-envelope.vitest.ts:157:vi.mock('../lib/search/recovery-payload', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/provenance-envelope.vitest.ts:202:      searchType: overrides.searchType ?? 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/provenance-envelope.vitest.ts:210:      searchType: 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/provenance-envelope.vitest.ts:308:      { searchType: 'hybrid', enableCausalBoost: true },
.opencode/skills/system-spec-kit/mcp_server/tests/provenance-envelope.vitest.ts:397:    ], 'hybrid');
.opencode/skills/system-spec-kit/mcp_server/tests/search-results-format.vitest.ts:152:      retrievalTrace: { stages: [{ stage: 'routing', metadata: { channel: 'vector' } }] },
.opencode/skills/system-spec-kit/mcp_server/tests/search-results-format.vitest.ts:158:      stages: [{ stage: 'routing', metadata: { channel: 'vector' } }],
.opencode/skills/system-spec-kit/mcp_server/tests/search-results-format.vitest.ts:437:      source: 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/search-results-format.vitest.ts:438:      sources: ['vector', 'fts'],
.opencode/skills/system-spec-kit/mcp_server/tests/search-results-format.vitest.ts:459:    expect(trace?.channelsUsed).toEqual(expect.arrayContaining(['vector', 'fts', 'trigger']));
.opencode/skills/system-spec-kit/mcp_server/tests/reranker-eval-comparison.vitest.ts:26:    query: 'how does the hybrid search pipeline work',
.opencode/skills/system-spec-kit/mcp_server/tests/reranker-eval-comparison.vitest.ts:72:    { id: 101, content: 'Hybrid search pipeline runs lexical retrieval, vector retrieval, and reranking in sequence. '.repeat(2) },
.opencode/skills/system-spec-kit/mcp_server/lib/session/context-metrics.ts:33:    recovery: number;       // 1.0 if memory recovered this session
.opencode/skills/system-spec-kit/mcp_server/lib/session/context-metrics.ts:41:  | 'memory_recovery'
.opencode/skills/system-spec-kit/mcp_server/lib/session/context-metrics.ts:100:    case 'memory_recovery':
.opencode/skills/system-spec-kit/mcp_server/lib/session/context-metrics.ts:173:/** Compute recovery factor: 1.0 if any memory recovery call, 0.0 otherwise. */
.opencode/skills/system-spec-kit/mcp_server/lib/session/context-metrics.ts:210:    recovery: computeRecovery(),
.opencode/skills/system-spec-kit/mcp_server/lib/session/context-metrics.ts:224:  //   recovery (0.20)      — A memory_context({ mode: "resume" }) call is the most
.opencode/skills/system-spec-kit/mcp_server/lib/session/context-metrics.ts:229:  //                          outdated symbols. Tied with recovery because both are
.opencode/skills/system-spec-kit/mcp_server/lib/session/context-metrics.ts:235:    factors.recovery * 0.20 +
.opencode/skills/system-spec-kit/mcp_server/hooks/gemini/compact-cache.ts:158:      'Do not reuse recovery wrapper text as session-state evidence.',
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/tests/scorer/native-scorer.vitest.ts:197:      skill({ id: 'derived-only', derivedTriggers: ['weak derived route'] }),
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/tests/scorer/native-scorer.vitest.ts:200:    const result = scoreAdvisorPrompt('weak derived route', {
.opencode/skills/system-spec-kit/mcp_server/tests/regression-010-index-large-files.vitest.ts:141:    const vectorIndex = await import('../lib/search/vector-index');
.opencode/skills/system-spec-kit/mcp_server/tests/regression-010-index-large-files.vitest.ts:142:    vectorIndex.initializeDb(dbPath);
.opencode/skills/system-spec-kit/mcp_server/tests/regression-010-index-large-files.vitest.ts:144:    const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/tests/regression-010-index-large-files.vitest.ts:156:    vectorIndex.closeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/regression-010-index-large-files.vitest.ts:198:    const vectorIndex = await import('../lib/search/vector-index');
.opencode/skills/system-spec-kit/mcp_server/tests/regression-010-index-large-files.vitest.ts:202:    vectorIndex.initializeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/regression-010-index-large-files.vitest.ts:203:    const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/tests/regression-010-index-large-files.vitest.ts:231:    vectorIndex.closeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/regression-010-index-large-files.vitest.ts:240:    vi.doMock('../lib/search/vector-index', async (importOriginal) => {
.opencode/skills/system-spec-kit/mcp_server/tests/regression-010-index-large-files.vitest.ts:241:      const actual = await importOriginal<typeof import('../lib/search/vector-index')>();
.opencode/skills/system-spec-kit/mcp_server/tests/regression-010-index-large-files.vitest.ts:264:      vi.doUnmock('../lib/search/vector-index');
.opencode/skills/system-spec-kit/mcp_server/tests/regression-010-index-large-files.vitest.ts:274:    const vectorIndex = await import('../lib/search/vector-index');
.opencode/skills/system-spec-kit/mcp_server/tests/regression-010-index-large-files.vitest.ts:278:    vectorIndex.initializeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/regression-010-index-large-files.vitest.ts:279:    const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/tests/regression-010-index-large-files.vitest.ts:308:    vectorIndex.closeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/regression-010-index-large-files.vitest.ts:317:    const vectorIndex = await import('../lib/search/vector-index');
.opencode/skills/system-spec-kit/mcp_server/tests/regression-010-index-large-files.vitest.ts:321:    vectorIndex.initializeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/regression-010-index-large-files.vitest.ts:322:    const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/tests/regression-010-index-large-files.vitest.ts:355:      vectorIndex.closeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/regression-010-index-large-files.vitest.ts:365:    const vectorIndex = await import('../lib/search/vector-index');
.opencode/skills/system-spec-kit/mcp_server/tests/regression-010-index-large-files.vitest.ts:369:    vectorIndex.initializeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/regression-010-index-large-files.vitest.ts:370:    const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/tests/regression-010-index-large-files.vitest.ts:401:      vectorIndex.closeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/regression-010-index-large-files.vitest.ts:410:    const vectorIndex = await import('../lib/search/vector-index');
.opencode/skills/system-spec-kit/mcp_server/tests/regression-010-index-large-files.vitest.ts:414:    vectorIndex.initializeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/regression-010-index-large-files.vitest.ts:415:    const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/tests/regression-010-index-large-files.vitest.ts:438:    vectorIndex.closeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/regression-010-index-large-files.vitest.ts:447:    const vectorIndex = await import('../lib/search/vector-index');
.opencode/skills/system-spec-kit/mcp_server/tests/regression-010-index-large-files.vitest.ts:452:    vectorIndex.initializeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/regression-010-index-large-files.vitest.ts:453:    const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/tests/regression-010-index-large-files.vitest.ts:456:    core.init({ vectorIndex, checkpoints });
.opencode/skills/system-spec-kit/mcp_server/tests/regression-010-index-large-files.vitest.ts:507:    vectorIndex.closeDb();
.opencode/skills/system-spec-kit/mcp_server/hooks/claude/session-prime.ts:395:  // output was handed off, so compact recovery cannot be dropped early.
.opencode/skills/system-spec-kit/mcp_server/tests/anchor-metadata.vitest.ts:73:        'We decided to use RRF over BM25.',        // line 2
.opencode/skills/system-spec-kit/mcp_server/hooks/gemini/session-prime.ts:277:      // in case BeforeAgent injects a one-shot compact recovery
.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:388:  it('should expose crash recovery exports without initializing a database', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:413:        contextSummary: 'Crash recovery tests now run without SQLite fixtures.',
.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:430:        context_summary: 'Crash recovery tests now run without SQLite fixtures.',
.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:481:        currentTask: 'resume crash recovery verification',
.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:506:        specFolder: 'specs/022-hybrid-rag-fusion',
.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:509:        contextSummary: 'Need to resume from the saved recovery packet.',
.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:519:      expect(content).toContain('/spec_kit:resume specs/022-hybrid-rag-fusion');
.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:537:    it('should write CONTINUE_SESSION.md to spec folder even when SQLite recovery is unavailable', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:538:      const specFolderPath = makeTempDir('crash-recovery');
.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:557:        contextSummary: 'Persist state and write recovery markdown.',
.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:769:    it('should set session to active after recovery', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:827:  describe('transaction-manager crash recovery integration', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:874:describe('code-graph SQLite recovery', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:878:    tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'cg-recovery-'));
.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:963:  it('recovery after corrupted DB file', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/graph-search-fn.vitest.ts:23:    fts_score: number;
.opencode/skills/system-spec-kit/mcp_server/tests/graph-search-fn.vitest.ts:32:    fts_score: 1,
.opencode/skills/system-spec-kit/mcp_server/tests/graph-search-fn.vitest.ts:224:      if (sql.includes("name='memory_fts'")) {
.opencode/skills/system-spec-kit/mcp_server/tests/graph-search-fn.vitest.ts:247:    mockGet.mockReturnValue({ name: 'memory_fts' });
.opencode/skills/system-spec-kit/mcp_server/tests/graph-search-fn.vitest.ts:249:      makeCausalRow({ source_id: '1', target_id: '2', strength: 0.5, fts_score: 4 }),
.opencode/skills/system-spec-kit/mcp_server/tests/graph-search-fn.vitest.ts:250:      makeCausalRow({ source_id: '3', target_id: '4', strength: 0.5, fts_score: 1 }),
.opencode/skills/system-spec-kit/mcp_server/tests/graph-search-fn.vitest.ts:259:    expect(results[0]?.['ftsScore']).toBe(4);
.opencode/skills/system-spec-kit/mcp_server/tests/graph-search-fn.vitest.ts:263:    mockGet.mockReturnValue({ name: 'memory_fts' });
.opencode/skills/system-spec-kit/mcp_server/tests/graph-search-fn.vitest.ts:265:      makeCausalRow({ source_id: '9', target_id: '10', strength: 0.8, fts_score: 1 }),
.opencode/skills/system-spec-kit/mcp_server/tests/graph-search-fn.vitest.ts:266:      makeCausalRow({ source_id: '9', target_id: '11', strength: 0.5, fts_score: 3 }),
.opencode/skills/system-spec-kit/mcp_server/tests/graph-search-fn.vitest.ts:312:      const vectorIndex = {
.opencode/skills/system-spec-kit/mcp_server/tests/graph-search-fn.vitest.ts:316:        vectorSearch: vi.fn(),
.opencode/skills/system-spec-kit/mcp_server/tests/graph-search-fn.vitest.ts:320:        vectorIndex,
.opencode/skills/system-spec-kit/mcp_server/tests/graph-search-fn.vitest.ts:323:        hybridSearch: { init: vi.fn() },
.opencode/skills/system-spec-kit/mcp_server/tests/pe-gating.vitest.ts:3:import * as vectorIndex from '../lib/search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/tests/pe-gating.vitest.ts:36:  it('expands the vector window until an in-scope match is found', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/pe-gating.vitest.ts:37:    const vectorSearchSpy = vi.spyOn(vectorIndex, 'vectorSearch')
.opencode/skills/system-spec-kit/mcp_server/tests/pe-gating.vitest.ts:44:        ] as ReturnType<typeof vectorIndex.vectorSearch>;
.opencode/skills/system-spec-kit/mcp_server/tests/pe-gating.vitest.ts:60:        ] as ReturnType<typeof vectorIndex.vectorSearch>;
.opencode/skills/system-spec-kit/mcp_server/tests/pe-gating.vitest.ts:69:    expect(vectorSearchSpy).toHaveBeenCalledTimes(2);
.opencode/skills/system-spec-kit/mcp_server/tests/pe-gating.vitest.ts:81:    const vectorSearchSpy = vi.spyOn(vectorIndex, 'vectorSearch')
.opencode/skills/system-spec-kit/mcp_server/tests/pe-gating.vitest.ts:88:        ] as ReturnType<typeof vectorIndex.vectorSearch>;
.opencode/skills/system-spec-kit/mcp_server/tests/pe-gating.vitest.ts:97:    expect(vectorSearchSpy).toHaveBeenCalledTimes(1);
.opencode/skills/system-spec-kit/mcp_server/lib/interfaces/README.md:3:description: "Protocol abstractions for embedding/vector backends, with shared-package migration notes."
.opencode/skills/system-spec-kit/mcp_server/lib/interfaces/README.md:7:  - "vector store interface"
.opencode/skills/system-spec-kit/mcp_server/lib/interfaces/README.md:12:> Protocol abstractions for embedding/vector backends, with shared-package migration notes.
.opencode/skills/system-spec-kit/mcp_server/lib/interfaces/README.md:32:The interfaces module documents contracts for embedding providers and vector stores. Most interfaces now live in `@spec-kit/shared`; this local module remains the compatibility layer and local vector-store stub.
.opencode/skills/system-spec-kit/mcp_server/lib/interfaces/README.md:53:> **Note**: Most source files (`embedding-provider.ts`, `index.ts`) were relocated to `@spec-kit/shared` during the shared package migration. `vector-store.ts` remains as a local stub/re-export.
.opencode/skills/system-spec-kit/mcp_server/lib/interfaces/README.md:57:├── vector-store.ts         # Vector store interface (stub/re-export from @spec-kit/shared)
.opencode/skills/system-spec-kit/mcp_server/lib/interfaces/README.md:66:| `vector-store.ts` | **Remains locally** (stub/re-export) |
.opencode/skills/system-spec-kit/mcp_server/lib/interfaces/README.md:82:| `IVectorStore` | `vector-store.ts` | Abstract base class for JS runtime consumers; subclasses must implement search/upsert/delete/get/stats/availability/dimension/close |
.opencode/skills/system-spec-kit/mcp_server/lib/interfaces/README.md:102:import { IVectorStore } from './vector-store';
.opencode/skills/system-spec-kit/mcp_server/lib/interfaces/README.md:119:import { IVectorStore } from './vector-store';
.opencode/skills/system-spec-kit/mcp_server/lib/interfaces/README.md:141:| [./vector-store.ts](./vector-store.ts) | Local runtime abstract class contract |
.opencode/skills/system-spec-kit/mcp_server/lib/interfaces/README.md:142:| [../search/vector-index-impl.ts](../search/vector-index-impl.ts) | Main in-repo `IVectorStore` implementation |
.opencode/skills/system-spec-kit/mcp_server/tests/content-normalizer.vitest.ts:523:    const input = '---\ntitle: bm25\n---\nKeyword content.';
.opencode/skills/system-spec-kit/mcp_server/handlers/save/atomic-index-memory.ts:204:        : 'Original file rollback failed after rejection; manual recovery may be required',
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-search.vitest.ts:7:import * as vectorIndex from '../lib/search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-search.vitest.ts:38:    vectorIndex.closeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-search.vitest.ts:39:    vectorIndex.initializeDb(':memory:');
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-search.vitest.ts:43:    vectorIndex.closeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-search.vitest.ts:182:        lexicalPath: 'fts5',
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-search.vitest.ts:192:    expect(data?.lexicalPath).toBe('fts5');
.opencode/skills/system-spec-kit/mcp_server/lib/interfaces/vector-store.ts:7:// This file exists for plain-JS files (e.g., vector-index-impl.js)
.opencode/skills/system-spec-kit/mcp_server/lib/interfaces/vector-store.ts:10: * Abstract base class for vector store implementations.
.opencode/skills/system-spec-kit/mcp_server/hooks/gemini/README.md:15:- `session-prime.ts` formats startup, resume, clear, and compact recovery context.
.opencode/skills/system-spec-kit/mcp_server/hooks/gemini/README.md:16:- `compact-inject.ts` prepares compaction-time recovery payloads.
.opencode/skills/system-spec-kit/mcp_server/hooks/gemini/README.md:22:These hooks keep the canonical recovery chain aligned with `handover.md`, `_memory.continuity`, and packet docs.
.opencode/skills/system-spec-kit/mcp_server/hooks/claude/README.md:55:For packet work, the operator-facing recovery surface remains `/spec_kit:resume`, with continuity rebuilt from `handover.md -> _memory.continuity -> spec docs`.
.opencode/skills/system-spec-kit/mcp_server/handlers/save/create-record.ts:7:import * as vectorIndex from '../../lib/search/vector-index.js';
.opencode/skills/system-spec-kit/mcp_server/handlers/save/create-record.ts:8:import * as bm25Index from '../../lib/search/bm25-index.js';
.opencode/skills/system-spec-kit/mcp_server/handlers/save/create-record.ts:311:      ? vectorIndex.indexMemory({
.opencode/skills/system-spec-kit/mcp_server/handlers/save/create-record.ts:327:      : vectorIndex.indexMemoryDeferred({
.opencode/skills/system-spec-kit/mcp_server/handlers/save/create-record.ts:398:    if (bm25Index.isBm25Enabled()) {
.opencode/skills/system-spec-kit/mcp_server/handlers/save/create-record.ts:400:        const bm25 = bm25Index.getIndex();
.opencode/skills/system-spec-kit/mcp_server/handlers/save/create-record.ts:401:        bm25.addDocument(String(memory_id), bm25Index.buildBm25DocumentText({
.opencode/skills/system-spec-kit/mcp_server/handlers/save/create-record.ts:407:      } catch (bm25_err: unknown) {
.opencode/skills/system-spec-kit/mcp_server/handlers/save/create-record.ts:408:        const message = toErrorMessage(bm25_err);
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-ablation-drift.vitest.ts:5:  hybridRows: [] as Array<Record<string, unknown>>,
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-ablation-drift.vitest.ts:10:  bm25Search: vi.fn(),
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-ablation-drift.vitest.ts:15:  ftsSearch: vi.fn(),
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-ablation-drift.vitest.ts:24:  hybridSearchEnhanced: vi.fn(),
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-ablation-drift.vitest.ts:31:  vectorSearch: vi.fn(),
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-ablation-drift.vitest.ts:50:vi.mock('../lib/search/vector-index', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-ablation-drift.vitest.ts:55:  vectorSearch: mocks.vectorSearch,
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-ablation-drift.vitest.ts:58:vi.mock('../lib/search/hybrid-search', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-ablation-drift.vitest.ts:59:  bm25Search: mocks.bm25Search,
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-ablation-drift.vitest.ts:60:  ftsSearch: mocks.ftsSearch,
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-ablation-drift.vitest.ts:61:  hybridSearchEnhanced: mocks.hybridSearchEnhanced,
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-ablation-drift.vitest.ts:176:    mockState.hybridRows = [
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-ablation-drift.vitest.ts:206:    mocks.bm25Search.mockReturnValue([]);
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-ablation-drift.vitest.ts:211:    mocks.ftsSearch.mockReturnValue([]);
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-ablation-drift.vitest.ts:226:    mocks.hybridSearchEnhanced.mockImplementation(async () => mockState.hybridRows);
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-ablation-drift.vitest.ts:232:      useVector: !disabledChannels.has('vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-ablation-drift.vitest.ts:233:      useBm25: !disabledChannels.has('bm25'),
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-ablation-drift.vitest.ts:234:      useFts: !disabledChannels.has('fts5'),
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-ablation-drift.vitest.ts:241:        new Set(['vector'])
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-ablation-drift.vitest.ts:248:      expect(config.channels).toEqual(['vector']);
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-ablation-drift.vitest.ts:257:            channel: 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-ablation-drift.vitest.ts:274:    mocks.vectorSearch.mockReturnValue([]);
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-ablation-drift.vitest.ts:322:      channels: ['vector'],
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-ablation-drift.vitest.ts:327:    const hybridSearchOptions = mocks.hybridSearchEnhanced.mock.calls[0]?.[2];
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-ablation-drift.vitest.ts:331:      channel: 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-ablation-drift.vitest.ts:337:    expect(hybridSearchOptions).toMatchObject({
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-ablation-drift.vitest.ts:346:    expect('includeArchived' in hybridSearchOptions).toBe(false);
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-ablation-drift.vitest.ts:347:    expect(hybridSearchOptions.triggerPhrases).toBeUndefined();
.opencode/skills/system-spec-kit/mcp_server/tests/co-activation.vitest.ts:323:    // Production signature: populateRelatedMemories(memoryId, vectorSearchFn): Promise<number>
.opencode/skills/system-spec-kit/mcp_server/tests/co-activation.vitest.ts:336:  describe('C138: Post-RRF Pipeline Integration', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/session-health.vitest.ts:105:      recovery: 1,
.opencode/skills/system-spec-kit/mcp_server/handlers/save/types.ts:114: * filter or overfetch window dropped otherwise-relevant vector-search
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-integration.vitest.ts:10:import * as vectorIndex from '../lib/search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-integration.vitest.ts:144:    '<!-- ANCHOR:recovery-hints -->',
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-integration.vitest.ts:150:    '<!-- /ANCHOR:recovery-hints -->',
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-integration.vitest.ts:235:    '<!-- ANCHOR:recovery-hints -->',
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-integration.vitest.ts:241:    '<!-- /ANCHOR:recovery-hints -->',
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-integration.vitest.ts:319:  const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-integration.vitest.ts:342:    vectorIndex.closeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-integration.vitest.ts:346:  vectorIndex.initializeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-integration.vitest.ts:358:    vectorIndex.closeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-benchmark-session-resume.vitest.ts:34:    factors: { recency: 1, recovery: 1, graphFreshness: 1, continuity: 1 },
.opencode/skills/system-spec-kit/mcp_server/hooks/claude/compact-inject.ts:151:  // Hint for AI to use CocoIndex for semantic neighbors after recovery
.opencode/skills/system-spec-kit/mcp_server/hooks/claude/compact-inject.ts:227:  // Build cocoIndex input: semantic neighbor hint for post-recovery
.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:17: * matching the production schema from vector-index-impl.js.
.opencode/skills/system-spec-kit/mcp_server/handlers/save/README.md:45:| `create-record.ts`          | Core record creation. Inserts into vector index (or deferred index), applies post-insert metadata, links related memories and indexes into BM25 when enabled. |
.opencode/skills/system-spec-kit/mcp_server/handlers/save/README.md:60:6. create-record  -- Insert memory into vector + BM25 indexes
.opencode/skills/system-spec-kit/mcp_server/handlers/save/README.md:88:- `../../lib/search/vector-index.ts` -- vector index operations
.opencode/skills/system-spec-kit/mcp_server/handlers/save/README.md:89:- `../../lib/search/bm25-index.ts` -- BM25 full-text index
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-decay-policy.vitest.ts:195:    // When hybrid decay is OFF but classification decay is ON, applyHybridDecayPolicy
.opencode/skills/system-spec-kit/mcp_server/tests/handler-helpers.vitest.ts:457:    const vectorIndex = await import('../lib/search/vector-index');
.opencode/skills/system-spec-kit/mcp_server/tests/handler-helpers.vitest.ts:458:    vi.spyOn(vectorIndex, 'vectorSearch').mockReturnValue([
.opencode/skills/system-spec-kit/mcp_server/handlers/save/reconsolidation-bridge.ts:7:import * as vectorIndex from '../../lib/search/vector-index.js';
.opencode/skills/system-spec-kit/mcp_server/handlers/save/reconsolidation-bridge.ts:9:import * as bm25Index from '../../lib/search/bm25-index.js';
.opencode/skills/system-spec-kit/mcp_server/handlers/save/reconsolidation-bridge.ts:65:   * T-RCB-10 (R16-002): vector-search rows rejected as malformed — missing
.opencode/skills/system-spec-kit/mcp_server/handlers/save/reconsolidation-bridge.ts:72:   * T-RCB-09 (R12-003): original vector-search row count before scope/malformed
.opencode/skills/system-spec-kit/mcp_server/handlers/save/reconsolidation-bridge.ts:211:    const bm25 = bm25Index.getIndex();
.opencode/skills/system-spec-kit/mcp_server/handlers/save/reconsolidation-bridge.ts:212:    const documentText = bm25Index.buildBm25DocumentText({
.opencode/skills/system-spec-kit/mcp_server/handlers/save/reconsolidation-bridge.ts:219:    bm25.removeDocument(String(args.memoryId));
.opencode/skills/system-spec-kit/mcp_server/handlers/save/reconsolidation-bridge.ts:220:    bm25.addDocument(String(args.memoryId), documentText);
.opencode/skills/system-spec-kit/mcp_server/handlers/save/reconsolidation-bridge.ts:295: * T-RCB-10 (R16-002): reject malformed vector-search rows instead of coercing
.opencode/skills/system-spec-kit/mcp_server/handlers/save/reconsolidation-bridge.ts:351:  const rawCandidates = vectorIndex.vectorSearch(args.embedding, {
.opencode/skills/system-spec-kit/mcp_server/handlers/save/reconsolidation-bridge.ts:446:      `[memory-save] ${contextLabel}: rejected ${malformedCandidateCount} malformed vector-search row(s).`,
.opencode/skills/system-spec-kit/mcp_server/handlers/save/reconsolidation-bridge.ts:577:                const id = vectorIndex.indexMemory({
.opencode/skills/system-spec-kit/mcp_server/handlers/save/reconsolidation-bridge.ts:609:                if (bm25Index.isBm25Enabled()) {
.opencode/skills/system-spec-kit/mcp_server/handlers/save/reconsolidation-bridge.ts:611:                    const bm25 = bm25Index.getIndex();
.opencode/skills/system-spec-kit/mcp_server/handlers/save/reconsolidation-bridge.ts:612:                    bm25.addDocument(String(id), bm25Index.buildBm25DocumentText({
.opencode/skills/system-spec-kit/mcp_server/handlers/save/reconsolidation-bridge.ts:618:                  } catch (bm25Err: unknown) {
.opencode/skills/system-spec-kit/mcp_server/handlers/save/reconsolidation-bridge.ts:619:                    const message = toErrorMessage(bm25Err);
.opencode/skills/system-spec-kit/mcp_server/handlers/save/reconsolidation-bridge.ts:621:                    const bm25Warning = repairBm25Document({
.opencode/skills/system-spec-kit/mcp_server/handlers/save/reconsolidation-bridge.ts:629:                    if (bm25Warning) {
.opencode/skills/system-spec-kit/mcp_server/handlers/save/reconsolidation-bridge.ts:630:                      reconWarnings.push(bm25Warning);
.opencode/skills/system-spec-kit/mcp_server/handlers/save/reconsolidation-bridge.ts:778:      // Find the top similar memory using the existing vector search
.opencode/skills/system-spec-kit/mcp_server/handlers/save/reconsolidation-bridge.ts:799:        // vectorSearch returns similarity in [0, 100], normalise to [0, 1]
.opencode/skills/system-spec-kit/mcp_server/tests/stage2-fusion.vitest.ts:64:      searchType: 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/stage2-fusion.vitest.ts:72:      searchType: 'vector' as const,
.opencode/skills/system-spec-kit/mcp_server/tests/stage2-fusion.vitest.ts:392:    input.config.searchType = 'hybrid';
.opencode/skills/system-spec-kit/mcp_server/tests/stage2-fusion.vitest.ts:412:    input.config.searchType = 'hybrid';
.opencode/skills/system-spec-kit/mcp_server/tests/stage2-fusion.vitest.ts:424:    input.config.searchType = 'hybrid';
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/tests/legacy/advisor-freshness.vitest.ts:261:    expect(result.diagnostics?.recoveryPath).toBe('regenerate');
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/tests/legacy/advisor-freshness.vitest.ts:275:    expect(result.diagnostics?.recoveryPath).toBe('unrecoverable');
.opencode/skills/system-spec-kit/mcp_server/lib/validation/README.md:49:| **Duplicate Detection** | Exact (SHA-256 hash) and similar (vector similarity) duplicate finding |
.opencode/skills/system-spec-kit/mcp_server/lib/validation/README.md:182:| `cosineSimilarity(a, b)` | Cosine similarity between two vectors |
.opencode/skills/system-spec-kit/mcp_server/lib/validation/README.md:263:  findSimilar: (emb, opts) => vectorStore.search(emb, opts),
.opencode/skills/system-spec-kit/mcp_server/lib/validation/README.md:294:| [../errors/](../errors/) | Error codes and recovery hints |
.opencode/skills/system-spec-kit/mcp_server/tests/session-bootstrap.vitest.ts:198:      'Use `session_resume({ specFolder })` when you need the fuller merged recovery payload.',
.opencode/skills/system-spec-kit/mcp_server/tests/session-bootstrap.vitest.ts:199:      'Resume recovery follows `handover.md` -> `_memory.continuity` -> spec docs.',
.opencode/skills/system-spec-kit/mcp_server/tests/k-value-optimization.vitest.ts:290:  const originalFlag = process.env.SPECKIT_RRF_K_EXPERIMENTAL;
.opencode/skills/system-spec-kit/mcp_server/tests/k-value-optimization.vitest.ts:294:      delete process.env.SPECKIT_RRF_K_EXPERIMENTAL;
.opencode/skills/system-spec-kit/mcp_server/tests/k-value-optimization.vitest.ts:296:      process.env.SPECKIT_RRF_K_EXPERIMENTAL = originalFlag;
.opencode/skills/system-spec-kit/mcp_server/tests/k-value-optimization.vitest.ts:401:    process.env.SPECKIT_RRF_K_EXPERIMENTAL = 'false';
.opencode/skills/system-spec-kit/mcp_server/tests/k-value-optimization.vitest.ts:411:    process.env.SPECKIT_RRF_K_EXPERIMENTAL = 'true';
.opencode/skills/system-spec-kit/mcp_server/tests/short-critical-quality-gate.vitest.ts:82:    expect(countStructuralSignals({ title: null, specFolder: '022-hybrid-rag' })).toBe(1);
.opencode/skills/system-spec-kit/mcp_server/tests/short-critical-quality-gate.vitest.ts:92:      specFolder: '022-hybrid-rag',
.opencode/skills/system-spec-kit/mcp_server/tests/short-critical-quality-gate.vitest.ts:99:      specFolder: '022-hybrid-rag',
.opencode/skills/system-spec-kit/mcp_server/tests/short-critical-quality-gate.vitest.ts:122:      specFolder: '022-hybrid-rag',
.opencode/skills/system-spec-kit/mcp_server/tests/short-critical-quality-gate.vitest.ts:199:      specFolder: '022-hybrid-rag',
.opencode/skills/system-spec-kit/mcp_server/tests/short-critical-quality-gate.vitest.ts:218:      specFolder: '022-hybrid-rag',
.opencode/skills/system-spec-kit/mcp_server/tests/short-critical-quality-gate.vitest.ts:228:      specFolder: '022-hybrid-rag',
.opencode/skills/system-spec-kit/mcp_server/tests/short-critical-quality-gate.vitest.ts:301:      title: 'Decision: adopt FSRS hybrid decay',
.opencode/skills/system-spec-kit/mcp_server/tests/short-critical-quality-gate.vitest.ts:303:      specFolder: '022-hybrid-rag',
.opencode/skills/system-spec-kit/mcp_server/tests/short-critical-quality-gate.vitest.ts:315:      specFolder: '022-hybrid-rag',
.opencode/skills/system-spec-kit/mcp_server/tests/short-critical-quality-gate.vitest.ts:329:      specFolder: '022-hybrid-rag',
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:4:import * as hybridSearch from '../lib/search/hybrid-search';
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:5:import * as bm25Index from '../lib/search/bm25-index';
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:14:type InitDb = Parameters<typeof hybridSearch.init>[0];
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:15:type VectorSearchFn = NonNullable<Parameters<typeof hybridSearch.init>[1]>;
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:16:type GraphSearchFn = NonNullable<Parameters<typeof hybridSearch.init>[2]>;
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:17:type HybridSearchResult = Awaited<ReturnType<typeof hybridSearch.hybridSearchEnhanced>>[number];
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:18:type MaybeAsyncHybridResults = ReturnType<typeof hybridSearch.hybridSearchEnhanced> | HybridSearchResult[];
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:19:type HybridModuleExport = keyof typeof hybridSearch;
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:37:// Mock vector search function
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:70:          if (sql.includes('memory_fts')) {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:83:            fts_score: 10 - i,
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:96:          if (sql.includes('memory_fts')) {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:129:          if (sql.includes('memory_fts')) {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:164:          if (sql.includes('memory_fts')) {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:168:              fts_score: 10 - index,
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:176:              fts_score: 10 - index,
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:182:            fts_score: 10 - index,
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:196:): value is ReturnType<typeof hybridSearch.hybridSearchEnhanced> {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:224:          hybridSearch.init(null as unknown as InitDb, mockVectorSearch);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:228:    it('T031-INIT-02: init() accepts null vectorSearch', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:230:      // Init() does no validation — null vectorSearch is accepted (graceful degradation)
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:232:        hybridSearch.init(mockDb, null);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:239:        hybridSearch.init(mockDb, mockVectorSearch, mockGraphSearch);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:246:        hybridSearch.init(mockDb, mockVectorSearch);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:256:      bm25Index.resetIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:259:    it('T031-BM25-01: is_bm25_available() returns false when empty', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:260:      const available = hybridSearch.isBm25Available();
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:264:    it('T031-BM25-02: is_bm25_available() returns true when populated', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:265:      const bm25 = bm25Index.getIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:267:        bm25.addDocument(String(doc.id), doc.content);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:269:      const available = hybridSearch.isBm25Available();
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:273:    it('T031-BM25-03: bm25_search() returns results', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:274:      const bm25 = bm25Index.getIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:276:        bm25.addDocument(String(doc.id), doc.content);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:278:      const results = hybridSearch.bm25Search('authentication', { limit: 5 });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:283:    it('T031-BM25-04: bm25_search() results have score', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:284:      const bm25 = bm25Index.getIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:286:        bm25.addDocument(String(doc.id), doc.content);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:288:      const results = hybridSearch.bm25Search('authentication', { limit: 5 });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:293:    it('T031-BM25-05: bm25_search() respects limit option', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:294:      const bm25 = bm25Index.getIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:296:        bm25.addDocument(String(doc.id), doc.content);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:298:      const results = hybridSearch.bm25Search('authentication', { limit: 2 });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:302:    it('T031-BM25-06: bm25_search() respects spec_folder filter', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:303:      const bm25 = bm25Index.getIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:305:        bm25.addDocument(String(doc.id), doc.content);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:307:      const results = hybridSearch.bm25Search('module', { limit: 10, specFolder: 'specs/auth' });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:316:    it('T031-BM25-07: bm25_search() fails closed when scoped lookup throws', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:320:          if (sql.includes('memory_fts')) {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:347:      hybridSearch.init(failingDb, mockVectorSearch, mockGraphSearch);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:348:      const bm25 = bm25Index.getIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:350:        bm25.addDocument(String(doc.id), doc.content);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:353:      const results = hybridSearch.bm25Search('module', { limit: 10, specFolder: 'specs/auth' });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:369:      hybridSearch.init(mockDb, mockVectorSearch, mockGraphSearch);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:370:      bm25Index.resetIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:371:      const bm25 = bm25Index.getIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:373:        bm25.addDocument(String(doc.id), doc.content);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:378:      const results = hybridSearch.combinedLexicalSearch('authentication', { limit: 10 });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:384:      const results = hybridSearch.combinedLexicalSearch('authentication', { limit: 10 });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:390:      const results = hybridSearch.combinedLexicalSearch('authentication', { limit: 10 });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:392:        ['fts5', 'bm25', 'both'].includes(String(r.source)) ||
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:393:        typeof r.bm25Score === 'number' ||
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:394:        typeof r.fts_score === 'number'
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:400:      const results = hybridSearch.combinedLexicalSearch('authentication module', { limit: 10 });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:407:      const results = hybridSearch.combinedLexicalSearch('authentication module', { limit: 10 });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:409:        hybridSearch.__testables.canonicalResultId(r.id as number | string)
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:416:      const results = hybridSearch.combinedLexicalSearch('authentication', { limit: 10 });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:436:      hybridSearch.init(mockDb, mockVectorSearch, mockGraphSearch);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:437:      bm25Index.resetIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:438:      const bm25 = bm25Index.getIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:440:        bm25.addDocument(String(doc.id), doc.content);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:445:    it('T031-HYB-01: hybridSearchEnhanced() returns results', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:446:      const result = hybridSearch.hybridSearchEnhanced('authentication', mockEmbedding, { limit: 5 }) as MaybeAsyncHybridResults;
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:452:    it('T031-HYB-02: hybridSearchEnhanced() returns correct type', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:453:      const result = hybridSearch.hybridSearchEnhanced('authentication', mockEmbedding, { limit: 5 }) as MaybeAsyncHybridResults;
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:458:    it('T031-HYB-03: hybridSearchEnhanced() accepts useBm25=true', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:460:        hybridSearch.hybridSearchEnhanced('authentication', mockEmbedding, { limit: 5, useBm25: true });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:464:    it('T031-HYB-04: hybridSearchEnhanced() accepts useBm25=false', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:466:        hybridSearch.hybridSearchEnhanced('authentication', mockEmbedding, { limit: 5, useBm25: false });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:470:    it('T031-HYB-05: hybridSearchEnhanced() results have scores', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:471:      const result = hybridSearch.hybridSearchEnhanced('authentication', mockEmbedding, { limit: 5 }) as MaybeAsyncHybridResults;
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:483:    it('T031-HYB-06: hybridSearchEnhanced() has source tracking', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:484:      const results = await hybridSearch.hybridSearchEnhanced('authentication', mockEmbedding, { limit: 5 });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:493:    it('T031-HYB-07: hybridSearchEnhanced() respects limit option', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:494:      const results = await hybridSearch.hybridSearchEnhanced('authentication', mockEmbedding, { limit: 3 });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:500:    it('T031-HYB-08: hybridSearchEnhanced() filters results by specFolder', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:502:      const results = await hybridSearch.hybridSearchEnhanced('module', mockEmbedding, { limit: 10, specFolder: 'specs/auth' });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:512:    it('T031-HYB-09: hybridSearchEnhanced() accepts query string', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:513:      const results = await hybridSearch.hybridSearchEnhanced('test query', mockEmbedding, { limit: 5 });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:518:    it('T031-HYB-10: hybridSearchEnhanced() works with null embedding', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:520:        hybridSearch.hybridSearchEnhanced('test', null, { limit: 5 });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:529:        const results = await hybridSearch.hybridSearchEnhanced('authentication', mockEmbedding, { limit: 5 });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:546:  // 5.5 RRF FUSION INTEGRATION TESTS
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:548:  describe('RRF Fusion Integration Tests', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:554:      hybridSearch.init(mockDb, mockVectorSearch, mockGraphSearch);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:558:    it('T031-RRF-01: unified_search available from rrf-fusion', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:562:    it('T031-RRF-02: is_rrf_enabled available from rrf-fusion', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:566:    it('T031-RRF-03: SOURCE_TYPES available from rrf-fusion', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:571:    it('T031-RRF-04: hybridSearchEnhanced uses RRF fusion internally', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:573:        hybridSearch.hybridSearchEnhanced('test', mockEmbedding, { limit: 5 });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:586:      hybridSearch.init(mockDb, mockVectorSearch, null);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:590:    it('T031-BASIC-01: hybridSearch() returns result', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:591:      const result = hybridSearch.hybridSearch('authentication', mockEmbedding, { limit: 5 });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:595:    it('T031-BASIC-02: hybridSearch() returns correct type', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:596:      const result = hybridSearch.hybridSearch('authentication', mockEmbedding, { limit: 5 });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:600:    it('T031-BASIC-03: hybridSearch() has source tracking', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:602:        hybridSearch.hybridSearch('authentication', mockEmbedding, { limit: 5 });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:606:    it('T031-BASIC-04: hybridSearch() deduplicates canonical IDs across channels', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:607:      bm25Index.resetIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:608:      const bm25 = bm25Index.getIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:610:        bm25.addDocument(String(doc.id), doc.content);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:613:      const results = await hybridSearch.hybridSearch('authentication module', null, {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:620:      const canonicalIds = results.map((r) => hybridSearch.__testables.canonicalResultId(r.id));
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:634:      hybridSearch.init(mockDb, mockVectorSearch, null);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:639:      const result = hybridSearch.searchWithFallback('authentication', mockEmbedding, { limit: 5 });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:645:        hybridSearch.searchWithFallback('authentication', null, { limit: 5 });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:656:      hybridSearch.init(mockDb, mockVectorSearch, null);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:659:    it('T031-FTS-01: is_fts_available() returns boolean', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:660:      const available = hybridSearch.isFtsAvailable();
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:664:    it('T031-FTS-02: fts_search() returns array', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:665:      const results = hybridSearch.ftsSearch('authentication', { limit: 5 });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:669:    it('T031-FTS-03: fts_search() results have fts_score', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:670:      const results = hybridSearch.ftsSearch('authentication', { limit: 5 });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:672:        const hasScores = results.every((r: Record<string, unknown>) => typeof r.fts_score === 'number');
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:678:    it('T031-FTS-04: fts_search() escapes special characters', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:679:      const results = hybridSearch.ftsSearch('test*:query()', { limit: 5 });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:683:    it('T031-FTS-05: fts_search() escapes boolean operators', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:684:      const results = hybridSearch.ftsSearch('test AND query OR something NOT here', { limit: 5 });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:696:      'ftsSearch',
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:697:      'hybridSearch',
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:698:      'hybridSearchEnhanced',
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:700:        'bm25Search',
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:707:        expect(hybridSearch[name]).toBeDefined();
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:716:    it('T031-ERR-01: hybridSearchEnhanced() with valid init works', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:718:      hybridSearch.init(mockDb, mockVectorSearch, null);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:721:        hybridSearch.hybridSearchEnhanced('test', mockEmbedding, { limit: 5 });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:725:    it('T031-ERR-02: bm25_search() handles empty/disabled state gracefully', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:726:      bm25Index.resetIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:727:      const results = hybridSearch.bm25Search('test', { limit: 5 });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:731:    it('T031-ERR-03: fts_search() handles empty query', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:733:      hybridSearch.init(mockDb, mockVectorSearch, null);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:734:      const results = hybridSearch.ftsSearch('', { limit: 5 });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:740:      const results = hybridSearch.combinedLexicalSearch('xyzzy123nonexistent', { limit: 5 });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:747:  it('C138-T1: hybridSearch module exports hybridSearchEnhanced (pipeline entry)', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:748:    expect(typeof hybridSearch.hybridSearchEnhanced).toBe('function');
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:751:  it('C138-T2: hybridSearch module exports init function', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:752:    expect(typeof hybridSearch.init).toBe('function');
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:759:  it('C138-T4: RRF fusion accepts graph as a valid source', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:789:    hybridSearch.init(mockDb, mockVectorSearch, trackingGraphSearch);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:790:    bm25Index.resetIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:791:    const bm25 = bm25Index.getIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:793:      bm25.addDocument(String(doc.id), doc.content);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:808:    await hybridSearch.hybridSearchEnhanced('authentication', mockEmbedding, { limit: 10 });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:813:    await hybridSearch.hybridSearchEnhanced('authentication', mockEmbedding, { limit: 10, useGraph: false });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:818:    const results = await hybridSearch.hybridSearchEnhanced('authentication', mockEmbedding, { limit: 20 });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:824:    hybridSearch.resetGraphMetrics();
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:825:    await hybridSearch.hybridSearchEnhanced('authentication', mockEmbedding, { limit: 10 });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:826:    const metrics = hybridSearch.getGraphMetrics();
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:834:    const results = await hybridSearch.hybridSearchEnhanced('authentication', mockEmbedding, { limit: 10 });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:842:    // Use a vector search that returns nothing to force fallback scenarios
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:846:    hybridSearch.init(mockDb, emptyVectorSearch, null);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:847:    bm25Index.resetIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:849:    const results = await hybridSearch.searchWithFallback('authentication', null, { limit: 5 });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:861:    const lowRecallVectorSearch = () => [{ id: 1, similarity: 0.01, content: 'vector low confidence' }];
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:869:        hybridSearch.init(mockDb, lowRecallVectorSearch as VectorSearchFn, trackingGraphSearch as GraphSearchFn);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:871:      bm25Index.resetIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:872:      const bm25 = bm25Index.getIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:874:        bm25.addDocument(String(doc.id), doc.content);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:881:      await hybridSearch.searchWithFallback('auth', embedding, { limit: 1 });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:906:    bm25Index.resetIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:924:    hybridSearch.init(createMockDb(), recordingVectorSearch, null);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:926:    const results = await hybridSearch.searchWithFallback(
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:936:  it('T020: collectRawCandidates tiered fallback widens vector search with 30/10 percent floors', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:945:    hybridSearch.init(createMockDb(), recordingVectorSearch, null);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:947:    await hybridSearch.collectRawCandidates(
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:965:    hybridSearch.init(createMockDb(), thresholdAwareVectorSearch, null);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:967:    const results = await hybridSearch.collectRawCandidates(
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:984:    hybridSearch.init(createMockDb(), emptyVectorSearch, null);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:985:    bm25Index.resetIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:986:    const bm25 = bm25Index.getIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:988:      bm25.addDocument(String(doc.id), doc.content);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:991:    const results = await hybridSearch.searchWithFallback(
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1012:    hybridSearch.init(createMockDb(), thresholdAwareVectorSearch, null);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1015:      const results = await hybridSearch.searchWithFallback(
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1030:  const { mergeRawCandidate } = hybridSearch.__testables;
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1036:      source: 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1037:      sources: ['vector'],
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1038:      sourceScores: { vector: 0.5 },
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1039:      channelAttribution: ['vector'],
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1046:    expect((merged as Record<string, unknown>).sources).toEqual(['vector']);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1054:        source: 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1055:        sources: ['vector'],
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1056:        sourceScores: { vector: 0.5 },
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1057:        channelAttribution: ['vector'],
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1072:      expect.arrayContaining(['vector', 'graph'])
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1081:        source: 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1082:        sources: ['vector', 'fts', 'bm25', 'graph'],
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1084:          vector: 0.97,
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1085:          fts: 0.96,
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1086:          bm25: 0.95,
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1089:        channelAttribution: ['vector', 'fts', 'bm25', 'graph'],
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1104:      expect.arrayContaining(['vector', 'fts', 'bm25', 'graph', 'trigger'])
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1112:    const vectorOnlySearch: VectorSearchFn = () => ([
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1113:      { id: 1, similarity: 0.9, title: 'vector-first' },
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1117:    hybridSearch.init(degreeAwareDb, vectorOnlySearch, () => []);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1118:    bm25Index.resetIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1120:    const results = await hybridSearch.hybridSearchEnhanced(
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1138:    const vectorOnlySearch: VectorSearchFn = () => ([
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1139:      { id: 1, similarity: 0.9, title: 'vector-first' },
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1143:    hybridSearch.init(degreeAwareDb, vectorOnlySearch, () => [{ id: 2, score: 0.7 }]);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1144:    bm25Index.resetIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1146:    const results = await hybridSearch.hybridSearchEnhanced(
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1169:    hybridSearch.init(mockDb, mockVectorSearch, graphSearch);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1170:    bm25Index.resetIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1171:    const bm25 = bm25Index.getIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1173:      bm25.addDocument(String(doc.id), doc.content);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1176:    const results = await hybridSearch.hybridSearchEnhanced(
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1184:      return sources.includes('keyword') || sources.includes('bm25') || sources.includes('fts');
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1193:      expect(lexicalSources).not.toEqual(expect.arrayContaining(['fts', 'bm25']));
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1195:      expect(lexicalSources.some((source) => source === 'bm25' || source === 'fts')).toBe(true);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1199:  it('T316: MMR reuses vector-provided embeddings without querying vec_memories', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1210:            if (sql.includes('memory_fts')) {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1226:    const vectorWithEmbeddings: VectorSearchFn = () => [
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1232:      hybridSearch.init(mmrDb, vectorWithEmbeddings, null);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1233:      bm25Index.resetIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1235:      const results = await hybridSearch.hybridSearchEnhanced(
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1298:    const vectorSearch: VectorSearchFn = () => ([
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1305:    hybridSearch.init(promotionDb, vectorSearch, null);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1307:    bm25Index.resetIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1308:    const bm25 = bm25Index.getIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1310:      bm25.addDocument(String(doc.id), doc.content);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1313:    const results = await hybridSearch.hybridSearchEnhanced(
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1326:      source: 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1331:      sources: ['vector', 'keyword'],
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1334:        attribution: { sources: ['vector', 'keyword'] },
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1338:    expect(hybridSearch.estimateResultTokens(enrichedResult)).toBeGreaterThan(
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1339:      hybridSearch.estimateResultTokens(baseResult)
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1347:      source: 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1357:      source: 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1360:    const budget = hybridSearch.estimateResultTokens(compact) + 5;
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1362:    const truncated = hybridSearch.truncateToBudget([oversized, compact], budget, {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1375:      source: 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1385:      source: 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1393:    const truncated = hybridSearch.truncateToBudget([oversizedSecond, oversizedTop], 50, {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1411:      source: 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1419:    const truncated = hybridSearch.truncateToBudget([resultWithGetter], 1, {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1447:  it('S1-FIX-01: routeQuery trigger-phrase path is reachable from hybridSearchEnhanced', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1450:    hybridSearch.init(mockDb, mockVectorSearch, mockGraphSearch);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1454:    const results = await hybridSearch.hybridSearchEnhanced(longTrigger, embedding, {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1466:  it('S1-FIX-02: folder scoring integrates into hybrid runtime behind feature flag', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1470:    hybridSearch.init(mockDb, mockVectorSearch, mockGraphSearch);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1473:    const results = await hybridSearch.hybridSearchEnhanced('authentication module', embedding, { limit: 10 });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1483:  it('S1-FIX-03: dynamic token budget is applied to live hybrid results', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1498:    hybridSearch.init(mockDb, hugeVectorSearch, null);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1501:    const results = await hybridSearch.hybridSearchEnhanced('fix bug', embedding, { limit: 20 });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1527:    hybridSearch.init(mockDb, hugeVectorSearch, null);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1530:    const results = await hybridSearch.hybridSearchEnhanced('fix bug', embedding, {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1549:  let vectorCallCount: number;
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1552:    vectorCallCount = 0;
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1554:      vectorCallCount++;
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1561:    hybridSearch.init(mockDb, trackingVectorSearch, null);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1562:    bm25Index.resetIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1563:    const bm25 = bm25Index.getIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1565:      bm25.addDocument(String(doc.id), doc.content);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1569:  it('BUG1-T1: useVector=false prevents vector search function from being called', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1571:    await hybridSearch.hybridSearchEnhanced('authentication', embedding, { limit: 10, useVector: false });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1572:    expect(vectorCallCount).toBe(0);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1575:  it('BUG1-T2: useVector=true (default) calls vector search function', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1577:    await hybridSearch.hybridSearchEnhanced('authentication', embedding, { limit: 10 });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1578:    expect(vectorCallCount).toBeGreaterThanOrEqual(1);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1583:    const results = await hybridSearch.hybridSearchEnhanced('authentication', embedding, { limit: 10, useFts: false });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1584:    const ftsSources = results.filter(r => r.source === 'fts');
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1585:    expect(ftsSources.length).toBe(0);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1590:    const results = await hybridSearch.hybridSearchEnhanced('authentication', embedding, { limit: 10, useBm25: false });
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1591:    const bm25Sources = results.filter(r => r.source === 'bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search.vitest.ts:1592:    expect(bm25Sources.length).toBe(0);
.opencode/skills/system-spec-kit/mcp_server/lib/validation/save-quality-gate.ts:22:import * as vectorIndex from '../search/vector-index.js';
.opencode/skills/system-spec-kit/mcp_server/lib/validation/save-quality-gate.ts:173:    const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/lib/validation/save-quality-gate.ts:190:    const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/lib/validation/save-quality-gate.ts:206:    const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/lib/validation/save-quality-gate.ts:660: * Compute cosine similarity between two vectors.
.opencode/skills/system-spec-kit/mcp_server/lib/validation/save-quality-gate.ts:662: * @param a - First vector
.opencode/skills/system-spec-kit/mcp_server/lib/validation/save-quality-gate.ts:663: * @param b - Second vector
.opencode/skills/system-spec-kit/mcp_server/lib/validation/save-quality-gate.ts:687: * Layer 3: Check for semantic near-duplicates using vector similarity.
.opencode/skills/system-spec-kit/mcp_server/lib/validation/save-quality-gate.ts:693: * @param embedding - The embedding vector of the new memory
.opencode/skills/system-spec-kit/mcp_server/tests/retry-manager.vitest.ts:8:import * as vectorIndex from '../lib/search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/tests/retry-manager.vitest.ts:208:  // 4. DB-DEPENDENT TESTS (WITH REAL vectorIndex DB)
.opencode/skills/system-spec-kit/mcp_server/tests/retry-manager.vitest.ts:262:      if (!vectorIndex || typeof vectorIndex.initializeDb !== 'function') return;
.opencode/skills/system-spec-kit/mcp_server/tests/retry-manager.vitest.ts:267:        try { vectorIndex.closeDb(); } catch { /* ignore */ }
.opencode/skills/system-spec-kit/mcp_server/tests/retry-manager.vitest.ts:268:        const initializedDb = vectorIndex.initializeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/retry-manager.vitest.ts:284:      try { vectorIndex.closeDb(); } catch { /* ignore */ }
.opencode/skills/system-spec-kit/mcp_server/tests/retry-manager.vitest.ts:511:        const memory = vectorIndex.getMemory(6001);
.opencode/skills/system-spec-kit/mcp_server/tests/retry-manager.vitest.ts:619:        const spy = vi.spyOn(vectorIndex, 'getDb').mockReturnValue(null);
.opencode/skills/system-spec-kit/mcp_server/handlers/save/post-insert.ts:573:    // can route to runEnrichmentBackfill for recovery (R8-001, R21-001).
.opencode/skills/system-spec-kit/mcp_server/tests/graph-regression-flag-off.vitest.ts:9:import type { GraphSearchFn } from '../lib/search/hybrid-search';
.opencode/skills/system-spec-kit/mcp_server/tests/graph-regression-flag-off.vitest.ts:11:import { init, hybridSearch, hybridSearchEnhanced, getGraphMetrics, resetGraphMetrics } from '../lib/search/hybrid-search';
.opencode/skills/system-spec-kit/mcp_server/tests/graph-regression-flag-off.vitest.ts:16: * the hybrid-search module's db.prepare() contract without pulling
.opencode/skills/system-spec-kit/mcp_server/tests/graph-regression-flag-off.vitest.ts:48:    // NOTE: T022-2 covers the hybridSearch graphFn=null behavior and lives in the
.opencode/skills/system-spec-kit/mcp_server/tests/graph-regression-flag-off.vitest.ts:49:    // Nested describe('T022-2: hybridSearch — graph search fn NOT called...') group below.
.opencode/skills/system-spec-kit/mcp_server/tests/graph-regression-flag-off.vitest.ts:99:     Group 2: Graph search function NOT called during hybridSearch
.opencode/skills/system-spec-kit/mcp_server/tests/graph-regression-flag-off.vitest.ts:103:  describe('T022-2: hybridSearch — graph search fn NOT called when graphFn is null', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/graph-regression-flag-off.vitest.ts:120:    it('T022-2a: hybridSearch does not invoke graph search fn when init receives null graphFn', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/graph-regression-flag-off.vitest.ts:125:      await hybridSearch('test query', null, { useGraph: true });
.opencode/skills/system-spec-kit/mcp_server/tests/graph-regression-flag-off.vitest.ts:132:    it('T022-2b: hybridSearch with useGraph=true and null graphFn returns result without graph source', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/graph-regression-flag-off.vitest.ts:136:      const results = await hybridSearch('test query', null, { useGraph: true });
.opencode/skills/system-spec-kit/mcp_server/tests/graph-regression-flag-off.vitest.ts:138:      // With no vector fn, empty FTS and BM25 (stub returns []), result is []
.opencode/skills/system-spec-kit/mcp_server/tests/graph-regression-flag-off.vitest.ts:144:    it('T022-2c: hybridSearch with useGraph=false and a real graphFn — graphFn NOT called', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/graph-regression-flag-off.vitest.ts:149:      await hybridSearch('test query', null, { useGraph: false });
.opencode/skills/system-spec-kit/mcp_server/tests/graph-regression-flag-off.vitest.ts:154:    it('T022-2d: hybridSearch with useGraph=true and a real graphFn — graphFn IS called', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/graph-regression-flag-off.vitest.ts:159:      await hybridSearch('test query', null, { useGraph: true });
.opencode/skills/system-spec-kit/mcp_server/tests/graph-regression-flag-off.vitest.ts:167:     Group 3: hybridSearchEnhanced — graph channel bypass
.opencode/skills/system-spec-kit/mcp_server/tests/graph-regression-flag-off.vitest.ts:170:  describe('T022-2e: hybridSearchEnhanced — graph search fn NOT called when graphFn is null', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/graph-regression-flag-off.vitest.ts:183:    it('T022-2e-null: hybridSearchEnhanced with null graphFn — spy never called', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/graph-regression-flag-off.vitest.ts:187:      await hybridSearchEnhanced('test query', null, { useGraph: true });
.opencode/skills/system-spec-kit/mcp_server/tests/graph-regression-flag-off.vitest.ts:192:    it('T022-2e-wired: hybridSearchEnhanced with real graphFn — spy called when useGraph=true', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/graph-regression-flag-off.vitest.ts:193:      // Positive control for hybridSearchEnhanced code path
.opencode/skills/system-spec-kit/mcp_server/tests/graph-regression-flag-off.vitest.ts:197:      await hybridSearchEnhanced('test query', null, { useGraph: true });
.opencode/skills/system-spec-kit/mcp_server/tests/graph-regression-flag-off.vitest.ts:199:      // HybridSearchEnhanced may fall through to hybridSearch internally;
.opencode/skills/system-spec-kit/mcp_server/tests/graph-regression-flag-off.vitest.ts:204:    it('T022-2e-off: hybridSearchEnhanced with real graphFn — spy NOT called when useGraph=false', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/graph-regression-flag-off.vitest.ts:208:      await hybridSearchEnhanced('test query', null, { useGraph: false });
.opencode/skills/system-spec-kit/mcp_server/tests/graph-regression-flag-off.vitest.ts:245:      // Drive some counters via hybridSearchEnhanced with a wired graphFn
.opencode/skills/system-spec-kit/mcp_server/tests/graph-regression-flag-off.vitest.ts:258:      await hybridSearchEnhanced('probe query', null, { useGraph: true });
.opencode/skills/system-spec-kit/mcp_server/tests/graph-regression-flag-off.vitest.ts:327:      const results = await hybridSearch('probe query', null, { useGraph: true });
.opencode/skills/system-spec-kit/mcp_server/lib/validation/preflight.ts:553:  // Check 2: Similar duplicate via vector similarity (requires embedding)
.opencode/skills/system-spec-kit/mcp_server/handlers/save/response-builder.ts:170:// route to recovery (runEnrichmentBackfill) without re-running the entire save.
.opencode/skills/system-spec-kit/mcp_server/handlers/save/response-builder.ts:194:  // deferred/partial/failed nuance, warnings, and recovery hints visible even when the
.opencode/skills/system-spec-kit/mcp_server/handlers/save/response-builder.ts:195:  // writer-side executionStatus collapsed to a simpler failure-with-recovery decision
.opencode/skills/system-spec-kit/mcp_server/handlers/save/response-builder.ts:199:  //   2. any step failed → 'failed' (recovery needed)
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index.vitest.ts:1215:        const isServerDep = /database|getDb|Rate limited|vector_index|null|not initialized|Database/.test(message);
.opencode/skills/system-spec-kit/mcp_server/tests/mcp-error-format.vitest.ts:7:import { RECOVERY_HINTS } from '../lib/errors/recovery-hints';
.opencode/skills/system-spec-kit/mcp_server/tests/mcp-error-format.vitest.ts:74:    it('T535-5: Error responses include recovery hint pattern', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/mcp-error-format.vitest.ts:84:        expect('recoveryHint' in instance).toBe(true);
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-triggers.vitest.ts:14:import * as vectorIndexStore from '../lib/search/vector-index-store';
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-triggers.vitest.ts:331:    vi.spyOn(vectorIndexStore, 'initialize_db').mockReturnValue({
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/lib/scorer/lanes/explicit.ts:132:  'vector-search': [['mcp-coco-index', 1]],
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-delete.ts:10:import * as vectorIndex from '../lib/search/vector-index.js';
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-delete.ts:59:    recovery: {
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-delete.ts:84:  const database = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-delete.ts:97:      deletedCount = vectorIndex.deleteMemory(numericId) ? 1 : 0;
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-delete.ts:141:    const memories: { id: number }[] = vectorIndex.getMemoriesByFolder(specFolder as string);
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-delete.ts:194:        if (vectorIndex.deleteMemory(memory.id)) {
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-ux-regressions.vitest.ts:30:import * as vectorIndex from '../lib/search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-ux-regressions.vitest.ts:120:<!-- ANCHOR:recovery-hints -->
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-ux-regressions.vitest.ts:124:- If this fixture starts failing insufficiency again, add more concrete file, decision, blocker, next action, or outcome evidence instead of weakening the gate.
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-ux-regressions.vitest.ts:127:<!-- /ANCHOR:recovery-hints -->
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-ux-regressions.vitest.ts:213:<!-- ANCHOR:recovery-hints -->
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-ux-regressions.vitest.ts:219:<!-- /ANCHOR:recovery-hints -->
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-ux-regressions.vitest.ts:350:  const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-ux-regressions.vitest.ts:375:    vectorIndex.closeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-ux-regressions.vitest.ts:379:  vectorIndex.initializeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-ux-regressions.vitest.ts:413:    vectorIndex.closeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:9:const VALID_RECOVERY_STATUSES = ['no_results', 'low_confidence', 'partial'] as const;
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:34:  suggestedQueries: string[];
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:49:    recovery?: RecoveryPayload;
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:68:    spec_folder: 'specs/system-spec-kit/022-hybrid-rag-fusion',
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:69:    file_path: `/tmp/recovery-${id}.md`,
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:73:    triggerPhrases: ['retrieval', 'recovery'],
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:85:    'hybrid',
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:113:describe('D5 Phase A: empty result recovery', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:129:  it('returns a structured recovery payload for empty result sets', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:133:      specFolder: 'specs/system-spec-kit/022-hybrid-rag-fusion/filters/fusion-only',
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:138:    expect(envelope.data.recovery).toEqual(
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:142:        suggestedQueries: expect.any(Array),
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:147:    expect(VALID_RECOVERY_STATUSES).toContain(envelope.data.recovery?.status);
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:148:    expect(VALID_RECOVERY_REASONS).toContain(envelope.data.recovery?.reason);
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:149:    expect(VALID_RECOVERY_ACTIONS).toContain(envelope.data.recovery?.recommendedAction);
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:152:  it('classifies weak result sets as low_confidence', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:160:          fts_score: 0.03,
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:169:          fts_score: 0.02,
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:181:    expect(envelope.data.recovery?.status).toBe('low_confidence');
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:202:          sources: ['semantic', 'fts'],
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:215:          sources: ['semantic', 'fts'],
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:228:          sources: ['semantic', 'fts'],
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:242:    expect(envelope.data.requestQuality).toEqual({ label: 'good' });
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:255:          fts_score: 0.64,
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:269:    expect(envelope.data.recovery?.status).toBe('partial');
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:277:      specFolder: 'specs/system-spec-kit/022-hybrid-rag-fusion/filters/fusion-only',
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:280:    const suggestedQueries = envelope.data.recovery?.suggestedQueries ?? [];
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:281:    expectReasonableSuggestions(suggestedQueries, originalQuery, [
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:298:          fts_score: 0.03,
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:307:          fts_score: 0.02,
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:316:          fts_score: 0.01,
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:325:          fts_score: 0.01,
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:334:          fts_score: 0.01,
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:345:    expect(envelope.data.recovery?.recommendedAction).toBe('ask_user');
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:347:    const suggestions = envelope.data.recovery?.suggestedQueries ?? [];
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:354:  it('omits the recovery payload when SPECKIT_EMPTY_RESULT_RECOVERY_V1 is false', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:360:      specFolder: 'specs/system-spec-kit/022-hybrid-rag-fusion/filters/fusion-only',
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:365:    expect(envelope.data.recovery).toBeUndefined();
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-update.ts:11:import * as vectorIndex from '../lib/search/vector-index.js';
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-update.ts:12:import type { UpdateMemoryParams } from '../lib/search/vector-index.js';
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-update.ts:14:import * as bm25Index from '../lib/search/bm25-index.js';
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-update.ts:80:  const existing = vectorIndex.getMemory(id);
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-update.ts:85:  const database = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-update.ts:151:        vectorIndex.updateEmbeddingStatus(id, 'pending');
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-update.ts:154:      vectorIndex.updateMemory(updateParams);
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-update.ts:157:        const updated = vectorIndex.getMemory(id) as (Record<string, unknown> | null);
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-update.ts:214:      if ((updateParams.title !== undefined || updateParams.triggerPhrases !== undefined) && bm25Index.isBm25Enabled()) {
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-update.ts:216:          const bm25Idx = bm25Index.getIndex();
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-update.ts:221:            const text = bm25Index.buildBm25DocumentText(row);
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-update.ts:223:              bm25Idx.addDocument(String(id), text);
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-update.ts:227:          const bm25ErrMsg = e instanceof Error ? e.message : String(e);
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-update.ts:239:          if (isBm25InfraFailure(bm25ErrMsg)) {
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-update.ts:240:            console.warn(`[memory-crud-update] BM25 infrastructure unavailable, skipping re-index [requestId=${requestId}]: ${bm25ErrMsg}`);
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-update.ts:242:            console.error(`[memory-crud-update] BM25 re-index failed, rolling back update [requestId=${requestId}]: ${bm25ErrMsg}`);
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-update.ts:243:            throw new Error(`BM25 re-index failed: ${bm25ErrMsg}`);
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-update.ts:294:      recovery: {
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-reconsolidation.vitest.ts:5:  bm25Enabled: vi.fn(() => false),
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-reconsolidation.vitest.ts:6:  bm25GetIndex: vi.fn(),
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-reconsolidation.vitest.ts:14:  vectorSearch: vi.fn(),
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-reconsolidation.vitest.ts:17:vi.mock('../lib/search/vector-index', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-reconsolidation.vitest.ts:18:  vectorSearch: bridgeMocks.vectorSearch,
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-reconsolidation.vitest.ts:26:vi.mock('../lib/search/bm25-index', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-reconsolidation.vitest.ts:27:  isBm25Enabled: bridgeMocks.bm25Enabled,
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-reconsolidation.vitest.ts:28:  buildBm25DocumentText: vi.fn(() => 'bm25 text'),
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-reconsolidation.vitest.ts:29:  getIndex: bridgeMocks.bm25GetIndex,
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-reconsolidation.vitest.ts:107:    bridgeMocks.bm25Enabled.mockClear();
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-reconsolidation.vitest.ts:108:    bridgeMocks.bm25GetIndex.mockClear();
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-reconsolidation.vitest.ts:120:    bridgeMocks.vectorSearch.mockClear();
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-reconsolidation.vitest.ts:131:    bridgeMocks.vectorSearch.mockReturnValueOnce([
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-reconsolidation.vitest.ts:155:    expect(bridgeMocks.vectorSearch).toHaveBeenCalledWith(
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-reconsolidation.vitest.ts:169:    bridgeMocks.vectorSearch.mockReturnValueOnce([
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:4:// Validates recovery payload generation, status classification,
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:15:} from '../lib/search/recovery-payload';
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:79:    // Threshold is 0.4 — exactly at the boundary still triggers recovery
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:80:    // because the check is strict < threshold means: 0.4 is NOT < 0.4 → no recovery
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:144:  it('emits status "low_confidence" when avgConfidence < threshold', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:149:    expect(payload.status).toBe('low_confidence');
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:201:      query: 'implementation details for hybrid rag fusion pipeline',
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:223:      query: 'implementation details for hybrid rag fusion pipeline',
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:251:  it('recommends "ask_user" for low_confidence + knowledge_gap', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:258:    expect(payload.status).toBe('low_confidence');
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:262:  it('recommends "ask_disambiguation" for low_confidence + low_signal_query', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:269:    expect(payload.status).toBe('low_confidence');
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:275:// -- buildRecoveryPayload — suggestedQueries field --
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:277:describe('buildRecoveryPayload() — suggestedQueries', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:279:    const payload = buildRecoveryPayload(makeCtx({ query: 'hybrid rag fusion pipeline' }));
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:280:    expect(Array.isArray(payload.suggestedQueries)).toBe(true);
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:284:    const payload = buildRecoveryPayload(makeCtx({ query: 'hybrid rag fusion pipeline implementation' }));
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:285:    expect(payload.suggestedQueries.length).toBeLessThanOrEqual(3);
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:290:    expect(payload.suggestedQueries.length).toBeGreaterThan(0);
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:291:    expect(payload.suggestedQueries.every((s) => typeof s === 'string' && s.length > 0)).toBe(true);
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:296:    expect(payload.suggestedQueries.length).toBeGreaterThan(0);
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:301:      query: 'implementation details for hybrid rag fusion pipeline stage two',
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:303:    const hasShortened = payload.suggestedQueries.some((s) =>
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:313:    const hasParenFree = payload.suggestedQueries.some((s) => !s.includes('('));
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:319:    const unique = new Set(payload.suggestedQueries);
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:320:    expect(unique.size).toBe(payload.suggestedQueries.length);
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:321:    expect(payload.suggestedQueries.every((s) => s.trim().length > 0)).toBe(true);
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:333:    expect(payload.suggestedQueries.length).toBeGreaterThanOrEqual(2);
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:334:    expect(payload.suggestedQueries.every((s) => s.trim().length > 0)).toBe(true);
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:345:    expect(payload).toHaveProperty('suggestedQueries');
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:350:    const validStatuses = ['no_results', 'low_confidence', 'partial'] as const;
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/lib/scorer/lanes/lexical.ts:30:  'mcp-coco-index': ['semantic search', 'vector search', 'grep not enough', 'find code', 'where logic'],
.opencode/skills/system-spec-kit/mcp_server/handlers/session-resume.ts:560:  // F052: Record memory recovery metric for session_resume
.opencode/skills/system-spec-kit/mcp_server/handlers/session-resume.ts:561:  recordMetricEvent({ kind: 'memory_recovery' });
.opencode/skills/system-spec-kit/mcp_server/handlers/session-resume.ts:569:    // Advanced targeted recovery selector: expose sessionId publicly for
.opencode/skills/system-spec-kit/mcp_server/handlers/session-resume.ts:603:    // — structural context hints at lines 128-130 provide preferred recovery path
.opencode/skills/system-spec-kit/mcp_server/handlers/session-resume.ts:678:    hints.push('Resume ladder found no canonical recovery context. Pass specFolder explicitly or start with /spec_kit:plan.');
.opencode/skills/system-spec-kit/mcp_server/tests/integration-error-recovery.vitest.ts:83:    it('T532-3: Error includes recovery hint', () => {
.opencode/skills/system-spec-kit/mcp_server/handlers/session-bootstrap.ts:95:  'Resume recovery follows `handover.md` -> `_memory.continuity` -> spec docs.';
.opencode/skills/system-spec-kit/mcp_server/handlers/session-bootstrap.ts:182:  nextActions.add('Use `session_resume({ specFolder })` when you need the fuller merged recovery payload.');
.opencode/skills/system-spec-kit/mcp_server/handlers/session-bootstrap.ts:546:    // remain the authoritative recovery owners for startup and deep resume flows.
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/lib/scorer/scoring-constants.ts:12:// numerics. Tweaking any value here is a behavior change, not a refactor.
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/lib/scorer/scoring-constants.ts:44:  /** Direct-score floor that, when paired with task-intent, lifts confidence
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/lib/scorer/scoring-constants.ts:47:  /** Live-normalized floor that, when paired with task-intent, lifts
.opencode/skills/system-spec-kit/mcp_server/tests/chunking-orchestrator.vitest.ts:97:vi.mock('../lib/search/bm25-index', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/chunking-orchestrator.vitest.ts:147:import { closeDb, initializeDb } from '../lib/search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/lib/parsing/content-normalizer.ts:18://   - bm25-index.ts     ~line 245  : where `content_text` is used for token building
.opencode/skills/system-spec-kit/mcp_server/lib/parsing/content-normalizer.ts:253: *   bm25-index.ts ~line 245 where `content_text` is used for token building.
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-context.ts:17:// Query-intent routing (Phase 020: structural/semantic/hybrid classification)
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-context.ts:48:import * as vectorIndex from '../lib/search/vector-index.js';
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-context.ts:917:  // Resume: Session recovery mode
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-context.ts:1039:      : 'Resume ladder found no canonical recovery context',
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-context.ts:1078:  db: ReturnType<typeof vectorIndex.getDb> | null,
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-context.ts:1321:    // backend channel selection only (structural / hybrid / semantic) and MUST
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-context.ts:1371:      recovery: {
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-context.ts:1396:      recovery: {
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-context.ts:1406:  // graph context for structural/hybrid queries. Entire block is
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-context.ts:1419:          : classification.intent === 'hybrid'
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-context.ts:1420:            ? 'hybrid'
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-context.ts:1454:      } else if (classification.intent === 'hybrid') {
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-context.ts:1467:          // Code graph unavailable — hybrid degrades to semantic-only
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-context.ts:1505:      recovery: {
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-context.ts:1620:  // in vector-index-queries.ts (m.spec_folder = ?) which silently drops all
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-context.ts:1654:      recovery: {
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-context.ts:1672:      recovery: {
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-context.ts:1681:  // options.specFolder, so the recovery retry is no longer needed. The folder
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-context.ts:1800:    const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-context.ts:1878:      recovery: {
.opencode/skills/system-spec-kit/mcp_server/tests/unit-rrf-fusion.vitest.ts:1:// TEST: RRF Fusion (C138-P3) — Cross-Variant Multi-Query Fusion
.opencode/skills/system-spec-kit/mcp_server/tests/unit-rrf-fusion.vitest.ts:27:describe('RRF Fusion (T001-T006)', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/unit-rrf-fusion.vitest.ts:29:    const vectorResults = [
.opencode/skills/system-spec-kit/mcp_server/tests/unit-rrf-fusion.vitest.ts:34:    const bm25Results = [
.opencode/skills/system-spec-kit/mcp_server/tests/unit-rrf-fusion.vitest.ts:41:      { source: SOURCE_TYPES.VECTOR, results: vectorResults },
.opencode/skills/system-spec-kit/mcp_server/tests/unit-rrf-fusion.vitest.ts:42:      { source: SOURCE_TYPES.BM25, results: bm25Results },
.opencode/skills/system-spec-kit/mcp_server/tests/unit-rrf-fusion.vitest.ts:56:  it('T002: Higher-ranked results get higher RRF scores', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/unit-rrf-fusion.vitest.ts:77:    const vectorResults = [
.opencode/skills/system-spec-kit/mcp_server/tests/unit-rrf-fusion.vitest.ts:79:      { id: 'vector-only', title: 'Vector Only' },
.opencode/skills/system-spec-kit/mcp_server/tests/unit-rrf-fusion.vitest.ts:81:    const bm25Results = [
.opencode/skills/system-spec-kit/mcp_server/tests/unit-rrf-fusion.vitest.ts:83:      { id: 'bm25-only', title: 'BM25 Only' },
.opencode/skills/system-spec-kit/mcp_server/tests/unit-rrf-fusion.vitest.ts:87:      { source: SOURCE_TYPES.VECTOR, results: vectorResults },
.opencode/skills/system-spec-kit/mcp_server/tests/unit-rrf-fusion.vitest.ts:88:      { source: SOURCE_TYPES.BM25, results: bm25Results },
.opencode/skills/system-spec-kit/mcp_server/tests/unit-rrf-fusion.vitest.ts:92:    const vectorOnly = requireResult(fused.find((r: FusionResult) => r.id === 'vector-only'));
.opencode/skills/system-spec-kit/mcp_server/tests/unit-rrf-fusion.vitest.ts:93:    const bm25Only = requireResult(fused.find((r: FusionResult) => r.id === 'bm25-only'));
.opencode/skills/system-spec-kit/mcp_server/tests/unit-rrf-fusion.vitest.ts:95:    expect(shared.rrfScore).toBeGreaterThan(vectorOnly.rrfScore);
.opencode/skills/system-spec-kit/mcp_server/tests/unit-rrf-fusion.vitest.ts:96:    expect(shared.rrfScore).toBeGreaterThan(bm25Only.rrfScore);
.opencode/skills/system-spec-kit/mcp_server/tests/unit-rrf-fusion.vitest.ts:136:    const vectorResults = [
.opencode/skills/system-spec-kit/mcp_server/tests/unit-rrf-fusion.vitest.ts:140:    const bm25Results = [
.opencode/skills/system-spec-kit/mcp_server/tests/unit-rrf-fusion.vitest.ts:146:      { source: SOURCE_TYPES.VECTOR, results: vectorResults },
.opencode/skills/system-spec-kit/mcp_server/tests/unit-rrf-fusion.vitest.ts:147:      { source: SOURCE_TYPES.BM25, results: bm25Results },
.opencode/skills/system-spec-kit/mcp_server/tests/unit-rrf-fusion.vitest.ts:180:describe('C138: Cross-Variant RRF (Multi-Query)', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/unit-rrf-fusion.vitest.ts:182:    const vectorResults = [{ id: 'shared', title: 'Shared' }, { id: 'v-only', title: 'V' }];
.opencode/skills/system-spec-kit/mcp_server/tests/unit-rrf-fusion.vitest.ts:183:    const bm25Results = [{ id: 'shared', title: 'Shared' }, { id: 'b-only', title: 'B' }];
.opencode/skills/system-spec-kit/mcp_server/tests/unit-rrf-fusion.vitest.ts:187:      { source: SOURCE_TYPES.VECTOR, results: vectorResults },
.opencode/skills/system-spec-kit/mcp_server/tests/unit-rrf-fusion.vitest.ts:188:      { source: SOURCE_TYPES.BM25, results: bm25Results },
.opencode/skills/system-spec-kit/mcp_server/tests/unit-rrf-fusion.vitest.ts:329:    ], { k: -1 })).toThrow('RRF k parameter must be non-negative');
.opencode/skills/system-spec-kit/mcp_server/tests/unit-rrf-fusion.vitest.ts:347:    ], { k: -1 })).toThrow('RRF k parameter must be non-negative');
.opencode/skills/system-spec-kit/mcp_server/lib/parsing/trigger-matcher.ts:7:import * as vectorIndex from '../search/vector-index.js';
.opencode/skills/system-spec-kit/mcp_server/lib/parsing/trigger-matcher.ts:488:    vectorIndex.initializeDb();
.opencode/skills/system-spec-kit/mcp_server/lib/parsing/trigger-matcher.ts:489:    const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-list.ts:12:import * as vectorIndex from '../lib/search/vector-index.js';
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-list.ts:94:  const database = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/feature_catalog/01--daemon-and-freshness/06-rebuild-from-source.md:6:  - "corrupt sqlite recovery"
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/feature_catalog/01--daemon-and-freshness/06-rebuild-from-source.md:8:  - "advisor recovery"
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/feature_catalog/01--daemon-and-freshness/06-rebuild-from-source.md:31:`lib/freshness/rebuild-from-source.ts` detects a corrupt or unreadable SQLite store via the daemon lifecycle, then walks `.opencode/skills/*/SKILL.md` plus each `graph-metadata.json`, applies the auto-indexing derivation pipeline, and republishes a fresh snapshot. Throughout the rebuild, readers see `unavailable` trust state and fail-open responses rather than exceptions. Rebuild is also the canonical recovery path for the H5 operator playbook.
.opencode/skills/system-spec-kit/mcp_server/tests/community-search.vitest.ts:88:      { id: 1, summary: 'vector embeddings and search', memberIds: [1, 2], count: 2 },
.opencode/skills/system-spec-kit/mcp_server/tests/session-learning-regressions.vitest.ts:6:import * as vectorIndex from '../lib/search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/tests/session-learning-regressions.vitest.ts:13:    vi.spyOn(vectorIndex, 'getDb').mockReturnValue(database as unknown as ReturnType<typeof vectorIndex.getDb>);
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts:4:import * as bm25Index from '../lib/search/bm25-index';
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts:29:/** Create a simple embedding vector of given dimension */
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts:548:      const bm25RemoveDocument = vi.fn();
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts:549:      const bm25AddDocument = vi.fn();
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts:550:      vi.spyOn(bm25Index, 'isBm25Enabled').mockReturnValue(true);
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts:551:      vi.spyOn(bm25Index, 'getIndex').mockReturnValue({
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts:552:        removeDocument: bm25RemoveDocument,
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts:553:        addDocument: bm25AddDocument,
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts:554:      } as unknown as ReturnType<typeof bm25Index.getIndex>);
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts:622:      expect(bm25RemoveDocument).toHaveBeenCalledWith('103');
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts:623:      expect(bm25AddDocument).toHaveBeenCalledWith(String(result.newMemoryId), expect.stringContaining('Merged addition'));
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts:624:      const bm25Text = bm25AddDocument.mock.calls[0]?.[1];
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts:625:      expect(bm25Text).toContain('Reachable Existing');
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts:626:      expect(bm25Text).toContain('/test/103.md');
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts:630:      const bm25RemoveDocument = vi.fn();
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts:631:      const bm25AddDocument = vi.fn()
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts:638:      vi.spyOn(bm25Index, 'isBm25Enabled').mockReturnValue(true);
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts:639:      vi.spyOn(bm25Index, 'getIndex').mockReturnValue({
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts:640:        removeDocument: bm25RemoveDocument,
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts:641:        addDocument: bm25AddDocument,
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts:642:      } as unknown as ReturnType<typeof bm25Index.getIndex>);
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts:674:      expect(bm25AddDocument).toHaveBeenCalledTimes(2);
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts:675:      expect(bm25RemoveDocument).toHaveBeenCalledWith('104');
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts:676:      expect(bm25RemoveDocument).toHaveBeenCalledWith(String(result.newMemoryId));
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts:682:        SELECT bm25_repair_needed
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts:685:      `).get(result.newMemoryId) as { bm25_repair_needed: number | null };
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts:686:      expect(repairFlagRow.bm25_repair_needed).toBe(1);
.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts:1233:      const errorFn: FindSimilarFn = () => { throw new Error('vector search down'); };
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-health.ts:14:import * as vectorIndex from '../lib/search/vector-index.js';
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-health.ts:296:  const database = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-health.ts:420:    'fts_rebuild',
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-health.ts:423:    'orphan_vector_cleanup',
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-health.ts:451:  if (!vectorIndex.isVectorSearchAvailable()) {
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-health.ts:458:      const ftsCountRow = database.prepare('SELECT COUNT(*) as count FROM memory_fts').get() as { count: number };
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-health.ts:459:      if (memoryCountRow.count !== ftsCountRow.count) {
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-health.ts:461:          `FTS5 index out of sync: memory_index has ${memoryCountRow.count} rows, memory_fts has ${ftsCountRow.count} rows. ` +
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-health.ts:467:            database.exec("INSERT INTO memory_fts(memory_fts) VALUES('rebuild')");
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-health.ts:468:            repair.actions.push('fts_rebuild');
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-health.ts:473:            const repairedFtsCountRow = database.prepare('SELECT COUNT(*) as count FROM memory_fts').get() as { count: number };
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-health.ts:476:              repair.actions.push('fts_consistency_verified');
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-health.ts:480:              const warning = `Post-repair mismatch persists: memory_index=${memoryCountRow.count}, memory_fts=${repairedFtsCountRow.count}`;
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-health.ts:522:      const integrityReport = vectorIndex.verifyIntegrity({ autoClean: true });
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-health.ts:523:      const cleanedVectors = integrityReport.cleaned?.vectors ?? 0;
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-health.ts:528:        repair.actions.push(`orphan_vectors_cleaned:${cleanedVectors}`);
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-health.ts:529:        hints.push(`Auto-repair: removed ${cleanedVectors} orphaned vector(s)`);
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-health.ts:538:      const postRepairReport = vectorIndex.verifyIntegrity({ autoClean: false });
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-health.ts:576:      vectorSearchAvailable: vectorIndex.isVectorSearchAvailable(),
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-health.ts:588:        databasePath: redactPath(vectorIndex.getDbPath() ?? ''),
.opencode/skills/system-spec-kit/mcp_server/tests/learning-stats-filters.vitest.ts:5:import * as vectorIndex from '../lib/search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/tests/learning-stats-filters.vitest.ts:64:        vectorIndex.closeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/learning-stats-filters.vitest.ts:69:      const db = vectorIndex.initializeDb(':memory:');
.opencode/skills/system-spec-kit/mcp_server/tests/learning-stats-filters.vitest.ts:82:      vectorIndex.closeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/learning-stats-filters.vitest.ts:426:      const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/tests/retrieval-directives.vitest.ts:24:import * as vectorIndex from '../lib/search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/tests/retrieval-directives.vitest.ts:509:    vi.spyOn(vectorIndex, 'getDb').mockReturnValue(
.opencode/skills/system-spec-kit/mcp_server/tests/retrieval-directives.vitest.ts:510:      makeConstitutionalDb(dbRows) as unknown as ReturnType<typeof vectorIndex.getDb>
.opencode/skills/system-spec-kit/mcp_server/tests/retrieval-directives.vitest.ts:536:    vi.spyOn(vectorIndex, 'getDb').mockReturnValue(
.opencode/skills/system-spec-kit/mcp_server/tests/retrieval-directives.vitest.ts:537:      makeConstitutionalDb(dbRows) as unknown as ReturnType<typeof vectorIndex.getDb>
.opencode/skills/system-spec-kit/mcp_server/handlers/checkpoints.ts:10:import * as vectorIndex from '../lib/search/vector-index.js';
.opencode/skills/system-spec-kit/mcp_server/handlers/checkpoints.ts:11:import * as bm25Index from '../lib/search/bm25-index.js';
.opencode/skills/system-spec-kit/mcp_server/handlers/checkpoints.ts:287:    recovery: {
.opencode/skills/system-spec-kit/mcp_server/handlers/checkpoints.ts:334:      recovery: {
.opencode/skills/system-spec-kit/mcp_server/handlers/checkpoints.ts:418:      recovery: {
.opencode/skills/system-spec-kit/mcp_server/handlers/checkpoints.ts:449:        recovery: {
.opencode/skills/system-spec-kit/mcp_server/handlers/checkpoints.ts:469:      vectorIndex.clearConstitutionalCache(null);
.opencode/skills/system-spec-kit/mcp_server/handlers/checkpoints.ts:470:      vectorIndex.clearSearchCache(null);
.opencode/skills/system-spec-kit/mcp_server/handlers/checkpoints.ts:472:      const database = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/handlers/checkpoints.ts:473:      if (database && bm25Index.isBm25Enabled()) {
.opencode/skills/system-spec-kit/mcp_server/handlers/checkpoints.ts:474:        bm25Index.getIndex().rebuildFromDatabase(database);
.opencode/skills/system-spec-kit/mcp_server/handlers/checkpoints.ts:496:      recovery: {
.opencode/skills/system-spec-kit/mcp_server/handlers/checkpoints.ts:518:      recovery: {
.opencode/skills/system-spec-kit/mcp_server/handlers/checkpoints.ts:598:        recovery: {
.opencode/skills/system-spec-kit/mcp_server/handlers/checkpoints.ts:660:  vectorIndex.initializeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/query-surrogates.vitest.ts:58:    aliases: overrides?.aliases ?? ['RRF', 'Reciprocal Rank Fusion'],
.opencode/skills/system-spec-kit/mcp_server/tests/query-surrogates.vitest.ts:63:      'How do I configure RRF?',
.opencode/skills/system-spec-kit/mcp_server/tests/query-surrogates.vitest.ts:128:    const content = 'Reciprocal Rank Fusion (RRF) is a fusion method.';
.opencode/skills/system-spec-kit/mcp_server/tests/query-surrogates.vitest.ts:130:    expect(aliases).toContain('RRF');
.opencode/skills/system-spec-kit/mcp_server/tests/query-surrogates.vitest.ts:135:      Reciprocal Rank Fusion (RRF) and Term Frequency-Inverse Document Frequency (TF-IDF)
.opencode/skills/system-spec-kit/mcp_server/tests/query-surrogates.vitest.ts:139:    expect(aliases).toContain('RRF');
.opencode/skills/system-spec-kit/mcp_server/tests/query-surrogates.vitest.ts:144:    const content = 'RRF (Reciprocal Rank Fusion) combines scores from multiple channels.';
.opencode/skills/system-spec-kit/mcp_server/tests/query-surrogates.vitest.ts:157:      Reciprocal Rank Fusion (RRF) is important.
.opencode/skills/system-spec-kit/mcp_server/tests/query-surrogates.vitest.ts:158:      Also see Reciprocal Rank Fusion (RRF) for details.
.opencode/skills/system-spec-kit/mcp_server/tests/query-surrogates.vitest.ts:161:    const rrfCount = aliases.filter((a) => a === 'RRF').length;
.opencode/skills/system-spec-kit/mcp_server/tests/query-surrogates.vitest.ts:419:Reciprocal Rank Fusion (RRF) is a method for combining ranked lists.
.opencode/skills/system-spec-kit/mcp_server/tests/query-surrogates.vitest.ts:421:## How to configure RRF
.opencode/skills/system-spec-kit/mcp_server/tests/query-surrogates.vitest.ts:427:RRF performs well on diverse query types.
.opencode/skills/system-spec-kit/mcp_server/tests/query-surrogates.vitest.ts:433:    expect(meta.aliases).toContain('RRF');
.opencode/skills/system-spec-kit/mcp_server/tests/query-surrogates.vitest.ts:476:    const result = matchSurrogates('What is RRF?', surrogates);
.opencode/skills/system-spec-kit/mcp_server/tests/query-surrogates.vitest.ts:492:      summary: 'A comprehensive guide to vector embedding search techniques.',
.opencode/skills/system-spec-kit/mcp_server/tests/query-surrogates.vitest.ts:494:    const result = matchSurrogates('vector embedding search', surrogates);
.opencode/skills/system-spec-kit/mcp_server/tests/query-surrogates.vitest.ts:510:      aliases: ['RRF'],
.opencode/skills/system-spec-kit/mcp_server/tests/query-surrogates.vitest.ts:522:    const result = matchSurrogates('RRF Reciprocal Rank Fusion configuration usage', surrogates);
.opencode/skills/system-spec-kit/mcp_server/tests/query-surrogates.vitest.ts:757:El sistema utiliza Reciprocal Rank Fusion (RRF) para combinar resultados.
.opencode/skills/system-spec-kit/mcp_server/tests/query-surrogates.vitest.ts:761:    expect(result!.aliases).toContain('RRF');
.opencode/skills/system-spec-kit/mcp_server/tests/query-surrogates.vitest.ts:777:The search pipeline uses Reciprocal Rank Fusion (RRF) to combine results.
.opencode/skills/system-spec-kit/mcp_server/tests/query-surrogates.vitest.ts:801:    const matchResult = matchSurrogates('How do I configure RRF pipeline?', loaded!);
.opencode/skills/system-spec-kit/mcp_server/tests/query-surrogates.vitest.ts:846:    expect(extractAliases('Reciprocal Rank Fusion (RRF)')).toContain('RRF');
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-crud.vitest.ts:6:import * as vectorIndex from '../lib/search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-crud.vitest.ts:39:    vectorIndex.closeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-crud.vitest.ts:40:    vectorIndex.initializeDb(':memory:');
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-crud.vitest.ts:44:    vectorIndex.closeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/search-archival.vitest.ts:15:  path.join(SRC_LIB_PATH, 'search', 'vector-index-queries.ts'),
.opencode/skills/system-spec-kit/mcp_server/tests/search-archival.vitest.ts:20:   Module loading — vector-index-impl.ts is plain JS and DB-dependent.
.opencode/skills/system-spec-kit/mcp_server/tests/search-archival.vitest.ts:24:describe('T206 - vector_search accepts includeArchived [deferred - DB dependency]', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/search-archival.vitest.ts:25:  it('T206-VS1: vectorSearch is exported', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/search-archival.vitest.ts:26:    expect(VECTOR_INDEX_QUERIES_SOURCE).toContain('export { vector_search as vectorSearch };');
.opencode/skills/system-spec-kit/mcp_server/tests/search-archival.vitest.ts:29:  it('T206-VS2: vectorSearch accepts includeArchived option', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/search-archival.vitest.ts:30:    expect(VECTOR_INDEX_QUERIES_SOURCE).toMatch(/export function vector_search\([\s\S]*?includeArchived = false/);
.opencode/skills/system-spec-kit/mcp_server/tests/search-archival.vitest.ts:72:  it('T206-SRC1: vector-index-queries.ts no longer filters on is_archived', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/search-archival.vitest.ts:76:  it('T206-SRC2: vector-index-schema documents the deprecated column', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/search-archival.vitest.ts:78:      path.join(SRC_LIB_PATH, 'search', 'vector-index-schema.ts'),
.opencode/skills/system-spec-kit/mcp_server/tests/search-archival.vitest.ts:84:  it('T206-SRC3: hybrid-search does not gate structural search on is_archived', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/search-archival.vitest.ts:88:        path.join(SRC_LIB_PATH, 'search', 'hybrid-search.ts'),
.opencode/skills/system-spec-kit/mcp_server/tests/search-archival.vitest.ts:94:        path.join(SRC_LIB_PATH, 'search', 'hybrid-search.js'),
.opencode/skills/system-spec-kit/mcp_server/tests/search-archival.vitest.ts:103:      path.join(SRC_LIB_PATH, 'search', 'hybrid-search.ts'),
.opencode/skills/system-spec-kit/mcp_server/tests/search-archival.vitest.ts:133:  it('T235-BH1: vector_search does not use the old WHERE-clause archive filter', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/search-archival.vitest.ts:144:    // vector_search and multi_concept_search, and referenced in other
.opencode/skills/system-spec-kit/mcp_server/tests/search-archival.vitest.ts:147:    // At least 4: vector_search param, multi_concept_search param,
.opencode/skills/system-spec-kit/mcp_server/tests/search-archival.vitest.ts:178:  it('T235-BH5: hybrid-search options type includes includeArchived field', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/search-archival.vitest.ts:180:      path.join(SRC_LIB_PATH, 'search', 'hybrid-search.ts'),
.opencode/skills/system-spec-kit/mcp_server/tests/graph-lifecycle.vitest.ts:551:    expect(object.toLowerCase()).toContain('vectorindex');
.opencode/skills/system-spec-kit/mcp_server/tests/response-profile-formatters.vitest.ts:13:        strategy: 'hybrid',
.opencode/skills/system-spec-kit/mcp_server/tests/response-profile-formatters.vitest.ts:46:      strategy: 'hybrid',
.opencode/skills/system-spec-kit/mcp_server/tests/response-profile-formatters.vitest.ts:67:      strategy: 'hybrid',
.opencode/skills/system-spec-kit/mcp_server/tests/p0-b-reconsolidation-composite.vitest.ts:5:  vectorSearch: vi.fn(),
.opencode/skills/system-spec-kit/mcp_server/tests/p0-b-reconsolidation-composite.vitest.ts:8:vi.mock('../lib/search/vector-index', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/p0-b-reconsolidation-composite.vitest.ts:9:  vectorSearch: compositeMocks.vectorSearch,
.opencode/skills/system-spec-kit/mcp_server/tests/p0-b-reconsolidation-composite.vitest.ts:69:    compositeMocks.vectorSearch.mockReset();
.opencode/skills/system-spec-kit/mcp_server/tests/p0-b-reconsolidation-composite.vitest.ts:140:    compositeMocks.vectorSearch
.opencode/skills/system-spec-kit/mcp_server/tests/p0-b-reconsolidation-composite.vitest.ts:227:    compositeMocks.vectorSearch.mockReturnValue([
.opencode/skills/system-spec-kit/mcp_server/handlers/README.md:30:- `memory-search.ts` - L2 hybrid search handler with telemetry and profile support.
.opencode/skills/system-spec-kit/mcp_server/tests/checkpoints-extended.vitest.ts:20:type VectorIndexModule = typeof import('../lib/search/vector-index');
.opencode/skills/system-spec-kit/mcp_server/tests/checkpoints-extended.vitest.ts:49:let vectorIndexModule: VectorIndexModule | null = null;
.opencode/skills/system-spec-kit/mcp_server/tests/checkpoints-extended.vitest.ts:73:      vectorIndexModule = await import('../lib/search/vector-index');
.opencode/skills/system-spec-kit/mcp_server/tests/checkpoints-extended.vitest.ts:529:  // 4.7 Extended restore fidelity and vector preservation
.opencode/skills/system-spec-kit/mcp_server/tests/checkpoints-extended.vitest.ts:651:    it('EXT-S16: clearExisting restore reinstates checkpoint vector snapshot', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/checkpoints-extended.vitest.ts:665:      checkpointStorage.createCheckpoint({ name: 'vector-restore-test' });
.opencode/skills/system-spec-kit/mcp_server/tests/checkpoints-extended.vitest.ts:667:      // Mutate vector payload and add an orphan vector row not in checkpoint memory set.
.opencode/skills/system-spec-kit/mcp_server/tests/checkpoints-extended.vitest.ts:677:      const result = checkpointStorage.restoreCheckpoint('vector-restore-test', true);
.opencode/skills/system-spec-kit/mcp_server/tests/checkpoints-extended.vitest.ts:692:      checkpointStorage.deleteCheckpoint('vector-restore-test');
.opencode/skills/system-spec-kit/mcp_server/tests/checkpoints-extended.vitest.ts:1013:      if (!vectorIndexModule) return;
.opencode/skills/system-spec-kit/mcp_server/tests/checkpoints-extended.vitest.ts:1015:      vi.spyOn(vectorIndexModule, 'initializeDb').mockReturnValue(testDb);
.opencode/skills/system-spec-kit/mcp_server/tests/checkpoints-extended.vitest.ts:1016:      vi.spyOn(vectorIndexModule, 'getDb').mockReturnValue(testDb);
.opencode/skills/system-spec-kit/mcp_server/tests/checkpoints-extended.vitest.ts:1036:      if (!vectorIndexModule) return;
.opencode/skills/system-spec-kit/mcp_server/tests/checkpoints-extended.vitest.ts:1038:      vi.spyOn(vectorIndexModule, 'initializeDb').mockReturnValue(testDb);
.opencode/skills/system-spec-kit/mcp_server/tests/checkpoints-extended.vitest.ts:1039:      vi.spyOn(vectorIndexModule, 'getDb').mockReturnValue(testDb);
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:75:      makeTopKItem('a1', 0.9, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:76:      makeTopKItem('b1', 0.8, 'bm25'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:80:      ['vector', [makeChannelResult('a1', 0.9), makeChannelResult('a2', 0.6)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:81:      ['bm25',   [makeChannelResult('b1', 0.8)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:95:      makeTopKItem('a1', 0.9, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:96:      makeTopKItem('b1', 0.8, 'bm25'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:99:      ['vector', [makeChannelResult('a1', 0.9)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:100:      ['bm25',   [makeChannelResult('b1', 0.8)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:116:      makeTopKItem('a1', 0.9, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:119:      ['vector', [makeChannelResult('a1', 0.9)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:134:      makeTopKItem('a1', 0.9, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:137:      ['vector', [makeChannelResult('a1', 0.9)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:138:      ['bm25',   [makeChannelResult('b1', 0.6), makeChannelResult('b2', 0.4)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:148:    expect(promotedChannels).toContain('bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:151:    // Best from bm25 is b1 (0.6)
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:152:    const bm25Promotion = result.promoted.find(p => p.promotedFrom === 'bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:153:    expect(bm25Promotion?.id).toBe('b1');
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:159:      makeTopKItem('a1', 0.9, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:162:      ['vector', [makeChannelResult('a1', 0.9)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:163:      ['bm25',   []], // contributed nothing
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:168:    expect(result.underRepresentedChannels).not.toContain('bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:176:      ['vector', [makeChannelResult('a1', 0.8)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:191:      makeTopKItem('a1', 0.9, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:194:      ['vector', [makeChannelResult('a1', 0.9)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:208:      makeTopKItem('a1', 0.9, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:211:      ['vector', [makeChannelResult('a1', 0.9)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:212:      ['bm25',   [makeChannelResult('b1', 0.55, { title: 'BM25 Doc' })]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:219:    expect(p.promotedFrom).toBe('bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:220:    expect(p.source).toBe('bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:229:      makeTopKItem('a1', 0.9, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:230:      makeTopKItem('a2', 0.85, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:231:      makeTopKItem('b1', 0.8, 'bm25'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:234:      ['vector', [makeChannelResult('a1', 0.9), makeChannelResult('a2', 0.85)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:235:      ['bm25',   [makeChannelResult('b1', 0.8)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:241:    expect(result.channelCounts['vector']).toBe(2);
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:242:    expect(result.channelCounts['bm25']).toBe(1);
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:250:      makeTopKItem('a1', 0.9, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:255:      ['vector', [makeChannelResult('a1', 0.9)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:264:      ['vector', [makeChannelResult('a1', 0.9)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:274:      makeTopKItem('a1', 0.9, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:277:      ['vector', [makeChannelResult('a1', 0.9)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:294:      makeTopKItem('a1', 0.9, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:322:    // Item a1 is in both vector and bm25 via convergence
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:324:      makeTopKItem('a1', 0.95, 'vector', { sources: ['vector', 'bm25'] }),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:327:      ['vector', [makeChannelResult('a1', 0.95)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:328:      ['bm25',   [makeChannelResult('a1', 0.90), makeChannelResult('b1', 0.50)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:335:    expect(result.underRepresentedChannels).not.toContain('bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:350:      makeTopKItem('a1', 0.9, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:351:      makeTopKItem('b1', 0.5, 'bm25'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:355:      ['vector', [makeChannelResult('a1', 0.9)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:356:      ['bm25',   [makeChannelResult('b1', 0.5)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:373:      makeTopKItem('a1', 0.9, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:376:      ['vector',  [makeChannelResult('a1', 0.9)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:377:      ['bm25',    [makeChannelResult('b1', 0.6)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:385:    expect(result.underRepresentedChannels).toContain('bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:388:    expect(result.underRepresentedChannels).not.toContain('vector');
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:394:      makeTopKItem('a1', 0.9, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:397:      ['vector', [makeChannelResult('a1', 0.9)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:398:      ['bm25',   [makeChannelResult('b1', 0.6)]],       // above floor → promoted
.opencode/skills/system-spec-kit/mcp_server/tests/channel-representation.vitest.ts:405:    expect(result.promoted[0].promotedFrom).toBe('bm25');
.opencode/skills/system-spec-kit/mcp_server/lib/config/README.md:221:| Reset config | `getDefaultHalfLives()` | Config recovery |
.opencode/skills/system-spec-kit/mcp_server/lib/utils/README.md:93:Shared path-policy module (Packet 026/010/002) used as the single source of truth for memory indexing and code-graph scanning exclusions. Enforces permanent exclusion of `z_future/` and `/external/` subtrees across memory discovery, spec-doc classification, parser admissibility, and code-graph recursive scans. Exported helpers are consumed by `memory-index-discovery.ts`, `spec-doc-paths.ts`, `memory-parser.ts`, `memory-save.ts`, `vector-index-mutations.ts`, `post-insert-metadata.ts`, `checkpoints.ts`, `code-graph/lib/indexer-types.ts`, and `code-graph/lib/structural-indexer.ts`.
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/scripts/fixtures/skill_advisor_regression_cases.jsonl:50:{"id":"P1-PHRASE-006","priority":"P1","prompt":"vector search","confidence_only":false,"expect_result":true,"expected_top_any":["mcp-coco-index"],"expect_kind":"skill","allow_command_bridge":false}
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:9:// 1. specFolder forwarded in Stage 1 — vector channel
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:10:// 2. specFolder forwarded in Stage 1 — hybrid channel
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:15:// 7. structuralSearch (hybrid fallback Tier 3) respects specFolder
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:25:// Capture call arguments for vectorSearch and multiConceptSearch
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:29:vi.mock('../lib/search/vector-index', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:30:  vectorSearch: vi.fn((...args) => {
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:40:// Capture call arguments for the Stage 1 hybrid raw-collector path.
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:44:vi.mock('../lib/search/hybrid-search', async (importOriginal) => {
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:45:  const actual = await importOriginal<typeof import('../lib/search/hybrid-search')>();
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:61:// BM25 — prevent filesystem access during hybrid-search init
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:62:vi.mock('../lib/search/bm25-index', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:70:// Sqlite-fts — prevent DB access
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:71:vi.mock('../lib/search/sqlite-fts', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:72:  fts5Bm25Search: vi.fn(() => []),
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:107:import { structuralSearch, init } from '../lib/search/hybrid-search';
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:117:    searchType: 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:197:// 1. Stage 1 — specFolder forwarded to vector channel
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:200:describe('R9: Stage 1 spec-folder forwarding — vector channel', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:203:  it('R9-01: vectorSearch is called with specFolder when provided', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:206:        searchType: 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:213:    // At least one call to vectorSearch must have occurred.
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:216:    // The primary vector channel call must carry specFolder.
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:221:  it('R9-02: vectorSearch is called with no specFolder (falsy) when not provided', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:224:        searchType: 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:240:// 2. Stage 1 — specFolder forwarded to hybrid channel
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:243:describe('R9: Stage 1 spec-folder forwarding — hybrid channel', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:249:        searchType: 'hybrid',
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:266:        searchType: 'hybrid',
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:291:        concepts: ['hybrid RAG', 'vector search'],
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:342:  it('R9-07: all vectorSearch calls (primary + constitutional) carry the same specFolder', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:344:    // Results, Stage 1 does an extra vectorSearch call with tier='constitutional'.
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:348:        searchType: 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:356:    // At least the primary vector channel call.
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:359:    // All calls to vectorSearch — primary channel + constitutional injection — must carry specFolder.
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:373:  it('R9-08: no specFolder means no folder filter in vectorSearch options', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:378:        searchType: 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:395:        searchType: 'hybrid',
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:435:  it('R9-10: returns empty candidates when vectorSearch returns [] for non-existent specFolder', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:439:        searchType: 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:456:        searchType: 'hybrid',
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:488:// 7. structuralSearch (hybrid fallback Tier 3) — real DB tests
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:558:        searchType: 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:568:        searchType: 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:577:    for (const searchType of ['vector', 'hybrid'] as const) {
.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-prefilter.vitest.ts:588:      config: makePipelineConfig({ searchType: 'vector' }),
.opencode/skills/system-spec-kit/mcp_server/tests/create-record-lineage-regressions.vitest.ts:5:import { createSchema, ensureSchemaVersion } from '../lib/search/vector-index-schema';
.opencode/skills/system-spec-kit/mcp_server/tests/causal-fixes.vitest.ts:5:import * as vectorIndex from '../lib/search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/tests/causal-fixes.vitest.ts:223:      vi.spyOn(vectorIndex, 'initializeDb').mockImplementation(() => testDb);
.opencode/skills/system-spec-kit/mcp_server/tests/causal-fixes.vitest.ts:224:      vi.spyOn(vectorIndex, 'getDb').mockReturnValue(testDb);
.opencode/skills/system-spec-kit/mcp_server/handlers/session-learning.ts:4:import * as vectorIndex from '../lib/search/vector-index.js';
.opencode/skills/system-spec-kit/mcp_server/handlers/session-learning.ts:325:  const database: Database | null = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/handlers/session-learning.ts:483:  const database: Database | null = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/handlers/session-learning.ts:678:  const database: Database | null = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/lib/errors/index.ts:32:} from './recovery-hints.js';
.opencode/skills/system-spec-kit/mcp_server/lib/errors/index.ts:41:} from './recovery-hints.js';
.opencode/skills/system-spec-kit/mcp_server/tests/search-flags.vitest.ts:275:  it('resolveSavePlannerMode accepts hybrid', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/search-flags.vitest.ts:276:    process.env.SPECKIT_SAVE_PLANNER_MODE = 'hybrid';
.opencode/skills/system-spec-kit/mcp_server/tests/search-flags.vitest.ts:277:    expect(resolveSavePlannerMode()).toBe('hybrid');
.opencode/skills/system-spec-kit/mcp_server/tests/eval-logger.vitest.ts:133:      logChannelResult({ evalRunId: 1, queryId: 1, channel: 'vector' });
.opencode/skills/system-spec-kit/mcp_server/tests/eval-logger.vitest.ts:158:        query: 'hybrid search for memory retrieval',
.opencode/skills/system-spec-kit/mcp_server/tests/eval-logger.vitest.ts:201:        channel: 'bm25',
.opencode/skills/system-spec-kit/mcp_server/tests/eval-logger.vitest.ts:213:      ).get(evalRunId, queryId, 'bm25') as { id: number } | undefined;
.opencode/skills/system-spec-kit/mcp_server/tests/eval-logger.vitest.ts:223:        channel: 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/eval-logger.vitest.ts:296:      logChannelResult({ evalRunId, queryId, channel: 'vector' });
.opencode/skills/system-spec-kit/mcp_server/tests/eval-logger.vitest.ts:302:      ).get(queryId, 'vector') as { eval_run_id: number };
.opencode/skills/system-spec-kit/mcp_server/tests/eval-logger.vitest.ts:339:        logChannelResult({ evalRunId: 0, queryId: 0, channel: 'vector' });
.opencode/skills/system-spec-kit/mcp_server/tests/eval-logger.vitest.ts:402:      logChannelResult({ evalRunId, queryId, channel: 'vector', resultMemoryIds: [1, 2, 3], scores: [0.9, 0.8, 0.7] });
.opencode/skills/system-spec-kit/mcp_server/tests/eval-logger.vitest.ts:422:      logChannelResult({ evalRunId: 1, queryId: 1, channel: 'vector' });
.opencode/skills/system-spec-kit/mcp_server/tests/eval-logger.vitest.ts:448:      logChannelResult({ evalRunId, queryId, channel: 'hybrid', resultMemoryIds: [1, 2], scores: [0.9, 0.8] });
.opencode/skills/system-spec-kit/mcp_server/tests/eval-logger.vitest.ts:483:        ).run(channelMaxId, 1, 'vector');
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:91:} from '../lib/search/sqlite-fts.js';
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:92:import type { LexicalCapabilitySnapshot } from '../lib/search/sqlite-fts.js';
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:609:/** Handle memory_search tool — performs hybrid vector/BM25 search with intent-aware ranking.
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:684:        recovery: {
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:724:          recovery: {
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:743:      recovery: {
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:755:      recovery: {
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:917:        : 'hybrid',
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:952:    // Phase B T018/T019: Community search fallback — inject community members on weak results
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:1163:      normalizedQuery,   // REQ-D5-001/D5-004: pass query for recovery + confidence context
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:1164:      specFolder ?? null // REQ-D5-001: pass specFolder for recovery narrowing detection
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:1430:            confidence: 'weak',
.opencode/skills/system-spec-kit/mcp_server/lib/utils/cleanup-helpers.ts:1:import { get_error_message } from '../search/vector-index-types.js';
.opencode/skills/system-spec-kit/mcp_server/lib/errors/core.ts:13:} from './recovery-hints.js';
.opencode/skills/system-spec-kit/mcp_server/lib/errors/core.ts:15:import type { RecoveryHint, Severity } from './recovery-hints.js';
.opencode/skills/system-spec-kit/mcp_server/lib/errors/core.ts:70:// Re-export from recovery-hints for backward compatibility.
.opencode/skills/system-spec-kit/mcp_server/lib/errors/core.ts:71:// New code should use ERROR_CODES from recovery-hints.ts.
.opencode/skills/system-spec-kit/mcp_server/lib/errors/core.ts:118:  public recoveryHint?: RecoveryHint;
.opencode/skills/system-spec-kit/mcp_server/lib/errors/core.ts:317:// Build standardized error responses with recovery hints.
.opencode/skills/system-spec-kit/mcp_server/lib/errors/core.ts:367: * Build an error response object with recovery hints.
.opencode/skills/system-spec-kit/mcp_server/lib/errors/core.ts:382:  // Get recovery hint (zero-cost static lookup)
.opencode/skills/system-spec-kit/mcp_server/lib/errors/core.ts:383:  const recoveryHint = getRecoveryHint(toolName, errorCode);
.opencode/skills/system-spec-kit/mcp_server/lib/errors/core.ts:385:  // Build hints array from recovery hint
.opencode/skills/system-spec-kit/mcp_server/lib/errors/core.ts:387:  if (recoveryHint.hint) hints.push(recoveryHint.hint);
.opencode/skills/system-spec-kit/mcp_server/lib/errors/core.ts:388:  if (recoveryHint.actions) hints.push(...recoveryHint.actions);
.opencode/skills/system-spec-kit/mcp_server/lib/errors/core.ts:389:  if (recoveryHint.toolTip) hints.push(recoveryHint.toolTip);
.opencode/skills/system-spec-kit/mcp_server/lib/errors/core.ts:403:      severity: recoveryHint.severity
.opencode/skills/system-spec-kit/mcp_server/lib/errors/core.ts:409: * Create a MemoryError with recovery hint pre-attached.
.opencode/skills/system-spec-kit/mcp_server/lib/errors/core.ts:420:  // Attach recovery hint if tool context provided
.opencode/skills/system-spec-kit/mcp_server/lib/errors/core.ts:422:    error.recoveryHint = getRecoveryHint(toolName, code);
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:113:    expect(CONFIDENCE_WEIGHTS.weak).toBe(0.1);
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:235:      makeEvent({ confidence: 'weak',   sessionId: 'sess-3' }),
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:242:    expect(s.weakCount).toBe(1);
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:292:      makeEvent({ memoryId: 'mem-low',  confidence: 'weak',   sessionId: 's1' }),
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:309:      mediumCount: 0, weakCount: 0, weightedScore: 3.0, computedBoost: 0.05,
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:319:      mediumCount: 0, weakCount: 0, weightedScore: 2.0, computedBoost: 0.05,
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:329:      mediumCount: 0, weakCount: 0, weightedScore: 1.0, computedBoost: 0.01,
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:333:      mediumCount: 0, weakCount: 0, weightedScore: 1.0, computedBoost: 0.01,
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:349:      { memoryId: 'a', sessionCount: 5, strongCount: 1, mediumCount: 0, weakCount: 0, weightedScore: 1.0, computedBoost: 0.01 },
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:350:      { memoryId: 'b', sessionCount: 1, strongCount: 1, mediumCount: 0, weakCount: 0, weightedScore: 1.0, computedBoost: 0.01 },
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:351:      { memoryId: 'c', sessionCount: 3, strongCount: 1, mediumCount: 0, weakCount: 0, weightedScore: 1.0, computedBoost: 0.01 },
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:438:      mediumCount: 1, weakCount: 0, weightedScore: 3.5, computedBoost: 0.08,
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:449:      mediumCount: 2, weakCount: 1, weightedScore: 3.1, computedBoost: 0.09,
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:466:      mediumCount: 0, weakCount: 0, weightedScore: 10.0, computedBoost: 0.99, // above cap
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:480:      mediumCount: 0, weakCount: 0, weightedScore: 4.0, computedBoost: 0.10,
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:554:      makeEvent({ memoryId: 'mem-weak', sessionId: 'sess-1', timestamp: BASE_TS }),
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:555:      makeEvent({ memoryId: 'mem-weak', sessionId: 'sess-2', timestamp: BASE_TS }),
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:565:    expect(getBatchLearningCount(db, 'mem-weak')).toBe(0);
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:658:      mediumCount: 0, weakCount: 0, weightedScore: 3.0, computedBoost: 0.05,
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:685:      mediumCount: 0, weakCount: 0, weightedScore: 3.0, computedBoost: 0.05,
.opencode/skills/system-spec-kit/mcp_server/tests/embedding-expansion.vitest.ts:46:// -- Mock: vector-index ------------------------------------------------------
.opencode/skills/system-spec-kit/mcp_server/tests/embedding-expansion.vitest.ts:48:// The vector index requires a real SQLite database. We mock it to return
.opencode/skills/system-spec-kit/mcp_server/tests/embedding-expansion.vitest.ts:51:vi.mock('../lib/search/vector-index', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/embedding-expansion.vitest.ts:52:  vectorSearch: vi.fn(() => []),
.opencode/skills/system-spec-kit/mcp_server/tests/embedding-expansion.vitest.ts:55:import * as vectorIndex from '../lib/search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/tests/embedding-expansion.vitest.ts:56:const mockVectorSearch = vectorIndex.vectorSearch as ReturnType<typeof vi.fn>;
.opencode/skills/system-spec-kit/mcp_server/tests/embedding-expansion.vitest.ts:65:/** A sample memory row returned by a mocked vectorSearch. */
.opencode/skills/system-spec-kit/mcp_server/tests/embedding-expansion.vitest.ts:77:    // Default: vector search returns nothing (safe baseline)
.opencode/skills/system-spec-kit/mcp_server/tests/embedding-expansion.vitest.ts:145:    // Simulate vector index returning memories with rich content
.opencode/skills/system-spec-kit/mcp_server/tests/embedding-expansion.vitest.ts:148:      makeMockMemory(2, 'embedding similarity vector search semantic expansion candidates'),
.opencode/skills/system-spec-kit/mcp_server/tests/embedding-expansion.vitest.ts:149:      makeMockMemory(3, 'hybrid retrieval fusion recall semantic candidates'),
.opencode/skills/system-spec-kit/mcp_server/tests/embedding-expansion.vitest.ts:316:  it('T11: combinedQuery === original when vector search returns no content', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/embedding-expansion.vitest.ts:337:    // The query contains all possible expansion tokens. We mock vectorSearch
.opencode/skills/system-spec-kit/mcp_server/tests/embedding-expansion.vitest.ts:366:      makeMockMemory(1, 'fusion retrieval ranking scoring candidates vectors similarity'),
.opencode/skills/system-spec-kit/mcp_server/tests/embedding-expansion.vitest.ts:388:  // -- T13: Graceful degradation on vectorSearch error ---------------------
.opencode/skills/system-spec-kit/mcp_server/tests/embedding-expansion.vitest.ts:390:  it('T13: returns identity result when vectorSearch throws', async () => {
.opencode/skills/system-spec-kit/mcp_server/handlers/causal-graph.ts:10:import * as vectorIndex from '../lib/search/vector-index.js';
.opencode/skills/system-spec-kit/mcp_server/handlers/causal-graph.ts:193:    recovery: getRecoveryHint(tool, code),
.opencode/skills/system-spec-kit/mcp_server/handlers/causal-graph.ts:435:      recovery: getRecoveryHint('memory_drift_why', 'E031'),
.opencode/skills/system-spec-kit/mcp_server/handlers/causal-graph.ts:443:    vectorIndex.initializeDb();
.opencode/skills/system-spec-kit/mcp_server/handlers/causal-graph.ts:444:    const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/handlers/causal-graph.ts:451:        recovery: getRecoveryHint('memory_drift_why', 'E020'),
.opencode/skills/system-spec-kit/mcp_server/handlers/causal-graph.ts:466:          recovery: getRecoveryHint('memory_drift_why', ErrorCodes.CAUSAL_INVALID_RELATION),
.opencode/skills/system-spec-kit/mcp_server/handlers/causal-graph.ts:660:      recovery: {
.opencode/skills/system-spec-kit/mcp_server/handlers/causal-graph.ts:676:    vectorIndex.initializeDb();
.opencode/skills/system-spec-kit/mcp_server/handlers/causal-graph.ts:677:    const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/handlers/causal-graph.ts:684:        recovery: getRecoveryHint('memory_causal_link', 'E020'),
.opencode/skills/system-spec-kit/mcp_server/handlers/causal-graph.ts:697:        recovery: getRecoveryHint('memory_causal_link', ErrorCodes.CAUSAL_INVALID_RELATION),
.opencode/skills/system-spec-kit/mcp_server/handlers/causal-graph.ts:710:        recovery: getRecoveryHint('memory_causal_link', ErrorCodes.CAUSAL_GRAPH_ERROR),
.opencode/skills/system-spec-kit/mcp_server/handlers/causal-graph.ts:751:    vectorIndex.initializeDb();
.opencode/skills/system-spec-kit/mcp_server/handlers/causal-graph.ts:752:    const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/handlers/causal-graph.ts:759:        recovery: getRecoveryHint('memory_causal_stats', 'E020'),
.opencode/skills/system-spec-kit/mcp_server/handlers/causal-graph.ts:862:      recovery: {
.opencode/skills/system-spec-kit/mcp_server/handlers/causal-graph.ts:877:    vectorIndex.initializeDb();
.opencode/skills/system-spec-kit/mcp_server/handlers/causal-graph.ts:878:    const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/handlers/causal-graph.ts:885:        recovery: getRecoveryHint('memory_causal_unlink', 'E020'),
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:28:vi.mock('../lib/search/vector-index', async (importOriginal) => {
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:120:let vectorIndex: any = null;
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:141:  vectorIndex = await import('../lib/search/vector-index');
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:186:  vi.mocked(vectorIndex.deleteMemory).mockImplementation((id: number) => { calls.deleteMemory.push(id); return deleteResult; });
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:187:  vi.mocked(vectorIndex.getDb).mockImplementation(() => fakeDb);
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:241:  vi.mocked(vectorIndex.getMemoriesByFolder).mockImplementation((folder: string) => { calls.getMemoriesByFolder.push(folder); return memories; });
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:242:  vi.mocked(vectorIndex.deleteMemory).mockImplementation((id: number) => { calls.deleteMemory.push(id); return true; });
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:243:  vi.mocked(vectorIndex.getDb).mockImplementation(() => fakeDb);
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:312:  vi.mocked(vectorIndex.getMemory).mockImplementation((id: number) => { calls.getMemory.push(id); return existingMemory; });
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:313:  vi.mocked(vectorIndex.getDb).mockImplementation(() => { calls.getDb.push(true); return fakeDb as any; });
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:314:  vi.mocked(vectorIndex.updateMemory).mockImplementation((params: any) => { calls.updateMemory.push(params); });
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:315:  vi.mocked(vectorIndex.updateEmbeddingStatus).mockImplementation((id: number, status: string) => { calls.updateEmbeddingStatus.push({ id, status }); });
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:361:  vi.mocked(vectorIndex.getDb).mockImplementation(() => fakeDb);
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:372:  vectorSearchAvailable?: boolean;
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:382:    vectorSearchAvailable = true,
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:410:  vi.mocked(vectorIndex.getDb).mockImplementation(() => fakeDb);
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:411:  vi.mocked(vectorIndex.getStatusCounts).mockImplementation(() => statusCounts);
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:412:  vi.mocked(vectorIndex.isVectorSearchAvailable).mockImplementation(() => vectorSearchAvailable);
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:428:  vectorSearchAvailable?: boolean;
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:439:    vectorSearchAvailable = true,
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:461:  vi.mocked(vectorIndex.getDb).mockImplementation(() => fakeDb);
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:462:  vi.mocked(vectorIndex.isVectorSearchAvailable).mockImplementation(() => vectorSearchAvailable);
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:463:  vi.mocked(vectorIndex.verifyIntegrity).mockImplementation(() => ({
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:472:  vi.mocked(vectorIndex.deleteMemory).mockImplementation(() => true);
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:519:    if (!handler?.handleMemoryDelete || !vectorIndex) {
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:520:      throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable');
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:529:    if (!handler?.handleMemoryDelete || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:537:    if (!handler?.handleMemoryDelete || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:544:    if (!handler?.handleMemoryDelete || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:554:    if (!handler?.handleMemoryDelete || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:562:    if (!handler?.handleMemoryDelete || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:576:    if (!handler?.handleMemoryDelete || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:599:    if (!handler?.handleMemoryDelete || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:609:    if (!handler?.handleMemoryDelete || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:617:    if (!handler?.handleMemoryDelete || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:630:    if (!handler?.handleMemoryDelete || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:641:    if (!handler?.handleMemoryDelete || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:651:    if (!handler?.handleMemoryDelete || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:659:    if (!handler?.handleMemoryDelete || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:672:    if (!handler?.handleMemoryDelete || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:681:    if (!handler?.handleMemoryDelete || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:691:    if (!handler?.handleMemoryDelete || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:702:    if (!handler?.handleMemoryDelete || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:722:    if (!handler?.handleMemoryUpdate || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:732:    if (!handler?.handleMemoryUpdate || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:740:    if (!handler?.handleMemoryUpdate || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:758:    if (!handler?.handleMemoryUpdate || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:773:    if (!handler?.handleMemoryUpdate || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:782:    if (!handler?.handleMemoryUpdate || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:807:    if (!handler?.handleMemoryUpdate || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:824:    if (!handler?.handleMemoryUpdate || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:835:    if (!handler?.handleMemoryUpdate || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:853:    if (!handler?.handleMemoryUpdate || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:865:    if (!handler?.handleMemoryUpdate || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:879:    if (!handler?.handleMemoryList || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:892:    if (!handler?.handleMemoryList || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:903:    if (!handler?.handleMemoryList || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:912:    if (!handler?.handleMemoryList || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:921:    if (!handler?.handleMemoryList || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:929:    if (!handler?.handleMemoryList || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:930:    vi.mocked(vectorIndex.getDb).mockImplementation(() => null);
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:938:    if (!handler?.handleMemoryList || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:949:    if (!handler?.handleMemoryList || !vectorIndex) {
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:950:      throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable');
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:969:    if (!handler?.handleMemoryStats || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:984:    if (!handler?.handleMemoryStats || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:992:    if (!handler?.handleMemoryStats || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1000:    if (!handler?.handleMemoryStats || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1008:    if (!handler?.handleMemoryStats || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1020:  it('EXT-S6: Stats returns without error (no vector)', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1021:    if (!handler?.handleMemoryStats || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1022:    installStatsMocks({ vectorSearchAvailable: false });
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1029:  it('EXT-S8: Stats exposes graph channel metrics from hybrid-search', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1030:    if (!handler?.handleMemoryStats || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1032:    const hybridSearch = await import('../lib/search/hybrid-search');
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1037:    expect(parsed?.data?.graphChannelMetrics).toEqual(hybridSearch.getGraphMetrics());
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1042:    if (!handler?.handleMemoryStats || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1043:    vi.mocked(vectorIndex.getDb).mockImplementation(() => null);
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1044:    vi.mocked(vectorIndex.getStatusCounts).mockImplementation(() => ({ success: 0, pending: 0, failed: 0 }));
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1060:    if (!handler?.handleMemoryStats || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1074:    if (!handler?.handleMemoryStats || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1084:    if (!handler?.handleMemoryStats || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1100:    if (!handler?.handleMemoryStats || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1120:    if (!handler?.handleMemoryHealth || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1122:    installHealthMocks({ dbAvailable: true, memoryCount: 42, vectorSearchAvailable: true });
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1129:    if (!handler?.handleMemoryHealth || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1138:    if (!handler?.handleMemoryHealth || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1149:    if (!handler?.handleMemoryHealth || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1164:    if (!handler?.handleMemoryHealth || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1189:    if (!handler?.handleMemoryHealth || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1209:    if (!handler?.handleMemoryHealth || !vectorIndex) {
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1238:    if (!handler?.handleMemoryHealth || !vectorIndex) {
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1267:    if (!handler?.handleMemoryHealth || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1276:    if (!handler?.handleMemoryHealth || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1285:  it('EXT-H7: Health completes without vector search', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1286:    if (!handler?.handleMemoryHealth || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1288:    installHealthMocks({ dbAvailable: true, vectorSearchAvailable: false });
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1295:      vectorSearchAvailable: false,
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1302:    if (!handler?.handleMemoryHealth || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1319:    if (!handler?.handleMemoryHealth || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1335:    if (!handler?.handleMemoryHealth || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1358:    if (!handler?.handleMemoryHealth || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1379:    if (!handler?.handleMemoryHealth || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1400:    if (!handler?.handleMemoryHealth || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1420:    if (!handler?.handleMemoryHealth || !vectorIndex || !embeddingsSourceMod || !triggerMatcherMod?.refreshTriggerCache) {
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1427:    let ftsCount = 2;
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1429:      ftsCount = 42;
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1435:          if (sql.includes('FROM memory_fts')) return { count: ftsCount };
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1443:    vi.mocked(vectorIndex.getDb).mockImplementation(() => fakeDb as any);
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1444:    vi.mocked(vectorIndex.isVectorSearchAvailable).mockImplementation(() => true);
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1454:    vi.mocked(vectorIndex.verifyIntegrity).mockImplementation(() => ({
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1478:      expect(parsed?.data?.repair?.actions).toContain('fts_rebuild');
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1489:      !vectorIndex ||
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1501:    let ftsCount = 2;
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1503:      ftsCount = 41;
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1509:          if (sql.includes('FROM memory_fts')) return { count: ftsCount };
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1517:    vi.mocked(vectorIndex.getDb).mockImplementation(() => fakeDb as any);
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1518:    vi.mocked(vectorIndex.isVectorSearchAvailable).mockImplementation(() => true);
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1530:    vi.mocked(vectorIndex.verifyIntegrity).mockImplementation(() => ({
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1566:      !vectorIndex ||
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1586:    vi.mocked(vectorIndex.getDb).mockImplementation(() => fakeDb as any);
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1587:    vi.mocked(vectorIndex.isVectorSearchAvailable).mockImplementation(() => true);
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1599:    vi.mocked(vectorIndex.verifyIntegrity).mockImplementation(() => ({
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1624:  it('EXT-H15: autoRepair cleans orphaned vectors but preserves orphaned files under temp-root workspaces', async (ctx) => {
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1627:      !vectorIndex ||
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1650:    vi.mocked(vectorIndex.deleteMemory).mockImplementation(() => true);
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1651:    vi.mocked(vectorIndex.verifyIntegrity)
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1663:        cleaned: { vectors: 3, chunks: 0 },
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1677:    vi.mocked(vectorIndex.deleteMemory).mockClear();
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1682:    expect(vi.mocked(vectorIndex.deleteMemory)).not.toHaveBeenCalled();
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1684:    expect(parsed?.data?.repair?.actions).toContain('orphan_vectors_cleaned:3');
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1690:        expect.stringContaining('removed 3 orphaned vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1708:    if (!handler?.setEmbeddingModelReady || !handler?.handleMemoryHealth || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1717:    if (!handler?.setEmbeddingModelReady || !handler?.handleMemoryHealth || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1727:    if (!handler?.setEmbeddingModelReady || !handler?.handleMemoryHealth || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1746:    if (!handler?.handleMemoryDelete || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1754:    if (!handler?.handleMemoryDelete || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1765:    if (!handler?.handleMemoryList || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1766:    vi.mocked(vectorIndex.getDb).mockImplementation(() => null);
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1776:    if (!handler?.handleMemoryDelete || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1791:    if (!handler?.handleMemoryDelete || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1805:    if (!handler?.handleMemoryUpdate || !vectorIndex) { throw new Error('Test setup incomplete: memory-crud handler or vector-index unavailable'); }
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1807:    vi.mocked(vectorIndex.getDb).mockImplementation(() => ({
.opencode/skills/system-spec-kit/mcp_server/lib/errors/README.md:3:description: "Error handling subsystem with custom error classes, recovery hints, and document-aware operation context."
.opencode/skills/system-spec-kit/mcp_server/lib/errors/README.md:6:  - "recovery hints"
.opencode/skills/system-spec-kit/mcp_server/lib/errors/README.md:12:> Error handling subsystem with custom error classes and recovery hints for memory and spec-document workflows.
.opencode/skills/system-spec-kit/mcp_server/lib/errors/README.md:32:The errors subsystem provides standardized error handling for the Spec Kit Memory MCP server. Every error includes a code and message paired with actionable recovery guidance to help agents self-diagnose and resolve issues across memory operations and document-aware indexing/search paths.
.opencode/skills/system-spec-kit/mcp_server/lib/errors/README.md:33:When work is packet-scoped, recovery hints should re-anchor operators on `/spec_kit:resume` and the canonical continuity chain `handover.md -> _memory.continuity -> spec docs`.
.opencode/skills/system-spec-kit/mcp_server/lib/errors/README.md:47:| **Recovery Hints** | Every error code maps to actionable recovery guidance |
.opencode/skills/system-spec-kit/mcp_server/lib/errors/README.md:62:├── recovery-hints.ts # 49 error codes with recovery guidance (v1.2.0)
.opencode/skills/system-spec-kit/mcp_server/lib/errors/README.md:72:| `recovery-hints.ts` | Error code catalog with severity levels and recovery actions |
.opencode/skills/system-spec-kit/mcp_server/lib/errors/README.md:92:| E040-E049 | Search | Query errors, vector unavailable |
.opencode/skills/system-spec-kit/mcp_server/lib/errors/README.md:95:| E070-E079 | Session | Expired, invalid, recovery failed |
.opencode/skills/system-spec-kit/mcp_server/lib/errors/README.md:104:- **hint**: Primary recovery suggestion
.opencode/skills/system-spec-kit/mcp_server/lib/errors/README.md:161:// Error has .recoveryHint attached
.opencode/skills/system-spec-kit/mcp_server/lib/errors/README.md:195:// From recovery-hints.ts
.opencode/skills/system-spec-kit/mcp_server/tests/mpab-quality-gate-integration.vitest.ts:98:/** Create a simple embedding vector */
.opencode/skills/system-spec-kit/mcp_server/tests/mpab-quality-gate-integration.vitest.ts:200:      // MPAB takes scores as-is from the fusion pipeline (post-RRF, post-normalization)
.opencode/skills/system-spec-kit/mcp_server/tests/mpab-quality-gate-integration.vitest.ts:202:      const fusionScores = [0.7, 0.3, 0.2]; // Simulated post-RRF fusion scores
.opencode/skills/system-spec-kit/mcp_server/tests/mpab-quality-gate-integration.vitest.ts:218:      const nonChunkResult = { id: 50, score: 0.8, source: 'vector' };
.opencode/skills/system-spec-kit/mcp_server/tests/mpab-quality-gate-integration.vitest.ts:610:      vector: [1, 2, 3],
.opencode/skills/system-spec-kit/mcp_server/tests/mpab-quality-gate-integration.vitest.ts:611:      fts: [2, 4],
.opencode/skills/system-spec-kit/mcp_server/tests/mpab-quality-gate-integration.vitest.ts:612:      bm25: [3, 4],
.opencode/skills/system-spec-kit/mcp_server/tests/mpab-quality-gate-integration.vitest.ts:622:    // Memory 1 is exclusive to vector
.opencode/skills/system-spec-kit/mcp_server/tests/mpab-quality-gate-integration.vitest.ts:623:    const vectorEcr = report.channelECRs.find(e => e.channel === 'vector');
.opencode/skills/system-spec-kit/mcp_server/tests/mpab-quality-gate-integration.vitest.ts:624:    expect(vectorEcr).toBeDefined();
.opencode/skills/system-spec-kit/mcp_server/tests/mpab-quality-gate-integration.vitest.ts:625:    expect(vectorEcr!.exclusiveCount).toBeGreaterThanOrEqual(1);
.opencode/skills/system-spec-kit/mcp_server/tests/mpab-quality-gate-integration.vitest.ts:805:    const sources: ChannelSources = { vector: [1, 2] };
.opencode/skills/system-spec-kit/mcp_server/lib/errors/recovery-hints.ts:5:// Error catalog with recovery hints (REQ-004, REQ-009)
.opencode/skills/system-spec-kit/mcp_server/lib/errors/recovery-hints.ts:137:// Each error code has specific recovery guidance.
.opencode/skills/system-spec-kit/mcp_server/lib/errors/recovery-hints.ts:155:    hint: 'Embedding dimension mismatch. The vector index may need reindexing.',
.opencode/skills/system-spec-kit/mcp_server/lib/errors/recovery-hints.ts:337:      'If vector search failed, results may still include BM25 matches'
.opencode/skills/system-spec-kit/mcp_server/lib/errors/recovery-hints.ts:469:      'Consider using /spec_kit:resume for session recovery'
.opencode/skills/system-spec-kit/mcp_server/lib/errors/recovery-hints.ts:487:      'Check memory_health() for recovery options'
.opencode/skills/system-spec-kit/mcp_server/lib/errors/recovery-hints.ts:818:// Returns recovery hint for tool + error code.
.opencode/skills/system-spec-kit/mcp_server/lib/errors/recovery-hints.ts:821: * Get recovery hint for a specific error in tool context.
.opencode/skills/system-spec-kit/mcp_server/core/db-state.ts:15:/** Minimal vector index interface for database operations */
.opencode/skills/system-spec-kit/mcp_server/core/db-state.ts:25:  vectorSearch?: VectorSearchFn;
.opencode/skills/system-spec-kit/mcp_server/core/db-state.ts:44:  init(database: DatabaseLike, vectorSearch: VectorSearchFn | undefined, graphSearch?: GraphSearchFn | null): void;
.opencode/skills/system-spec-kit/mcp_server/core/db-state.ts:64:  vectorIndex?: VectorIndexLike;
.opencode/skills/system-spec-kit/mcp_server/core/db-state.ts:67:  hybridSearch?: HybridSearchLike;
.opencode/skills/system-spec-kit/mcp_server/core/db-state.ts:97:let vectorIndex: VectorIndexLike | null = null;
.opencode/skills/system-spec-kit/mcp_server/core/db-state.ts:100:let hybridSearch: HybridSearchLike | null = null;
.opencode/skills/system-spec-kit/mcp_server/core/db-state.ts:105:let vectorIndexListenerCleanup: (() => void) | null = null;
.opencode/skills/system-spec-kit/mcp_server/core/db-state.ts:133:  if (vectorIndexListenerCleanup) {
.opencode/skills/system-spec-kit/mcp_server/core/db-state.ts:134:    vectorIndexListenerCleanup();
.opencode/skills/system-spec-kit/mcp_server/core/db-state.ts:135:    vectorIndexListenerCleanup = null;
.opencode/skills/system-spec-kit/mcp_server/core/db-state.ts:143:  vectorIndexListenerCleanup = nextVectorIndex.onDatabaseConnectionChange((database: DatabaseLike) => {
.opencode/skills/system-spec-kit/mcp_server/core/db-state.ts:163:  if (hybridSearch) {
.opencode/skills/system-spec-kit/mcp_server/core/db-state.ts:165:      console.warn('[db-state] hybridSearch reinit missing graphSearchFn; graph retrieval channel is disabled');
.opencode/skills/system-spec-kit/mcp_server/core/db-state.ts:167:    hybridSearch.init(database, vectorIndex?.vectorSearch, graphSearchFnRef ?? null);
.opencode/skills/system-spec-kit/mcp_server/core/db-state.ts:191:  if (deps.vectorIndex) {
.opencode/skills/system-spec-kit/mcp_server/core/db-state.ts:192:    vectorIndex = deps.vectorIndex;
.opencode/skills/system-spec-kit/mcp_server/core/db-state.ts:193:    registerVectorIndexListener(deps.vectorIndex);
.opencode/skills/system-spec-kit/mcp_server/core/db-state.ts:199:  if (deps.hybridSearch) hybridSearch = deps.hybridSearch;
.opencode/skills/system-spec-kit/mcp_server/core/db-state.ts:247:  if (!vectorIndex) {
.opencode/skills/system-spec-kit/mcp_server/core/db-state.ts:248:    throw new Error('db-state not initialized: vector_index is null');
.opencode/skills/system-spec-kit/mcp_server/core/db-state.ts:271:      if (typeof vectorIndex.closeDb === 'function') {
.opencode/skills/system-spec-kit/mcp_server/core/db-state.ts:272:        vectorIndex.closeDb();
.opencode/skills/system-spec-kit/mcp_server/core/db-state.ts:274:      vectorIndex.initializeDb();
.opencode/skills/system-spec-kit/mcp_server/core/db-state.ts:279:    const database = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/core/db-state.ts:396:  if (!vectorIndex) {
.opencode/skills/system-spec-kit/mcp_server/core/db-state.ts:397:    throw new Error('db-state not initialized: vector_index is null');
.opencode/skills/system-spec-kit/mcp_server/core/db-state.ts:409:    const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/core/db-state.ts:504:  if (!vectorIndex) {
.opencode/skills/system-spec-kit/mcp_server/core/db-state.ts:505:    throw new Error('db-state not initialized: vector_index is null');
.opencode/skills/system-spec-kit/mcp_server/core/db-state.ts:509:    const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/core/db-state.ts:529:  if (!vectorIndex) {
.opencode/skills/system-spec-kit/mcp_server/core/db-state.ts:530:    throw new Error('db-state not initialized: vector_index is null');
.opencode/skills/system-spec-kit/mcp_server/core/db-state.ts:534:    const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:14:import * as hybridSearch from '../lib/search/hybrid-search';
.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:737:          if (sql.includes('memory_fts')) {
.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:747:              content: 'fts duplicate entry',
.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:748:              fts_score: 9.0,
.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:754:              content: 'unique fts entry',
.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:755:              fts_score: 8.0,
.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:769:      title: 'Canonical duplicate from vector',
.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:770:      content: 'vector duplicate entry',
.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:776:      title: 'Unique vector entry',
.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:777:      content: 'unique vector entry',
.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:784:function canonicalIds(results: Awaited<ReturnType<typeof hybridSearch.hybridSearchEnhanced>>): string[] {
.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:785:  return results.map((result) => hybridSearch.__testables.canonicalResultId(result.id));
.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:788:describe('T008: includeContent-independent dedup in hybrid search path', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:790:    hybridSearch.init(createHybridMockDb(), mockVectorSearch, null);
.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:791:    hybridSearch.resetGraphMetrics();
.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:793:    const results = await hybridSearch.hybridSearchEnhanced(
.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:810:    hybridSearch.init(createHybridMockDb(), mockVectorSearch, null);
.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:811:    hybridSearch.resetGraphMetrics();
.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:813:    const results = await hybridSearch.hybridSearchEnhanced(
.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:831:    hybridSearch.init(createHybridMockDb(), mockVectorSearch, null);
.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:834:    const defaultPath = await hybridSearch.hybridSearchEnhanced('dedup regression query', embedding, {
.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:840:    const includeContentPath = await hybridSearch.hybridSearchEnhanced('dedup regression query', embedding, {
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/scripts/routing-accuracy/labeled-prompts.jsonl:51:{"id":"rr-iter2-051","bucket":"skill_routing_prompts","source_type":"synthetic-realistic","prompt":"Find code that does vector-search blending when Grep is not enough.","gate3_triggers":"no","gate3_reason_category":"skill_routing_only","skill_top_1":"mcp-coco-index","skill_correct":"yes","notes":"semantic search request"}
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/scripts/routing-accuracy/labeled-prompts.jsonl:135:{"id":"rr-iter3-135","bucket":"mixed_ambiguous","source_type":"paraphrased-realistic","prompt":"Review the routing packet and create a follow-up task list only if the evidence is weak.","gate3_triggers":"yes","gate3_reason_category":"mixed_ambiguous","skill_top_1":"system-spec-kit","skill_correct":"yes","notes":"conditional create still write-intent"}
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/scripts/routing-accuracy/labeled-prompts.jsonl:141:{"id":"rr-iter3-141","bucket":"mixed_ambiguous","source_type":"synthetic-edge","prompt":"Analyze the continuation prompts and rewrite the weak ones if you find any.","gate3_triggers":"yes","gate3_reason_category":"mixed_ambiguous","skill_top_1":"system-spec-kit","skill_correct":"yes","notes":"analyze plus rewrite"}
.opencode/skills/system-spec-kit/mcp_server/tests/memory-lineage-backfill.vitest.ts:7:import { createSchema, ensureSchemaVersion } from '../lib/search/vector-index-schema';
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/manual_testing_playbook/manual_testing_playbook.md:3:description: "Operator-facing validation package for the Phase 027 native skill advisor, covering native MCP tools, runtime hooks, compatibility shim, operator recovery, daemon auto-update, auto-indexing, lifecycle routing, 5-lane scorer fusion, and Python compatibility."
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/manual_testing_playbook/manual_testing_playbook.md:48:| Operator H5 | degraded, quarantined, unavailable recovery playbooks | [04--operator-h5](04--operator-h5/) |
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/manual_testing_playbook/manual_testing_playbook.md:101:Release readiness is `READY` only when all 42 scenarios are `PASS` or have an approved `SKIP` with a real sandbox or runtime blocker. A failed native MCP tool scenario, disable-control scenario, or operator recovery scenario makes the package `NOT READY`.
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-benchmark-memory-search.vitest.ts:54:      stage1: { searchType: 'hybrid', channelCount: 3, candidateCount: 3, constitutionalInjected: 0, durationMs: 1 },
.opencode/skills/system-spec-kit/mcp_server/tests/constitutional-filtering.vitest.ts:14:vi.mock('../lib/search/vector-index-store.js', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/constitutional-filtering.vitest.ts:26:import { getConstitutionalMemories } from '../lib/search/vector-index-queries.js';
.opencode/skills/system-spec-kit/mcp_server/lib/response/profile-formatters.ts:14://              Structured continuation shape for session recovery.
.opencode/skills/system-spec-kit/mcp_server/lib/MODULE_MAP.md:129:- Purpose: Owns normalized error classes, recovery hints, and error-to-message translation for memory operations. It is the standard place for operational failures that need actionable remediation.
.opencode/skills/system-spec-kit/mcp_server/lib/MODULE_MAP.md:132:  - `recovery-hints.ts` — tool-aware recovery guidance and error-code hint mapping.
.opencode/skills/system-spec-kit/mcp_server/lib/MODULE_MAP.md:137:  - Handler-level mutation/search/reporting paths that surface recovery hints
.opencode/skills/system-spec-kit/mcp_server/lib/MODULE_MAP.md:144:  - `bm25-baseline.ts` — lexical-only baseline measurement.
.opencode/skills/system-spec-kit/mcp_server/lib/MODULE_MAP.md:206:- Purpose: Owns local runtime abstractions for vector-store behavior and documents the shared-package migration of interface types. It is the compatibility boundary between in-repo consumers and `@spec-kit/shared` contracts.
.opencode/skills/system-spec-kit/mcp_server/lib/MODULE_MAP.md:208:  - `vector-store.ts` — local abstract base class for JS/runtime vector-store implementations.
.opencode/skills/system-spec-kit/mcp_server/lib/MODULE_MAP.md:301:- Purpose: Owns the retrieval engine: candidate generation, vector/lexical channels, fusion, reranking, query intelligence, graph-aware retrieval, and schema/index helpers needed by the search path. This is the highest-churn and broadest domain module in `lib/`.
.opencode/skills/system-spec-kit/mcp_server/lib/MODULE_MAP.md:303:  - `hybrid-search.ts` — main hybrid retrieval entry point across search channels.
.opencode/skills/system-spec-kit/mcp_server/lib/MODULE_MAP.md:305:  - `vector-index-store.ts` — vector-store abstraction bridge and core index operations.
.opencode/skills/system-spec-kit/mcp_server/lib/MODULE_MAP.md:306:  - `vector-index-schema.ts` — schema creation and schema-safety helpers for search storage.
.opencode/skills/system-spec-kit/mcp_server/lib/MODULE_MAP.md:318:- Purpose: Owns session deduplication, session-state persistence, and crash-recovery support. It is the boundary for request/session continuity rather than retrieval policy itself.
.opencode/skills/system-spec-kit/mcp_server/lib/MODULE_MAP.md:320:  - `session-manager.ts` — session-state lifecycle, dedup tracking, cleanup, and recovery helpers.
.opencode/skills/system-spec-kit/mcp_server/core/README.md:25:These modules can support recovery plumbing, but they do not replace canonical packet continuity. For Spec Kit packet work, `/spec_kit:resume` still rebuilds state from `handover.md`, then `_memory.continuity`, then the remaining spec docs.
.opencode/skills/system-spec-kit/mcp_server/tests/memory-delete-cascade.vitest.ts:7:type VectorIndexModule = typeof import('../lib/search/vector-index');
.opencode/skills/system-spec-kit/mcp_server/tests/memory-delete-cascade.vitest.ts:18:    mod = await import('../lib/search/vector-index');
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/scripts/skill_advisor.py:1057:    "memory": ["context", "session", "save", "store", "database", "vector", "embedding", "index"],
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/scripts/skill_advisor.py:1185:    "vector": ("system-spec-kit", 0.5),
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/scripts/skill_advisor.py:1371:    # MCP-COCO-INDEX: Semantic code search via vector embeddings
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/scripts/skill_advisor.py:1520:    "vector search": [("mcp-coco-index", 2.0)],
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/scripts/skill_advisor.py:1831:    "recovery",
.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:191:          bm25: [42],
.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:338:    const { requestQuality } = assessRequestQuality([], []);
.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:339:    expect(requestQuality.label).toBe('gap');
.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:349:    const { requestQuality } = assessRequestQuality(results, confidences);
.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:350:    expect(requestQuality.label).toBe('good');
.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:356:    const { requestQuality } = assessRequestQuality(results, confidences);
.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:357:    expect(requestQuality.label).toBe('gap');
.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:360:  it('returns "weak" for results with mediocre scores and mixed confidence', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:363:    const { requestQuality } = assessRequestQuality(results, confidences);
.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:364:    // Scores around 0.4–0.45 → should be "weak" (not gap, not good)
.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:365:    expect(['weak', 'good']).toContain(requestQuality.label);
.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:368:  it('requestQuality.label is one of the valid literals', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:369:    const validLabels = ['good', 'weak', 'gap'];
.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:372:    const { requestQuality } = assessRequestQuality(results, confidences);
.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:373:    expect(validLabels).toContain(requestQuality.label);
.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:376:  it('always returns an object with requestQuality.label', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:380:    expect(assessment).toHaveProperty('requestQuality');
.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:381:    expect(assessment.requestQuality).toHaveProperty('label');
.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:382:    expect(typeof assessment.requestQuality.label).toBe('string');
.opencode/skills/system-spec-kit/mcp_server/lib/response/README.md:26:Gate E alignment: response envelopes now describe the canonical continuity model directly. Resume-shaped outputs are meant to support `/spec_kit:resume` and should point callers back to `handover.md`, `_memory.continuity`, and the spec docs as the recovery chain.
.opencode/skills/system-spec-kit/mcp_server/tests/session-resume-auth.vitest.ts:33:    factors: { recency: 0, recovery: 0, graphFreshness: 0, continuity: 0 },
.opencode/skills/system-spec-kit/mcp_server/tests/stage1-expansion.vitest.ts:38:// Mock vector-index
.opencode/skills/system-spec-kit/mcp_server/tests/stage1-expansion.vitest.ts:39:vi.mock('../lib/search/vector-index', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/stage1-expansion.vitest.ts:40:  vectorSearch: vi.fn(() => []),
.opencode/skills/system-spec-kit/mcp_server/tests/stage1-expansion.vitest.ts:49:// Mock hybrid-search
.opencode/skills/system-spec-kit/mcp_server/tests/stage1-expansion.vitest.ts:50:vi.mock('../lib/search/hybrid-search', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/stage1-expansion.vitest.ts:168:import { searchWithFallback } from '../lib/search/hybrid-search';
.opencode/skills/system-spec-kit/mcp_server/tests/stage1-expansion.vitest.ts:169:import * as vectorIndex from '../lib/search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/tests/stage1-expansion.vitest.ts:175:    searchType: 'hybrid',
.opencode/skills/system-spec-kit/mcp_server/tests/stage1-expansion.vitest.ts:494:  it('T9: constitutional injection re-applies governance scope after vector fetch', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/stage1-expansion.vitest.ts:496:    const mockVectorSearch = vectorIndex.vectorSearch as ReturnType<typeof vi.fn>;
.opencode/skills/system-spec-kit/mcp_server/tests/query-decomposer.vitest.ts:28:    expect(isMultiFacet('embedding vectors')).toBe(false);
.opencode/skills/system-spec-kit/mcp_server/tests/query-decomposer.vitest.ts:65:    expect(isMultiFacet('Explain the hybrid search. Describe the scoring algorithm.')).toBe(true);
.opencode/skills/system-spec-kit/mcp_server/tests/query-decomposer.vitest.ts:73:    expect(isMultiFacet('describe the hybrid search pipeline scoring approach')).toBe(false);
.opencode/skills/system-spec-kit/mcp_server/tests/query-decomposer.vitest.ts:120:    const facets = decompose('Explain the hybrid search pipeline. Describe the scoring algorithm.');
.opencode/skills/system-spec-kit/mcp_server/lib/routing/routing-prototypes.json:154:        "tags": ["architecture", "research", "conclusion", "hybrid"],
.opencode/skills/system-spec-kit/mcp_server/lib/routing/routing-prototypes.json:156:        "chunk": "The compact code graph work should use a clean-room tree-sitter plus SQLite approach rather than a full graph database. The research across tooling and academic sources points to a hybrid retrieval system: embeddings for recall, structural graph signals for precision, and a compact projection layer for model-facing context. This is a research synthesis chunk."
.opencode/skills/system-spec-kit/mcp_server/lib/routing/routing-prototypes.json:254:        "label": "recovery hints boilerplate",
.opencode/skills/system-spec-kit/mcp_server/lib/routing/routing-prototypes.json:256:        "tags": ["recovery", "boilerplate", "generic", "resume"],
.opencode/skills/system-spec-kit/mcp_server/lib/routing/routing-prototypes.json:266:        "chunk": "Table of contents continue session, project state snapshot, overview, detailed changes, decisions, conversation, recovery hints, memory metadata. The chunk exists only to help a human scan a long legacy memory file and carries almost no semantic retrieval value by itself."
.opencode/skills/system-spec-kit/mcp_server/lib/providers/retry-manager.ts:9:import * as vectorIndex from '../search/vector-index.js';
.opencode/skills/system-spec-kit/mcp_server/lib/providers/retry-manager.ts:292:  const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/lib/providers/retry-manager.ts:442:  vectorIndex.initializeDb();
.opencode/skills/system-spec-kit/mcp_server/lib/providers/retry-manager.ts:443:  const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/lib/providers/retry-manager.ts:491:  const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/lib/providers/retry-manager.ts:507:  const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/lib/providers/retry-manager.ts:561:  const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/lib/providers/retry-manager.ts:567:    const memory = vectorIndex.getMemory(id);
.opencode/skills/system-spec-kit/mcp_server/lib/providers/retry-manager.ts:683:  const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/lib/providers/retry-manager.ts:687:  const memory = vectorIndex.getMemory(id);
.opencode/skills/system-spec-kit/mcp_server/lib/providers/retry-manager.ts:719:  const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/lib/providers/retry-manager.ts:725:  const memory = vectorIndex.getMemory(id);
.opencode/skills/system-spec-kit/mcp_server/lib/providers/retry-manager.ts:745:  const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/lib/providers/retry-manager.ts:748:  const memory = vectorIndex.getMemory(id);
.opencode/skills/system-spec-kit/mcp_server/lib/providers/retry-manager.ts:945:  const memory = vectorIndex.getMemory(id) as RetryMemoryRow | undefined;
.opencode/skills/system-spec-kit/mcp_server/handlers/eval-reporting.ts:8:import * as vectorIndex from '../lib/search/vector-index.js';
.opencode/skills/system-spec-kit/mcp_server/handlers/eval-reporting.ts:11:  hybridSearchEnhanced,
.opencode/skills/system-spec-kit/mcp_server/handlers/eval-reporting.ts:12:  bm25Search,
.opencode/skills/system-spec-kit/mcp_server/handlers/eval-reporting.ts:13:  ftsSearch,
.opencode/skills/system-spec-kit/mcp_server/handlers/eval-reporting.ts:14:} from '../lib/search/hybrid-search.js';
.opencode/skills/system-spec-kit/mcp_server/handlers/eval-reporting.ts:83:function initializeEvalHybridSearch(database: ReturnType<typeof vectorIndex.getDb>) {
.opencode/skills/system-spec-kit/mcp_server/handlers/eval-reporting.ts:85:  initHybridSearch(database, vectorIndex.vectorSearch, graphSearchFn);
.opencode/skills/system-spec-kit/mcp_server/handlers/eval-reporting.ts:99:  run: (database: NonNullable<ReturnType<typeof vectorIndex.getDb>>, dbPath: string) => Promise<T>,
.opencode/skills/system-spec-kit/mcp_server/handlers/eval-reporting.ts:102:  const activeDb = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/handlers/eval-reporting.ts:112:    return run(activeDb, vectorIndex.getDbPath());
.opencode/skills/system-spec-kit/mcp_server/handlers/eval-reporting.ts:115:  const currentDbPath = path.resolve(vectorIndex.getDbPath());
.opencode/skills/system-spec-kit/mcp_server/handlers/eval-reporting.ts:128:  vectorIndex.closeDb();
.opencode/skills/system-spec-kit/mcp_server/handlers/eval-reporting.ts:132:    const overrideDb = vectorIndex.initializeDb();
.opencode/skills/system-spec-kit/mcp_server/handlers/eval-reporting.ts:133:    return await run(overrideDb, vectorIndex.getDbPath());
.opencode/skills/system-spec-kit/mcp_server/handlers/eval-reporting.ts:135:    vectorIndex.closeDb();
.opencode/skills/system-spec-kit/mcp_server/handlers/eval-reporting.ts:141:    vectorIndex.initializeDb();
.opencode/skills/system-spec-kit/mcp_server/handlers/eval-reporting.ts:146:  database: NonNullable<ReturnType<typeof vectorIndex.getDb>>,
.opencode/skills/system-spec-kit/mcp_server/handlers/eval-reporting.ts:155:    const vectorResults = vectorIndex.vectorSearch(embedding, {
.opencode/skills/system-spec-kit/mcp_server/handlers/eval-reporting.ts:161:    if (vectorResults.length > 0) {
.opencode/skills/system-spec-kit/mcp_server/handlers/eval-reporting.ts:163:        source: 'vector',
.opencode/skills/system-spec-kit/mcp_server/handlers/eval-reporting.ts:164:        results: vectorResults.map((row) => ({ id: row.id as number | string })),
.opencode/skills/system-spec-kit/mcp_server/handlers/eval-reporting.ts:169:  const ftsResults = ftsSearch(query, { limit });
.opencode/skills/system-spec-kit/mcp_server/handlers/eval-reporting.ts:170:  if (ftsResults.length > 0) {
.opencode/skills/system-spec-kit/mcp_server/handlers/eval-reporting.ts:172:      source: 'fts',
.opencode/skills/system-spec-kit/mcp_server/handlers/eval-reporting.ts:173:      results: ftsResults.map((row) => ({ id: row.id })),
.opencode/skills/system-spec-kit/mcp_server/handlers/eval-reporting.ts:177:  const bm25Results = bm25Search(query, { limit });
.opencode/skills/system-spec-kit/mcp_server/handlers/eval-reporting.ts:178:  if (bm25Results.length > 0) {
.opencode/skills/system-spec-kit/mcp_server/handlers/eval-reporting.ts:180:      source: 'bm25',
.opencode/skills/system-spec-kit/mcp_server/handlers/eval-reporting.ts:181:      results: bm25Results.map((row) => ({ id: row.id })),
.opencode/skills/system-spec-kit/mcp_server/handlers/eval-reporting.ts:281:      const results = await hybridSearchEnhanced(query, embedding, searchOptions);
.opencode/skills/system-spec-kit/mcp_server/handlers/eval-reporting.ts:332:  'hybrid search fusion',
.opencode/skills/system-spec-kit/mcp_server/handlers/eval-reporting.ts:334:  'RRF scoring',
.opencode/skills/system-spec-kit/mcp_server/handlers/eval-reporting.ts:339: * Run Multi-K RRF sensitivity analysis.
.opencode/skills/system-spec-kit/mcp_server/handlers/eval-reporting.ts:341: * 1. Runs hybridSearchEnhanced for each representative query
.opencode/skills/system-spec-kit/mcp_server/handlers/eval-reporting.ts:348:  const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/lib/response/envelope.ts:79:  recovery?: RecoveryInfo | null;
.opencode/skills/system-spec-kit/mcp_server/lib/response/envelope.ts:246:    recovery = null,
.opencode/skills/system-spec-kit/mcp_server/lib/response/envelope.ts:252:  // Build hints from recovery object
.opencode/skills/system-spec-kit/mcp_server/lib/response/envelope.ts:254:  if (recovery) {
.opencode/skills/system-spec-kit/mcp_server/lib/response/envelope.ts:255:    if (recovery.hint) hints.push(recovery.hint);
.opencode/skills/system-spec-kit/mcp_server/lib/response/envelope.ts:256:    if (recovery.actions) hints.push(...recovery.actions);
.opencode/skills/system-spec-kit/mcp_server/lib/response/envelope.ts:257:    if (recovery.toolTip) hints.push(recovery.toolTip);
.opencode/skills/system-spec-kit/mcp_server/lib/response/envelope.ts:272:      severity: recovery?.severity || 'error'
.opencode/skills/system-spec-kit/mcp_server/lib/routing/content-router.ts:404:      /recovery scenarios|diagnostic commands|table of contents|placeholder|auto-truncated/.test(normalized),
.opencode/skills/system-spec-kit/mcp_server/lib/routing/content-router.ts:418:const HARD_DROP_WRAPPER_CUES = /\b(conversation transcript|generic recovery hints|tool telemetry|table of contents|raw tool|repository state|assistant:|user:|tool:|recovery scenarios|diagnostic commands)\b/u;
.opencode/skills/system-spec-kit/mcp_server/lib/routing/content-router.ts:1053:  if (/\brecovery scenarios|diagnostic commands|table of contents\b/.test(normalizedText)) {
.opencode/skills/system-spec-kit/mcp_server/lib/routing/content-router.ts:1292:    '- drop: transcript turns, generic recovery hints, tool telemetry, wrapper scaffolding, or other non-canonical content that should not merge into spec docs',
.opencode/skills/system-spec-kit/mcp_server/lib/routing/content-router.ts:1294:    'Confidence scale: 0.90-1.00 safe auto-route; 0.70-0.89 strong route; 0.50-0.69 weak route with warning; below 0.50 refuse.',
.opencode/skills/system-spec-kit/mcp_server/tests/trigger-matcher.vitest.ts:35:// without better-sqlite3 or vector-index wiring.
.opencode/skills/system-spec-kit/mcp_server/tests/trigger-matcher.vitest.ts:36:vi.mock('../lib/search/vector-index', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/trigger-matcher.vitest.ts:394:          trigger_phrases: JSON.stringify(['continuity recovery']),
.opencode/skills/system-spec-kit/mcp_server/tests/trigger-matcher.vitest.ts:405:      expect(cache[0].phrase).toBe('continuity recovery');
.opencode/skills/system-spec-kit/mcp_server/lib/providers/README.md:34:Those providers support the Gate E recovery model where `/spec_kit:resume` restores packet context from `handover.md` -> `_memory.continuity` -> spec docs. Generated memory artifacts remain supporting only.
.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/README.md:41:Gate E alignment: canonical continuity does not come from low-priority rows or lifecycle states. Operator-facing recovery still starts with `/spec_kit:resume`, then rebuilds context from `handover.md -> _memory.continuity -> spec docs`. Any colder or retained-history rows discussed below are supporting evidence only.
.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/README.md:267:| `temporal-contiguity.ts`   | Time-based linking        | `vectorSearchWithContiguity`, `getTemporalNeighbors`, `buildTimeline`       |
.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/README.md:543:// Populate related memories using vector search
.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/README.md:546:  vectorSearchFn  // (embedding: Float32Array, options) => Array<{id, similarity}>
.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/README.md:659:  vectorSearchWithContiguity,
.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/README.md:669:// Boost vector search results by temporal proximity
.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/README.md:675:const boosted = vectorSearchWithContiguity(results, DEFAULT_WINDOW);
.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/README.md:744:  candidates,        // from vector search
.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/README.md:967:| [../search/vector-index.ts](../search/vector-index.ts)             | Semantic search using voyageai embeddings |
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:25:import * as vectorIndex from '../lib/search/vector-index.js';
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:168:      recovery: {
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:214:      recovery: {
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:270:        const staleSnapshot = vectorIndex.getDb()?.prepare(
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:274:        if (vectorIndex.deleteMemory(staleRecordId)) {
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/INSTALL_GUIDE.md:140:Unset variables after recovery:
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/INSTALL_GUIDE.md:168:Manual recovery scenarios live at:
.opencode/skills/system-spec-kit/mcp_server/tools/types.ts:309:  channels?: Array<'vector' | 'bm25' | 'fts5' | 'graph' | 'trigger'>;
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:81:  it('T1: simple tier maps to exactly 2 channels (vector + fts)', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:82:    expect(DEFAULT_ROUTING_CONFIG.simple).toEqual(['vector', 'fts']);
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:86:  it('T2: moderate tier maps to 3 channels (vector + fts + bm25)', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:87:    expect(DEFAULT_ROUTING_CONFIG.moderate).toEqual(['vector', 'fts', 'bm25']);
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:92:    expect(DEFAULT_ROUTING_CONFIG.complex).toEqual(['vector', 'fts', 'bm25', 'graph', 'degree']);
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:97:    expect(ALL_CHANNELS).toEqual(['vector', 'fts', 'bm25', 'graph', 'degree']);
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:105:  it('T6: FALLBACK_CHANNELS are vector and fts', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:106:    expect(FALLBACK_CHANNELS).toEqual(['vector', 'fts']);
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:118:    expect(channels).toContain('vector');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:119:    expect(channels).toContain('fts');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:125:    expect(channels).toContain('vector');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:126:    expect(channels).toContain('fts');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:127:    expect(channels).toContain('bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:133:    expect(channels).toContain('vector');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:134:    expect(channels).toContain('fts');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:135:    expect(channels).toContain('bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:142:      simple: ['bm25', 'graph'],
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:143:      moderate: ['vector', 'fts', 'graph', 'degree'],
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:144:      complex: ['vector', 'fts', 'bm25', 'graph', 'degree'],
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:148:    expect(simpleChannels).toEqual(['bm25', 'graph']);
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:151:    expect(moderateChannels).toEqual(['vector', 'fts', 'graph', 'degree']);
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:171:      moderate: ['vector', 'fts', 'bm25'],
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:172:      complex: ['vector', 'fts', 'bm25', 'graph', 'degree'],
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:177:    expect(channels).toContain('vector');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:178:    expect(channels).toContain('fts');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:184:      moderate: ['vector', 'fts', 'bm25'],
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:185:      complex: ['vector', 'fts', 'bm25', 'graph', 'degree'],
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:192:    const hasFallback = channels.includes('vector') || channels.includes('fts');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:196:  it('T14: single-channel config with vector gets fts as fallback', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:198:      simple: ['vector'],
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:199:      moderate: ['vector', 'fts', 'bm25'],
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:200:      complex: ['vector', 'fts', 'bm25', 'graph', 'degree'],
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:205:    expect(channels).toContain('vector');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:206:    expect(channels).toContain('fts');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:212:    expect(result).toContain('vector');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:213:    expect(result).toContain('fts');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:217:    const input: ChannelName[] = ['bm25', 'graph', 'degree'];
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:219:    expect(result).toEqual(['bm25', 'graph', 'degree']);
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:223:    const input: ChannelName[] = ['vector'];
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:226:    expect(result).toContain('vector');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:227:    expect(result).toContain('fts');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:229:    expect(result.filter(c => c === 'vector')).toHaveLength(1);
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:233:    const input: ChannelName[] = ['vector', 'vector'];
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:235:    expect(result).toEqual(['vector', 'fts']);
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:240:      simple: ['vector', 'vector'],
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:241:      moderate: ['vector', 'fts', 'bm25'],
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:242:      complex: ['vector', 'fts', 'bm25', 'graph', 'degree'],
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:246:    expect(channels).toEqual(['vector', 'fts']);
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:267:    expect(result.channels).toContain('vector');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:268:    expect(result.channels).toContain('fts');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:301:    expect(result.channels).toContain('vector');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:302:    expect(result.channels).toContain('fts');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:303:    expect(result.channels).toContain('bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:323:    expect(result.channels).toEqual(['vector', 'fts', 'bm25', 'graph', 'degree']);
.opencode/skills/system-spec-kit/mcp_server/tests/query-router.vitest.ts:343:    expect(result.channels).toEqual(['vector', 'fts', 'bm25', 'graph', 'degree']);
.opencode/skills/system-spec-kit/mcp_server/lib/context/opencode-transport.ts:240:             'Inject this as the startup digest for hookless OpenCode recovery. Keep it transport-only.',
.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/attention-decay.ts:16:// Search-time ranking      → FSRS-preferred SQL (vector-index-impl.js)
.opencode/skills/system-spec-kit/mcp_server/tests/extraction-adapter.vitest.ts:47:      (101, 'system-spec-kit/020-mcp-working-memory-hybrid-rag', '/tmp/spec.md', 'Spec', 'important', '[]', CURRENT_TIMESTAMP),
.opencode/skills/system-spec-kit/mcp_server/tests/extraction-adapter.vitest.ts:48:      (102, 'system-spec-kit/020-mcp-working-memory-hybrid-rag', '/tmp/error.log', 'Errors', 'normal', '[]', CURRENT_TIMESTAMP)
.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/fsrs-scheduler.ts:387: * Context types that should never decay under the hybrid decay policy.
.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/fsrs-scheduler.ts:408: * REQ-D4-002: Check whether the hybrid decay policy feature flag is enabled.
.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/fsrs-scheduler.ts:417: * REQ-D4-002: Classify a memory's decay behaviour under the hybrid policy.
.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/fsrs-scheduler.ts:440: * REQ-D4-002: Apply the hybrid decay policy to a stability value.
.opencode/skills/system-spec-kit/mcp_server/tools/README.md:24:For continuity recovery, `/spec_kit:resume` remains the canonical operator surface; these dispatchers enrich the packet-first chain `handover.md -> _memory.continuity -> spec docs` rather than replacing it.
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-stats.ts:13:import * as vectorIndex from '../lib/search/vector-index.js';
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-stats.ts:16:import { getGraphMetrics } from '../lib/search/hybrid-search.js';
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-stats.ts:48:  const database = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-stats.ts:127:  let statusCounts: ReturnType<typeof vectorIndex.getStatusCounts> = { success: 0, pending: 0, failed: 0, retry: 0, partial: 0 };
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-stats.ts:137:    statusCounts = vectorIndex.getStatusCounts();
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-stats.ts:169:    const dbPath = vectorIndex.getDbPath();
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-stats.ts:294:  if (!vectorIndex.isVectorSearchAvailable()) {
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-stats.ts:313:      vectorSearchEnabled: vectorIndex.isVectorSearchAvailable(),
.opencode/skills/system-spec-kit/mcp_server/tests/search-extended.vitest.ts:9:} from '../lib/search/bm25-index';
.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/prediction-error-gate.ts:149:  // General/weak signals get lower confidence, explicit/strong signals get higher
.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/prediction-error-gate.ts:151:    clarification: 0.45,   // "actually" — weakest, often conversational
.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/prediction-error-gate.ts:178:      // Existing content had a signal that new content dropped — weaker signal
.opencode/skills/system-spec-kit/mcp_server/lib/eval/edge-density.ts:211:    '  neutralising its contribution to hybrid search until R10 is complete.',
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:23:  label: 'good' | 'weak' | 'gap';
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:34:    requestQuality?: RequestQualityPayload;
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:51:    spec_folder: 'specs/system-spec-kit/022-hybrid-rag-fusion',
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:69:    'hybrid',
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:113:        fts_score: 0.89,
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:126:            vector: [1],
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:127:            fts: [1],
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:137:        fts_score: 0.35,
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:156:        fts_score: 0.79,
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:169:            vector: [1],
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:170:            fts: [1],
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:180:        fts_score: 0.58,
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:190:        fts_score: 0.21,
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:195:            vector: [1],
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:196:            fts: [2],
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:205:        fts_score: 0.72,
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:224:        fts_score: 0.31,
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:233:        fts_score: 0.3,
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:251:        fts_score: 0.88,
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:268:        fts_score: 0.49,
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:285:        fts_score: 0.28,
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:318:        fts_score: 0.9,
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:332:            vector: [1],
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:333:            fts: [1],
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:352:  it('assesses request quality as good, weak, or gap at the query level', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:359:        fts_score: 0.84,
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:367:        fts_score: 0.63,
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:371:            vector: [2],
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:372:            fts: [2],
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:377:    const weakEnvelope = await formatEnvelope([
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:383:        fts_score: 0.25,
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:400:    expect(goodEnvelope.data.requestQuality?.label).toBe('good');
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:401:    expect(weakEnvelope.data.requestQuality?.label).toBe('weak');
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:402:    expect(gapEnvelope.data.requestQuality?.label).toBe('gap');
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:414:        fts_score: 0.89,
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:426:    expect(envelope.data.requestQuality).toBeUndefined();
.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery.vitest.ts:33:    const content = `# Hybrid RAG Fusion Refinement\n\nThis spec describes the hybrid approach.`;
.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery.vitest.ts:111:    expect(keywords).toContain('hybrid');
.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery.vitest.ts:144:    expect(keywords).toContain('bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery.vitest.ts:145:    expect(keywords).toContain('vector');
.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery.vitest.ts:146:    expect(keywords).toContain('hybrid');
.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery.vitest.ts:182:        description: 'Semantic memory search with vector embeddings and BM25 index',
.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery.vitest.ts:183:        keywords: ['semantic', 'memory', 'search', 'vector', 'embeddings', 'bm25', 'index'],
.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery.vitest.ts:187:        specFolder: 'specs/003-hybrid-rag',
.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery.vitest.ts:188:        description: 'Hybrid RAG fusion pipeline combining vector and keyword retrieval',
.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery.vitest.ts:189:        keywords: ['hybrid', 'rag', 'fusion', 'pipeline', 'combining', 'vector', 'keyword', 'retrieval'],
.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery.vitest.ts:202:    const results = findRelevantFolders('vector search memory', mockCache);
.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery.vitest.ts:204:    // Specs/002-memory should score highly — has 'vector', 'memory', 'search'
.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery.vitest.ts:211:    const results = findRelevantFolders('hybrid rag fusion vector', mockCache);
.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery.vitest.ts:226:    const results = findRelevantFolders('vector search routing', mockCache, 2);
.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery.vitest.ts:232:    const broadResults = findRelevantFolders('system memory vector fusion cache', mockCache);
.opencode/skills/system-spec-kit/mcp_server/lib/contracts/README.md:127:**Purpose**: Describe a pipeline failure with recovery guidance.
.opencode/skills/system-spec-kit/mcp_server/lib/contracts/README.md:153:| `fusion` | RRF score fusion |
.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/co-activation.ts:271:  vectorSearchFn: (embedding: Float32Array, options: Record<string, unknown>) => Array<{ id: number; similarity: number; [key: string]: unknown }>
.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/co-activation.ts:276:    // Get the memory's embedding via a vector search for itself
.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/co-activation.ts:295:    const similar = vectorSearchFn(embedding, {
.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/co-activation.ts:367: * that pure vector similarity would miss.
.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:7:import * as vectorIndex from '../lib/search/vector-index.js';
.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:9:import * as bm25Index from '../lib/search/bm25-index.js';
.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:127:      if (vectorIndex.deleteMemory(memoryId)) {
.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:209:          if (vectorIndex.deleteMemory(existingChunk.id)) {
.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:216:        if (vectorIndex.deleteMemory(existing.id)) {
.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:229:      pid = vectorIndex.indexMemoryDeferred({
.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:275:  const bm25FailedChunks: number[] = [];
.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:314:          childId = vectorIndex.indexMemory({
.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:328:          childId = vectorIndex.indexMemoryDeferred({
.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:366:      if (bm25Index.isBm25Enabled()) {
.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:368:          const bm25 = bm25Index.getIndex();
.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:369:          bm25.addDocument(String(childId), bm25Index.buildBm25DocumentText({
.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:375:        } catch (bm25_err: unknown) {
.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:376:          const message = toErrorMessage(bm25_err);
.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:378:          bm25FailedChunks.push(childId);
.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:390:          vectorIndex.deleteMemory(childId);
.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:418:            if (vectorIndex.deleteMemory(chunkRow.id)) {
.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:426:          if (vectorIndex.deleteMemory(parentId)) {
.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:433:            if (vectorIndex.deleteMemory(childId)) {
.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:451:    if (deletedChunkIds.length > 0 && bm25Index.isBm25Enabled()) {
.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:453:        const bm25 = bm25Index.getIndex();
.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:455:          bm25.removeDocument(String(deletedChunkId));
.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:457:      } catch (bm25Err: unknown) {
.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:458:        const message = toErrorMessage(bm25Err);
.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:463:    if (parentRolledBack && bm25Index.isBm25Enabled()) {
.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:465:        bm25Index.getIndex().removeDocument(String(parentId));
.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:466:      } catch (bm25Err: unknown) {
.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:467:        const message = toErrorMessage(bm25Err);
.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:572:            if (vectorIndex.deleteMemory(cid)) {
.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:602:  if (bm25Index.isBm25Enabled()) {
.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:604:      const bm25 = bm25Index.getIndex();
.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:605:      bm25.addDocument(String(parentId), bm25Index.buildBm25DocumentText({
.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:611:    } catch (bm25_err: unknown) {
.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:612:      const message = toErrorMessage(bm25_err);
.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:653:      (bm25FailedChunks.length > 0 ? ` (${bm25FailedChunks.length} BM25 failures)` : ''),
.opencode/skills/system-spec-kit/mcp_server/lib/continuity/README.md:15:- `thin-continuity-record.ts` validates bounded continuity fields, enforces byte limits, and reads or writes the compact continuity record used by packet-local recovery.
.opencode/skills/system-spec-kit/mcp_server/lib/context/shared-payload.ts:5:// shared by startup, recovery, and compaction surfaces.
.opencode/skills/system-spec-kit/mcp_server/tests/query-decomposition.vitest.ts:48:      'scoring, graph pruning, concept routing, embeddings, and bm25',
.opencode/skills/system-spec-kit/mcp_server/tests/search-fallback-tiered.vitest.ts:12:  hybridSearchEnhanced,
.opencode/skills/system-spec-kit/mcp_server/tests/search-fallback-tiered.vitest.ts:17:} from '../lib/search/hybrid-search';
.opencode/skills/system-spec-kit/mcp_server/tests/search-fallback-tiered.vitest.ts:18:import type { HybridSearchResult, DegradationEvent } from '../lib/search/hybrid-search';
.opencode/skills/system-spec-kit/mcp_server/tests/search-fallback-tiered.vitest.ts:158:    // Initialize hybrid-search with our test db
.opencode/skills/system-spec-kit/mcp_server/tests/search-fallback-tiered.vitest.ts:302:      [{ id: 42, score: 0.12, source: 'vector' } as HybridSearchResult],
.opencode/skills/system-spec-kit/mcp_server/tests/search-fallback-tiered.vitest.ts:303:      [{ id: '42', score: 0.18, source: 'bm25' } as HybridSearchResult]
.opencode/skills/system-spec-kit/mcp_server/tests/search-fallback-tiered.vitest.ts:312:      { id: 1, score: 0.03, source: 'vector' } as HybridSearchResult,
.opencode/skills/system-spec-kit/mcp_server/tests/search-fallback-tiered.vitest.ts:313:      { id: 2, score: 0.005, source: 'bm25' } as HybridSearchResult,
.opencode/skills/system-spec-kit/mcp_server/tests/search-fallback-tiered.vitest.ts:314:      { id: 3, score: 0.004, source: 'fts' } as HybridSearchResult,
.opencode/skills/system-spec-kit/mcp_server/tests/search-fallback-tiered.vitest.ts:318:    const weak = __testables.checkDegradation([
.opencode/skills/system-spec-kit/mcp_server/tests/search-fallback-tiered.vitest.ts:319:      { id: 1, score: 0.01, source: 'vector' } as HybridSearchResult,
.opencode/skills/system-spec-kit/mcp_server/tests/search-fallback-tiered.vitest.ts:320:      { id: 2, score: 0.0095, source: 'bm25' } as HybridSearchResult,
.opencode/skills/system-spec-kit/mcp_server/tests/search-fallback-tiered.vitest.ts:321:      { id: 3, score: 0.009, source: 'fts' } as HybridSearchResult,
.opencode/skills/system-spec-kit/mcp_server/tests/search-fallback-tiered.vitest.ts:324:    expect(weak).toBeTruthy();
.opencode/skills/system-spec-kit/mcp_server/tests/search-fallback-tiered.vitest.ts:325:    expect(['low_quality', 'both']).toContain(weak?.reason);
.opencode/skills/system-spec-kit/mcp_server/tests/search-fallback-tiered.vitest.ts:329:    const existing = [{ id: 1, score: 0.13, source: 'vector' } as HybridSearchResult];
.opencode/skills/system-spec-kit/mcp_server/tests/search-fallback-tiered.vitest.ts:362:      source: 'vector',
.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/temporal-contiguity.ts:51: * Apply temporal-contiguity boost to vector search results.
.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/temporal-contiguity.ts:63:export function vectorSearchWithContiguity(
.opencode/skills/system-spec-kit/mcp_server/lib/resume/resume-ladder.ts:485:      ? 'No recovery context found in handover.md, _memory.continuity, or spec docs. Start with /spec_kit:plan or inspect the packet directly.'
.opencode/skills/system-spec-kit/mcp_server/lib/resume/resume-ladder.ts:486:      : 'No recovery context found. Pass specFolder explicitly or start with /spec_kit:plan.',
.opencode/skills/system-spec-kit/mcp_server/lib/resume/resume-ladder.ts:607: * no fresher packet-local recovery data is available.
.opencode/skills/system-spec-kit/mcp_server/lib/resume/resume-ladder.ts:610: * @returns Resume payload describing the best recovery source and hints
.opencode/skills/system-spec-kit/mcp_server/tests/feature-eval-query-intelligence.vitest.ts:130:  it('T003-02: vector-dominated results get padded with under-represented channels', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/feature-eval-query-intelligence.vitest.ts:132:      { id: 1, score: 0.9, source: 'vector' },
.opencode/skills/system-spec-kit/mcp_server/tests/feature-eval-query-intelligence.vitest.ts:133:      { id: 2, score: 0.85, source: 'vector' },
.opencode/skills/system-spec-kit/mcp_server/tests/feature-eval-query-intelligence.vitest.ts:134:      { id: 3, score: 0.8, source: 'vector' },
.opencode/skills/system-spec-kit/mcp_server/tests/feature-eval-query-intelligence.vitest.ts:138:      ['vector', [{ id: 1, score: 0.9 }, { id: 2, score: 0.85 }, { id: 3, score: 0.8 }]],
.opencode/skills/system-spec-kit/mcp_server/tests/feature-eval-query-intelligence.vitest.ts:139:      ['bm25', [{ id: 10, score: 0.5 }, { id: 11, score: 0.3 }]],
.opencode/skills/system-spec-kit/mcp_server/tests/feature-eval-query-intelligence.vitest.ts:145:    expect(result.underRepresentedChannels).toContain('bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/feature-eval-query-intelligence.vitest.ts:147:    expect(result.promoted[0].promotedFrom).toBe('bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/feature-eval-query-intelligence.vitest.ts:153:      { id: 1, score: 0.9, source: 'vector' },
.opencode/skills/system-spec-kit/mcp_server/tests/feature-eval-query-intelligence.vitest.ts:154:      { id: 2, score: 0.85, source: 'bm25' },
.opencode/skills/system-spec-kit/mcp_server/tests/feature-eval-query-intelligence.vitest.ts:159:      ['vector', [{ id: 1, score: 0.9 }]],
.opencode/skills/system-spec-kit/mcp_server/tests/feature-eval-query-intelligence.vitest.ts:160:      ['bm25', [{ id: 2, score: 0.85 }]],
.opencode/skills/system-spec-kit/mcp_server/tests/feature-eval-query-intelligence.vitest.ts:173:      { id: 1, score: 0.9, source: 'vector' },
.opencode/skills/system-spec-kit/mcp_server/tests/feature-eval-query-intelligence.vitest.ts:177:      ['vector', [{ id: 1, score: 0.9 }]],
.opencode/skills/system-spec-kit/mcp_server/tests/feature-eval-query-intelligence.vitest.ts:178:      ['bm25', [{ id: 10, score: 0.003 }]], // below 0.005 floor
.opencode/skills/system-spec-kit/mcp_server/tests/feature-eval-query-intelligence.vitest.ts:184:    expect(result.underRepresentedChannels).toContain('bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/feature-eval-query-intelligence.vitest.ts:192:      { id: 1, score: 0.9, source: 'vector' },
.opencode/skills/system-spec-kit/mcp_server/tests/feature-eval-query-intelligence.vitest.ts:195:      ['vector', [{ id: 1, score: 0.9 }]],
.opencode/skills/system-spec-kit/mcp_server/tests/feature-eval-query-intelligence.vitest.ts:196:      ['bm25', [{ id: 10, score: 0.5 }]],
.opencode/skills/system-spec-kit/mcp_server/lib/eval/data/ground-truth.json:10:      "expectedResultDescription": "Memory or spec covering search-weights.json and the MAX_TRIGGERS_PER_MEMORY constant in vector-index-impl.ts. Should surface the T000c audit or related sprint-0 documentation.",
.opencode/skills/system-spec-kit/mcp_server/lib/eval/data/ground-truth.json:35:      "query": "what decisions led to using RRF instead of a weighted linear combination for search fusion",
.opencode/skills/system-spec-kit/mcp_server/lib/eval/data/ground-truth.json:40:      "expectedResultDescription": "Decision records from hybrid-rag-fusion spec (spec 139) about fusion strategy selection. Should surface rationale for RRF over linear weighted sum.",
.opencode/skills/system-spec-kit/mcp_server/lib/eval/data/ground-truth.json:115:      "query": "which spec documents were added during the hybrid RAG fusion sprint",
.opencode/skills/system-spec-kit/mcp_server/lib/eval/data/ground-truth.json:120:      "expectedResultDescription": "Should surface memories in spec folder system-spec-kit/022-hybrid-rag-fusion (89 memories) and 140-hybrid-rag-fusion-refinement. Lists spec documents created in those sprints.",
.opencode/skills/system-spec-kit/mcp_server/lib/eval/data/ground-truth.json:140:      "expectedResultDescription": "Should surface T000c audit document which explicitly documents the relevanceWeight 0.2 vs 0.5 discrepancy, plus vector-index-impl.ts lines 2802-2804.",
.opencode/skills/system-spec-kit/mcp_server/lib/eval/data/ground-truth.json:280:      "expectedResultDescription": "Deep investigation query. Should surface adaptive-fusion.ts, hybrid-search.ts, rrf-fusion.ts, and related spec memories spanning the search stack.",
.opencode/skills/system-spec-kit/mcp_server/lib/eval/data/ground-truth.json:295:      "query": "list all memories in the hybrid RAG fusion spec folder",
.opencode/skills/system-spec-kit/mcp_server/lib/eval/data/ground-truth.json:300:      "expectedResultDescription": "Spec-scoped browse. Should surface memory titles and tiers from spec folder system-spec-kit/022-hybrid-rag-fusion or 140-hybrid-rag-fusion-refinement.",
.opencode/skills/system-spec-kit/mcp_server/lib/eval/data/ground-truth.json:340:      "expectedResultDescription": "Git context recovery query. Should surface sk-git skill documentation and any spec memories about branch naming conventions or git workflow choices.",
.opencode/skills/system-spec-kit/mcp_server/lib/eval/data/ground-truth.json:341:      "notes": "From T007b Pattern 9: sk-git skill session recovery with domain-specific phrase."
.opencode/skills/system-spec-kit/mcp_server/lib/eval/data/ground-truth.json:370:      "expectedResultDescription": "Should surface bm25-index.ts isBm25Enabled() function and any documentation about the BM25 feature flag.",
.opencode/skills/system-spec-kit/mcp_server/lib/eval/data/ground-truth.json:455:      "query": "how does RRF fusion combine vector and BM25 channel scores",
.opencode/skills/system-spec-kit/mcp_server/lib/eval/data/ground-truth.json:595:      "query": "vector index embedding generation pipeline",
.opencode/skills/system-spec-kit/mcp_server/lib/eval/data/ground-truth.json:600:      "expectedResultDescription": "Should surface vector-index.ts, embeddings.ts, and any spec memories about embedding model selection or the indexing pipeline.",
.opencode/skills/system-spec-kit/mcp_server/lib/eval/data/ground-truth.json:601:      "notes": "Trigger-phrase-style query about the vector indexing subsystem."
.opencode/skills/system-spec-kit/mcp_server/lib/eval/data/ground-truth.json:605:      "query": "RRF reciprocal rank fusion channel weights",
.opencode/skills/system-spec-kit/mcp_server/lib/eval/data/ground-truth.json:611:      "notes": "Derived from \"reciprocal rank fusion\" trigger phrase in the hybrid search documentation."
.opencode/skills/system-spec-kit/mcp_server/lib/eval/data/ground-truth.json:660:      "expectedResultDescription": "Should surface bm25-index.ts tokenize() and simpleStem() functions and any spec documentation about the text normalization approach.",
.opencode/skills/system-spec-kit/mcp_server/lib/eval/data/ground-truth.json:765:      "query": "why did the team choose SQLite over a dedicated vector database for memory storage",
.opencode/skills/system-spec-kit/mcp_server/lib/eval/data/ground-truth.json:770:      "expectedResultDescription": "Should surface decision records or spec memories explaining the choice of SQLite + FTS5 + custom vector storage over alternatives like Pinecone or Chroma.",
.opencode/skills/system-spec-kit/mcp_server/lib/eval/data/ground-truth.json:855:      "query": "I want to add telemetry tracking to the hybrid search pipeline",
.opencode/skills/system-spec-kit/mcp_server/lib/eval/data/ground-truth.json:880:      "expectedResultDescription": "Should surface the vector-store.ts interface, eval-db.ts, and the decision record about choosing SQLite. May surface the architecture layer definitions.",
.opencode/skills/system-spec-kit/mcp_server/lib/eval/data/ground-truth.json:905:      "query": "show me the checklist for the sprint 0 hybrid RAG fusion refinement",
.opencode/skills/system-spec-kit/mcp_server/lib/eval/data/ground-truth.json:915:      "query": "is there a research document for the hybrid RAG fusion approach",
.opencode/skills/system-spec-kit/mcp_server/lib/eval/data/ground-truth.json:920:      "expectedResultDescription": "Should surface research/research.md from the 139-hybrid-rag-fusion or 140-hybrid-rag-fusion-refinement spec folder if it exists.",
.opencode/skills/system-spec-kit/mcp_server/lib/eval/data/ground-truth.json:955:      "query": "can the trigger matching and vector search be unified into a single query path",
.opencode/skills/system-spec-kit/mcp_server/lib/eval/data/ground-truth.json:960:      "expectedResultDescription": "Should surface trigger-matcher.ts, vector-index.ts, hybrid-search.ts, and any architectural decision about keeping the two paths separate.",
.opencode/skills/system-spec-kit/mcp_server/lib/eval/eval-logger.ts:93:  /** Channel name: "vector", "bm25", "graph", or "trigger". */
.opencode/skills/system-spec-kit/mcp_server/lib/resume/README.md:3:description: "Resume ladder logic for packet recovery and continuity resolution."
.opencode/skills/system-spec-kit/mcp_server/lib/resume/README.md:13:`lib/resume/` owns the packet recovery ladder used by session-resume flows.
.opencode/skills/system-spec-kit/mcp_server/tests/concept-routing.vitest.ts:104:  it('matches "vectors" to canonical "embedding"', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/concept-routing.vitest.ts:105:    const concepts = matchAliases(['vectors']);
.opencode/skills/system-spec-kit/mcp_server/tests/concept-routing.vitest.ts:170:  it('includes "embedding" concept for vector-related query', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/concept-routing.vitest.ts:171:    const result = routeQueryConcepts('retrieve embeddings from the vector index');
.opencode/skills/system-spec-kit/mcp_server/lib/architecture/layer-definitions.ts:82:    description: 'Checkpoint and version management. Use for state preservation and recovery.',
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:69:import { delete_memory_from_database } from '../lib/search/vector-index-mutations.js';
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:225:  '## recovery hints',
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:2512:        finalizeWarning = `[file-persistence-failed] Quality-loop file persistence failed after DB commit: ${finalizeErr instanceof Error ? finalizeErr.message : String(finalizeErr)}. DB row committed — manual file recovery may be needed.`;
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:2672:      recovery: {
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:2903:            recovery: {
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:3054:        recovery: {
.opencode/skills/system-spec-kit/mcp_server/database/README.md:3:description: "Runtime SQLite storage for memory, structural code graph, vectors, FTS, and coordination files."
.opencode/skills/system-spec-kit/mcp_server/database/README.md:7:  - "vector embeddings"
.opencode/skills/system-spec-kit/mcp_server/database/README.md:34:- Embedding-profile database: `context-index__voyage__voyage-4__1024.sqlite` (and `-wal`, `-shm` sidecars) — profile-specific vector store.
.opencode/skills/system-spec-kit/mcp_server/database/README.md:42:- Primary table set includes `memory_index`, `vec_memories`, `memory_fts`, `checkpoints`, and `config`.
.opencode/skills/system-spec-kit/mcp_server/database/README.md:70:- Embedding-profile database: `context-index__voyage__voyage-4__1024.sqlite` stores profile-specific vectors (naming convention: `context-index__<provider>__<model>__<dims>.sqlite`).
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:7:// Search path (disabling vector, graph, and trigger channels)
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:75:  bm25MRR: number;
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:85:  hybridMRR?: number;
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:86:  /** BM25/hybrid ratio (relative mode only). */
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:92: * Mirrors the shape used in hybrid-search.ts so callers can reuse the same
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:100:  /** Source channel identifier. Expected: 'bm25' or 'fts'. */
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:118: * using ONLY the BM25/FTS5 channel (vector, graph, trigger disabled).
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:119: * For production use, wire up the FTS5 path from hybrid-search with all
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:146: *     BM25 alone is weak — strong justification for multi-channel
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:147: *     retrieval. Proceed with hybrid search implementation.
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:149: * @param bm25MRR - The measured MRR@5 value (must be in [0, 1]).
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:152:export function evaluateContingency(bm25MRR: number): ContingencyDecision {
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:153:  if (bm25MRR >= 0.80) {
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:155:      bm25MRR,
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:162:        'additional retrieval channels. Consider whether the marginal gain from vector/graph ' +
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:167:  if (bm25MRR >= 0.50) {
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:169:      bm25MRR,
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:175:        'Each additional channel (vector, graph, trigger) must show a statistically meaningful ' +
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:181:    bm25MRR,
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:186:      'BM25 alone is weak — strong justification for multi-channel retrieval. ' +
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:188:      'adds meaningful value. Proceed with hybrid search implementation.',
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:194:   Compares BM25 MRR@5 as a percentage of hybrid MRR@5.
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:195:   Spec: "BM25 >= 80% of hybrid MRR@5" → PAUSE.
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:199: * Evaluate BM25 performance relative to hybrid MRR@5 (spec-compliant).
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:202: *   ratio = bm25MRR / hybridMRR
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:205: *     BM25 achieves ≥80% of hybrid — multi-channel adds little value.
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:208: *     BM25 achieves 50-79% of hybrid — channels need per-channel evidence.
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:211: *     BM25 achieves <50% of hybrid — multi-channel clearly justified.
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:213: * @param bm25MRR   - BM25-only MRR@5 (must be in [0, 1]).
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:214: * @param hybridMRR - Hybrid/multi-channel MRR@5 (must be in (0, 1]).
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:218:  bm25MRR: number,
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:219:  hybridMRR: number,
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:221:  if (!Number.isFinite(bm25MRR) || !Number.isFinite(hybridMRR) || hybridMRR <= 0) {
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:223:      bm25MRR,
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:224:      hybridMRR,
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:231:        'Defaulting to PROCEED until hybrid baseline is established.',
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:235:  const ratio = bm25MRR / hybridMRR;
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:239:      bm25MRR,
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:240:      hybridMRR,
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:246:        `BM25 achieves ${(ratio * 100).toFixed(1)}% of hybrid MRR@5 ` +
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:247:        `(${bm25MRR.toFixed(4)} / ${hybridMRR.toFixed(4)}). ` +
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:255:      bm25MRR,
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:256:      hybridMRR,
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:262:        `BM25 achieves ${(ratio * 100).toFixed(1)}% of hybrid MRR@5 ` +
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:263:        `(${bm25MRR.toFixed(4)} / ${hybridMRR.toFixed(4)}). ` +
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:270:    bm25MRR,
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:271:    hybridMRR,
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:277:      `BM25 achieves only ${(ratio * 100).toFixed(1)}% of hybrid MRR@5 ` +
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:278:      `(${bm25MRR.toFixed(4)} / ${hybridMRR.toFixed(4)}). ` +
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:280:      'Proceed with hybrid search optimization.',
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:419: * Channel is recorded as 'bm25' to distinguish from multi-channel runs.
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:438:  const channel = 'bm25';
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:453:      'bm25_contingency_decision',
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:454:      result.contingencyDecision.bm25MRR,
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:474: * the BM25/FTS5 path ONLY — vector, graph, and trigger channels must be
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:478: * deterministic results (see tests/bm25-baseline.vitest.ts).
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:529:    // Run BM25-only search (channels: bm25/fts only, no vector/graph/trigger)
.opencode/skills/system-spec-kit/mcp_server/tests/db-state.vitest.ts:11:  it('logs when a direct vector-index rebind listener returns false', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/db-state.vitest.ts:17:    const vectorIndex = {
.opencode/skills/system-spec-kit/mcp_server/tests/db-state.vitest.ts:21:      vectorSearch: vi.fn(),
.opencode/skills/system-spec-kit/mcp_server/tests/db-state.vitest.ts:31:      vectorIndex,
.opencode/skills/system-spec-kit/mcp_server/tests/db-state.vitest.ts:34:      hybridSearch: { init: vi.fn() },
.opencode/skills/system-spec-kit/mcp_server/tests/db-state.vitest.ts:49:      vectorIndex: {
.opencode/skills/system-spec-kit/mcp_server/tests/db-state.vitest.ts:75:      vectorIndex: {
.opencode/skills/system-spec-kit/mcp_server/tests/db-state.vitest.ts:99:      vectorIndex: {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search-context-headers.vitest.ts:3:import { __testables, truncateToBudget, estimateResultTokens } from '../lib/search/hybrid-search';
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search-context-headers.vitest.ts:18:      source: 'hybrid',
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search-context-headers.vitest.ts:44:      source: 'hybrid',
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search-context-headers.vitest.ts:45:      file_path: '/workspace/.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/019-sprint-9-extra-features/implementation-summary.md',
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search-context-headers.vitest.ts:50:      ['022-hybrid-rag-fusion/019-sprint-9-extra-features', 'Description'],
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search-context-headers.vitest.ts:63:        source: 'hybrid',
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search-context-headers.vitest.ts:70:        source: 'hybrid',
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search-context-headers.vitest.ts:77:        source: 'hybrid',
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search-context-headers.vitest.ts:111:        source: 'hybrid',
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search-context-headers.vitest.ts:118:        source: 'hybrid',
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search-context-headers.vitest.ts:150:      source: 'hybrid',
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search-context-headers.vitest.ts:171:      source: 'hybrid',
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search-context-headers.vitest.ts:190:      source: 'hybrid',
.opencode/skills/system-spec-kit/mcp_server/lib/telemetry/README.md:37:Telemetry here supports the canonical Gate E flow: `/spec_kit:resume` remains the recovery surface, while packet continuity is re-established from `handover.md` -> `_memory.continuity` -> spec docs. Generated memory artifacts are supporting evidence, not the primary continuity source.
.opencode/skills/system-spec-kit/mcp_server/lib/telemetry/README.md:137:| `fusionLatencyMs` | `number` | RRF fusion duration |
.opencode/skills/system-spec-kit/mcp_server/lib/telemetry/README.md:147:| `selectedMode` | `string \| null` | Mode chosen for this run (e.g., `hybrid`, `auto`, `deep`) |
.opencode/skills/system-spec-kit/mcp_server/tests/adaptive-ranking.vitest.ts:93:      searchType: 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/adaptive-ranking.vitest.ts:101:      searchType: 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-constitutional-memory.vitest.ts:183:        stage1: { searchType: 'hybrid', channelCount: 2, candidateCount: 4, constitutionalInjected: 1, durationMs: 1 },
.opencode/skills/system-spec-kit/mcp_server/lib/telemetry/eval-channel-tracking.ts:59: * Falls back to `['hybrid']` if no channels are found.
.opencode/skills/system-spec-kit/mcp_server/lib/telemetry/eval-channel-tracking.ts:85:    channels.add('hybrid');
.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:197:    CREATE INDEX IF NOT EXISTS idx_fts_fallback
.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:205:    CREATE VIRTUAL TABLE IF NOT EXISTS memory_fts USING fts5(
.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:212:    CREATE TRIGGER IF NOT EXISTS memory_fts_insert AFTER INSERT ON memory_index BEGIN
.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:213:      INSERT INTO memory_fts(rowid, title, trigger_phrases, file_path, content_text)
.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:219:    CREATE TRIGGER IF NOT EXISTS memory_fts_update AFTER UPDATE ON memory_index BEGIN
.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:220:      INSERT INTO memory_fts(memory_fts, rowid, title, trigger_phrases, file_path, content_text)
.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:222:      INSERT INTO memory_fts(rowid, title, trigger_phrases, file_path, content_text)
.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:228:    CREATE TRIGGER IF NOT EXISTS memory_fts_delete AFTER DELETE ON memory_index BEGIN
.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:229:      INSERT INTO memory_fts(memory_fts, rowid, title, trigger_phrases, file_path, content_text)
.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:234:  database.exec(`INSERT INTO memory_fts(memory_fts) VALUES('rebuild')`);
.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:272:        DROP TRIGGER IF EXISTS memory_fts_insert;
.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:273:        DROP TRIGGER IF EXISTS memory_fts_update;
.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:274:        DROP TRIGGER IF EXISTS memory_fts_delete;
.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:275:        DROP TABLE IF EXISTS memory_fts;
.opencode/skills/system-spec-kit/mcp_server/tests/integration-causal-graph.vitest.ts:7:import * as vectorIndex from '../lib/search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/tests/integration-causal-graph.vitest.ts:89:  vi.spyOn(vectorIndex, 'initializeDb').mockImplementation(() => undefined);
.opencode/skills/system-spec-kit/mcp_server/tests/integration-causal-graph.vitest.ts:90:  vi.spyOn(vectorIndex, 'getDb').mockReturnValue(
.opencode/skills/system-spec-kit/mcp_server/tests/integration-causal-graph.vitest.ts:91:    isolatedDb as unknown as NonNullable<ReturnType<typeof vectorIndex.getDb>>
.opencode/skills/system-spec-kit/mcp_server/tests/integration-causal-graph.vitest.ts:186:      vi.spyOn(vectorIndex, 'initializeDb').mockImplementation(
.opencode/skills/system-spec-kit/mcp_server/tests/integration-causal-graph.vitest.ts:187:        () => ({} as ReturnType<typeof vectorIndex.initializeDb>)
.opencode/skills/system-spec-kit/mcp_server/tests/integration-causal-graph.vitest.ts:189:      vi.spyOn(vectorIndex, 'getDb').mockReturnValue(
.opencode/skills/system-spec-kit/mcp_server/tests/integration-causal-graph.vitest.ts:190:        {} as NonNullable<ReturnType<typeof vectorIndex.getDb>>
.opencode/skills/system-spec-kit/mcp_server/tests/integration-causal-graph.vitest.ts:435:      vi.spyOn(vectorIndex, 'initializeDb').mockImplementation(() => undefined);
.opencode/skills/system-spec-kit/mcp_server/tests/integration-causal-graph.vitest.ts:464:      } as unknown as NonNullable<ReturnType<typeof vectorIndex.getDb>>;
.opencode/skills/system-spec-kit/mcp_server/tests/integration-causal-graph.vitest.ts:466:      vi.spyOn(vectorIndex, 'getDb').mockReturnValue(fakeDb);
.opencode/skills/system-spec-kit/mcp_server/tests/integration-causal-graph.vitest.ts:516:        vi.spyOn(vectorIndex, 'initializeDb').mockImplementation(() => undefined);
.opencode/skills/system-spec-kit/mcp_server/tests/integration-causal-graph.vitest.ts:517:        vi.spyOn(vectorIndex, 'getDb').mockReturnValue(
.opencode/skills/system-spec-kit/mcp_server/tests/integration-causal-graph.vitest.ts:518:          db as unknown as NonNullable<ReturnType<typeof vectorIndex.getDb>>
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/feedback-ledger.ts:12://   weak    — search_shown, same_topic_requery (passive exposure)
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/feedback-ledger.ts:22: * Confidence signal hierarchy (strongest → weakest):
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/feedback-ledger.ts:33:export type FeedbackConfidence = 'strong' | 'medium' | 'weak';
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/feedback-ledger.ts:82:  same_topic_requery:   'weak',
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/feedback-ledger.ts:83:  search_shown:         'weak',
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/feedback-ledger.ts:95:  return EVENT_TYPE_CONFIDENCE[type] ?? 'weak';
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/feedback-ledger.ts:124:    confidence TEXT NOT NULL CHECK(confidence IN ('strong','medium','weak')),
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/feedback-ledger.ts:314:  weak: number;
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/feedback-ledger.ts:330:    const summary: MemoryFeedbackSummary = { memoryId, total: 0, strong: 0, medium: 0, weak: 0 };
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/feedback-ledger.ts:337:    return { memoryId, total: 0, strong: 0, medium: 0, weak: 0 };
.opencode/skills/system-spec-kit/mcp_server/tests/quality-loop.vitest.ts:46:This memory documents the Sprint 0 measurement foundation for the hybrid RAG fusion refinement project.
.opencode/skills/system-spec-kit/mcp_server/tests/quality-loop.vitest.ts:60:- Implement hybrid fusion scoring calibration
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-security.vitest.ts:11:} from '../lib/search/bm25-index';
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-security.vitest.ts:298:    it('S44: Combined attack vector neutralized', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-security.vitest.ts:395:        { id: 2, title: 'Index Management', content_text: 'BM25 indexing pipeline', trigger_phrases: 'index,bm25', file_path: 'specs/002/spec.md' },
.opencode/skills/system-spec-kit/mcp_server/lib/eval/reporting-dashboard.ts:35:  /** Filter to specific channels (e.g. 'vector', 'bm25', 'fts', 'graph', 'trigger'). */
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/shadow-evaluation-runtime.ts:226:    searchType: 'hybrid',
.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:185: * Heuristic-only contradiction scan when vector similarity is unavailable.
.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:208:  // Same 5-second timeout guard as the vector-based scan to prevent
.opencode/skills/system-spec-kit/mcp_server/handlers/pe-gating.ts:4:import * as vectorIndex from '../lib/search/vector-index.js';
.opencode/skills/system-spec-kit/mcp_server/handlers/pe-gating.ts:111:      const results = vectorIndex.vectorSearch(embedding, {
.opencode/skills/system-spec-kit/mcp_server/handlers/pe-gating.ts:295:    const nextMemoryId = vectorIndex.indexMemory({
.opencode/skills/system-spec-kit/mcp_server/lib/eval/eval-db.ts:18:// Follow same env-var precedence as main DB (vector-index-impl.ts)
.opencode/skills/system-spec-kit/mcp_server/lib/eval/eval-db.ts:65:  -- Final fused results after RRF/fusion
.opencode/skills/system-spec-kit/mcp_server/lib/README.md:38:Gate E keeps that retrieval in a supporting role: `/spec_kit:resume` is the operator-facing recovery surface, and packet continuity is rebuilt from `handover.md` -> `_memory.continuity` -> spec docs. Generated continuity support artifacts are not the primary continuity source.
.opencode/skills/system-spec-kit/mcp_server/lib/README.md:56:| **Semantic Search** | Vector-based similarity search with SQLite vector index and hybrid keyword matching |
.opencode/skills/system-spec-kit/mcp_server/lib/README.md:96:import { SQLiteVectorStore } from './search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/lib/README.md:113:import { SQLiteVectorStore } from './search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/lib/README.md:137:│   ├── vector-index.ts         # Vector similarity search with SQLite
.opencode/skills/system-spec-kit/mcp_server/lib/README.md:138:│   ├── vector-index-impl.ts    # Core vector index implementation
.opencode/skills/system-spec-kit/mcp_server/lib/README.md:139:│   ├── hybrid-search.ts        # Combined semantic + keyword search + token budget
.opencode/skills/system-spec-kit/mcp_server/lib/README.md:142:│   ├── bm25-index.ts           # BM25 lexical indexing
.opencode/skills/system-spec-kit/mcp_server/lib/README.md:143:│   ├── sqlite-fts.ts           # SQLite FTS5 full-text search
.opencode/skills/system-spec-kit/mcp_server/lib/README.md:210:│   ├── recovery-hints.ts       # 49 error codes with recovery hints
.opencode/skills/system-spec-kit/mcp_server/lib/README.md:239:│   ├── bm25-baseline.ts        # BM25 baseline measurement
.opencode/skills/system-spec-kit/mcp_server/lib/README.md:251:│   ├── vector-store.ts         # Vector store interface
.opencode/skills/system-spec-kit/mcp_server/lib/README.md:318:| `search/vector-index.ts` | Core vector similarity search with RRF fusion |
.opencode/skills/system-spec-kit/mcp_server/lib/README.md:319:| `search/vector-index-impl.ts` | Core vector index implementation |
.opencode/skills/system-spec-kit/mcp_server/lib/README.md:321:| `search/bm25-index.ts` | BM25 lexical search indexing |
.opencode/skills/system-spec-kit/mcp_server/lib/README.md:329:| `errors/recovery-hints.ts` | 49 error codes with recovery hints |
.opencode/skills/system-spec-kit/mcp_server/lib/README.md:338:| `search/graph-search-fn.ts` | Typed-weighted degree computation for RRF 5th channel |
.opencode/skills/system-spec-kit/mcp_server/lib/README.md:360:| **Usage** | `search.vectorIndex.search_memories(query, options)` |
.opencode/skills/system-spec-kit/mcp_server/lib/README.md:368:| **Usage** | `search.hybridSearch.search(query, options)` |
.opencode/skills/system-spec-kit/mcp_server/lib/README.md:369:| **Fusion** | Uses Reciprocal Rank Fusion (RRF) to merge results |
.opencode/skills/system-spec-kit/mcp_server/lib/README.md:390:// DORMANT (0.02 <= R < 0.05) - Very weak, needs revival
.opencode/skills/system-spec-kit/mcp_server/lib/README.md:515:- `lib/search/vector-index-impl.ts`: v13 migration adds `document_type` and `spec_level` columns and indexes.
.opencode/skills/system-spec-kit/mcp_server/lib/README.md:529:import * as vectorIndex from './search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/lib/README.md:531:const queryEmbedding = new Float32Array(vectorIndex.getEmbeddingDim());
.opencode/skills/system-spec-kit/mcp_server/lib/README.md:532:const results = vectorIndex.vectorSearch(queryEmbedding, {
.opencode/skills/system-spec-kit/mcp_server/lib/README.md:575:import { hybridSearch } from './search/hybrid-search';
.opencode/skills/system-spec-kit/mcp_server/lib/README.md:578:const results = await hybridSearch('TODO authentication', queryEmbedding, {
.opencode/skills/system-spec-kit/mcp_server/lib/README.md:612:| Direct imports | `import { SQLiteVectorStore } from './search/vector-index';` | Focused module usage |
.opencode/skills/system-spec-kit/mcp_server/lib/README.md:628:**Symptom**: `Error: Cannot find module './search/vector-index'`
.opencode/skills/system-spec-kit/mcp_server/lib/README.md:635:import { SQLiteVectorStore } from './search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/lib/README.md:674:| Import errors | Use concrete module paths such as `./search/vector-index` |
.opencode/skills/system-spec-kit/mcp_server/lib/README.md:683:import { SQLiteVectorStore } from './search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/lib/README.md:718:| [Search Modules](./search/) | Vector index, hybrid search, fusion algorithms |
.opencode/skills/system-spec-kit/mcp_server/tests/adaptive-fusion.vitest.ts:9:  hybridAdaptiveFuse,
.opencode/skills/system-spec-kit/mcp_server/tests/adaptive-fusion.vitest.ts:161:    const result = hybridAdaptiveFuse(semantic, keyword, 'understand');
.opencode/skills/system-spec-kit/mcp_server/tests/adaptive-fusion.vitest.ts:177:    const result = hybridAdaptiveFuse(semantic, keyword, 'understand');
.opencode/skills/system-spec-kit/mcp_server/tests/adaptive-fusion.vitest.ts:196:    const result = hybridAdaptiveFuse(semantic, keyword, 'understand');
.opencode/skills/system-spec-kit/mcp_server/tests/adaptive-fusion.vitest.ts:212:    const outOfBucket = hybridAdaptiveFuse(semantic, keyword, 'understand', { identity: 'session-0' });
.opencode/skills/system-spec-kit/mcp_server/tests/adaptive-fusion.vitest.ts:213:    const inBucket = hybridAdaptiveFuse(semantic, keyword, 'understand', { identity: 'session-3' });
.opencode/skills/system-spec-kit/mcp_server/tests/adaptive-fusion.vitest.ts:227:    const result = hybridAdaptiveFuse(semantic, keyword, 'understand', { darkRun: true });
.opencode/skills/system-spec-kit/mcp_server/tests/adaptive-fusion.vitest.ts:240:  it('T12: degraded contract is assembled by hybridAdaptiveFuse when adaptive fusion throws', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/adaptive-fusion.vitest.ts:265:    const result = dynamicFusion.hybridAdaptiveFuse(semantic, keyword, 'understand');
.opencode/skills/system-spec-kit/mcp_server/tests/adaptive-fusion.vitest.ts:282:    const result = hybridAdaptiveFuse([], [], 'understand');
.opencode/skills/system-spec-kit/mcp_server/tests/adaptive-fusion.vitest.ts:313:  // ---- C138 ADDITIONS: Intent-Weighted RRF Activation ----
.opencode/skills/system-spec-kit/mcp_server/tests/adaptive-fusion.vitest.ts:315:  describe('C138: Intent-Weighted RRF Activation', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/adaptive-fusion.vitest.ts:329:    it('C138-T3: hybridAdaptiveFuse produces different rankings per intent', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/adaptive-fusion.vitest.ts:334:      const understandResult = hybridAdaptiveFuse(semantic, keyword, 'understand');
.opencode/skills/system-spec-kit/mcp_server/tests/adaptive-fusion.vitest.ts:335:      const fixBugResult = hybridAdaptiveFuse(semantic, keyword, 'fix_bug');
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:4:// Combines vector, FTS, and BM25 search with fallback
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:9:import { getIndex, isBm25Enabled } from './bm25-index.js';
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:15:import { fts5Bm25Search } from './sqlite-fts.js';
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:108:   * When true, return immediately after adaptive/RRF fusion so Stage 2/3 can
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:118:   * - `'vector'` — cosine similarity from sqlite-vec (normalized from 0-100 to 0-1)
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:119:   * - `'bm25'` — BM25 term-frequency relevance (min-max normalized per source group)
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:120:   * - `'fts'` — FTS5 rank score (absolute value, min-max normalized per source group)
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:123:   * After hybrid merge, all source scores are min-max normalized to 0-1 within
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:139:/** Normalize a fused RRF result to the HybridSearchResult contract. */
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:142:  const primarySource = result.sources[0] ?? 'hybrid';
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:219: * Raw RRF scores are typically small decimals (often <0.05), so a
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:235:/** Primary vector similarity floor for hybrid fallback passes (percentage units). */
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:237:/** Secondary vector similarity floor for adaptive retry passes (percentage units). */
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:239:/** Tier-2 vector similarity floor for quality-aware fallback (percentage units). */
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:261:let vectorSearchFn: VectorSearchFn | null = null;
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:304: * Initialize hybrid search with database, vector search, and optional graph search dependencies.
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:306: * @param vectorFn - Optional vector search function for semantic similarity.
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:311:  vectorFn: VectorSearchFn | null = null,
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:315:  vectorSearchFn = vectorFn;
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:325: * @returns Array of BM25-scored results tagged with source 'bm25'.
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:327:function bm25Search(
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:332:    console.warn('[hybrid-search] BM25 not enabled — returning empty bm25Search results');
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:395:        source: 'bm25',
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:399:    console.warn(`[hybrid-search] BM25 search failed: ${msg}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:426: * @returns True if the memory_fts table exists in the connected database.
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:430:    console.warn('[hybrid-search] db not initialized — isFtsAvailable returning false');
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:436:      SELECT name FROM sqlite_master WHERE type='table' AND name='memory_fts'
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:449: * @returns Array of FTS-scored results tagged with source 'fts'.
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:451:function ftsSearch(
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:456:    console.warn('[hybrid-search] db not initialized or FTS unavailable — returning empty ftsSearch results');
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:463:    // C138-P2: Delegate to weighted BM25 FTS5 search from sqlite-fts.ts
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:464:    // Uses bm25(memory_fts, 10.0, 5.0, 2.0, 1.0) for per-column weighting
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:466:    // Filters: deprecated-tier exclusion and spec-folder matching handled by fts5Bm25Search
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:467:    const bm25Results = fts5Bm25Search(db, query, { limit, specFolder, includeArchived });
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:469:    return bm25Results.map(row => ({
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:472:      score: row.fts_score || 0,
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:473:      source: 'fts',
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:477:    console.warn(`[hybrid-search] FTS search failed: ${msg}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:494:  const ftsResults = ftsSearch(query, options);
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:495:  const bm25Results = bm25Search(query, options);
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:502:  for (const r of ftsResults) {
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:506:  for (const r of bm25Results) {
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:601:    source: typeof primary.source === 'string' ? primary.source : (sources[0] ?? 'hybrid'),
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:683:  const allowed = new Set<ChannelName>(['vector', 'fts', 'graph', 'degree']);
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:686:    allowed.add('bm25');
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:689:  if (options.useVector === false) allowed.delete('vector');
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:690:  if (options.useBm25 === false) allowed.delete('bm25');
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:691:  if (options.useFts === false) allowed.delete('fts');
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:708:    useVector: allowedChannels.has('vector'),
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:709:    useBm25: allowedChannels.has('bm25'),
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:710:    useFts: allowedChannels.has('fts'),
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:743:  vectorEmbeddingCache: Map<number, Float32Array>;
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:814:    : await hybridSearch(query, embedding, primaryOptions);
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:836:      : await hybridSearch(query, embedding, retryOptions);
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:856:      : await hybridSearch(query, embedding, retryOptions);
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:875: * Run multi-channel hybrid search combining vector, FTS, BM25, and graph results with per-source normalization.
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:876: * Prefer hybridSearchEnhanced() or searchWithFallback() instead. This function uses naive per-source
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:877: * min-max normalization which produces different orderings than the RRF pipeline in hybridSearchEnhanced().
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:880:async function hybridSearch(
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:899:  if (useVector && embedding && vectorSearchFn) {
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:901:      const vectorResults = vectorSearchFn(embedding, {
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:908:      for (const r of vectorResults) {
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:913:          source: 'vector',
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:918:      console.warn(`[hybrid-search] Vector search failed: ${msg}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:924:    const ftsResults = ftsSearch(query, { limit, specFolder, includeArchived });
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:925:    results.push(...ftsResults);
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:930:    const bm25Results = bm25Search(query, { limit, specFolder });
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:931:    results.push(...bm25Results);
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:948:      console.warn(`[hybrid-search] Graph search failed: ${msg}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:981:  // LIMITATION (P1-1): When a result appears in multiple sources (e.g., vector + fts),
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1000: * Enhanced hybrid search with RRF fusion.
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1004:async function hybridSearchEnhanced(
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1018:  return hybridSearch(query, embedding, options);
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1037:    const allPossibleChannels: ChannelName[] = ['vector', 'fts', 'bm25', 'graph', 'degree'];
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1081:    let ftsChannelResults: HybridSearchResult[] = [];
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1082:    let bm25ChannelResults: HybridSearchResult[] = [];
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1083:    const vectorEmbeddingCache = new Map<number, Float32Array>();
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1089:    if (activeChannels.has('vector') && embedding && vectorSearchFn) {
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1091:        const vectorResults = vectorSearchFn(embedding, {
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1099:        semanticResults = vectorResults.map((r: Record<string, unknown>): { id: number | string; source: string; [key: string]: unknown } => ({
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1102:          source: 'vector',
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1111:            vectorEmbeddingCache.set(result.id, embeddingCandidate);
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1114:        lists.push({ source: 'vector', results: semanticResults, weight: 1.0 });
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1116:        // Non-critical — vector channel failure does not block pipeline
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1117:        console.warn('[hybrid-search] Channel error:', _err instanceof Error ? _err.message : String(_err));
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1121:    // FTS channel (internal error handling in ftsSearch) — gated by query-complexity routing
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1122:    if (activeChannels.has('fts')) {
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1123:      ftsChannelResults = ftsSearch(query, options);
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1124:      if (ftsChannelResults.length > 0) {
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1127:        lists.push({ source: 'fts', results: ftsChannelResults, weight: 0.3 });
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1131:    // BM25 channel (internal error handling in bm25Search) — gated by query-complexity routing
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1132:    if (activeChannels.has('bm25')) {
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1133:      bm25ChannelResults = bm25Search(query, options);
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1134:      if (bm25ChannelResults.length > 0) {
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1137:        lists.push({ source: 'bm25', results: bm25ChannelResults, weight: 0.6 });
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1160:        console.warn('[hybrid-search] Channel error:', _err instanceof Error ? _err.message : String(_err));
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1204:        console.warn('[hybrid-search] Channel error:', _err instanceof Error ? _err.message : String(_err));
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1210:      ...ftsChannelResults,
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1211:      ...bm25ChannelResults,
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1222:        vectorEmbeddingCache,
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1249:    // weights, avoiding the heavier hybridAdaptiveFuse() standard-first path.
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1270:      .filter((list) => list.source !== 'fts' && list.source !== 'bm25')
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1272:        if (list.source === 'vector') {
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1290:    const vectorList = fusionLists.find((list) => list.source === 'vector');
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1291:    const passthroughLists = fusionLists.filter((list) => list.source !== 'graph' && list.source !== 'vector' && list.source !== 'keyword');
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1302:        (vectorList?.results ?? []) as Array<Record<string, unknown>>,
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1330:      vectorEmbeddingCache,
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1335:    console.warn(`[hybrid-search] Enhanced search failed, falling back: ${msg}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1353:    vectorEmbeddingCache,
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1394:      console.error('[hybrid-search] MPAB error (non-fatal):', msg);
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1417:      fusedHybridResults.map(r => ({ ...r, source: r.source || 'hybrid' })),
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1432:    console.warn('[hybrid-search] channel enforcement failed:', err instanceof Error ? err.message : String(err));
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1442:  // Reuse embeddings already returned by the vector channel when present and
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1462:        const embeddingMap = new Map<number, Float32Array>(vectorEmbeddingCache);
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1516:              source: 'vector',
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1526:        console.warn(`[hybrid-search] MMR embedding retrieval failed: ${msg}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1558:      console.warn('[hybrid-search] co-activation enrichment failed:', err instanceof Error ? err.message : String(err));
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1612:      console.warn('[hybrid-search] confidence truncation failed:', err instanceof Error ? err.message : String(err));
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1680:      queryId: `hybrid-${Date.now()}`,
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1737: * @param embedding - Optional embedding vector for semantic search.
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1767:  if (allowedChannels.has('fts')) {
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1768:    const ftsFallback = collectCandidatesFromLists(
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1769:      [{ source: 'fts', results: ftsSearch(query, options) }],
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1772:    if (ftsFallback.length > 0) return ftsFallback;
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1775:  if (allowedChannels.has('bm25')) {
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1776:    const bm25Fallback = collectCandidatesFromLists(
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1777:      [{ source: 'bm25', results: bm25Search(query, options) }],
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1780:    if (bm25Fallback.length > 0) return bm25Fallback;
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1783:  console.warn('[hybrid-search] Raw candidate collection returned empty results');
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1794: * @param embedding - Optional embedding vector for semantic search.
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1810:  // P3-03 FIX: Use hybridSearchEnhanced (with RRF fusion) instead of
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1811:  // The naive hybridSearch that merges raw scores
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1828:  if (allowedChannels.has('fts')) {
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1829:    const ftsResults = ftsSearch(query, options);
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1830:    if (ftsResults.length > 0) return ftsResults;
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1834:  if (allowedChannels.has('bm25')) {
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1835:    const bm25Results = bm25Search(query, options);
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1836:    if (bm25Results.length > 0) return bm25Results;
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1839:  console.warn('[hybrid-search] All search methods returned empty results');
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1857:    console.warn('[hybrid-search] db not initialized — returning empty structuralSearch results');
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1911:    console.warn(`[hybrid-search] Structural search failed: ${msg}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:2159: * TIER 1: hybridSearchEnhanced at minSimilarity=30
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:2162: * TIER 2: hybridSearchEnhanced at minSimilarity=10, all allowed channels forced
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:2171: * @param embedding - Optional embedding vector for semantic search.
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:2203:  console.error(`[hybrid-search] Tier 1→2 degradation: ${tier1Trigger.reason} (topScore=${tier1Trigger.topScore.toFixed(3)}, count=${tier1Trigger.resultCount})`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:2230:  console.error(`[hybrid-search] Tier 2→3 degradation: ${tier2Trigger.reason} (topScore=${tier2Trigger.topScore.toFixed(3)}, count=${tier2Trigger.resultCount})`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:2446:      `[hybrid-search] Token budget overflow (single-result fallback): ` +
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:2483:      `[hybrid-search] Token budget overflow (top-result fallback): ` +
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:2500:    `[hybrid-search] Token budget overflow: ${totalTokens} tokens > ${effectiveBudget} budget, ` +
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:2523:  bm25Search,
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:2528:  ftsSearch,
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:2529:  hybridSearch,
.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:2530:  hybridSearchEnhanced,
.opencode/skills/system-spec-kit/mcp_server/tests/context-metrics.vitest.ts:54:    it('increments memoryRecoveryCalls on memory_recovery event', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/context-metrics.vitest.ts:56:      recordMetricEvent({ kind: 'memory_recovery' });
.opencode/skills/system-spec-kit/mcp_server/tests/context-metrics.vitest.ts:90:      expect(typeof score.factors.recovery).toBe('number');
.opencode/skills/system-spec-kit/mcp_server/tests/context-metrics.vitest.ts:101:    it('has recovery = 1.0 after memory recovery', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/context-metrics.vitest.ts:102:      recordMetricEvent({ kind: 'memory_recovery' });
.opencode/skills/system-spec-kit/mcp_server/tests/context-metrics.vitest.ts:104:      expect(score.factors.recovery).toBe(1.0);
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:106:      channel: 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:118:      channel: 'bm25',
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:130:      channel: 'fts5',
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:146:    config: { channels: ['vector', 'bm25', 'fts5'] as AblationChannel[] },
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:221:    it('contains vector, bm25, fts5, graph, trigger', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:222:      expect(ALL_CHANNELS).toContain('vector');
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:223:      expect(ALL_CHANNELS).toContain('bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:224:      expect(ALL_CHANNELS).toContain('fts5');
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:321:    it('disables vector channel correctly', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:322:      const flags = toHybridSearchFlags(new Set<AblationChannel>(['vector']));
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:329:    it('disables bm25 channel correctly', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:330:      const flags = toHybridSearchFlags(new Set<AblationChannel>(['bm25']));
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:337:    it('disables fts5 channel correctly (maps to useFts)', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:338:      const flags = toHybridSearchFlags(new Set<AblationChannel>(['fts5']));
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:354:      const flags = toHybridSearchFlags(new Set<AblationChannel>(['vector', 'graph']));
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:374:        new Set<AblationChannel>(['vector', 'bm25', 'fts5', 'graph', 'trigger']),
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:437:        channels: ['vector'],
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:477:      // Set up channel contributions: vector provides first half, bm25 provides second half
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:480:        ['vector', relevantIds.slice(0, mid)],
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:481:        ['bm25', relevantIds.slice(mid)],
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:487:        channels: ['vector', 'bm25'],
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:547:        channels: ['vector'],
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:577:        if (disabledChannels.has('vector')) {
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:578:          throw new Error('vector channel outage');
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:590:        channels: ['vector', 'bm25'],
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:600:      // Vector fails, bm25 still succeeds (partial report)
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:602:      expect(report.results[0].channel).toBe('bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:605:        channel: 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:606:        error: 'vector channel outage',
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:610:        expect.stringContaining('[ablation] Channel "vector" failed'),
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:611:        expect.stringContaining('vector channel outage'),
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:650:      const channels: AblationChannel[] = ['vector', 'bm25', 'fts5'];
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:728:      expect(md).toContain('| vector ');
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:729:      expect(md).toContain('| bm25 ');
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:730:      expect(md).toContain('| fts5 ');
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:746:      // Vector (|delta|=0.3) should come before bm25 (|delta|=0.05) before fts5 (|delta|=0.02)
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:748:      expect(dataRows[0]).toContain('vector');
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:749:      expect(dataRows[1]).toContain('bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:750:      expect(dataRows[2]).toContain('fts5');
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:758:      const vectorLine = md.split('\n').find(l => l.includes('| vector'));
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:759:      expect(vectorLine).toBeDefined();
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:760:      expect(vectorLine).toContain('*');
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:779:      const vectorLine = md.split('\n').find(l => l.includes('| vector'));
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:780:      expect(vectorLine).toContain('CRITICAL');
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:783:      const fts5Line = md.split('\n').find(l => l.includes('| fts5'));
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:784:      expect(fts5Line).toContain('likely redundant');
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:792:      expect(md).toContain('**vector**');
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:793:      expect(md).toContain('**bm25**');
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:794:      expect(md).toContain('**fts5**');
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:818:            channel: 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:942:    expect(channels).toContain('vector');
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:943:    expect(channels).toContain('bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:944:    expect(channels).toContain('fts5');
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:946:    // Verify vector channel delta value
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:947:    const vectorRow = deltaRows.find(r => r.channel === 'vector');
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:948:    expect(vectorRow).toBeDefined();
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:949:    expect(vectorRow!.metric_value).toBeCloseTo(-0.3);
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:952:    const meta = JSON.parse(vectorRow!.metadata);
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:983:        { channel: 'vector', error: 'vector outage', queryId: 1, query: 'q1' },
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:984:        { channel: 'bm25', error: 'bm25 outage', queryId: 1, query: 'q1' },
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:1059:    // Ablating vector should show a measurable negative delta.
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:1079:    // Build a search function where vector uniquely contributes some results
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:1095:      // When vector is disabled, only return the second half of relevant IDs
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:1096:      // This simulates vector contributing the first half uniquely
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:1098:      if (disabledChannels.has('vector')) {
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:1113:      channels: ['vector', 'bm25'],
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:1133:    // Specifically, vector should show negative delta (removing it hurts)
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:1134:    const vectorResult = report.results.find(r => r.channel === 'vector');
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:1135:    expect(vectorResult).toBeDefined();
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:1136:    expect(vectorResult!.delta).toBeLessThan(0);
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:1139:    const bm25Result = report.results.find(r => r.channel === 'bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:1140:    expect(bm25Result).toBeDefined();
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:1141:    expect(bm25Result!.delta).toBeCloseTo(0, 4);
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:1146:    expect(md).toContain('vector');
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:1171:      ['vector', relevantIds.slice(0, third)],
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:1172:      ['bm25', relevantIds.slice(third, 2 * third)],
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:1173:      ['fts5', relevantIds.slice(2 * third)],
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:1179:      channels: ['vector', 'bm25', 'fts5'],
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:1194:    for (const channel of ['vector', 'bm25', 'fts5']) {
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:1249:    expect(md).toContain('| vector ');
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:1250:    expect(md).toContain('| bm25 ');
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:1289:      // Verify multi-metric rows exist for vector
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:1290:      const vectorMetricRows = rows.filter(
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:1291:        r => r.channel === 'vector' && r.metric_name.startsWith('ablation_') && r.metric_name !== 'ablation_recall@20_delta' && r.metric_name !== 'ablation_baseline_recall@20',
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:1293:      expect(vectorMetricRows.length).toBe(8);
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:1296:      const metricNames = vectorMetricRows.map(r => r.metric_name);
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:1330:        if (disabled.has('vector')) ids = ids.slice(Math.ceil(ids.length / 2));
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:1335:        channels: ['vector'],
.opencode/skills/system-spec-kit/mcp_server/tests/ablation-framework.vitest.ts:1373:        channels: ['vector'],
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/query-flow-tracker.ts:8:// Spec: system-spec-kit/023-hybrid-rag-fusion-refinement/014-feedback-signal-pipeline
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/query-flow-tracker.ts:184:    const confidence = detection.type === 'query_reformulated' ? 'medium' : 'weak';
.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:141:    'memory_fts',
.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:245:  vectors?: SnapshotVectorRow[];
.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:351:  'memory_index', 'memory_fts', 'vec_memories', 'vec_metadata', 'causal_edges',
.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:790:  if (Array.isArray(snapshot.vectors)) {
.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:793:      rows: snapshot.vectors.map((row) => ({
.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:823:  if (tableName === 'memory_fts') {
.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:824:    database.exec(`INSERT INTO memory_fts(memory_fts) VALUES('delete-all')`);
.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:961:    if (tableName === 'memory_fts') {
.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1131:      name: 'fts-rebuild',
.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1134:        if (tableExists(database, 'memory_fts')) {
.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1135:          database.exec(`INSERT INTO memory_fts(memory_fts) VALUES('rebuild')`);
.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1413:      const vectorRows = tables.vec_memories?.rows ?? [];
.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1416:      const vectors = vectorRows.map((row) => ({
.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1426:        vectors,
.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1452:          vectorCount: vectors.length,
.opencode/skills/system-spec-kit/mcp_server/tests/recovery-hints.vitest.ts:2:// Converted from recovery-hints.test.js
.opencode/skills/system-spec-kit/mcp_server/tests/recovery-hints.vitest.ts:3:// T001-T095: Error catalog with recovery hints (REQ-004, REQ-009)
.opencode/skills/system-spec-kit/mcp_server/tests/recovery-hints.vitest.ts:16:} from '../lib/errors/recovery-hints';
.opencode/skills/system-spec-kit/mcp_server/tests/recovery-hints.vitest.ts:104:  it('T012: All error codes have recovery hints', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/recovery-hints.vitest.ts:685:  it('T088b: MEMORY_SAVE_FAILED mentions insufficient context recovery', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/recovery-hints.vitest.ts:701:  it('T090: SESSION_EXPIRED mentions recovery option', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/recovery-hints.vitest.ts:704:      (a: string) => a.includes('/spec_kit:resume') || a.includes('recovery')
.opencode/skills/system-spec-kit/mcp_server/tests/graph-first-routing-nudge.vitest.ts:297:      'Use `session_resume({ specFolder })` when you need the fuller merged recovery payload.',
.opencode/skills/system-spec-kit/mcp_server/lib/search/learned-feedback.ts:399:    // Do NOT touch memory_fts or any FTS5 table (Safeguard #1).
.opencode/skills/system-spec-kit/mcp_server/tests/session-resume.vitest.ts:61:    factors: { recency: 0, recovery: 0, graphFreshness: 0, continuity: 0 },
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-save.vitest.ts:254:          '<!-- ANCHOR:recovery-hints -->',
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-save.vitest.ts:260:          '<!-- /ANCHOR:recovery-hints -->',
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-save.vitest.ts:620:      // from tripping vector_search dim validation; tests that need to simulate
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-save.vitest.ts:708:      vectorIndexMutationsModuleFactory?: () => unknown | Promise<unknown>;
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-save.vitest.ts:847:      if (options.vectorIndexMutationsModuleFactory) {
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-save.vitest.ts:848:        vi.doMock('../lib/search/vector-index-mutations', options.vectorIndexMutationsModuleFactory as any);
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-save.vitest.ts:1054:      vi.doUnmock('../lib/search/vector-index-mutations');
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-save.vitest.ts:2432:    // vector_search with the harness's tiny fixture embedding. Requires a
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-save.vitest.ts:2433:    // proper DB/vector-index fixture harness, which this T518 suite was
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-save.vitest.ts:3444:        vectorIndexMutationsModuleFactory: async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-save.vitest.ts:3445:          const actual = await vi.importActual<typeof import('../lib/search/vector-index-mutations')>('../lib/search/vector-index-mutations');
.opencode/skills/system-spec-kit/mcp_server/code_graph/handlers/query.ts:764:  let weakest: {
.opencode/skills/system-spec-kit/mcp_server/code_graph/handlers/query.ts:770:    if (weakest == null || edge.numericConfidence < weakest.numericConfidence) {
.opencode/skills/system-spec-kit/mcp_server/code_graph/handlers/query.ts:771:      weakest = edge;
.opencode/skills/system-spec-kit/mcp_server/code_graph/handlers/query.ts:776:      edge.numericConfidence === weakest.numericConfidence
.opencode/skills/system-spec-kit/mcp_server/code_graph/handlers/query.ts:778:        < EDGE_EVIDENCE_CLASS_WEAKNESS[weakest.edgeEvidenceClass]
.opencode/skills/system-spec-kit/mcp_server/code_graph/handlers/query.ts:780:      weakest = edge;
.opencode/skills/system-spec-kit/mcp_server/code_graph/handlers/query.ts:784:  return weakest;
.opencode/skills/system-spec-kit/mcp_server/lib/scoring/negative-feedback.ts:9:// Decay: gradual recovery over time (30-day half-life)
.opencode/skills/system-spec-kit/mcp_server/lib/scoring/negative-feedback.ts:29: * Half-life for recovery in milliseconds (30 days).
.opencode/skills/system-spec-kit/mcp_server/lib/scoring/negative-feedback.ts:62: * Time-based recovery: the penalty decays with a 30-day half-life since
.opencode/skills/system-spec-kit/mcp_server/lib/scoring/negative-feedback.ts:71: *                         If null/undefined, no recovery decay is applied.
.opencode/skills/system-spec-kit/mcp_server/lib/scoring/negative-feedback.ts:85:  // Apply time-based recovery (exponential decay of penalty)
.opencode/skills/system-spec-kit/mcp_server/lib/eval/README.md:42:| `bm25-baseline.ts` | BM25-only baseline measurement and baseline metric persistence |
.opencode/skills/system-spec-kit/mcp_server/lib/eval/README.md:51:| `k-value-analysis.ts` | RRF K-value sweep helpers |
.opencode/skills/system-spec-kit/mcp_server/tests/preflight.vitest.ts:523:    it('T164: similar duplicate match via vector', () => {
.opencode/skills/system-spec-kit/mcp_server/lib/storage/README.md:25:`lib/storage/` contains the persistence-side helpers that sit below handlers and above the raw vector-index schema/runtime. The directory currently contains 14 TypeScript modules.
.opencode/skills/system-spec-kit/mcp_server/lib/storage/README.md:39:- The primary memory schema is at `SCHEMA_VERSION = 23` in `lib/search/vector-index-schema.ts`.
.opencode/skills/system-spec-kit/mcp_server/lib/storage/README.md:61:| `transaction-manager.ts` | Atomic pending-file workflow and crash-recovery support |
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/batch-learning.ts:50:  weak:   0.1,
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/batch-learning.ts:66:  /** Raw count of weak-tier events. */
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/batch-learning.ts:67:  weakCount: number;
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/batch-learning.ts:203:      weak: number;
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/batch-learning.ts:209:        entry = { sessions: new Set<string>(), strong: 0, medium: 0, weak: 0 };
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/batch-learning.ts:224:        data.weak   * CONFIDENCE_WEIGHTS.weak;
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/batch-learning.ts:228:      const totalEvents = data.strong + data.medium + data.weak;
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/batch-learning.ts:237:        weakCount:     data.weak,
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/batch-learning.ts:435:      (sum, s) => sum + s.strongCount + s.mediumCount + s.weakCount, 0
.opencode/skills/system-spec-kit/mcp_server/lib/scoring/mpab-aggregation.ts:6:// Pipeline position: after RRF fusion, before state filtering.
.opencode/skills/system-spec-kit/mcp_server/lib/scoring/mpab-aggregation.ts:38:  /** Retrieval score for this chunk (e.g., RRF score, similarity). */
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-trigger-fast-match.vitest.ts:25:vi.mock('../lib/search/vector-index', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/checkpoint-completeness.vitest.ts:8:import { createSchema, ensureSchemaVersion } from '../lib/search/vector-index-schema';
.opencode/skills/system-spec-kit/mcp_server/tests/checkpoint-completeness.vitest.ts:49:  'memory_fts',
.opencode/skills/system-spec-kit/mcp_server/tests/checkpoint-completeness.vitest.ts:221:    'specs/022-hybrid-rag-fusion',
.opencode/skills/system-spec-kit/mcp_server/tests/checkpoint-completeness.vitest.ts:267:    'specs/022-hybrid-rag-fusion',
.opencode/skills/system-spec-kit/mcp_server/tests/checkpoint-completeness.vitest.ts:312:  `).run('hist-1', 1, null, 'Alpha Memory', 'ADD', now, 0, 'tester', 'specs/022-hybrid-rag-fusion');
.opencode/skills/system-spec-kit/mcp_server/tests/checkpoint-completeness.vitest.ts:325:  `).run(1, later, 'UPDATE', 'hash-beta', 2, 1, 0.82, 'seed conflict', 'beta preview', 'alpha preview', 0, null, 'specs/022-hybrid-rag-fusion', later);
.opencode/skills/system-spec-kit/mcp_server/tests/checkpoint-completeness.vitest.ts:358:  `).run(1, 'scope_check', 'allow', 1, 'specs/022-hybrid-rag-fusion::/tmp/specs/022/alpha.md::_', 'tenant-a', 'user-a', 'agent-a', 'sess-1', 'seed governance', '{"phase":"seed"}', later);
.opencode/skills/system-spec-kit/mcp_server/tests/checkpoint-completeness.vitest.ts:364:  `).run('sess-1', 'active', 'specs/022-hybrid-rag-fusion', 'checkpoint test', 'seed', 'summary', '[]', '{"phase":"seed"}', now, later);
.opencode/skills/system-spec-kit/mcp_server/tests/checkpoint-completeness.vitest.ts:498:    const ftsCount = restoreDb.prepare('SELECT COUNT(*) AS count FROM memory_fts').get() as { count: number };
.opencode/skills/system-spec-kit/mcp_server/tests/checkpoint-completeness.vitest.ts:506:    // intentionally rebuilds degree/fts artifacts while leaving assignments empty.
.opencode/skills/system-spec-kit/mcp_server/tests/checkpoint-completeness.vitest.ts:508:    expect(ftsCount.count).toBe(2);
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-degree-channel.vitest.ts:2:// 1. TEST — RRF DEGREE CHANNEL
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-degree-channel.vitest.ts:4:// T002 (degree as 5th RRF channel) + T003a (co-activation boost)
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-degree-channel.vitest.ts:94:// T002: Degree as 5th RRF Channel
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-degree-channel.vitest.ts:95:describe('T002: Degree as 5th RRF Channel', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-degree-channel.vitest.ts:106:      expect(SOURCE_TYPES.VECTOR).toBe('vector');
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-degree-channel.vitest.ts:107:      expect(SOURCE_TYPES.FTS).toBe('fts');
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-degree-channel.vitest.ts:108:      expect(SOURCE_TYPES.BM25).toBe('bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-degree-channel.vitest.ts:114:  describe('RRF fusion with 5 channels (flag enabled)', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-degree-channel.vitest.ts:131:      // Each result should have RRF score and sources
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-degree-channel.vitest.ts:140:      // Item 1 appears in vector + degree = convergence bonus
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-degree-channel.vitest.ts:177:  describe('RRF fusion without degree (flag disabled) is identical to 4-channel', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-degree-channel.vitest.ts:253:      // Simulate what hybrid-search does: sort by degree score, pass to RRF
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-degree-channel.vitest.ts:276:      // Item 1 (highest degree) should have the highest RRF score
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-degree-channel.vitest.ts:432:      // Lower similarity = lower boost (fan-effect: many weak connections matter less)
.opencode/skills/system-spec-kit/mcp_server/lib/search/hyde.ts:31:import * as vectorIndex from './vector-index.js';
.opencode/skills/system-spec-kit/mcp_server/lib/search/hyde.ts:61:  /** Embedding vector of the pseudo-document (Float32Array). */
.opencode/skills/system-spec-kit/mcp_server/lib/search/hyde.ts:353: * Run a vector-only search using the HyDE pseudo-document embedding.
.opencode/skills/system-spec-kit/mcp_server/lib/search/hyde.ts:366:export function vectorOnly(
.opencode/skills/system-spec-kit/mcp_server/lib/search/hyde.ts:371:  return vectorIndex.vectorSearch(embedding, {
.opencode/skills/system-spec-kit/mcp_server/lib/search/hyde.ts:412:    const candidates = vectorOnly(hydeResult.embedding, limit, specFolder);
.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:9:import * as bm25Index from '../search/bm25-index.js';
.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:13:import { ensureLineageTables } from '../search/vector-index-schema.js';
.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:14:import { get_embedding_dim, refresh_interference_scores_for_folder, sqlite_vec_available } from '../search/vector-index-store.js';
.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:15:import { to_embedding_buffer } from '../search/vector-index-types.js';
.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:520:  if (bm25Index.isBm25Enabled()) {
.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:522:      bm25Index.getIndex().addDocument(String(memoryId), bm25Index.buildBm25DocumentText({
.opencode/skills/system-spec-kit/mcp_server/lib/enrichment/retry-budget.ts:11: * C4 (iter 5) documents that shared expectation explicitly for recovery analysis.
.opencode/skills/system-spec-kit/mcp_server/lib/eval/ground-truth-generator.ts:108:  // The production memory_fts index using multi-strategy FTS5 search.
.opencode/skills/system-spec-kit/mcp_server/lib/storage/transaction-manager.ts:5:// Atomic file + index operations with pending file recovery
.opencode/skills/system-spec-kit/mcp_server/lib/storage/transaction-manager.ts:47: * Optional database probe used during pending-file recovery.
.opencode/skills/system-spec-kit/mcp_server/lib/storage/transaction-manager.ts:50: * Throwing aborts recovery for that file and surfaces the error message in `RecoveryResult.error`.
.opencode/skills/system-spec-kit/mcp_server/lib/storage/transaction-manager.ts:282:    // This state and trigger recovery (e.g., re-index from DB or replay the write).
.opencode/skills/system-spec-kit/mcp_server/lib/storage/transaction-manager.ts:289:      // Leave pending file for startup recovery and report failure with dbCommitted flag.
.opencode/skills/system-spec-kit/mcp_server/lib/storage/transaction-manager.ts:291:      console.warn(`[transaction-manager] rename failed after DB commit; pending file kept for recovery: ${pendingPath} (${msg})`);
.opencode/skills/system-spec-kit/mcp_server/lib/storage/transaction-manager.ts:317: * Find pending files in a directory (crash recovery).
.opencode/skills/system-spec-kit/mcp_server/lib/storage/transaction-manager.ts:370:    // Guard: verify pending file still exists before attempting recovery
.opencode/skills/system-spec-kit/mcp_server/lib/storage/transaction-manager.ts:385:        console.warn(`[transaction-manager] Skipping pending recovery because DB file is missing: ${databasePath}`);
.opencode/skills/system-spec-kit/mcp_server/lib/storage/transaction-manager.ts:386:        return { path: pendingPath, recovered: false, error: 'Database file missing during recovery' };
.opencode/skills/system-spec-kit/mcp_server/code_graph/handlers/README.md:5:Code graph handlers can enrich recovery, but they do not own packet continuity. For Spec Kit packet work, `/spec_kit:resume` remains canonical and recovery still flows through `handover.md`, then `_memory.continuity`, then the remaining spec docs.
.opencode/skills/system-spec-kit/mcp_server/tests/retrieval-trace.vitest.ts:146:      'embedding_timeout', 'bm25_only', 0.6, 'delayed', ['fusion']
.opencode/skills/system-spec-kit/mcp_server/tests/retry-manager-health.vitest.ts:13:    vi.doMock('../lib/search/vector-index', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-update-constitutional-guard.vitest.ts:88:  vi.doMock('../lib/search/vector-index.js', async (importOriginal) => {
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-update-constitutional-guard.vitest.ts:89:    const actual = await importOriginal<typeof import('../lib/search/vector-index.js')>();
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-update-constitutional-guard.vitest.ts:99:  vi.doMock('../lib/search/bm25-index.js', async (importOriginal) => {
.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-update-constitutional-guard.vitest.ts:100:    const actual = await importOriginal<typeof import('../lib/search/bm25-index.js')>();
.opencode/skills/system-spec-kit/mcp_server/lib/eval/k-value-analysis.ts:4:// Feature catalog: RRF K-value sensitivity analysis
.opencode/skills/system-spec-kit/mcp_server/lib/eval/k-value-analysis.ts:5:// Measures the impact of different RRF K-values on ranking stability.
.opencode/skills/system-spec-kit/mcp_server/lib/eval/k-value-analysis.ts:21:  /** Average RRF score across all fused results for this K-value. */
.opencode/skills/system-spec-kit/mcp_server/lib/eval/k-value-analysis.ts:141: * 5. Computes average RRF score
.opencode/skills/system-spec-kit/mcp_server/lib/eval/k-value-analysis.ts:303:    sensitivityCurve = 'Flat — average RRF score is stable across all tested K values. Ranking is insensitive to K.';
.opencode/skills/system-spec-kit/mcp_server/lib/eval/k-value-analysis.ts:385:  /** Whether SPECKIT_RRF_K_EXPERIMENTAL was enabled */
.opencode/skills/system-spec-kit/mcp_server/lib/eval/k-value-analysis.ts:598: * Default: ON (graduated). Set SPECKIT_RRF_K_EXPERIMENTAL=false to disable.
.opencode/skills/system-spec-kit/mcp_server/lib/eval/k-value-analysis.ts:610: * @param k - RRF smoothing constant to use for fusion
.opencode/skills/system-spec-kit/mcp_server/lib/eval/k-value-analysis.ts:664: * Feature flag: SPECKIT_RRF_K_EXPERIMENTAL (default ON, graduated).
.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:18:import * as bm25Index from '../search/bm25-index.js';
.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:19:import { clear_search_cache } from '../search/vector-index-aliases.js';
.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:20:import { refresh_interference_scores_for_folder } from '../search/vector-index-store.js';
.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:23:import { delete_memory_from_database } from '../search/vector-index-mutations.js';
.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:171: * @param embedding - The embedding vector to compare against
.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:237:  let bm25RepairWarning: string | null = null;
.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:269:    let bm25RepairNeeded = false;
.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:299:      mergedBm25DocumentText = bm25Index.buildBm25DocumentText({
.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:323:        bm25_repair_needed: 0,
.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:367:      if (bm25Index.isBm25Enabled()) {
.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:369:          const bm25 = bm25Index.getIndex();
.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:370:          bm25.removeDocument(String(existingMemory.id));
.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:371:          bm25.addDocument(String(newId), mergedBm25DocumentText);
.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:372:        } catch (bm25Err: unknown) {
.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:373:          const message = bm25Err instanceof Error ? bm25Err.message : String(bm25Err);
.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:375:          bm25RepairNeeded = true;
.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:401:    if (bm25RepairNeeded) {
.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:409:        bm25RepairWarning =
.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:423:      warnings: bm25RepairWarning ? [bm25RepairWarning] : undefined,
.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:789:  if (!bm25Index.isBm25Enabled()) {
.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:794:    const bm25 = bm25Index.getIndex();
.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:796:      bm25.removeDocument(String(args.previousMemoryId));
.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:798:    bm25.removeDocument(String(args.memoryId));
.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:799:    bm25.addDocument(String(args.memoryId), args.documentText);
.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:817:  if (tableColumns.has('bm25_repair_needed')) {
.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:822:    db.exec('ALTER TABLE memory_index ADD COLUMN bm25_repair_needed INTEGER DEFAULT 0');
.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:823:    tableColumns.add('bm25_repair_needed');
.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:827:      tableColumns.add('bm25_repair_needed');
.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:830:    console.warn('[reconsolidation] Failed to ensure bm25_repair_needed column:', message);
.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:840:  if (!tableColumns.has('bm25_repair_needed')) {
.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:847:      SET bm25_repair_needed = ?,
.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:853:    console.warn(`[reconsolidation] Failed to persist bm25_repair_needed=${repairNeeded ? 1 : 0} for memory ${memoryId}: ${message}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-types.ts:4:// SCHEMA_VERSION is now canonical in vector-index-schema.ts
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-types.ts:8:/** Supported embedding input shapes for vector search and mutation operations. */
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-types.ts:11:/** Stable error codes emitted by vector-index modules. */
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-types.ts:23:/** Structured error used by vector-index query, mutation, and store helpers. */
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-types.ts:75:/** Represents a vector-search memory row shared by query and store helpers. */
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-types.ts:132:/** Controls vector search filtering and ranking behavior. */
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-types.ts:168: * Converts an embedding vector into a binary buffer for sqlite-vec storage.
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-types.ts:232:// ValidateEmbeddingDimension are exported from vector-index-store.ts (canonical)
.opencode/skills/system-spec-kit/mcp_server/tests/session-learning.vitest.ts:6:import * as vectorIndex from '../lib/search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/tests/session-learning.vitest.ts:33:    vi.spyOn(vectorIndex, 'getDb').mockReturnValue(database as unknown as ReturnType<typeof vectorIndex.getDb>);
.opencode/skills/system-spec-kit/mcp_server/lib/ops/job-queue.ts:6:// Crash recovery with re-enqueue, and original-path progress tracking.
.opencode/skills/system-spec-kit/mcp_server/lib/ops/job-queue.ts:147:// Loop is not yet serving requests (table creation, crash recovery reset).
.opencode/skills/system-spec-kit/mcp_server/lib/ops/job-queue.ts:707:  // Crash recovery: reset incomplete jobs to 'queued' AND re-enqueue them
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-health-edge.vitest.ts:4:import * as vectorIndex from '../lib/search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-health-edge.vitest.ts:23:  vectorIndex.closeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-health-edge.vitest.ts:24:  vectorIndex.initializeDb(':memory:');
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-health-edge.vitest.ts:28:  vectorIndex.closeDb();
.opencode/skills/system-spec-kit/mcp_server/lib/scoring/README.md:170: negative-feedback.ts     # Negative validation confidence multiplier with time-based recovery
.opencode/skills/system-spec-kit/mcp_server/lib/scoring/README.md:185:| `mpab-aggregation.ts` | Multi-Parent Aggregated Bonus (MPAB) for chunk-to-memory score aggregation; computes aggregated scores after RRF fusion, collapses and reassembles chunk results |
.opencode/skills/system-spec-kit/mcp_server/lib/scoring/README.md:186:| `negative-feedback.ts` | Negative validation confidence multiplier with 30-day half-life recovery; records negative feedback events and batch-loads stats for scoring pipeline |
.opencode/skills/system-spec-kit/mcp_server/tests/reporting-dashboard.vitest.ts:332:          channel: 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/reporting-dashboard.vitest.ts:340:          channel: 'bm25',
.opencode/skills/system-spec-kit/mcp_server/tests/reporting-dashboard.vitest.ts:347:        { eval_run_id: 1, query_id: 1, channel: 'vector', hit_count: 5, latency_ms: 12.5 },
.opencode/skills/system-spec-kit/mcp_server/tests/reporting-dashboard.vitest.ts:348:        { eval_run_id: 1, query_id: 2, channel: 'vector', hit_count: 3, latency_ms: 15.0 },
.opencode/skills/system-spec-kit/mcp_server/tests/reporting-dashboard.vitest.ts:349:        { eval_run_id: 1, query_id: 1, channel: 'bm25', hit_count: 4, latency_ms: 8.0 },
.opencode/skills/system-spec-kit/mcp_server/tests/reporting-dashboard.vitest.ts:350:        { eval_run_id: 1, query_id: 2, channel: 'bm25', hit_count: 2, latency_ms: 6.0 },
.opencode/skills/system-spec-kit/mcp_server/tests/reporting-dashboard.vitest.ts:360:      expect(channels).toHaveProperty('vector');
.opencode/skills/system-spec-kit/mcp_server/tests/reporting-dashboard.vitest.ts:361:      expect(channels).toHaveProperty('bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/reporting-dashboard.vitest.ts:364:      expect(channels['vector'].queryCount).toBe(2);
.opencode/skills/system-spec-kit/mcp_server/tests/reporting-dashboard.vitest.ts:365:      expect(channels['vector'].hitCount).toBe(8);
.opencode/skills/system-spec-kit/mcp_server/tests/reporting-dashboard.vitest.ts:366:      expect(channels['vector'].avgLatencyMs).toBeCloseTo(13.75, 1);
.opencode/skills/system-spec-kit/mcp_server/tests/reporting-dashboard.vitest.ts:369:      expect(channels['bm25'].queryCount).toBe(2);
.opencode/skills/system-spec-kit/mcp_server/tests/reporting-dashboard.vitest.ts:370:      expect(channels['bm25'].hitCount).toBe(6);
.opencode/skills/system-spec-kit/mcp_server/tests/reporting-dashboard.vitest.ts:371:      expect(channels['bm25'].avgLatencyMs).toBeCloseTo(7.0, 1);
.opencode/skills/system-spec-kit/mcp_server/tests/reporting-dashboard.vitest.ts:386:        { eval_run_id: 2, query_id: 1, channel: 'vector', hit_count: 4, latency_ms: 100.0 },
.opencode/skills/system-spec-kit/mcp_server/tests/reporting-dashboard.vitest.ts:390:      const vector = report.sprints[0].channels['vector'];
.opencode/skills/system-spec-kit/mcp_server/tests/reporting-dashboard.vitest.ts:392:      expect(vector.queryCount).toBe(3);
.opencode/skills/system-spec-kit/mcp_server/tests/reporting-dashboard.vitest.ts:393:      expect(vector.hitCount).toBe(12);
.opencode/skills/system-spec-kit/mcp_server/tests/reporting-dashboard.vitest.ts:394:      expect(vector.avgLatencyMs).toBeCloseTo((12.5 + 15.0 + 100.0) / 3, 4);
.opencode/skills/system-spec-kit/mcp_server/tests/reporting-dashboard.vitest.ts:412:      expect(sprint.channelMetrics['ndcg@5']['vector'].latest).toBe(0.85);
.opencode/skills/system-spec-kit/mcp_server/tests/reporting-dashboard.vitest.ts:413:      expect(sprint.channelMetrics['ndcg@5']['bm25'].latest).toBe(0.75);
.opencode/skills/system-spec-kit/mcp_server/tests/reporting-dashboard.vitest.ts:602:          channel: 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/reporting-dashboard.vitest.ts:608:        { eval_run_id: 1, query_id: 1, channel: 'vector', hit_count: 5, latency_ms: 10.0 },
.opencode/skills/system-spec-kit/mcp_server/tests/reporting-dashboard.vitest.ts:616:      expect(text).toContain('ndcg@5 [vector]');
.opencode/skills/system-spec-kit/mcp_server/tests/reporting-dashboard.vitest.ts:617:      expect(text).toContain('vector');
.opencode/skills/system-spec-kit/mcp_server/tests/reporting-dashboard.vitest.ts:878:        { eval_run_id: 1, query_id: 1, channel: 'vector', hit_count: 5, latency_ms: 10.0 },
.opencode/skills/system-spec-kit/mcp_server/tests/reporting-dashboard.vitest.ts:879:        { eval_run_id: 1, query_id: 1, channel: 'bm25', hit_count: 3, latency_ms: 5.0 },
.opencode/skills/system-spec-kit/mcp_server/tests/reporting-dashboard.vitest.ts:880:        { eval_run_id: 1, query_id: 1, channel: 'fts', hit_count: 2, latency_ms: 3.0 },
.opencode/skills/system-spec-kit/mcp_server/tests/reporting-dashboard.vitest.ts:883:      const report = await generateDashboardReport({ channelFilter: ['vector', 'bm25'] });
.opencode/skills/system-spec-kit/mcp_server/tests/reporting-dashboard.vitest.ts:886:      expect(channelNames).toContain('vector');
.opencode/skills/system-spec-kit/mcp_server/tests/reporting-dashboard.vitest.ts:887:      expect(channelNames).toContain('bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/reporting-dashboard.vitest.ts:888:      expect(channelNames).not.toContain('fts');
.opencode/skills/system-spec-kit/mcp_server/lib/eval/shadow-scoring.ts:40:  /** Human-readable name for this shadow algorithm (e.g. "rrf-v2", "weighted-bm25"). */
.opencode/skills/system-spec-kit/mcp_server/tests/feature-eval-graph-signals.vitest.ts:8:// --- T001/T002: Degree computation & RRF channel ---
.opencode/skills/system-spec-kit/mcp_server/tests/feature-eval-graph-signals.vitest.ts:22:// --- T002: RRF fusion ---
.opencode/skills/system-spec-kit/mcp_server/tests/feature-eval-graph-signals.vitest.ts:258:// T002: RRF 5TH DEGREE CHANNEL
.opencode/skills/system-spec-kit/mcp_server/tests/feature-eval-graph-signals.vitest.ts:261:describe('T002: RRF 5th degree channel integration', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/feature-eval-graph-signals.vitest.ts:322:    expect(result.sources).toContain('vector');
.opencode/skills/system-spec-kit/mcp_server/tests/feature-eval-graph-signals.vitest.ts:337:    // Build the degree ranked list as hybrid-search would
.opencode/skills/system-spec-kit/mcp_server/tests/feature-eval-graph-signals.vitest.ts:349:    // Feed into RRF — rank order should be preserved
.opencode/skills/system-spec-kit/mcp_server/tests/feature-flag-reference-docs.vitest.ts:29:    env: 'SPECKIT_RRF',
.opencode/skills/system-spec-kit/mcp_server/tests/feature-flag-reference-docs.vitest.ts:50:    source: 'lib/search/vector-index-store.ts',
.opencode/skills/system-spec-kit/mcp_server/tests/feature-flag-reference-docs.vitest.ts:60:    source: 'lib/search/vector-index-store.ts',
.opencode/skills/system-spec-kit/mcp_server/lib/scoring/interference-scoring.ts:74: * This is a lightweight heuristic used when vector cosine similarity
.opencode/skills/system-spec-kit/mcp_server/tests/degree-computation.vitest.ts:4:// Tests for the R4 5th RRF channel: degree-based scoring
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index.ts:13:} from './vector-index-types.js';
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index.ts:20:} from './vector-index-types.js';
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index.ts:38:} from './vector-index-schema.js';
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index.ts:56:} from './vector-index-mutations.js';
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index.ts:63:  vector_search,
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index.ts:72:  vector_search_enriched,
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index.ts:88:  vectorSearch,
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index.ts:97:  vectorSearchEnriched,
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index.ts:108:} from './vector-index-queries.js';
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index.ts:126:} from './vector-index-aliases.js';
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index.ts:154:  is_vector_search_available,
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index.ts:161:} from './vector-index-store.js';
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index.ts:165:  isVectorSearchAvailable as is_vector_search_available_alias,
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index.ts:166:} from './vector-index-store.js';
.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:54: * the memory_fts FTS5 virtual table. The FTS5 index columns are:
.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:95: * FTS5 index (memory_fts). This is a safety check that should be run
.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:98: * The FTS5 virtual table memory_fts should only contain:
.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:111:    const ftsTable = db.prepare(
.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:112:      `SELECT sql FROM sqlite_master WHERE type='table' AND name='memory_fts'`
.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:115:    if (!ftsTable) {
.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:120:    const createSql = ftsTable.sql.toLowerCase();
.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:125:        'CRITICAL: learned_triggers found in FTS5 index (memory_fts). ' +
.opencode/skills/system-spec-kit/mcp_server/lib/ops/README.md:35:- **Job Queue** manages multi-file ingestion as stateful jobs with a true sequential worker, crash recovery and continue-on-error behavior.
.opencode/skills/system-spec-kit/mcp_server/lib/ops/README.md:46:| `job-queue.ts` | SQLite-backed ingestion job queue with a bounded lifecycle (`queued` > `parsing` > `embedding` > `indexing` > `complete`/`failed`/`cancelled`). Enforces valid state transitions, tracks per-file progress against the original submitted path list and caps stored errors at 50. Crash recovery resets incomplete jobs to `queued` on startup. |
.opencode/skills/system-spec-kit/mcp_server/lib/ops/README.md:63:- Crash recovery: On init, incomplete jobs are reset to `queued` and re-enqueued for processing.
.opencode/skills/system-spec-kit/mcp_server/tests/trigger-extractor.vitest.ts:3:// TF-IDF + N-gram hybrid trigger phrase extraction
.opencode/skills/system-spec-kit/mcp_server/tests/trigger-extractor.vitest.ts:182:      embedding vectors. The [trigger-extractor](./trigger-extractor.ts) module
.opencode/skills/system-spec-kit/mcp_server/tests/trigger-extractor.vitest.ts:194:      - Embedding provider chain for vector generation
.opencode/skills/system-spec-kit/mcp_server/lib/eval/ablation-framework.ts:12:// - Channel toggle mechanism (vector, bm25, fts5, graph, trigger)
.opencode/skills/system-spec-kit/mcp_server/lib/eval/ablation-framework.ts:52:export type AblationChannel = 'vector' | 'bm25' | 'fts5' | 'graph' | 'trigger';
.opencode/skills/system-spec-kit/mcp_server/lib/eval/ablation-framework.ts:56:  'vector',
.opencode/skills/system-spec-kit/mcp_server/lib/eval/ablation-framework.ts:57:  'bm25',
.opencode/skills/system-spec-kit/mcp_server/lib/eval/ablation-framework.ts:58:  'fts5',
.opencode/skills/system-spec-kit/mcp_server/lib/eval/ablation-framework.ts:746:    // With production run IDs (same pattern as bm25-baseline.ts).
.opencode/skills/system-spec-kit/mcp_server/lib/eval/ablation-framework.ts:995: * expected by the hybridSearch / hybridSearchEnhanced functions.
.opencode/skills/system-spec-kit/mcp_server/lib/eval/ablation-framework.ts:1004:    useVector: !disabledChannels.has('vector'),
.opencode/skills/system-spec-kit/mcp_server/lib/eval/ablation-framework.ts:1005:    useBm25: !disabledChannels.has('bm25'),
.opencode/skills/system-spec-kit/mcp_server/lib/eval/ablation-framework.ts:1006:    useFts: !disabledChannels.has('fts5'),
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:93:vi.mock('../lib/search/vector-index', () => ({
.opencode/skills/system-spec-kit/mcp_server/lib/search/folder-discovery.ts:541: * This is a lightweight pre-filter, NOT a replacement for vector search.
.opencode/skills/system-spec-kit/mcp_server/tests/handler-session-learning.vitest.ts:7:import * as vectorIndex from '../lib/search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/tests/handler-session-learning.vitest.ts:178:      // Mock vectorIndex.getDb to return our mock DB
.opencode/skills/system-spec-kit/mcp_server/tests/handler-session-learning.vitest.ts:179:      const spy = vi.spyOn(vectorIndex, 'getDb').mockReturnValue(mockDb as any);
.opencode/skills/system-spec-kit/mcp_server/lib/search/evidence-gap-detector.ts:6:// On RRF scores to detect low-confidence retrieval and inject
.opencode/skills/system-spec-kit/mcp_server/lib/search/evidence-gap-detector.ts:32: * Summarises Z-score statistics for the RRF score distribution.
.opencode/skills/system-spec-kit/mcp_server/lib/search/evidence-gap-detector.ts:39:  /** Arithmetic mean of all RRF scores. */
.opencode/skills/system-spec-kit/mcp_server/lib/search/evidence-gap-detector.ts:41:  /** Population standard deviation of all RRF scores. */
.opencode/skills/system-spec-kit/mcp_server/lib/search/evidence-gap-detector.ts:144: * Detect evidence gaps in an RRF score distribution.
.opencode/skills/system-spec-kit/mcp_server/tests/session-boost.vitest.ts:70:  it('T015: RRF + session boost pipeline keeps score order stable with equal boosts', () => {
.opencode/skills/system-spec-kit/mcp_server/lib/search/community-search.ts:6:// When primary search returns weak or zero results, this module
.opencode/skills/system-spec-kit/mcp_server/lib/search/community-search.ts:94: * score. Used as a fallback channel when primary search returns weak results.
.opencode/skills/system-spec-kit/mcp_server/lib/search/causal-boost.ts:81: * amplify the boost while weaker ones (contradicts) attenuate it.
.opencode/skills/system-spec-kit/mcp_server/tests/k-value-judged-sweep.vitest.ts:2:// Feature flag: SPECKIT_RRF_K_EXPERIMENTAL
.opencode/skills/system-spec-kit/mcp_server/tests/k-value-judged-sweep.vitest.ts:100:describe('REQ-D1-003 Feature Flag (SPECKIT_RRF_K_EXPERIMENTAL)', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/k-value-judged-sweep.vitest.ts:102:    delete process.env.SPECKIT_RRF_K_EXPERIMENTAL;
.opencode/skills/system-spec-kit/mcp_server/tests/k-value-judged-sweep.vitest.ts:107:    process.env.SPECKIT_RRF_K_EXPERIMENTAL = 'false';
.opencode/skills/system-spec-kit/mcp_server/tests/k-value-judged-sweep.vitest.ts:112:    process.env.SPECKIT_RRF_K_EXPERIMENTAL = 'true';
.opencode/skills/system-spec-kit/mcp_server/tests/k-value-judged-sweep.vitest.ts:114:    delete process.env.SPECKIT_RRF_K_EXPERIMENTAL;
.opencode/skills/system-spec-kit/mcp_server/tests/k-value-judged-sweep.vitest.ts:236:    // item-0 is rank 1 in vector results → NDCG should be perfect
.opencode/skills/system-spec-kit/mcp_server/tests/k-value-judged-sweep.vitest.ts:315:    setEnv({ SPECKIT_RRF_K_EXPERIMENTAL: 'false' });
.opencode/skills/system-spec-kit/mcp_server/tests/k-value-judged-sweep.vitest.ts:335:    delete process.env.SPECKIT_RRF_K_EXPERIMENTAL;
.opencode/skills/system-spec-kit/mcp_server/tests/k-value-judged-sweep.vitest.ts:348:    setEnv({ SPECKIT_RRF_K_EXPERIMENTAL: 'true' });
.opencode/skills/system-spec-kit/mcp_server/lib/search/graph-calibration.ts:40:  /** N2a cap for RRF fusion overflow prevention. */
.opencode/skills/system-spec-kit/mcp_server/lib/search/graph-calibration.ts:42:  /** N2b cap for RRF fusion overflow prevention. */
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-list-edge.vitest.ts:4:import * as vectorIndex from '../lib/search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-list-edge.vitest.ts:17:  vectorIndex.closeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-list-edge.vitest.ts:18:  vectorIndex.initializeDb(':memory:');
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-list-edge.vitest.ts:22:  vectorIndex.closeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-list-edge.vitest.ts:79:    vectorIndex.indexMemoryDeferred({
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-list-edge.vitest.ts:85:    vectorIndex.indexMemoryDeferred({
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-list-edge.vitest.ts:138:    vectorIndex.indexMemoryDeferred({
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-list-edge.vitest.ts:144:    vectorIndex.indexMemoryDeferred({
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-list-edge.vitest.ts:150:    vectorIndex.indexMemoryDeferred({
.opencode/skills/system-spec-kit/mcp_server/tests/chunk-thinning.vitest.ts:135:    const richContent = '## Architecture Decisions\n\n- Use SQLite for local storage\n- Implement vector search with cosine similarity\n- Cache embeddings with content hash keys\n\n```typescript\nconst db = new Database("speckit.db");\ndb.exec("CREATE TABLE memories (id INTEGER PRIMARY KEY)");\n```\n\nThis design balances performance with simplicity.';
.opencode/skills/system-spec-kit/mcp_server/tests/chunk-thinning.vitest.ts:351:    const vectorIndex = await import('../lib/search/vector-index');
.opencode/skills/system-spec-kit/mcp_server/tests/chunk-thinning.vitest.ts:357:    try { vectorIndex.closeDb(); } catch { /* ignore */ }
.opencode/skills/system-spec-kit/mcp_server/tests/chunk-thinning.vitest.ts:358:    vectorIndex.initializeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/chunk-thinning.vitest.ts:399:      const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/tests/chunk-thinning.vitest.ts:408:      vectorIndex.closeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/graph-roadmap-finalization.vitest.ts:200:        if (sql.includes("name='memory_fts'")) {
.opencode/skills/system-spec-kit/mcp_server/lib/search/search-flags.ts:19:export type SavePlannerMode = 'plan-only' | 'full-auto' | 'hybrid';
.opencode/skills/system-spec-kit/mcp_server/lib/search/search-flags.ts:125: * the legacy mutation-first behavior. `hybrid` is reserved for future mixed
.opencode/skills/system-spec-kit/mcp_server/lib/search/search-flags.ts:133:  if (raw === 'hybrid') {
.opencode/skills/system-spec-kit/mcp_server/lib/search/search-flags.ts:134:    return 'hybrid';
.opencode/skills/system-spec-kit/mcp_server/lib/search/search-flags.ts:307: * Temporal contiguity boost on raw Stage 1 vector results.
.opencode/skills/system-spec-kit/mcp_server/lib/search/search-flags.ts:569: * REQ-D1-003: Experimental per-intent RRF K selection.
.opencode/skills/system-spec-kit/mcp_server/lib/search/search-flags.ts:570: * Default: TRUE (graduated). Set SPECKIT_RRF_K_EXPERIMENTAL=false to disable.
.opencode/skills/system-spec-kit/mcp_server/lib/search/search-flags.ts:573:  return isFeatureEnabled('SPECKIT_RRF_K_EXPERIMENTAL');
.opencode/skills/system-spec-kit/mcp_server/lib/search/search-flags.ts:585: * REQ-D5-001: Empty/weak result recovery UX.
.opencode/skills/system-spec-kit/mcp_server/lib/search/search-flags.ts:637: * Phase B T016: Query concept expansion for hybrid search.
.opencode/skills/system-spec-kit/mcp_server/lib/search/search-flags.ts:646: * Phase B T017: Graph-expanded fallback on zero/weak results.
.opencode/skills/system-spec-kit/mcp_server/lib/search/search-flags.ts:647: * Queries causal_edges for neighbor titles when recovery triggers.
.opencode/skills/system-spec-kit/mcp_server/lib/search/search-flags.ts:699: * When primary search returns weak/no results, searches community summaries
.opencode/skills/system-spec-kit/mcp_server/lib/search/embedding-expansion.ts:20:import * as vectorIndex from './vector-index.js';
.opencode/skills/system-spec-kit/mcp_server/lib/search/embedding-expansion.ts:164: *   3. Embedding vector is invalid (zero-length or non-finite values).
.opencode/skills/system-spec-kit/mcp_server/lib/search/embedding-expansion.ts:168: *   a. Run a vector similarity search using the provided embedding.
.opencode/skills/system-spec-kit/mcp_server/lib/search/embedding-expansion.ts:215:    const similarMemories = vectorIndex.vectorSearch(embedding, {
.opencode/skills/system-spec-kit/mcp_server/tests/graph-signals.vitest.ts:18:import { delete_memory_from_database } from '../lib/search/vector-index-mutations';
.opencode/skills/system-spec-kit/mcp_server/tests/graph-signals.vitest.ts:838:      let ftsProbeCount = 0;
.opencode/skills/system-spec-kit/mcp_server/tests/graph-signals.vitest.ts:846:              if (sql.includes('sqlite_master') && sql.includes("name='memory_fts'")) {
.opencode/skills/system-spec-kit/mcp_server/tests/graph-signals.vitest.ts:847:                ftsProbeCount += 1;
.opencode/skills/system-spec-kit/mcp_server/tests/graph-signals.vitest.ts:848:                return { name: 'memory_fts' };
.opencode/skills/system-spec-kit/mcp_server/tests/graph-signals.vitest.ts:860:                  fts_score: 1.25,
.opencode/skills/system-spec-kit/mcp_server/tests/graph-signals.vitest.ts:882:      expect(ftsProbeCount).toBe(1);
.opencode/skills/system-spec-kit/mcp_server/tests/graph-signals.vitest.ts:884:      const ftsSql = preparedSql.find((sql) => sql.includes('WITH matched_memories'));
.opencode/skills/system-spec-kit/mcp_server/tests/graph-signals.vitest.ts:885:      expect(ftsSql).toBeDefined();
.opencode/skills/system-spec-kit/mcp_server/tests/graph-signals.vitest.ts:886:      expect(ftsSql).toContain('UNION ALL');
.opencode/skills/system-spec-kit/mcp_server/tests/graph-signals.vitest.ts:887:      expect(ftsSql).not.toContain('JOIN memory_fts ON (');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-mutations.ts:5:// Split from vector-index-store.ts — contains ALL mutation functions:
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-mutations.ts:19:import * as bm25Index from './bm25-index.js';
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-mutations.ts:22:} from './vector-index-aliases.js';
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-mutations.ts:28:} from './vector-index-types.js';
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-mutations.ts:36:} from './vector-index-store.js';
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-mutations.ts:40:} from './vector-index-types.js';
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-mutations.ts:223:    console.warn(`[vector-index] Embedding dimension mismatch: expected ${expected_dim}, got ${embedding.length}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-mutations.ts:510:      // H1 FIX: Set 'pending' until vector write is confirmed
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-mutations.ts:530:        console.warn(`[vector-index] Embedding dimension mismatch in update: expected ${expected_dim}, got ${embedding.length}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-mutations.ts:542:      // H1 FIX: Mark success only after vector write confirmed
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-mutations.ts:625:      if (bm25Index.isBm25Enabled()) {
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-mutations.ts:626:        bm25Index.getIndex().removeDocument(String(id));
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-mutations.ts:725:            console.warn(`[VectorIndex] Failed to delete vector for memory ${id}: ${get_error_message(vec_error)}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-mutations.ts:746:        console.warn(`[vector-index] Failed to delete memory ${id}: ${get_error_message(e)}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-mutations.ts:773:        if (bm25Index.isBm25Enabled()) {
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-mutations.ts:774:          const bm25 = bm25Index.getIndex();
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-mutations.ts:776:            bm25.removeDocument(String(id));
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-mutations.ts:784:    console.warn(`[vector-index] delete_memories transaction error: ${get_error_message(e)}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-mutations.ts:806:    console.warn(`[vector-index] Invalid embedding status: ${status}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-mutations.ts:819:    console.warn(`[vector-index] Failed to update embedding status for ${id}: ${get_error_message(error)}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-mutations.ts:836:    console.warn(`[vector-index] Invalid confidence value: ${confidence}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-mutations.ts:849:    console.warn(`[vector-index] Failed to update confidence for ${memory_id}: ${get_error_message(error)}`);
.opencode/skills/system-spec-kit/mcp_server/tests/api-public-surfaces.vitest.ts:10:    expect(searchApi.hybridSearchEnhanced).toBeTypeOf('function');
.opencode/skills/system-spec-kit/mcp_server/tests/api-public-surfaces.vitest.ts:11:    expect(searchApi.fts5Bm25Search).toBeTypeOf('function');
.opencode/skills/system-spec-kit/mcp_server/tests/api-public-surfaces.vitest.ts:13:    expect(searchApi.vectorIndex).toBeDefined();
.opencode/skills/system-spec-kit/mcp_server/tests/api-public-surfaces.vitest.ts:14:    expect(searchApi.vectorIndex.initializeDb).toBeTypeOf('function');
.opencode/skills/system-spec-kit/mcp_server/tests/api-public-surfaces.vitest.ts:15:    expect(searchApi.vectorIndex.closeDb).toBeTypeOf('function');
.opencode/skills/system-spec-kit/mcp_server/tests/api-public-surfaces.vitest.ts:19:    expect(publicApi.hybridSearchEnhanced).toBe(searchApi.hybridSearchEnhanced);
.opencode/skills/system-spec-kit/mcp_server/tests/api-public-surfaces.vitest.ts:21:    expect(publicApi.fts5Bm25Search).toBe(searchApi.fts5Bm25Search);
.opencode/skills/system-spec-kit/mcp_server/tests/api-public-surfaces.vitest.ts:22:    expect(publicApi.vectorIndex).toBe(searchApi.vectorIndex);
.opencode/skills/system-spec-kit/mcp_server/tests/anchor-prefix-matching.vitest.ts:276:        'recovery-hints',
.opencode/skills/system-spec-kit/mcp_server/tests/job-queue.vitest.ts:94:describe('ingest job queue crash recovery', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/trigger-config-extended.vitest.ts:17:   MODULE LOADING  (mock vector-index for trigger-matcher)
.opencode/skills/system-spec-kit/mcp_server/tests/trigger-config-extended.vitest.ts:107:vi.mock('../lib/search/vector-index.js', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:103:      makeFused('a1', 0.9, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:104:      makeFused('b1', 0.8, 'bm25'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:107:      ['vector', [makeChannel('a1', 0.9)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:108:      ['bm25',   [makeChannel('b1', 0.8)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:125:      makeFused('a1', 0.9, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:128:      ['vector', [makeChannel('a1', 0.9)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:145:      makeFused('a1', 0.95, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:146:      makeFused('b1', 0.90, 'bm25'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:147:      makeFused('a2', 0.85, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:149:      makeFused('a3', 0.75, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:152:      ['vector', [makeChannel('a1', 0.95), makeChannel('a2', 0.85), makeChannel('a3', 0.75)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:153:      ['bm25',   [makeChannel('b1', 0.90)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:171:      makeFused('a1', 0.9, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:174:      ['vector', [makeChannel('a1', 0.9)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:175:      ['bm25',   [makeChannel('b1', 0.65, { title: 'BM25 Doc' })]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:181:    expect(result.enforcement.underRepresentedChannels).toContain('bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:184:    expect(promoted?.source).toBe('bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:192:      makeFused('a1', 0.9, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:193:      makeFused('b1', 0.7, 'bm25'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:198:      ['vector', [makeChannel('a1', 0.9)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:199:      ['bm25',   [makeChannel('b1', 0.7)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:229:      makeFused('a1', 0.95, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:230:      makeFused('b1', 0.88, 'bm25'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:232:      makeFused('a2', 0.72, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:235:      ['vector', [makeChannel('a1', 0.95), makeChannel('a2', 0.72)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:236:      ['bm25',   [makeChannel('b1', 0.88)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:252:      makeFused('a1', 0.95, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:253:      makeFused('b1', 0.88, 'bm25'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:254:      makeFused('a2', 0.78, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:258:      ['vector', [makeChannel('a1', 0.95), makeChannel('a2', 0.78)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:259:      ['bm25',   [makeChannel('b1', 0.88)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:279:      makeFused('a1', 0.93, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:280:      makeFused('b1', 0.87, 'bm25'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:281:      makeFused('a2', 0.81, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:285:      ['vector', [makeChannel('a1', 0.93), makeChannel('a2', 0.81)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:286:      ['bm25',   [makeChannel('b1', 0.87)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:302:      makeFused('a1', 0.9, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:305:      ['vector', [makeChannel('a1', 0.9)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:306:      ['bm25',   [makeChannel('b1', 0.004)]],  // just below floor (0.005)
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:316:    expect(result.enforcement.underRepresentedChannels).toContain('bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:323:      makeFused('a1', 0.9, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:326:      ['vector', [makeChannel('a1', 0.9)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:327:      ['bm25',   [makeChannel('b1', 0.70), makeChannel('b2', 0.60), makeChannel('b3', 0.50)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:339:    const bm25Count = result.results.filter(r => r.source === 'bm25').length;
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:343:    expect(bm25Count).toBe(1);
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:347:    // Best from bm25 is b1 (0.70), best from graph is g1 (0.65).
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:348:    expect(result.results.find(r => r.source === 'bm25')?.id).toBe('b1');
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:357:      makeFused('a1', 0.92, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:358:      makeFused('b1', 0.85, 'bm25'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:359:      makeFused('a2', 0.79, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:362:      ['vector', [makeChannel('a1', 0.92), makeChannel('a2', 0.79)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:363:      ['bm25',   [makeChannel('b1', 0.85)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:382:      ['vector', [makeChannel('a1', 0.8)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:395:    const fused: FusedResult[] = [makeFused('a1', 0.8, 'vector')];
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:397:      ['vector', [makeChannel('a1', 0.8)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:398:      ['bm25',   [makeChannel('b1', 0.5)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:410:      makeFused('a1', 0.8, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:413:      ['vector', []],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:414:      ['bm25',   []],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:427:      makeFused('a1', 0.9, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:428:      makeFused('b1', 0.8, 'bm25'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:431:      ['vector', [makeChannel('a1', 0.9)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:432:      ['bm25',   [makeChannel('b1', 0.8)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:447:      makeFused('a1', 0.9, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:448:      makeFused('b1', 0.8, 'bm25'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:451:      ['vector', [makeChannel('a1', 0.9)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:452:      ['bm25',   [makeChannel('b1', 0.8)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:467:      makeFused('a1', 0.9, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:470:      ['vector', [makeChannel('a1', 0.9)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:471:      ['bm25',   [makeChannel('b1', 0.55, { title: 'Doc Title', content: 'Some content', rank: 2 })]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:486:      makeFused('a1', 0.9, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:487:      makeFused('a2', 0.85, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:488:      makeFused('b1', 0.80, 'bm25'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:491:      ['vector', [makeChannel('a1', 0.9), makeChannel('a2', 0.85)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:492:      ['bm25',   [makeChannel('b1', 0.80)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:498:    expect(result.enforcement.channelCounts['vector']).toBe(2);
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:499:    expect(result.enforcement.channelCounts['bm25']).toBe(1);
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:515:      makeFused('a1', 0.95, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:516:      makeFused('b1', 0.90, 'bm25'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:517:      makeFused('a2', 0.85, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:518:      makeFused('b2', 0.80, 'bm25'),
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:521:      ['vector', [makeChannel('a1', 0.95), makeChannel('a2', 0.85)]],
.opencode/skills/system-spec-kit/mcp_server/tests/channel-enforcement.vitest.ts:522:      ['bm25',   [makeChannel('b1', 0.90), makeChannel('b2', 0.80)]],
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-impl.ts:6:// - vector-index-types.ts
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-impl.ts:7:// - vector-index-schema.ts
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-impl.ts:8:// - vector-index-mutations.ts
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-impl.ts:9:// - vector-index-store.ts
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-impl.ts:10:// - vector-index-queries.ts
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-impl.ts:11:// - vector-index-aliases.ts
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-impl.ts:14:export * from './vector-index.js';
.opencode/skills/system-spec-kit/mcp_server/tests/regression-suite.vitest.ts:27:        '../lib/search/vector-index-schema.ts'
.opencode/skills/system-spec-kit/mcp_server/tests/regression-suite.vitest.ts:42:        '../lib/search/vector-index-schema.ts'
.opencode/skills/system-spec-kit/mcp_server/tests/regression-suite.vitest.ts:56:        '../lib/search/vector-index-schema.ts'
.opencode/skills/system-spec-kit/mcp_server/tests/regression-suite.vitest.ts:116:      const { sanitizeFTS5Query } = await import('../lib/search/bm25-index');
.opencode/skills/system-spec-kit/mcp_server/tests/regression-suite.vitest.ts:225:      // The vectorSearchFn call must use 2 * maxRelated, not maxRelated + 1
.opencode/skills/system-spec-kit/mcp_server/tests/regression-suite.vitest.ts:231:      const { BM25Index } = await import('../lib/search/bm25-index');
.opencode/skills/system-spec-kit/mcp_server/tests/regression-suite.vitest.ts:246:      const { BM25Index } = await import('../lib/search/bm25-index');
.opencode/skills/system-spec-kit/mcp_server/tests/regression-suite.vitest.ts:255:    it('DEFAULT_LIMIT is 20 in hybrid search', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/regression-suite.vitest.ts:259:      const hybridPath = path.resolve(
.opencode/skills/system-spec-kit/mcp_server/tests/regression-suite.vitest.ts:261:        '../lib/search/hybrid-search.ts'
.opencode/skills/system-spec-kit/mcp_server/tests/regression-suite.vitest.ts:263:      const source = fs.readFileSync(hybridPath, 'utf8');
.opencode/skills/system-spec-kit/mcp_server/tests/transaction-manager-recovery.vitest.ts:25:  // so the fixture matches the path the recovery code actually queries.
.opencode/skills/system-spec-kit/mcp_server/tests/transaction-manager-recovery.vitest.ts:32:  const dir = fs.mkdtempSync(path.join(os.tmpdir(), `txn-mgr-recovery-${label}-`));
.opencode/skills/system-spec-kit/mcp_server/tests/transaction-manager-recovery.vitest.ts:75:describe('transaction-manager recovery committed vs uncommitted (T007)', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/transaction-manager-recovery.vitest.ts:132:  it('T007-R4b: callback exceptions surface as recovery errors and leave the pending file in place', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/transaction-manager-recovery.vitest.ts:183:  it('T011-R3: without DB probe, recovery defaults to rename behavior', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/transaction-manager-recovery.vitest.ts:285:  it('T007-R9: skips recovery when DB file is missing even if callback reports committed', () => {
.opencode/skills/system-spec-kit/mcp_server/lib/governance/scope-governance.ts:8:import { ensureGovernanceTables } from '../search/vector-index-schema.js';
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-v2.vitest.ts:73:      row.channelAttribution = ['vector', 'fts5'];
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-v2.vitest.ts:75:      expect(row.channelAttribution).toEqual(['vector', 'fts5']);
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-v2.vitest.ts:312:        searchType: 'hybrid',
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-v2.vitest.ts:320:    expect(output.metadata.searchType).toBe('hybrid');
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:8:// TEST: VECTOR INDEX IMPLEMENTATION (vector-index-impl)
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:9:// Core vector search implementation — pure functions, DB ops,
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:12:type VectorIndexModule = typeof import('../lib/search/vector-index-impl');
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:15:type VectorSearchResult = ReturnType<VectorIndexModule['vectorSearch']>[number];
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:43:      mod = await import('../lib/search/vector-index-impl');
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:87:        'vectorSearch', 'getConstitutionalMemories',
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:91:        'vectorSearchEnriched', 'multiConceptSearchEnriched',
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:137:      // The implementation resolves dimensions from the active provider (vector-index-store.ts:121-129).
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:246:      const tags = mod.extractTags('---\ntags: [memory, search, "vector"]\n---\n\nContent');
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:249:      expect(tags).toContain('vector');
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:861:      vi.doMock('../lib/search/vector-index-store', async (importOriginal) => {
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:862:        const actual = await importOriginal<typeof import('../lib/search/vector-index-store')>();
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:869:      const mutations = await import('../lib/search/vector-index-mutations');
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1190:    let vectorMod!: VectorIndexModule;
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1191:    let vectorTmpDir: string | null = null;
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1197:        vectorMod = mod;
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1201:      vectorTmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'vec-idx-mock-'));
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1202:      const vectorDbPath = path.join(vectorTmpDir, 'test-context-index.sqlite');
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1206:      process.env.MEMORY_DB_PATH = vectorDbPath;
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1207:      process.env.MEMORY_ALLOWED_PATHS = vectorTmpDir;
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1210:      vi.doMock('../lib/search/vector-index-store', async (importOriginal) => {
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1211:        const actual = await importOriginal<typeof import('../lib/search/vector-index-store')>();
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1216:          is_vector_search_available: () => true,
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1220:      vectorMod = await import('../lib/search/vector-index-impl');
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1221:      const db = vectorMod.initializeDb(vectorDbPath);
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1236:      `).run(String(vectorMod.getEmbeddingDim()));
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1243:          vectorMod?.closeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1245:        vi.doUnmock('../lib/search/vector-index-store');
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1261:      if (vectorTmpDir && fs.existsSync(vectorTmpDir)) {
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1262:        fs.rmSync(vectorTmpDir, { recursive: true, force: true });
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1266:    it('indexMemory creates vector memory with embedding', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1267:      vecMemId = vectorMod.indexMemory({
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1271:        triggerPhrases: ['vector', 'search'],
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1276:      const mem = vectorMod.getMemory(vecMemId);
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1280:    it('indexMemory creates additional vector memories for search', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1281:      vectorMod.indexMemory({
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1289:      vectorMod.indexMemory({
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1301:      const idA = vectorMod.indexMemory({
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1310:      const idB = vectorMod.indexMemory({
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1319:      const db = vectorMod.getDb();
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1327:      vectorMod.updateMemory({
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1338:    it('vectorSearch returns results', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1340:      const searchResults = vectorMod.vectorSearch(query, { limit: 5 });
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1349:    it('vectorSearch filters by specFolder', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1351:      const filtered = vectorMod.vectorSearch(query, { limit: 10, specFolder: 'specs/test-vec' });
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1355:    it('vectorSearch respects minSimilarity', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1357:      const strict = vectorMod.vectorSearch(query, { limit: 10, minSimilarity: 99 });
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1365:        vectorMod.indexMemory({
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1376:        vectorMod.indexMemory({
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1388:      const mcResults = vectorMod.multiConceptSearch([emb1, emb2], { limit: 5 });
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1394:        vectorMod.multiConceptSearch([makeEmbedding(1)], { limit: 5 });
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1401:      const updatedId = vectorMod.updateMemory({
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1407:      const mem = vectorMod.getMemory(vecMemId!);
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1417:    it('vectorSearchEnriched — exported and falls back to keyword search without embedding', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1418:      expect(typeof mod.vectorSearchEnriched).toBe('function');
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1420:      const results = await mod.vectorSearchEnriched('test query', 5);
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1460:      const result = mod.learnFromSelection('vector search implementation testing', deferredId1!);
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1463:      // "vector", "search", "implementation" should be added (each >= 4 chars, not stop words)
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1464:      expect(mem?.trigger_phrases).toContain('vector');
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1485:      const result = mod.learnFromSelection('alpha vector search', deferredId1!);
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1486:      // "alpha", "vector", "search" already exist — no new terms
.opencode/skills/system-spec-kit/mcp_server/lib/search/sqlite-fts.ts:6:// Extracted from hybrid-search.ts ftsSearch() for independent
.opencode/skills/system-spec-kit/mcp_server/lib/search/sqlite-fts.ts:9:import { BM25_FTS5_WEIGHTS, normalizeLexicalQueryTokens } from './bm25-index.js';
.opencode/skills/system-spec-kit/mcp_server/lib/search/sqlite-fts.ts:18:  fts_score: number;
.opencode/skills/system-spec-kit/mcp_server/lib/search/sqlite-fts.ts:28:type LexicalPath = 'fts5' | 'like' | 'unavailable';
.opencode/skills/system-spec-kit/mcp_server/lib/search/sqlite-fts.ts:33:  | 'no_such_module_fts5'
.opencode/skills/system-spec-kit/mcp_server/lib/search/sqlite-fts.ts:34:  | 'bm25_runtime_failure';
.opencode/skills/system-spec-kit/mcp_server/lib/search/sqlite-fts.ts:84:  return toErrorMessage(error).toLowerCase().includes('no such module: fts5');
.opencode/skills/system-spec-kit/mcp_server/lib/search/sqlite-fts.ts:89:  return message.includes('bm25');
.opencode/skills/system-spec-kit/mcp_server/lib/search/sqlite-fts.ts:114:      `SELECT name FROM sqlite_master WHERE type='table' AND name='memory_fts'`
.opencode/skills/system-spec-kit/mcp_server/lib/search/sqlite-fts.ts:127:        fallbackState: 'no_such_module_fts5',
.opencode/skills/system-spec-kit/mcp_server/lib/search/sqlite-fts.ts:137:    lexicalPath: 'fts5',
.opencode/skills/system-spec-kit/mcp_server/lib/search/sqlite-fts.ts:147: * Execute a weighted BM25 FTS5 search against memory_fts.
.opencode/skills/system-spec-kit/mcp_server/lib/search/sqlite-fts.ts:149: * Uses SQLite FTS5's built-in bm25() ranking function with
.opencode/skills/system-spec-kit/mcp_server/lib/search/sqlite-fts.ts:159: * const rows = fts5Bm25Search(db, 'memory search', { limit: 10 });
.opencode/skills/system-spec-kit/mcp_server/lib/search/sqlite-fts.ts:162:function fts5Bm25Search(
.opencode/skills/system-spec-kit/mcp_server/lib/search/sqlite-fts.ts:171:  const tokens = normalizeLexicalQueryTokens(query).fts;
.opencode/skills/system-spec-kit/mcp_server/lib/search/sqlite-fts.ts:195:    SELECT m.*, -bm25(memory_fts, ${w0}, ${w1}, ${w2}, ${w3}) AS fts_score
.opencode/skills/system-spec-kit/mcp_server/lib/search/sqlite-fts.ts:196:    FROM memory_fts
.opencode/skills/system-spec-kit/mcp_server/lib/search/sqlite-fts.ts:197:    JOIN memory_index m ON m.id = memory_fts.rowid
.opencode/skills/system-spec-kit/mcp_server/lib/search/sqlite-fts.ts:198:    WHERE memory_fts MATCH ?
.opencode/skills/system-spec-kit/mcp_server/lib/search/sqlite-fts.ts:201:    ORDER BY fts_score DESC
.opencode/skills/system-spec-kit/mcp_server/lib/search/sqlite-fts.ts:208:    console.warn(`[sqlite-fts] FTS5 unavailable (${capability.fallbackState}); returning empty lexical lane results`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/sqlite-fts.ts:220:      fts_score: (row.fts_score as number) || 0,
.opencode/skills/system-spec-kit/mcp_server/lib/search/sqlite-fts.ts:223:      lexicalPath: 'fts5',
.opencode/skills/system-spec-kit/mcp_server/lib/search/sqlite-fts.ts:232:          fallbackState: 'no_such_module_fts5',
.opencode/skills/system-spec-kit/mcp_server/lib/search/sqlite-fts.ts:237:            fallbackState: 'bm25_runtime_failure',
.opencode/skills/system-spec-kit/mcp_server/lib/search/sqlite-fts.ts:239:        : msg.toLowerCase().includes('no such table: memory_fts')
.opencode/skills/system-spec-kit/mcp_server/lib/search/sqlite-fts.ts:246:              fallbackState: 'bm25_runtime_failure',
.opencode/skills/system-spec-kit/mcp_server/lib/search/sqlite-fts.ts:249:    console.warn(`[sqlite-fts] BM25 FTS5 search failed: ${msg}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/sqlite-fts.ts:255: * Check if the memory_fts FTS5 virtual table exists in the database.
.opencode/skills/system-spec-kit/mcp_server/lib/search/sqlite-fts.ts:257: * Used as a feature-detect before calling fts5Bm25Search, since FTS5
.opencode/skills/system-spec-kit/mcp_server/lib/search/sqlite-fts.ts:261: * @returns true if memory_fts exists and is queryable
.opencode/skills/system-spec-kit/mcp_server/lib/search/sqlite-fts.ts:265: *   fts5Bm25Search(db, 'memory');
.opencode/skills/system-spec-kit/mcp_server/lib/search/sqlite-fts.ts:279:  fts5Bm25Search,
.opencode/skills/system-spec-kit/mcp_server/code_graph/lib/runtime-detection.ts:164:/** Get the recommended context recovery approach for the current runtime */
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-ux-hooks.vitest.ts:30:      stage1: { searchType: 'hybrid', channelCount: 2, candidateCount: 7, constitutionalInjected: 0, durationMs: 1 },
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-ux-hooks.vitest.ts:248:        stage1: { searchType: 'hybrid', channelCount: 2, candidateCount: 4, constitutionalInjected: 0, durationMs: 1 },
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:78:    // Disable score normalization for predictable RRF scores
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:107:      const result = routeQuery('find all implementation details about the hybrid search pipeline including scoring normalization and channel representation enforcement mechanisms');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:115:      expect(padded).toContain('vector');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:116:      expect(padded).toContain('fts');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:120:      const padded = enforceMinimumChannels(['bm25'] as ChannelName[]);
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:122:      expect(padded).toContain('bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:127:      expect(DEFAULT_ROUTING_CONFIG.simple).toContain('vector');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:128:      expect(DEFAULT_ROUTING_CONFIG.simple).toContain('fts');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:139:      // Simulate simple tier: only vector and fts channels
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:140:      const channels: ChannelName[] = ['vector', 'fts'];
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:142:      // Top-K results only from vector (fts missing)
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:144:        makeFused(1, 0.9, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:145:        makeFused(2, 0.85, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:146:        makeFused(3, 0.80, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:149:      // Channel raw results (fts has results but none in top-k)
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:151:      channelResults.set('vector', [
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:156:      channelResults.set('fts', [
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:163:      // R2 should detect fts is under-represented and promote from it
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:164:      expect(result.underRepresentedChannels).toContain('fts');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:166:      expect(result.promoted[0].promotedFrom).toBe('fts');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:167:      // Enhanced top-k should now include an fts result
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:168:      const ftsInTopK = result.topK.filter(r => r.source === 'fts');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:169:      expect(ftsInTopK.length).toBeGreaterThanOrEqual(1);
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:175:      // Moderate tier: vector, fts, bm25
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:177:        makeFused(1, 0.9, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:178:        makeFused(2, 0.85, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:179:        makeFused(3, 0.80, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:183:      channelResults.set('vector', [
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:188:      channelResults.set('fts', [
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:191:      channelResults.set('bm25', [
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:197:      expect(result.underRepresentedChannels).toContain('fts');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:198:      expect(result.underRepresentedChannels).toContain('bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:201:      // Both fts and bm25 should now appear in top-k
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:203:      expect(sources.has('fts')).toBe(true);
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:204:      expect(sources.has('bm25')).toBe(true);
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:212:        makeFused(1, 0.95, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:213:        makeFused(2, 0.90, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:214:        makeFused(3, 0.85, 'fts'),
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:218:      channelResults.set('vector', [
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:221:      channelResults.set('fts', [makeChannelResult(3, 0.85)]);
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:222:      channelResults.set('bm25', [makeChannelResult(10, 0.60)]);
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:229:      expect(result.underRepresentedChannels).toContain('bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:248:        makeFused(1, 0.9, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:249:        makeFused(2, 0.85, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:252:      channelResults.set('vector', [makeChannelResult(1, 0.9)]);
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:253:      channelResults.set('fts', [makeChannelResult(10, 0.7)]);
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:266:        makeFused(1, 0.9, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:267:        makeFused(2, 0.85, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:270:      channelResults.set('vector', [makeChannelResult(1, 0.9), makeChannelResult(2, 0.85)]);
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:271:      channelResults.set('fts', [makeChannelResult(10, 0.7)]);
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:288:        makeFused(1, 0.9, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:289:        makeFused(2, 0.85, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:293:      channelResults.set('vector', [makeChannelResult(1, 0.9), makeChannelResult(2, 0.85)]);
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:295:      channelResults.set('fts', [
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:303:      expect(result.underRepresentedChannels).toContain('fts');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:305:      const promotedFts = result.promoted.filter(p => p.promotedFrom === 'fts');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:313:        makeFused(1, 0.9, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:317:      channelResults.set('vector', [makeChannelResult(1, 0.9)]);
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:318:      channelResults.set('fts', []); // Empty — should not be penalized
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:323:      expect(result.underRepresentedChannels).not.toContain('fts');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:339:      expect(route.channels).toContain('vector');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:340:      expect(route.channels).toContain('fts');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:345:        makeFused(1, 0.9, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:346:        makeFused(2, 0.85, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:347:        makeFused(3, 0.80, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:352:      channelResults.set('vector', [
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:357:      channelResults.set('fts', [
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:370:      expect(sources.has('vector')).toBe(true);
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:371:      expect(sources.has('fts')).toBe(true);
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:379:      const route = routeQuery('find all implementation details about the hybrid search pipeline including scoring normalization and channel representation enforcement mechanisms');
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:385:        makeFused(1, 0.95, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:386:        makeFused(2, 0.90, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:387:        makeFused(3, 0.85, 'fts'),
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:392:      channelResults.set('vector', [makeChannelResult(1, 0.95), makeChannelResult(2, 0.90)]);
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:393:      channelResults.set('fts', [makeChannelResult(3, 0.85)]);
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:394:      channelResults.set('bm25', [makeChannelResult(10, 0.60)]);
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:402:      expect(enforcement.enforcement.promotedCount).toBe(3); // bm25, graph, degree
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:417:      // Fused results only from vector
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:419:        makeFused(1, 0.9, 'vector'),
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:423:      channelResults.set('vector', [makeChannelResult(1, 0.9)]);
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:424:      channelResults.set('fts', [makeChannelResult(10, 0.7)]);
.opencode/skills/system-spec-kit/mcp_server/tests/query-router-channel-interaction.vitest.ts:425:      channelResults.set('bm25', [makeChannelResult(20, 0.5)]);
.opencode/skills/system-spec-kit/mcp_server/lib/search/intent-classifier.ts:356: * @returns Normalized Float32Array embedding vector
.opencode/skills/system-spec-kit/mcp_server/lib/search/intent-classifier.ts:369: * Build one centroid vector per intent from seed phrases and keywords.
.opencode/skills/system-spec-kit/mcp_server/lib/search/intent-classifier.ts:371: * @returns Map of intent types to their centroid embedding vectors
.opencode/skills/system-spec-kit/mcp_server/lib/search/intent-classifier.ts:406: * L2-normalize a vector in place.
.opencode/skills/system-spec-kit/mcp_server/lib/search/intent-classifier.ts:408: * @param vec - Float32Array vector to normalize
.opencode/skills/system-spec-kit/mcp_server/lib/search/intent-classifier.ts:409: * @returns The same vector, normalized to unit length
.opencode/skills/system-spec-kit/mcp_server/lib/search/intent-classifier.ts:425: * Dot product similarity for normalized vectors.
.opencode/skills/system-spec-kit/mcp_server/lib/search/intent-classifier.ts:427: * @param a - First vector
.opencode/skills/system-spec-kit/mcp_server/lib/search/intent-classifier.ts:428: * @param b - Second vector
.opencode/skills/system-spec-kit/mcp_server/lib/search/intent-classifier.ts:429: * @returns Dot product (cosine similarity for unit vectors)
.opencode/skills/system-spec-kit/mcp_server/lib/search/intent-classifier.ts:556:  // This prevents weak single-keyword matches from dominating classification.
.opencode/skills/system-spec-kit/mcp_server/lib/search/channel-enforcement.ts:7:// Use inside the hybrid-search pipeline after RRF/RSF fusion.
.opencode/skills/system-spec-kit/mcp_server/tests/transaction-manager.vitest.ts:333:    setup('T196-startup-recovery');
.opencode/skills/system-spec-kit/mcp_server/tests/transaction-manager.vitest.ts:412:  it('T199: pending file recovery renames correctly', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-architecture-remediation.vitest.ts:9:import { IVectorStore } from '../lib/interfaces/vector-store';
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-architecture-remediation.vitest.ts:10:import { SQLiteVectorStore } from '../lib/search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/tests/cross-runtime-fallback.vitest.ts:69:  describe('each runtime gets correct recovery approach', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/cross-runtime-fallback.vitest.ts:104:  describe('hook-based recovery for configured runtimes', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/cross-runtime-fallback.vitest.ts:109:    it('codex-cli uses the recovery approach implied by dynamic hook policy', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/cross-runtime-fallback.vitest.ts:130:    it('claude-code with hooks enabled: hookPolicy is enabled, areHooksAvailable true, recovery is hooks', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/cross-runtime-fallback.vitest.ts:139:    it('no runtime env set: areHooksAvailable false, recovery is tool_fallback', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/cross-runtime-fallback.vitest.ts:146:    it('codex-cli: runtime is codex-cli, hookPolicy is dynamic, recovery follows policy', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/cross-runtime-fallback.vitest.ts:157:    it('copilot-cli: runtime is copilot-cli, hookPolicy is enabled, recovery is hooks when repo hook config exists', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/cross-runtime-fallback.vitest.ts:167:    it('gemini-cli: runtime is gemini-cli, canonical names stay BeforeAgent/SessionStart/PreCompress/SessionEnd, but fixture recovery is tool_fallback without repo-root settings.json', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/cross-runtime-fallback.vitest.ts:182:    it('unknown runtime: runtime is unknown, hookPolicy is unknown, recovery is tool_fallback', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/cross-runtime-fallback.vitest.ts:191:    it('runtime detection failure: detectRuntime does not throw, returns valid RuntimeInfo, recovery is tool_fallback', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/graph-scoring-integration.vitest.ts:29:} from '../lib/search/hybrid-search';
.opencode/skills/system-spec-kit/mcp_server/tests/graph-scoring-integration.vitest.ts:31:// A. RRF Score Normalization (S2 — Score Normalization)
.opencode/skills/system-spec-kit/mcp_server/tests/graph-scoring-integration.vitest.ts:32:describe('A. RRF Score Normalization', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/graph-scoring-integration.vitest.ts:41:      { source: 'vector', results: [{ id: 1 }, { id: 2 }, { id: 3 }] },
.opencode/skills/system-spec-kit/mcp_server/tests/graph-scoring-integration.vitest.ts:42:      { source: 'fts',    results: [{ id: 2 }, { id: 1 }] },
.opencode/skills/system-spec-kit/mcp_server/tests/graph-scoring-integration.vitest.ts:58:      { source: 'vector', results: [{ id: 1 }, { id: 2 }] },
.opencode/skills/system-spec-kit/mcp_server/tests/graph-scoring-integration.vitest.ts:59:      { source: 'fts',    results: [{ id: 2 }] },
.opencode/skills/system-spec-kit/mcp_server/tests/graph-scoring-integration.vitest.ts:64:    // Raw RRF scores with k=60 are well below 1.0 (typically 0.01–0.05 range)
.opencode/skills/system-spec-kit/mcp_server/tests/graph-scoring-integration.vitest.ts:81:      [{ source: 'vector', results: [{ id: 1 }, { id: 2 }] }],
.opencode/skills/system-spec-kit/mcp_server/tests/graph-scoring-integration.vitest.ts:82:      [{ source: 'fts',    results: [{ id: 2 }, { id: 3 }] }],
.opencode/skills/system-spec-kit/mcp_server/tests/graph-scoring-integration.vitest.ts:101:      { source: 'vector', results: [{ id: 1 }, { id: 2 }, { id: 3 }] },
.opencode/skills/system-spec-kit/mcp_server/tests/graph-scoring-integration.vitest.ts:102:      { source: 'fts',    results: [{ id: 1 }, { id: 2 }] },
.opencode/skills/system-spec-kit/mcp_server/tests/graph-scoring-integration.vitest.ts:103:      { source: 'bm25',   results: [{ id: 1 }] },
.opencode/skills/system-spec-kit/mcp_server/tests/graph-scoring-integration.vitest.ts:220:      source: 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/graph-scoring-integration.vitest.ts:243:      { id: 1, score: 0.9, source: 'vector', title: 'Short result A' },
.opencode/skills/system-spec-kit/mcp_server/tests/graph-scoring-integration.vitest.ts:244:      { id: 2, score: 0.8, source: 'fts',    title: 'Short result B' },
.opencode/skills/system-spec-kit/mcp_server/tests/graph-scoring-integration.vitest.ts:260:  it('E1: SPECKIT_DEGREE_BOOST alone does not affect RRF score normalization', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/graph-scoring-integration.vitest.ts:265:      { source: 'vector', results: [{ id: 1 }, { id: 2 }, { id: 3 }] },
.opencode/skills/system-spec-kit/mcp_server/tests/graph-scoring-integration.vitest.ts:269:    // Without normalization, scores should still be in raw RRF range (< 1.0 for 3+ results)
.opencode/skills/system-spec-kit/mcp_server/tests/graph-scoring-integration.vitest.ts:300:    // RRF scores unchanged
.opencode/skills/system-spec-kit/mcp_server/tests/graph-scoring-integration.vitest.ts:302:      { source: 'vector', results: [{ id: 1 }, { id: 2 }] },
.opencode/skills/system-spec-kit/mcp_server/tests/graph-scoring-integration.vitest.ts:326:      { id: 1, rrfScore: 0.02, sources: ['vector'], sourceScores: {}, convergenceBonus: 0 },
.opencode/skills/system-spec-kit/mcp_server/tests/graph-scoring-integration.vitest.ts:327:      { id: 2, rrfScore: 0.04, sources: ['fts'],    sourceScores: {}, convergenceBonus: 0 },
.opencode/skills/system-spec-kit/mcp_server/tests/graph-scoring-integration.vitest.ts:328:      { id: 3, rrfScore: 0.03, sources: ['bm25'],   sourceScores: {}, convergenceBonus: 0 },
.opencode/skills/system-spec-kit/mcp_server/tests/graph-scoring-integration.vitest.ts:342:      source: 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/graph-scoring-integration.vitest.ts:352:      { id: 1, score: 0.9, source: 'vector', title: 'Exact fit A' },
.opencode/skills/system-spec-kit/mcp_server/tests/graph-scoring-integration.vitest.ts:353:      { id: 2, score: 0.8, source: 'fts', title: 'Exact fit B' },
.opencode/skills/system-spec-kit/mcp_server/lib/search/graph-search-fn.ts:7:import { sanitizeFTS5Query } from './bm25-index.js';
.opencode/skills/system-spec-kit/mcp_server/lib/search/graph-search-fn.ts:35:/** Edge type weights for typed-degree computation (R4 5th RRF channel) */
.opencode/skills/system-spec-kit/mcp_server/lib/search/graph-search-fn.ts:61:let ftsTableAvailabilityPerDb = new WeakMap<Database.Database, boolean>();
.opencode/skills/system-spec-kit/mcp_server/lib/search/graph-search-fn.ts:70:  const cached = ftsTableAvailabilityPerDb.get(database);
.opencode/skills/system-spec-kit/mcp_server/lib/search/graph-search-fn.ts:77:      `SELECT name FROM sqlite_master WHERE type='table' AND name='memory_fts'`
.opencode/skills/system-spec-kit/mcp_server/lib/search/graph-search-fn.ts:80:    ftsTableAvailabilityPerDb.set(database, available);
.opencode/skills/system-spec-kit/mcp_server/lib/search/graph-search-fn.ts:83:    ftsTableAvailabilityPerDb.set(database, false);
.opencode/skills/system-spec-kit/mcp_server/lib/search/graph-search-fn.ts:91: * Uses FTS5 full-text search (memory_fts table) instead of naive LIKE matching.
.opencode/skills/system-spec-kit/mcp_server/lib/search/graph-search-fn.ts:150: * FTS5-backed causal edge query. Finds memory IDs via the memory_fts
.opencode/skills/system-spec-kit/mcp_server/lib/search/graph-search-fn.ts:165:  // 1) Materialize matched memory rowids once (no OR join against memory_fts)
.opencode/skills/system-spec-kit/mcp_server/lib/search/graph-search-fn.ts:167:  // 3) Collapse duplicate edge hits in SQL (MAX fts_score per edge)
.opencode/skills/system-spec-kit/mcp_server/lib/search/graph-search-fn.ts:172:        -bm25(memory_fts, 10.0, 5.0, 2.0, 1.0) AS fts_score
.opencode/skills/system-spec-kit/mcp_server/lib/search/graph-search-fn.ts:173:      FROM memory_fts
.opencode/skills/system-spec-kit/mcp_server/lib/search/graph-search-fn.ts:174:      WHERE memory_fts MATCH ?
.opencode/skills/system-spec-kit/mcp_server/lib/search/graph-search-fn.ts:175:      ORDER BY fts_score DESC
.opencode/skills/system-spec-kit/mcp_server/lib/search/graph-search-fn.ts:179:      SELECT ce.id, ce.source_id, ce.target_id, ce.relation, ce.strength, mm.fts_score
.opencode/skills/system-spec-kit/mcp_server/lib/search/graph-search-fn.ts:183:      SELECT ce.id, ce.source_id, ce.target_id, ce.relation, ce.strength, mm.fts_score
.opencode/skills/system-spec-kit/mcp_server/lib/search/graph-search-fn.ts:194:        MAX(fts_score) AS fts_score
.opencode/skills/system-spec-kit/mcp_server/lib/search/graph-search-fn.ts:198:    SELECT id, source_id, target_id, relation, strength, fts_score
.opencode/skills/system-spec-kit/mcp_server/lib/search/graph-search-fn.ts:200:    ORDER BY (strength * fts_score) DESC
.opencode/skills/system-spec-kit/mcp_server/lib/search/graph-search-fn.ts:206:  ) as Array<CausalEdgeRow & { fts_score: number }>;
.opencode/skills/system-spec-kit/mcp_server/lib/search/graph-search-fn.ts:209:  // Numeric IDs matching memory_index.id (INTEGER column) in the hybrid search
.opencode/skills/system-spec-kit/mcp_server/lib/search/graph-search-fn.ts:216:    const ftsScore = typeof row.fts_score === 'number' && Number.isFinite(row.fts_score)
.opencode/skills/system-spec-kit/mcp_server/lib/search/graph-search-fn.ts:217:      ? row.fts_score
.opencode/skills/system-spec-kit/mcp_server/lib/search/graph-search-fn.ts:219:    const score = edgeStrength * ftsScore;
.opencode/skills/system-spec-kit/mcp_server/lib/search/graph-search-fn.ts:228:        ftsScore,
.opencode/skills/system-spec-kit/mcp_server/lib/search/graph-search-fn.ts:243:        ftsScore,
.opencode/skills/system-spec-kit/mcp_server/lib/search/graph-search-fn.ts:634:  ftsTableAvailabilityPerDb = new WeakMap<Database.Database, boolean>();
.opencode/skills/system-spec-kit/mcp_server/lib/search/graph-search-fn.ts:640:  ftsTableAvailabilityPerDb.delete(database);
.opencode/skills/system-spec-kit/mcp_server/lib/search/graph-search-fn.ts:691:  // Typed-degree computation (R4 5th RRF channel)
.opencode/skills/system-spec-kit/mcp_server/lib/search/memory-summaries.ts:26: * Compute cosine similarity between two vectors.
.opencode/skills/system-spec-kit/mcp_server/lib/search/memory-summaries.ts:95: * @param embeddingFn - Async function to compute embedding vector
.opencode/skills/system-spec-kit/mcp_server/lib/search/memory-summaries.ts:157: * @param queryEmbedding - Query vector to compare against stored summaries
.opencode/skills/system-spec-kit/mcp_server/lib/search/progressive-disclosure.ts:197: * Format: "3 strong, 2 weak, 1 conflict" style.
.opencode/skills/system-spec-kit/mcp_server/lib/search/progressive-disclosure.ts:211:  if (classification.low > 0) parts.push(`${classification.low} weak`);
.opencode/skills/system-spec-kit/mcp_server/tests/README.md:29:The suite now verifies the Gate E continuity contract as well: `/spec_kit:resume` is the recovery surface, packet context rebuilds from `handover.md` -> `_memory.continuity` -> spec docs, and generated memory artifacts remain supporting only.
.opencode/skills/system-spec-kit/mcp_server/tests/README.md:85:| Search and ranking | `hybrid-search.vitest.ts`, `bm25-index.vitest.ts`, `query-router.vitest.ts`, `dynamic-token-budget.vitest.ts`, `result-confidence-scoring.vitest.ts` | Retrieval, ranking, and profile/trace behavior |
.opencode/skills/system-spec-kit/mcp_server/tests/README.md:88:| Eval and reporting | `ablation-framework.vitest.ts`, `bm25-baseline.vitest.ts`, `reporting-dashboard.vitest.ts`, `eval-logger.vitest.ts`, `memory-state-baseline.vitest.ts` | Baselines, ablations, dashboard, and telemetry |
.opencode/skills/system-spec-kit/mcp_server/tests/README.md:91:| Infrastructure and utilities | `batch-processor.vitest.ts`, `tool-input-schema.vitest.ts`, `transaction-manager.vitest.ts`, `retry-manager-health.vitest.ts`, `vector-index-store-remediation.vitest.ts` | Shared helpers and runtime hardening |
.opencode/skills/system-spec-kit/mcp_server/tests/learned-feedback.vitest.ts:103:    CREATE VIRTUAL TABLE IF NOT EXISTS memory_fts USING fts5(
.opencode/skills/system-spec-kit/mcp_server/tests/learned-feedback.vitest.ts:238:    badDb.exec('DROP TABLE IF EXISTS memory_fts');
.opencode/skills/system-spec-kit/mcp_server/tests/learned-feedback.vitest.ts:240:      CREATE VIRTUAL TABLE memory_fts USING fts5(
.opencode/skills/system-spec-kit/mcp_server/tests/learned-feedback.vitest.ts:894:  it('R11-NF05: time-based recovery (30-day half-life)', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/learned-feedback.vitest.ts:934:  it('R11-NF10: no lastNegativeAt -> no recovery decay applied', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/learned-feedback.vitest.ts:939:    // Both should show the same raw penalty (no recovery)
.opencode/skills/system-spec-kit/mcp_server/tests/learned-feedback.vitest.ts:989:    recordSelection('q-fts', 1, ['authentication'], 5, testDb);
.opencode/skills/system-spec-kit/mcp_server/tests/feedback-ledger.vitest.ts:34:    confidence: 'weak',
.opencode/skills/system-spec-kit/mcp_server/tests/feedback-ledger.vitest.ts:119:    expect(FEEDBACK_SCHEMA_SQL).toContain('weak');
.opencode/skills/system-spec-kit/mcp_server/tests/feedback-ledger.vitest.ts:126:    expect(resolveConfidence('result_cited', 'weak')).toBe('weak');
.opencode/skills/system-spec-kit/mcp_server/tests/feedback-ledger.vitest.ts:133:    expect(resolveConfidence('same_topic_requery')).toBe('weak');
.opencode/skills/system-spec-kit/mcp_server/tests/feedback-ledger.vitest.ts:134:    expect(resolveConfidence('search_shown')).toBe('weak');
.opencode/skills/system-spec-kit/mcp_server/tests/feedback-ledger.vitest.ts:159:  it('passive signals are weak', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/feedback-ledger.vitest.ts:160:    expect(EVENT_TYPE_CONFIDENCE['search_shown']).toBe('weak');
.opencode/skills/system-spec-kit/mcp_server/tests/feedback-ledger.vitest.ts:161:    expect(EVENT_TYPE_CONFIDENCE['same_topic_requery']).toBe('weak');
.opencode/skills/system-spec-kit/mcp_server/tests/feedback-ledger.vitest.ts:200:    logFeedbackEvent(db, makeEvent({ confidence: 'weak' }));
.opencode/skills/system-spec-kit/mcp_server/tests/feedback-ledger.vitest.ts:205:    expect(tiers).toContain('weak');
.opencode/skills/system-spec-kit/mcp_server/tests/feedback-ledger.vitest.ts:320:    logFeedbackEvent(db, makeEvent({ confidence: 'weak' }));
.opencode/skills/system-spec-kit/mcp_server/tests/feedback-ledger.vitest.ts:391:    expect(summary.weak).toBe(0);
.opencode/skills/system-spec-kit/mcp_server/tests/feedback-ledger.vitest.ts:399:    logFeedbackEvent(db, makeEvent({ memoryId: 'mem-1', confidence: 'weak' }));
.opencode/skills/system-spec-kit/mcp_server/tests/feedback-ledger.vitest.ts:405:    expect(summary.weak).toBe(1);
.opencode/skills/system-spec-kit/mcp_server/tests/feedback-ledger.vitest.ts:412:    logFeedbackEvent(db, makeEvent({ memoryId: 'mem-B', confidence: 'weak' }));
.opencode/skills/system-spec-kit/mcp_server/tests/feedback-ledger.vitest.ts:419:    expect(summaryB.weak).toBe(1);
.opencode/skills/system-spec-kit/mcp_server/tests/quality-gate-exception.vitest.ts:3:vi.mock('../lib/search/vector-index', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/quality-gate-exception.vitest.ts:33:      specFolder: '022-hybrid-rag-fusion',
.opencode/skills/system-spec-kit/mcp_server/tests/quality-gate-exception.vitest.ts:40:      specFolder: '022-hybrid-rag-fusion',
.opencode/skills/system-spec-kit/mcp_server/tests/quality-gate-exception.vitest.ts:45:      specFolder: '022-hybrid-rag-fusion',
.opencode/skills/system-spec-kit/mcp_server/tests/quality-gate-exception.vitest.ts:79:      specFolder: '022-hybrid-rag-fusion',
.opencode/skills/system-spec-kit/mcp_server/tests/quality-gate-exception.vitest.ts:87:      specFolder: '022-hybrid-rag-fusion',
.opencode/skills/system-spec-kit/mcp_server/tests/quality-gate-exception.vitest.ts:100:      specFolder: '022-hybrid-rag-fusion',
.opencode/skills/system-spec-kit/mcp_server/tests/quality-gate-exception.vitest.ts:108:      specFolder: '022-hybrid-rag-fusion',
.opencode/skills/system-spec-kit/mcp_server/tests/quality-gate-exception.vitest.ts:140:      specFolder: '022-hybrid-rag-fusion',
.opencode/skills/system-spec-kit/mcp_server/tests/quality-gate-exception.vitest.ts:158:      specFolder: '022-hybrid-rag-fusion',
.opencode/skills/system-spec-kit/mcp_server/tests/quality-gate-exception.vitest.ts:169:      specFolder: '022-hybrid-rag-fusion',
.opencode/skills/system-spec-kit/mcp_server/tests/query-intent-classifier.vitest.ts:49:  describe('hybrid queries', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/query-intent-classifier.vitest.ts:50:    it('returns hybrid for empty string', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/query-intent-classifier.vitest.ts:52:      expect(result.intent).toBe('hybrid');
.opencode/skills/system-spec-kit/mcp_server/tests/query-intent-classifier.vitest.ts:56:    it('returns hybrid for ambiguous queries', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/query-intent-classifier.vitest.ts:58:      expect(result.intent).toBe('hybrid');
.opencode/skills/system-spec-kit/mcp_server/tests/query-intent-classifier.vitest.ts:65:      expect(['structural', 'semantic', 'hybrid']).toContain(result.intent);
.opencode/skills/system-spec-kit/mcp_server/tests/query-intent-classifier.vitest.ts:84:      expect(result.intent).toBe('hybrid');
.opencode/skills/system-spec-kit/mcp_server/tests/trace-propagation.vitest.ts:5:import * as hybridSearch from '../lib/search/hybrid-search';
.opencode/skills/system-spec-kit/mcp_server/tests/trace-propagation.vitest.ts:6:import * as bm25Index from '../lib/search/bm25-index';
.opencode/skills/system-spec-kit/mcp_server/tests/trace-propagation.vitest.ts:9:type InitDb = Parameters<typeof hybridSearch.init>[0];
.opencode/skills/system-spec-kit/mcp_server/tests/trace-propagation.vitest.ts:10:type VectorSearchFn = NonNullable<Parameters<typeof hybridSearch.init>[1]>;
.opencode/skills/system-spec-kit/mcp_server/tests/trace-propagation.vitest.ts:29:    content: 'Database refactor notes covering connection retry logic and transactional recovery behavior.',
.opencode/skills/system-spec-kit/mcp_server/tests/trace-propagation.vitest.ts:44:          if (sql.includes('memory_fts')) {
.opencode/skills/system-spec-kit/mcp_server/tests/trace-propagation.vitest.ts:52:            fts_score: 10 - index,
.opencode/skills/system-spec-kit/mcp_server/tests/trace-propagation.vitest.ts:69:  const results = await hybridSearch.hybridSearchEnhanced(query, new Float32Array(384).fill(0.2), {
.opencode/skills/system-spec-kit/mcp_server/tests/trace-propagation.vitest.ts:99:    hybridSearch.init(createMockDb(), mockVectorSearch, null);
.opencode/skills/system-spec-kit/mcp_server/tests/trace-propagation.vitest.ts:100:    bm25Index.resetIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/trace-propagation.vitest.ts:101:    const bm25 = bm25Index.getIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/trace-propagation.vitest.ts:103:      bm25.addDocument(String(doc.id), doc.content);
.opencode/skills/system-spec-kit/mcp_server/tests/trace-propagation.vitest.ts:108:    bm25Index.resetIndex();
.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:6:// PURPOSE: Generate structured recovery payloads when search returns
.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:14://   "status": "no_results" | "low_confidence" | "partial",
.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:16://   "suggestedQueries": ["broader alternative 1", "rephrased alternative 2"],
.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:23:export type RecoveryStatus = 'no_results' | 'low_confidence' | 'partial';
.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:38:/** Structured recovery payload attached to search responses. */
.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:42:  suggestedQueries: string[];
.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:46:/** Input context used to build the recovery payload. */
.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:54:  /** How many results were returned (0 = no_results, 1–N = partial/low_confidence). */
.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:58:  /** Low-confidence threshold — results below this trigger recovery. */
.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:66:// Minimum result count considered "good enough" — fewer than this triggers partial recovery.
.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:83:  ) return 'low_confidence';
.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:85:  return 'low_confidence'; // fallback — should only be called when recovery is warranted
.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:209:  if (status === 'low_confidence') {
.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:225: * Phase B T017: Build graph-expanded fallback query terms on zero/weak results.
.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:246:  if (status !== 'no_results' && status !== 'low_confidence') return [];
.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:306:    console.warn(`[recovery-payload] buildGraphExpandedFallback failed (fail-open): ${message}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:314: * Build a structured recovery payload for a failed or weak retrieval.
.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:322: * @returns Structured recovery payload
.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:329:  const suggestedQueries = recommendedAction === 'ask_user' && generatedSuggestions.length === 0
.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:336:    suggestedQueries,
.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:342: * Determine whether a search result set warrants recovery.
.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:369: * Check whether the empty-result recovery feature flag is enabled.
.opencode/skills/system-spec-kit/mcp_server/lib/search/bm25-index.ts:16:   * Higher = better lexical match. Not directly comparable to vector similarity
.opencode/skills/system-spec-kit/mcp_server/lib/search/bm25-index.ts:17:   * scores; use min-max normalization or RRF when combining with other methods.
.opencode/skills/system-spec-kit/mcp_server/lib/search/bm25-index.ts:51: * These weights are consumed by the FTS5 path in sqlite-fts.ts,
.opencode/skills/system-spec-kit/mcp_server/lib/search/bm25-index.ts:323:    const queryTokens = normalizeLexicalQueryTokens(query).bm25;
.opencode/skills/system-spec-kit/mcp_server/lib/search/bm25-index.ts:414:      console.warn(`[bm25-index] Failed to sync BM25 rows: ${msg}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/bm25-index.ts:463:      console.warn(`[bm25-index] Failed to schedule BM25 warmup: ${msg}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/bm25-index.ts:531: * sanitizeQueryTokens('title:memory AND vector');
.opencode/skills/system-spec-kit/mcp_server/lib/search/bm25-index.ts:532: * // ['title', 'memory', 'vector']
.opencode/skills/system-spec-kit/mcp_server/lib/search/bm25-index.ts:559:  fts: string[];
.opencode/skills/system-spec-kit/mcp_server/lib/search/bm25-index.ts:560:  bm25: string[];
.opencode/skills/system-spec-kit/mcp_server/lib/search/bm25-index.ts:571:    fts: [...sharedTokens, ...phraseToken],
.opencode/skills/system-spec-kit/mcp_server/lib/search/bm25-index.ts:572:    bm25: sharedTokens
.opencode/skills/system-spec-kit/mcp_server/lib/search/query-surrogates.ts:90: *   - Parenthetical abbreviations: "Reciprocal Rank Fusion (RRF)" → "RRF"
.opencode/skills/system-spec-kit/mcp_server/lib/search/query-surrogates.ts:91: *   - Parenthetical definitions: "RRF (Reciprocal Rank Fusion)" → "Reciprocal Rank Fusion"
.opencode/skills/system-spec-kit/mcp_server/tests/signal-vocab.vitest.ts:7:// Without better-sqlite3 or vector-index wiring.
.opencode/skills/system-spec-kit/mcp_server/tests/signal-vocab.vitest.ts:8:vi.mock('../lib/search/vector-index', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/signal-vocab.vitest.ts:117:      const signals = detectSignals('how does the vector index work?');
.opencode/skills/system-spec-kit/mcp_server/tests/compact-merger.vitest.ts:12:    triggered: 'Trigger: compaction recovery context',
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:353:        vector: [1],
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:354:        bm25: [2],
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:360:      expect(attributed[0].channels.has('vector')).toBe(true);
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:362:      expect(attributed[0].exclusiveChannel).toBe('vector');
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:364:      expect(attributed[1].channels.has('bm25')).toBe(true);
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:374:        vector: [1, 2],
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:375:        bm25: [1],
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:381:      // ID 1: vector + bm25
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:383:      expect(attributed[0].channels.has('vector')).toBe(true);
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:384:      expect(attributed[0].channels.has('bm25')).toBe(true);
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:388:      // ID 2: vector + graph
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:390:      expect(attributed[1].channels.has('vector')).toBe(true);
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:398:        vector: [1],
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:403:      expect(attributed[0].channels.size).toBe(1); // ID 1 in vector
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:412:      const sources: ChannelSources = { vector: [42] };
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:426:        vector: [1],
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:427:        bm25: [2],
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:445:        vector: [1, 2],
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:446:        bm25: [1, 2],
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:462:        vector: [1, 2, 3],
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:463:        bm25: [2, 4],
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:470:      // ID 1: vector only (exclusive)
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:471:      // ID 2: vector + bm25 (not exclusive)
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:472:      // ID 3: vector + trigger (not exclusive)
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:473:      // ID 4: bm25 only (exclusive)
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:474:      const vectorEcr = ecrs.find(e => e.channel === 'vector');
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:475:      const bm25Ecr = ecrs.find(e => e.channel === 'bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:478:      expect(vectorEcr!.exclusiveCount).toBe(1); // ID 1 only
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:479:      expect(bm25Ecr!.exclusiveCount).toBe(1);   // ID 4 only
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:480:      expect(triggerEcr!.exclusiveCount).toBe(0); // ID 3 is also in vector
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:491:        vector: [1, 2, 3, 4, 5],
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:492:        bm25: [4, 5], // only in bottom 2
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:498:      // Only top-3 analyzed: IDs 1, 2, 3 — all vector-only
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:499:      const vectorEcr = ecrs.find(e => e.channel === 'vector');
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:500:      expect(vectorEcr!.exclusiveCount).toBe(3);
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:501:      expect(vectorEcr!.totalInTopK).toBe(3);
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:502:      expect(vectorEcr!.ecr).toBe(1);
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:508:        vector: [1, 2, 3],
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:515:      expect(ecrs[0].channel).toBe('vector');
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:524:        vector: [1, 2, 3],
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:525:        bm25: [2, 4],
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:533:      // ID 1: vector only (single)
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:534:      // ID 2: vector + bm25 (multi)
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:535:      // ID 3: vector only (single)
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:536:      // ID 4: bm25 only (single)
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:542:      expect(report.channelCoverage['vector']).toBe(3); // IDs 1, 2, 3
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:543:      expect(report.channelCoverage['bm25']).toBe(2);   // IDs 2, 4
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:549:        vector: [1],
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring.vitest.ts:560:        vector: [1, 2, 3, 4, 5],
.opencode/skills/system-spec-kit/mcp_server/lib/search/result-explainability.ts:19://     "channelContribution": { "vector": 0.44, "fts": 0.12, "graph": 0.06 }
.opencode/skills/system-spec-kit/mcp_server/lib/search/result-explainability.ts:45:  vector: number;
.opencode/skills/system-spec-kit/mcp_server/lib/search/result-explainability.ts:46:  fts: number;
.opencode/skills/system-spec-kit/mcp_server/lib/search/result-explainability.ts:103:  if (channelAttribution.includes('fts') || channelAttribution.includes('bm25')) {
.opencode/skills/system-spec-kit/mcp_server/lib/search/result-explainability.ts:232: * distribute the effective score across vector, fts, and graph channels.
.opencode/skills/system-spec-kit/mcp_server/lib/search/result-explainability.ts:240:  const vectorScore = typeof row.vectorScore === 'number' && Number.isFinite(row.vectorScore)
.opencode/skills/system-spec-kit/mcp_server/lib/search/result-explainability.ts:241:    ? Math.max(0, Math.min(1, row.vectorScore))
.opencode/skills/system-spec-kit/mcp_server/lib/search/result-explainability.ts:243:  const ftsScore = typeof row.ftsScore === 'number' && Number.isFinite(row.ftsScore)
.opencode/skills/system-spec-kit/mcp_server/lib/search/result-explainability.ts:244:    ? Math.max(0, Math.min(1, row.ftsScore))
.opencode/skills/system-spec-kit/mcp_server/lib/search/result-explainability.ts:254:  if (vectorScore !== null && ftsScore !== null) {
.opencode/skills/system-spec-kit/mcp_server/lib/search/result-explainability.ts:258:      vector: Math.round(vectorScore * 100) / 100,
.opencode/skills/system-spec-kit/mcp_server/lib/search/result-explainability.ts:259:      fts: Math.round(ftsScore * 100) / 100,
.opencode/skills/system-spec-kit/mcp_server/lib/search/result-explainability.ts:268:  const hasFTS = channelAttribution.includes('fts') || channelAttribution.includes('bm25');
.opencode/skills/system-spec-kit/mcp_server/lib/search/result-explainability.ts:275:      vector: Math.round(remaining * 0.75 * 100) / 100,
.opencode/skills/system-spec-kit/mcp_server/lib/search/result-explainability.ts:276:      fts: Math.round(remaining * 0.25 * 100) / 100,
.opencode/skills/system-spec-kit/mcp_server/lib/search/result-explainability.ts:283:      vector: Math.round(effectiveScore * 0.78 * 100) / 100,
.opencode/skills/system-spec-kit/mcp_server/lib/search/result-explainability.ts:284:      fts: Math.round(effectiveScore * 0.22 * 100) / 100,
.opencode/skills/system-spec-kit/mcp_server/lib/search/result-explainability.ts:292:      vector: Math.round((effectiveScore - graphShare) * 100) / 100,
.opencode/skills/system-spec-kit/mcp_server/lib/search/result-explainability.ts:293:      fts: 0,
.opencode/skills/system-spec-kit/mcp_server/lib/search/result-explainability.ts:299:  return { vector: Math.round(effectiveScore * 100) / 100, fts: 0, graph: 0 };
.opencode/skills/system-spec-kit/mcp_server/tests/orchestrator-error-cascade.vitest.ts:71:    searchType: 'hybrid',
.opencode/skills/system-spec-kit/mcp_server/tests/orchestrator-error-cascade.vitest.ts:95:    searchType: 'hybrid',
.opencode/skills/system-spec-kit/mcp_server/tests/orchestrator-error-cascade.vitest.ts:181:    mockStage2.mockRejectedValue(new Error('RRF fusion NaN overflow'));
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-intent-routing.vitest.ts:137:vi.mock('../lib/search/vector-index.js', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/memory-context-eval-channels.vitest.ts:76:vi.mock('../lib/search/vector-index', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/modularization.vitest.ts:6:// DB-dependent barrel checks use mocked vector-index imports so we can validate
.opencode/skills/system-spec-kit/mcp_server/tests/modularization.vitest.ts:21:  'context-server.js': 1780,        // actual: 1754 — Main entry point wiring for tools, hooks, startup lifecycle, startup root discovery, session priming, remediation hooks, and current bootstrap/recovery contracts (grew with Phase 019 remediations)
.opencode/skills/system-spec-kit/mcp_server/tests/modularization.vitest.ts:47:vi.mock('../lib/search/vector-index.js', () => mockedDbDeps);
.opencode/skills/system-spec-kit/mcp_server/tests/create-record-identity.vitest.ts:4:import * as bm25Index from '../lib/search/bm25-index';
.opencode/skills/system-spec-kit/mcp_server/tests/create-record-identity.vitest.ts:5:import * as vectorIndex from '../lib/search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/tests/create-record-identity.vitest.ts:173:    const indexSpy = vi.spyOn(vectorIndex, 'indexMemory').mockReturnValue(77);
.opencode/skills/system-spec-kit/mcp_server/tests/create-record-identity.vitest.ts:174:    vi.spyOn(bm25Index, 'isBm25Enabled').mockReturnValue(false);
.opencode/skills/system-spec-kit/mcp_server/tests/memory-context-session-state.vitest.ts:122:    vi.doMock('../lib/search/vector-index', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/memory-context-session-state.vitest.ts:127:      discoverSpecFolder: vi.fn(() => 'system-spec-kit/022-hybrid-rag-fusion/026-memory-database-refinement'),
.opencode/skills/system-spec-kit/mcp_server/tests/memory-context-session-state.vitest.ts:145:      input: 'find the hybrid rag memory database refinement spec and related context',
.opencode/skills/system-spec-kit/mcp_server/tests/memory-context-session-state.vitest.ts:152:        specFolder: 'system-spec-kit/022-hybrid-rag-fusion/026-memory-database-refinement',
.opencode/skills/system-spec-kit/mcp_server/tests/memory-context-session-state.vitest.ts:158:          folder: 'system-spec-kit/022-hybrid-rag-fusion/026-memory-database-refinement',
.opencode/skills/system-spec-kit/mcp_server/lib/search/llm-reformulation.ts:24:import { fts5Bm25Search } from './sqlite-fts.js';
.opencode/skills/system-spec-kit/mcp_server/lib/search/llm-reformulation.ts:110:    const rawResults = fts5Bm25Search(db, query, { limit });
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:2:// Verifies weighted BM25 scoring via FTS5 bm25() function.
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:6:  fts5Bm25Search,
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:12:} from '../lib/search/sqlite-fts';
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:37:      CREATE VIRTUAL TABLE memory_fts USING fts5(
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:59:      INSERT INTO memory_fts (rowid, title, trigger_phrases, content_text, file_path)
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:69:  it('T1: isFts5Available detects memory_fts table', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:88:  it('T3: fts5Bm25Search returns matching results', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:89:    const results = fts5Bm25Search(db, 'login');
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:99:    const results = fts5Bm25Search(db, 'authentication');
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:103:    expect(results[0].fts_score).toBeGreaterThan(0);
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:108:    const results = fts5Bm25Search(db, 'login', { specFolder: 'db-spec' });
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:115:    const results = fts5Bm25Search(db, 'archived');
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:121:    const baselineIds = fts5Bm25Search(db, 'archived').map(r => r.id);
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:122:    const compatibilityIds = fts5Bm25Search(db, 'archived', { includeArchived: true }).map(r => r.id);
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:128:    const results = fts5Bm25Search(db, '');
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:134:    const results = fts5Bm25Search(db, 'login', { limit: 1 });
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:138:  // ---- T9: Scores are positive (negated from bm25) ----
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:139:  it('T9: fts_score values are positive numbers', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:140:    const results = fts5Bm25Search(db, 'login');
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:142:      expect(r.fts_score).toBeGreaterThanOrEqual(0);
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:147:  it('T10: results are sorted by fts_score descending', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:148:    const results = fts5Bm25Search(db, 'login');
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:150:      expect(results[i].fts_score).toBeGreaterThanOrEqual(results[i + 1].fts_score);
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:154:  it('T11: successful FTS search records lexicalPath=fts5 and fallbackState=ok', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:155:    fts5Bm25Search(db, 'login');
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:157:      lexicalPath: 'fts5',
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:175:    const results = fts5Bm25Search(compileProbeMissDb, 'login');
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:203:    expect(fts5Bm25Search(missingTableDb, 'login')).toEqual([]);
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:212:  it('T14: forced degrade no_such_module_fts5 records engine-level failure explicitly', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:222:            get: () => ({ name: 'memory_fts' }),
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:225:        if (sql.includes('FROM memory_fts')) {
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:228:              throw new Error('no such module: fts5');
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:237:    expect(fts5Bm25Search(noSuchModuleDb, 'login')).toEqual([]);
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:240:      fallbackState: 'no_such_module_fts5',
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:244:  it('T15: forced degrade bm25_runtime_failure records ranking failure explicitly', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:245:    const bm25FailureDb = {
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:254:            get: () => ({ name: 'memory_fts' }),
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:257:        if (sql.includes('FROM memory_fts')) {
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:260:              throw new Error('unable to use function bm25 in the requested context');
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:265:        throw new Error(`Unexpected SQL for bm25 runtime failure test: ${sql}`);
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:269:    expect(fts5Bm25Search(bm25FailureDb, 'login')).toEqual([]);
.opencode/skills/system-spec-kit/mcp_server/tests/sqlite-fts.vitest.ts:272:      fallbackState: 'bm25_runtime_failure',
.opencode/skills/system-spec-kit/mcp_server/lib/search/spec-folder-hierarchy.ts:7:// Parses folder paths like "system-spec-kit/140-hybrid-rag/006-sprint-5"
.opencode/skills/system-spec-kit/mcp_server/lib/search/spec-folder-hierarchy.ts:75: * Parses folder paths like "system-spec-kit/140-hybrid-rag/006-sprint-5"
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:8:// Contiguity to raw vector-channel hits before later pipeline stages.
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:13://   - hybrid (deep mode): Query expansion + multi-variant hybrid search + dedup
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:14://   - hybrid (R12):       Embedding-based query expansion (SPECKIT_EMBEDDING_EXPANSION)
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:16://   - hybrid: collectRawCandidates → falls back to vector on failure
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:17://   - vector: Direct vectorSearch
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:28://     - candidates contains raw channel scores; vector hits may include an
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:34://     - Reads from the vector index and FTS5 / BM25 index (DB reads only)
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:38:import * as vectorIndex from '../vector-index.js';
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:40:import * as hybridSearch from '../hybrid-search.js';
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:41:import { vectorSearchWithContiguity } from '../../cognitive/temporal-contiguity.js';
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:79:/** Number of constitutional results to fetch when none appear in hybrid/vector results. */
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:529: * and `config.mode`, then applies vector-channel temporal contiguity when
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:567:  const hybridSearchOptions = {
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:583:  // the query for the hybrid search channel, improving recall for alias-rich
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:588:  /** Effective query for hybrid search — may be expanded by concept routing. */
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:591:  if (isGraphConceptRoutingEnabled() && searchType === 'hybrid') {
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:669:    candidates = vectorIndex.multiConceptSearch(conceptEmbeddings, {
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:678:  else if (searchType === 'hybrid') {
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:687:      throw new Error('[stage1-candidate-gen] Failed to generate embedding for hybrid search query');
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:690:    // Deep mode: expand query into variants and run hybrid for each, then dedup
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:695:      // sub-query facets and run hybrid search per facet. Results are merged
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:728:            // Run hybrid for the original query plus each facet, in parallel
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:740:                  return hybridSearch.collectRawCandidates(
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:743:                    hybridSearchOptions
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:803:                const variantResults = await hybridSearch.collectRawCandidates(
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:806:                  hybridSearchOptions
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:833:            `[stage1-candidate-gen] Deep query expansion failed, falling back to single hybrid: ${expandMsg}`
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:835:          // Fall through to single hybrid search below
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:837:          candidates = (await hybridSearch.collectRawCandidates(
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:840:            hybridSearchOptions
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:844:        // ExpandQuery returned only the original; treat as standard hybrid
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:846:        candidates = (await hybridSearch.collectRawCandidates(
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:849:          hybridSearchOptions
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:885:              hybridSearch.collectRawCandidates(
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:888:                hybridSearchOptions
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:902:                  return hybridSearch.collectRawCandidates(
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:905:                    hybridSearchOptions
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:938:            `[stage1-candidate-gen] R12 embedding expansion failed, using standard hybrid: ${r12Msg}`
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:943:      // Standard hybrid search — runs when R12 is off, suppressed by R15,
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:949:          const hybridResults = (await hybridSearch.collectRawCandidates(
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:952:            hybridSearchOptions
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:954:          candidates = hybridResults;
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:955:        } catch (hybridErr: unknown) {
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:956:          const hybridMsg =
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:957:            hybridErr instanceof Error ? hybridErr.message : String(hybridErr);
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:959:            `[stage1-candidate-gen] Hybrid search failed, falling back to vector: ${hybridMsg}`
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:962:          // Fallback: pure vector search
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:964:          let vectorResults = vectorIndex.vectorSearch(effectiveEmbedding, {
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:973:            vectorResults = (
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:974:              vectorSearchWithContiguity(
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:975:                vectorResults as Array<PipelineRow & { similarity: number; created_at: string }>,
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:978:            ) ?? vectorResults;
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:980:          candidates = vectorResults;
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:984:              reason: hybridMsg,
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:985:              channel: 'vector',
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:995:  else if (searchType === 'vector') {
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:1000:      throw new Error('[stage1-candidate-gen] Failed to generate embedding for vector search query');
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:1004:    let vectorResults = vectorIndex.vectorSearch(effectiveEmbedding, {
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:1013:      vectorResults = (
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:1014:        vectorSearchWithContiguity(
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:1015:          vectorResults as Array<PipelineRow & { similarity: number; created_at: string }>,
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:1018:      ) ?? vectorResults;
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:1020:    candidates = vectorResults;
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:1027:      `[stage1-candidate-gen] Unknown searchType: "${searchType}". Expected 'multi-concept', 'hybrid', or 'vector'.`
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:1035:  // Exception: for hybrid search, tier/contextType are applied here because
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:1037:  // For vector search, tier/contextType were already passed to vectorSearch,
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:1078:  // In the current candidate set, fetch them separately via vector search.
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:1098:        const constitutionalResults = vectorIndex.vectorSearch(
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:1115:        // via vector search bypass the earlier governance/context gate.
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:1145:  //   3. Fan-out [original, abstract, ...variants] as additional hybrid search channels.
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:1151:  if (mode === 'deep' && isLlmReformulationEnabled() && searchType === 'hybrid') {
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:1172:              return hybridSearch.collectRawCandidates(
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:1175:                hybridSearchOptions
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:1232:  //   - Run a vector-only search with the pseudo-document embedding.
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:1239:  if (mode === 'deep' && isHyDEEnabled() && searchType === 'hybrid') {
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:1398:              // raw row.score. For vector-only rows with only `similarity`,
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:1454:  // P1 fix: activeChannels counts actual retrieval channels (vector, keyword/BM25),
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:1455:  // while channelCount counts parallel query variants. In hybrid mode both vector
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage1-candidate-gen.ts:1457:  const activeChannels = searchType === 'hybrid' ? 2 : 1;
.opencode/skills/system-spec-kit/mcp_server/tests/mmr-reranker.vitest.ts:145:  it('T10: zero-vector embeddings return 0 similarity', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/eval-db.vitest.ts:235:      `).run(1, 1, 'vector', 3);
.opencode/skills/system-spec-kit/mcp_server/tests/eval-db.vitest.ts:277:      `).run(1, 'mrr@5', 0.72, 'vector');
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-embedding-semantic-search.vitest.ts:34:        content: 'Canonical continuity tracks the recent action and next safe action for resume recovery.',
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-embedding-semantic-search.vitest.ts:50:        title: 'Archived recovery note',
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-embedding-semantic-search.vitest.ts:58:      stage1: { searchType: 'hybrid', channelCount: 3, candidateCount: 4, constitutionalInjected: 0, durationMs: 1 },
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-trigger-perf-benchmark.vitest.ts:47:vi.mock('../lib/search/vector-index.js', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/transcript-planner-export.vitest.ts:7:import * as vectorIndex from '../lib/search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/tests/transcript-planner-export.vitest.ts:156:      vectorIndex.closeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/transcript-planner-export.vitest.ts:160:    vectorIndex.initializeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/transcript-planner-export.vitest.ts:226:    vectorIndex.closeDb();
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:6:// TypeScript port of the vector index implementation.
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:26:import { IVectorStore } from '../interfaces/vector-store.js';
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:35:} from './vector-index-types.js';
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:39:} from './vector-index-schema.js';
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:46:} from './vector-index-types.js';
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:82:/** Loaded search weight configuration for vector-index ranking (lazy-loaded). */
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:100:let _cached_queries: Awaited<typeof import('./vector-index-queries.js')> | null = null;
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:101:let _cached_mutations: Awaited<typeof import('./vector-index-mutations.js')> | null = null;
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:102:let _cached_aliases: Awaited<typeof import('./vector-index-aliases.js')> | null = null;
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:105:  return _cached_queries ??= await import('./vector-index-queries.js');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:109:  return _cached_mutations ??= await import('./vector-index-mutations.js');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:113:  return _cached_aliases ??= await import('./vector-index-aliases.js');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:120:/** Default embedding dimension used by the vector index. */
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:146:  console.warn(`[vector-index] Using embedding dimension ${fallbackDim} after timeout`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:223:    reason: 'No stored vector dimension found for existing schema',
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:249:      const warning = `EMBEDDING DIMENSION MISMATCH: Existing database stores ${existing.stored_dim}-dim vectors (${source_label}), ` +
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:250:        `but the active embedding configuration resolves to ${current_dim}. Refusing to bootstrap because vector search would fail. ` +
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:253:      console.error(`[vector-index] WARNING: ${warning}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:259:    console.warn('[vector-index] Dimension validation error:', get_error_message(e));
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:265: * Validates that stored vector dimensions match the provider.
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:280:/** Default path for the vector-index database file. */
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:327:      console.warn(`[vector-index] Could not read file ${valid_path}: ${get_error_message(err)}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:360:        console.warn('[vector-index] Blocked potential prototype pollution in JSON');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:367:    console.warn(`[vector-index] JSON parse error: ${get_error_message(err)}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:413:        console.warn(`[vector-index] Database connection listener failed: ${get_error_message(error)}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:425:    console.warn(`[vector-index] Could not set permissions on ${target_path}: ${get_error_message(err)}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:499:    console.warn('[vector-index] Cache validation error:', get_error_message(e));
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:726:    console.warn(`[vector-index] interference score refresh failed for '${specFolder}': ${get_error_message(error)}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:735: * Initializes the vector-index database connection.
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:771:      console.error('[vector-index] FATAL: better-sqlite3 native module failed to load');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:772:      console.error(`[vector-index] ${errMsg}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:773:      console.error(`[vector-index] Running: Node ${process.version} (MODULE_VERSION ${process.versions.modules})`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:778:          console.error(`[vector-index] Marker recorded: Node ${marker.nodeVersion} (MODULE_VERSION ${marker.moduleVersion})`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:783:      console.error('[vector-index] This usually means Node.js was updated without rebuilding native modules.');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:784:      console.error('[vector-index] Fix: Run \'bash scripts/setup/rebuild-native-modules.sh\' from the spec-kit root');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:785:      console.error('[vector-index] Or manually: npm rebuild better-sqlite3');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:795:    console.warn(`[vector-index] sqlite-vec extension not available: ${get_error_message(vec_error)}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:796:    console.warn('[vector-index] Falling back to anchor-only mode (no vector search)');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:797:    console.warn('[vector-index] Install sqlite-vec: brew install sqlite-vec (macOS)');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:812:    console.error(`[vector-index] FATAL: ${msg}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:823:    console.error(`[vector-index] FATAL: ${msg}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:841: * Closes the shared vector-index database connection.
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:858: * Gets the active vector-index database path.
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:866: * Gets the shared vector-index database connection.
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:873:// Check if vector search is available (sqlite-vec loaded)
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:875: * Reports whether sqlite-vec vector search is available.
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:876: * @returns True when vector search is available.
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:878:export function is_vector_search_available(): boolean {
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:886:/** Implements the vector-store interface on top of SQLite. */
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:943:    const { vector_search } = await getQueriesModule();
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:944:    return vector_search(embedding, search_options, database);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:1082:    const { vector_search_enriched } = await getQueriesModule();
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:1083:    return vector_search_enriched(embedding, undefined, options, database);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:1112:    cleaned?: { vectors: number; chunks: number };
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:1135:export { is_vector_search_available as isVectorSearchAvailable };
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-aliases.ts:5:// Split from vector-index-store.ts — contains LRUCache, query caching,
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-aliases.ts:13:} from './vector-index-types.js';
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-aliases.ts:17:} from './vector-index-store.js';
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-aliases.ts:19:  vector_search,
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-aliases.ts:20:  vector_search_enriched,
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-aliases.ts:24:} from './vector-index-queries.js';
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-aliases.ts:199:// Cached version of vector_search_enriched with LRU cache
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-aliases.ts:219:  const results = await vector_search_enriched(query, limit, options);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-aliases.ts:276:    console.warn(`[vector-index] learn_from_selection query error: ${get_error_message(e)}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-aliases.ts:318:    console.warn(`[vector-index] learn_from_selection update error: ${get_error_message(e)}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-aliases.ts:342:      console.warn(`[vector-index] Could not generate embedding for memory ${new_memory_id}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-aliases.ts:346:    const similar = vector_search(embedding, {
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-aliases.ts:365:    console.warn(`[vector-index] Failed to link related memories for ${new_memory_id}: ${get_error_message(error)}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-aliases.ts:389:    console.warn(`[vector-index] Failed to record access for memory ${memory_id}: ${get_error_message(error)}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-aliases.ts:415:  const results = await vector_search_enriched(query, fetch_limit, {
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-aliases.ts:429:    console.warn(`[vector-index] Enhanced search took ${elapsed}ms (target <600ms)`);
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-benchmark-trigger-fast-path.vitest.ts:39:vi.mock('../lib/search/vector-index-store.js', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-benchmark-trigger-fast-path.vitest.ts:43:vi.mock('../lib/search/vector-index.js', () => ({
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage3-rerank.ts:12:// MPAB MUST remain AFTER RRF fusion (Stage 2).
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage3-rerank.ts:169:  // The result set, matching the V1 hybrid-search behavior.
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage3-rerank.ts:248:  // MPAB must remain AFTER RRF (Stage 2 constraint). This step runs
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage3-rerank.ts:473: * RRF fusion (Stage 2). It is intentionally placed in Stage 3.
.opencode/skills/system-spec-kit/mcp_server/tests/stage3-rerank-regression.vitest.ts:220:        searchType: 'hybrid',
.opencode/skills/system-spec-kit/mcp_server/tests/stage3-rerank-regression.vitest.ts:271:        searchType: 'hybrid',
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/manual_testing_playbook/05--auto-update-daemon/002-lease-single-writer.md:77:- Scenario [OP-003](../04--operator-h5/003-unavailable-daemon.md) — recovery from unreadable DB.
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:1:// TEST: RRF FUSION
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:28:describe('RRF Fusion Core Tests (T021-T030)', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:29:  it('T021: RRF fusion with default k=40 parameter', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:33:  it('T022: RRF score formula 1/(k+rank) produces correct values', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:34:    const vectorResults = [
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:39:    const ftsResults = [
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:44:    const fused = fuseResults(vectorResults, ftsResults);
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:49:    // Doc1: vector rank=0, fts rank=1 => 1/61 + 1/62 + 0.10 convergence bonus
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:52:    // Doc3: vector rank=2 only => 1/63
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:61:      { source: 'vector', results: [{ id: 'vec_only', content: 'vector only' }] },
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:62:      { source: 'fts', results: [{ id: 'fts_only', content: 'fts only' }] },
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:69:    const ftsDoc = expectDefined(fused.find((r: MultiFusedResult) => r.id === 'fts_only'), 'fts_only');
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:72:    expect(vecDoc.sources).toContain('vector');
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:73:    expect(ftsDoc.sources).toContain('fts');
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:79:      { source: 'vector', results: [{ id: 'multi', content: 'multi source' }, { id: 'vec_only', content: 'vector only' }] },
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:80:      { source: 'fts', results: [{ id: 'multi', content: 'multi source' }] },
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:94:    const vectorResults = [{ id: 'dual', content: 'dual source' }];
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:95:    const ftsResults = [{ id: 'dual', content: 'dual source' }];
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:97:    const fused = fuseResults(vectorResults, ftsResults);
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:107:    const vectorResults = [{ id: 'single', content: 'single source' }];
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:108:    const ftsResults: Array<{ id: string; content: string }> = [];
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:110:    const fused = fuseResults(vectorResults, ftsResults);
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:125:      { source: 'vector', results: [{ id: 'v1', content: 'test1' }, { id: 'v2', content: 'test2' }] },
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:136:      { source: 'vector', results: [
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:137:        { id: 'doc1', content: 'first in vector' },
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:138:        { id: 'doc2', content: 'second in vector' },
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:139:        { id: 'doc3', content: 'third in vector' },
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:141:      { source: 'fts', results: [
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:142:        { id: 'doc3', content: 'first in fts' },
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:143:        { id: 'doc1', content: 'second in fts' },
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:156:    expect(doc1.sources).toContain('vector');
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:157:    expect(doc1.sources).toContain('fts');
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:158:    expect(doc2.sources).toContain('vector');
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:160:    expect(doc3.sources).toContain('vector');
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:161:    expect(doc3.sources).toContain('fts');
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:166:      { source: 'vector', results: [
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:168:        { id: 'vec_only', content: 'vector only' },
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:170:      { source: 'bm25', results: [
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:172:        { id: 'bm25_only', content: 'bm25 only' },
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-fusion.vitest.ts:184:    expect(ids).toContain('bm25_only');
.opencode/skills/system-spec-kit/mcp_server/tests/content-router.vitest.ts:245:  it('uses Tier 2 when Tier 1 confidence is too weak', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/content-router.vitest.ts:648:      text: 'Research finding: the upstream vector store library uses cosine similarity by default and does not support inner-product distance without a configuration change.',
.opencode/skills/system-spec-kit/mcp_server/lib/search/query-router.ts:24:type ChannelName = 'vector' | 'fts' | 'bm25' | 'graph' | 'degree';
.opencode/skills/system-spec-kit/mcp_server/lib/search/query-router.ts:41:const ALL_CHANNELS: readonly ChannelName[] = ['vector', 'fts', 'bm25', 'graph', 'degree'] as const;
.opencode/skills/system-spec-kit/mcp_server/lib/search/query-router.ts:47:const FALLBACK_CHANNELS: readonly ChannelName[] = ['vector', 'fts'] as const;
.opencode/skills/system-spec-kit/mcp_server/lib/search/query-router.ts:64: * - simple:   2 channels (vector + fts) — fastest path
.opencode/skills/system-spec-kit/mcp_server/lib/search/query-router.ts:65: * - moderate: 3 channels (vector + fts + bm25) — balanced
.opencode/skills/system-spec-kit/mcp_server/lib/search/query-router.ts:69:  simple: ['vector', 'fts'],
.opencode/skills/system-spec-kit/mcp_server/lib/search/query-router.ts:70:  moderate: ['vector', 'fts', 'bm25'],
.opencode/skills/system-spec-kit/mcp_server/lib/search/query-router.ts:71:  complex: ['vector', 'fts', 'bm25', 'graph', 'degree'],
.opencode/skills/system-spec-kit/mcp_server/lib/search/query-router.ts:81: * fallback channels (vector, fts) until the minimum is met.
.opencode/skills/system-spec-kit/mcp_server/lib/search/query-router.ts:156:    ? enforceMinimumChannels([...channels, 'bm25'])
.opencode/skills/system-spec-kit/mcp_server/lib/search/channel-representation.ts:8: * assumed normalized [0,1] scores, but raw RRF scores (~0.01-0.03) never exceeded that
.opencode/skills/system-spec-kit/mcp_server/lib/search/channel-representation.ts:9: * threshold, causing channel-representation promotion to silently reject ALL RRF results.
.opencode/skills/system-spec-kit/mcp_server/lib/search/channel-representation.ts:11: * compatible with both raw RRF scores and normalized [0,1] scores. */
.opencode/skills/system-spec-kit/mcp_server/lib/search/channel-representation.ts:77: * @param topK              - Ordered top-k results from RRF fusion.
.opencode/skills/system-spec-kit/mcp_server/tests/progressive-disclosure.vitest.ts:111:    expect(summary.digest).toBe('2 strong, 1 moderate, 1 weak');
.opencode/skills/system-spec-kit/mcp_server/tests/progressive-disclosure.vitest.ts:114:  it('classifies results without confidence data as "weak"', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/progressive-disclosure.vitest.ts:116:    // No confidence property → defaults to low/weak
.opencode/skills/system-spec-kit/mcp_server/tests/progressive-disclosure.vitest.ts:118:    expect(summary.digest).toBe('2 weak');
.opencode/skills/system-spec-kit/mcp_server/tests/progressive-disclosure.vitest.ts:157:    expect(buildDigest({ high: 3, medium: 2, low: 1 })).toBe('3 strong, 2 moderate, 1 weak');
.opencode/skills/system-spec-kit/mcp_server/tests/embedding-weighting.vitest.ts:20:    const vector = new Float32Array(vocabulary.length);
.opencode/skills/system-spec-kit/mcp_server/tests/embedding-weighting.vitest.ts:24:        vector[index] += 1;
.opencode/skills/system-spec-kit/mcp_server/tests/embedding-weighting.vitest.ts:27:    return vector;
.opencode/skills/system-spec-kit/mcp_server/tests/embedding-weighting.vitest.ts:62:      decisions: ['Choose rollback-only recovery path'],
.opencode/skills/system-spec-kit/mcp_server/tests/embedding-weighting.vitest.ts:69:    expect(weighted.indexOf('Rollback guardrail')).toBeLessThan(weighted.indexOf('Choose rollback-only recovery path'));
.opencode/skills/system-spec-kit/mcp_server/tests/embedding-weighting.vitest.ts:70:    expect(weighted.indexOf('Choose rollback-only recovery path')).toBeLessThan(weighted.indexOf('Rollback validated in staging'));
.opencode/skills/system-spec-kit/mcp_server/tests/embedding-weighting.vitest.ts:73:    expect(countOccurrences(weighted, 'Choose rollback-only recovery path')).toBe(3);
.opencode/skills/system-spec-kit/mcp_server/code_graph/lib/query-intent-classifier.ts:6:// (CocoIndex) vs hybrid (both).
.opencode/skills/system-spec-kit/mcp_server/code_graph/lib/query-intent-classifier.ts:11:export type QueryIntent = 'structural' | 'semantic' | 'hybrid';
.opencode/skills/system-spec-kit/mcp_server/code_graph/lib/query-intent-classifier.ts:125:    return { intent: 'hybrid', confidence: 0.5, structuralScore: 0, semanticScore: 0, matchedKeywords: [] };
.opencode/skills/system-spec-kit/mcp_server/code_graph/lib/query-intent-classifier.ts:141:  // No signals at all → hybrid (run both)
.opencode/skills/system-spec-kit/mcp_server/code_graph/lib/query-intent-classifier.ts:143:    return { intent: 'hybrid', confidence: 0.5, structuralScore: 0, semanticScore: 0, matchedKeywords };
.opencode/skills/system-spec-kit/mcp_server/code_graph/lib/query-intent-classifier.ts:177:  // Ambiguous → hybrid with moderate confidence
.opencode/skills/system-spec-kit/mcp_server/code_graph/lib/query-intent-classifier.ts:179:    intent: 'hybrid',
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/types.ts:124:  searchType: 'hybrid' | 'vector' | 'multi-concept';
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/types.ts:208:    /** Actual retrieval channels active (vector=1, hybrid=2). Unlike channelCount which tracks query variants. */
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/types.ts:226: * Single point for ALL scoring signals: RRF/RSF, causal boost, co-activation,
.opencode/skills/system-spec-kit/mcp_server/lib/search/query-expander.ts:46:  embedding: ['vector', 'representation'],
.opencode/skills/system-spec-kit/mcp_server/tests/evidence-gap-detector.vitest.ts:2:// Transparent Reasoning Module: Z-score confidence check on RRF
.opencode/skills/system-spec-kit/mcp_server/tests/evidence-gap-detector.vitest.ts:140:  it('T12: handles negative RRF scores gracefully', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:6:import type { GraphSearchFn } from '../lib/search/hybrid-search';
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:29:vi.mock('../lib/search/bm25-index', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:38:// Mock the RRF fusion so we can control its output.
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:128:  it('hybrid-search exports: init, hybridSearch, hybridSearchEnhanced, searchWithFallback, getGraphMetrics, resetGraphMetrics', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:129:    const mod = await import('../lib/search/hybrid-search');
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:131:    expect(typeof mod.hybridSearch).toBe('function');
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:132:    expect(typeof mod.hybridSearchEnhanced).toBe('function');
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:174:// Wire mock graph fn via init(), call hybridSearch(), verify graph
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:179:  let init: typeof import('../lib/search/hybrid-search').init;
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:180:  let hybridSearch: typeof import('../lib/search/hybrid-search').hybridSearch;
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:181:  let hybridSearchEnhanced: typeof import('../lib/search/hybrid-search').hybridSearchEnhanced;
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:182:  let getGraphMetrics: typeof import('../lib/search/hybrid-search').getGraphMetrics;
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:183:  let resetGraphMetrics: typeof import('../lib/search/hybrid-search').resetGraphMetrics;
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:190:    const mod = await import('../lib/search/hybrid-search');
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:192:    hybridSearch = mod.hybridSearch;
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:193:    hybridSearchEnhanced = mod.hybridSearchEnhanced;
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:209:  it('hybridSearch with useGraph:true calls the graphSearchFn and returns graph results', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:210:    const results = await hybridSearch('test query', null, { useGraph: true });
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:217:  it('hybridSearch with useGraph:false does NOT call the graphSearchFn', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:218:    await hybridSearch('test query', null, { useGraph: false });
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:223:  it('hybridSearch with useGraph:false returns NO graph-sourced results', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:224:    const results = await hybridSearch('test query', null, { useGraph: false });
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:230:  it('hybridSearchEnhanced runs without throwing', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:232:      hybridSearchEnhanced('test query', null, {})
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:236:  it('S4: hybridSearchEnhanced forwards specFolder to graphSearchFn', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:237:    await hybridSearchEnhanced('test query', null, { useGraph: true, specFolder: '003-root/007-child' });
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:246:  it('getGraphMetrics().totalQueries increases after hybridSearchEnhanced calls', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:251:    await hybridSearchEnhanced('test query', null, { useGraph: true });
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:259:    await hybridSearchEnhanced('test query', null, { useGraph: true });
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:304:// All hybridSearch results must have id, score, source fields.
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:310:  let init: typeof import('../lib/search/hybrid-search').init;
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:311:  let hybridSearch: typeof import('../lib/search/hybrid-search').hybridSearch;
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:315:    const mod = await import('../lib/search/hybrid-search');
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:317:    hybridSearch = mod.hybridSearch;
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:322:    const results = await hybridSearch('test query', null, { useGraph: true });
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:332:    const results = await hybridSearch('test query', null, { useGraph: true });
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:343:    const results = await hybridSearch('test query', null, { useGraph: true });
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:351:  it('hybridSearch respects the limit option', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-integration.vitest.ts:353:    const results = await hybridSearch('test query', null, { useGraph: true, limit });
.opencode/skills/system-spec-kit/mcp_server/tests/handler-causal-graph.vitest.ts:5:import * as vectorIndex from '../lib/search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/tests/handler-causal-graph.vitest.ts:104:      vi.spyOn(vectorIndex, 'initializeDb').mockImplementation(() => undefined);
.opencode/skills/system-spec-kit/mcp_server/tests/handler-causal-graph.vitest.ts:105:      vi.spyOn(vectorIndex, 'getDb').mockReturnValue({} as ReturnType<typeof vectorIndex.getDb>);
.opencode/skills/system-spec-kit/mcp_server/tests/handler-causal-graph.vitest.ts:145:      vi.spyOn(vectorIndex, 'initializeDb').mockImplementation(() => undefined);
.opencode/skills/system-spec-kit/mcp_server/tests/handler-causal-graph.vitest.ts:146:      vi.spyOn(vectorIndex, 'getDb').mockReturnValue({} as ReturnType<typeof vectorIndex.getDb>);
.opencode/skills/system-spec-kit/mcp_server/tests/handler-causal-graph.vitest.ts:213:      vi.spyOn(vectorIndex, 'initializeDb').mockImplementation(() => undefined);
.opencode/skills/system-spec-kit/mcp_server/tests/handler-causal-graph.vitest.ts:214:      vi.spyOn(vectorIndex, 'getDb').mockReturnValue({} as ReturnType<typeof vectorIndex.getDb>);
.opencode/skills/system-spec-kit/mcp_server/tests/handler-causal-graph.vitest.ts:310:      vi.spyOn(vectorIndex, 'initializeDb').mockImplementation(() => undefined);
.opencode/skills/system-spec-kit/mcp_server/tests/handler-causal-graph.vitest.ts:311:      vi.spyOn(vectorIndex, 'getDb').mockReturnValue({} as ReturnType<typeof vectorIndex.getDb>);
.opencode/skills/system-spec-kit/mcp_server/tests/handler-causal-graph.vitest.ts:329:      vi.spyOn(vectorIndex, 'initializeDb').mockImplementation(() => undefined);
.opencode/skills/system-spec-kit/mcp_server/tests/handler-causal-graph.vitest.ts:330:      vi.spyOn(vectorIndex, 'getDb').mockImplementation(() => {
.opencode/skills/system-spec-kit/mcp_server/tests/handler-causal-graph.vitest.ts:344:      vi.spyOn(vectorIndex, 'initializeDb').mockImplementation(() => undefined);
.opencode/skills/system-spec-kit/mcp_server/tests/handler-causal-graph.vitest.ts:345:      vi.spyOn(vectorIndex, 'getDb').mockReturnValue({} as ReturnType<typeof vectorIndex.getDb>);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:4:// Split from vector-index-store.ts — contains ALL schema creation,
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:18:} from './vector-index-types.js';
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:425:/** Current schema version for vector-index migrations. */
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:594:          CREATE INDEX IF NOT EXISTS idx_fts_fallback
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:598:        logger.info('Migration v7: Created idx_fts_fallback index for deferred indexing');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:600:        console.warn('[VectorIndex] Migration v7 warning (idx_fts_fallback):', get_error_message(e));
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:750:        database.exec('DROP TRIGGER IF EXISTS memory_fts_insert');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:751:        database.exec('DROP TRIGGER IF EXISTS memory_fts_update');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:752:        database.exec('DROP TRIGGER IF EXISTS memory_fts_delete');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:754:        database.exec('DROP TABLE IF EXISTS memory_fts');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:756:          CREATE VIRTUAL TABLE memory_fts USING fts5(
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:763:          CREATE TRIGGER memory_fts_insert AFTER INSERT ON memory_index BEGIN
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:764:            INSERT INTO memory_fts(rowid, title, trigger_phrases, file_path, content_text)
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:769:          CREATE TRIGGER memory_fts_update AFTER UPDATE ON memory_index BEGIN
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:770:            INSERT INTO memory_fts(memory_fts, rowid, title, trigger_phrases, file_path, content_text)
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:772:            INSERT INTO memory_fts(rowid, title, trigger_phrases, file_path, content_text)
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:777:          CREATE TRIGGER memory_fts_delete AFTER DELETE ON memory_index BEGIN
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:778:            INSERT INTO memory_fts(memory_fts, rowid, title, trigger_phrases, file_path, content_text)
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:826:          database.exec("INSERT INTO memory_fts(memory_fts) VALUES('rebuild')");
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1748:      console.warn('[vector-index] Migration: Added confidence column');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1760:      console.warn('[vector-index] Migration: Added validation_count column');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1772:      console.warn('[vector-index] Migration: Added importance_tier column');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1781:      console.warn('[vector-index] Migration: Created idx_importance_tier index');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1792:      console.warn('[vector-index] Migration: Added context_type column');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1804:      console.warn('[vector-index] Migration: Added content_hash column');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1816:      console.warn('[vector-index] Migration: Added channel column');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1828:      console.warn('[vector-index] Migration: Added session_id column');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1840:      console.warn('[vector-index] Migration: Added base_importance column');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1852:      console.warn('[vector-index] Migration: Added decay_half_life_days column');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1864:      console.warn('[vector-index] Migration: Added is_pinned column');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1876:      console.warn('[vector-index] Migration: Added last_accessed column');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1888:      console.warn('[vector-index] Migration: Added expires_at column');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1900:      console.warn('[vector-index] Migration: Added related_memories column');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1912:      console.warn('[vector-index] Migration: Added stability column (FSRS)');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1924:      console.warn('[vector-index] Migration: Added difficulty column (FSRS)');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1936:      console.warn('[vector-index] Migration: Added last_review column (FSRS)');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1948:      console.warn('[vector-index] Migration: Added review_count column (FSRS)');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1970:      console.warn('[vector-index] Migration: Added canonical_file_path column');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1989:    console.warn('[vector-index] Canonical path index warning:', get_error_message(e));
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2056: * Creates common indexes used by vector-index queries.
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2065:    console.warn('[vector-index] Failed to create index', {
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2082:    console.warn('[vector-index] Failed to create canonical path indexes', {
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2099:    console.warn('[vector-index] Failed to create index', {
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2110:    console.warn('[vector-index] Failed to create index', {
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2121:    console.warn('[vector-index] Failed to create index', {
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2139:    console.warn('[vector-index] Failed to create idx_trigger_cache_source', {
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2150:    console.warn('[vector-index] Failed to create idx_spec_folder_created_at', {
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2163:      console.warn('[vector-index] Failed to create idx_history_timestamp:', get_error_message(err));
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2319: * Creates or upgrades the vector-index schema.
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2445:    CREATE VIRTUAL TABLE IF NOT EXISTS memory_fts USING fts5(
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2453:    CREATE TRIGGER IF NOT EXISTS memory_fts_insert AFTER INSERT ON memory_index BEGIN
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2454:      INSERT INTO memory_fts(rowid, title, trigger_phrases, file_path, content_text)
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2460:    CREATE TRIGGER IF NOT EXISTS memory_fts_update AFTER UPDATE ON memory_index BEGIN
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2461:      INSERT INTO memory_fts(memory_fts, rowid, title, trigger_phrases, file_path, content_text)
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2463:      INSERT INTO memory_fts(rowid, title, trigger_phrases, file_path, content_text)
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2469:    CREATE TRIGGER IF NOT EXISTS memory_fts_delete AFTER DELETE ON memory_index BEGIN
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2470:      INSERT INTO memory_fts(memory_fts, rowid, title, trigger_phrases, file_path, content_text)
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2538:  console.warn('[vector-index] Schema created successfully');
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-eval-channels.vitest.ts:30:      { id: 101, score: 0.91, source: 'vector', sources: ['vector', 'bm25'] },
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-eval-channels.vitest.ts:31:      { id: 202, score: 0.88, source: 'bm25', sources: ['bm25'] },
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-eval-channels.vitest.ts:34:      stage1: { searchType: 'hybrid', channelCount: 2, candidateCount: 2, constitutionalInjected: 0, durationMs: 1 },
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-eval-channels.vitest.ts:127:    const vectorPayload = byChannel.get('vector');
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-eval-channels.vitest.ts:128:    const bm25Payload = byChannel.get('bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-eval-channels.vitest.ts:130:    expect(vectorPayload).toBeDefined();
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-eval-channels.vitest.ts:131:    expect(bm25Payload).toBeDefined();
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-eval-channels.vitest.ts:133:    expect(vectorPayload!.resultMemoryIds).toEqual([101]);
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-eval-channels.vitest.ts:134:    expect(bm25Payload!.resultMemoryIds).toEqual([101, 202]);
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-eval-channels.vitest.ts:135:    expect(bm25Payload!.hitCount).toBe(2);
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-eval-channels.vitest.ts:138:  it('buildEvalChannelPayloads falls back to hybrid channel when attribution is missing', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-eval-channels.vitest.ts:147:    expect(payload!.channel).toBe('hybrid');
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/manual_testing_playbook/05--auto-update-daemon/004-generation-publication.md:87:- Scenario [AU-005](./005-rebuild-from-source.md) — recovery when snapshot unreadable.
.opencode/skills/system-spec-kit/mcp_server/tests/runtime-routing.vitest.ts:52:  describe('maps session queries to hybrid intent', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/runtime-routing.vitest.ts:53:    it('previous work', () => { expect(classifyQueryIntent('what was I working on in the previous session').intent).toBe('hybrid'); });
.opencode/skills/system-spec-kit/mcp_server/tests/runtime-routing.vitest.ts:54:    it('resume', () => { expect(classifyQueryIntent('resume my last session').intent).toBe('hybrid'); });
.opencode/skills/system-spec-kit/mcp_server/tests/runtime-routing.vitest.ts:55:    it('prior decisions', () => { expect(classifyQueryIntent('what was the prior decision about auth').intent).toBe('hybrid'); });
.opencode/skills/system-spec-kit/mcp_server/tests/runtime-routing.vitest.ts:72:  describe('session queries map to hybrid intent', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/runtime-routing.vitest.ts:73:    it('resume my previous work', () => { expect(classifyQueryIntent('resume my previous work').intent).toBe('hybrid'); });
.opencode/skills/system-spec-kit/mcp_server/tests/runtime-routing.vitest.ts:74:    it('what was I doing last session', () => { expect(classifyQueryIntent('what was I doing last session').intent).toBe('hybrid'); });
.opencode/skills/system-spec-kit/mcp_server/tests/runtime-routing.vitest.ts:86:    it('Resume My Session → hybrid', () => { expect(classifyQueryIntent('Resume My Session').intent).toBe('hybrid'); });
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/README.md:34:The `pipeline/` directory implements the core retrieval pipeline behind `memory_search`. Each search request flows through four sequential stages, each with a defined I/O contract and clear responsibility boundary. The pipeline supports hybrid, vector and multi-concept search types with optional deep-mode query expansion, cross-encoder reranking, MMR diversity pruning and MPAB chunk-to-parent reassembly.
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/README.md:48:| `stage1-candidate-gen.ts` | Stage 1: Candidate Generation. Runs search channels (hybrid, vector, multi-concept), applies deep-mode query expansion (R6), embedding-based expansion (R12), summary embeddings (R8), constitutional memory injection, quality threshold filtering and tier/contextType filtering. |
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/README.md:49:| `stage2-fusion.ts` | Stage 2: Fusion + Signal Integration. The single authoritative scoring point. Applies 9 signal steps in fixed order: session boost, causal boost, co-activation spreading, community co-retrieval, graph signals, FSRS testing effect, intent weights (non-hybrid only, G2 prevention), artifact routing, feedback signals, artifact limiting, anchor metadata and validation metadata scoring. |
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/README.md:80:- Channels: hybrid (with optional deep-mode expansion), vector, multi-concept.
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/README.md:88:- G2 prevention: intent weights are applied only for non-hybrid search types.
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/README.md:108:2. **G2 Double-Weighting Guard.** Intent weights are applied only for non-hybrid search types. Hybrid search incorporates intent weighting during RRF/RSF fusion internally.
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/README.md:116:- `mcp_server/lib/search/` - Parent search directory containing hybrid search, vector index, cross-encoder and other search modules consumed by the pipeline.
.opencode/skills/system-spec-kit/mcp_server/lib/search/confidence-scoring.ts:19://   "requestQuality": {
.opencode/skills/system-spec-kit/mcp_server/lib/search/confidence-scoring.ts:20://     "label": "good" | "weak" | "gap"
.opencode/skills/system-spec-kit/mcp_server/lib/search/confidence-scoring.ts:63:export type RequestQualityLabel = 'good' | 'weak' | 'gap';
.opencode/skills/system-spec-kit/mcp_server/lib/search/confidence-scoring.ts:89:  requestQuality: {
.opencode/skills/system-spec-kit/mcp_server/lib/search/confidence-scoring.ts:103:  /** RRF fusion score (0–1). */
.opencode/skills/system-spec-kit/mcp_server/lib/search/confidence-scoring.ts:262:    // should reflect that even when heuristic signals are weak.
.opencode/skills/system-spec-kit/mcp_server/lib/search/confidence-scoring.ts:287: * - "weak":  results exist but signals are mixed or low
.opencode/skills/system-spec-kit/mcp_server/lib/search/confidence-scoring.ts:298:    return { requestQuality: { label: 'gap' } };
.opencode/skills/system-spec-kit/mcp_server/lib/search/confidence-scoring.ts:310:    return { requestQuality: { label: 'good' } };
.opencode/skills/system-spec-kit/mcp_server/lib/search/confidence-scoring.ts:313:    return { requestQuality: { label: 'weak' } };
.opencode/skills/system-spec-kit/mcp_server/lib/search/confidence-scoring.ts:315:  return { requestQuality: { label: 'gap' } };
.opencode/skills/system-spec-kit/mcp_server/tests/dual-scope-hooks.vitest.ts:16:vi.mock('../lib/search/vector-index', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/dual-scope-hooks.vitest.ts:38:import * as vectorIndex from '../lib/search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/tests/dual-scope-hooks.vitest.ts:86:    vi.mocked(vectorIndex.getDb).mockReturnValue(null);
.opencode/skills/system-spec-kit/mcp_server/tests/dual-scope-hooks.vitest.ts:123:    vi.mocked(vectorIndex.getDb).mockReturnValue(null);
.opencode/skills/system-spec-kit/mcp_server/tests/dual-scope-hooks.vitest.ts:199:    vi.mocked(vectorIndex.getDb).mockReturnValue(null);
.opencode/skills/system-spec-kit/mcp_server/tests/dual-scope-hooks.vitest.ts:243:    vi.mocked(vectorIndex.getDb).mockReturnValue(null);
.opencode/skills/system-spec-kit/mcp_server/tests/dual-scope-hooks.vitest.ts:296:    vi.mocked(vectorIndex.getDb).mockReturnValue(null);
.opencode/skills/system-spec-kit/mcp_server/tests/dual-scope-hooks.vitest.ts:321:    vi.mocked(vectorIndex.getDb).mockReturnValue(null);
.opencode/skills/system-spec-kit/mcp_server/tests/dual-scope-hooks.vitest.ts:387:    vi.mocked(vectorIndex.getDb).mockReturnValue(null);
.opencode/skills/system-spec-kit/mcp_server/tests/dual-scope-hooks.vitest.ts:439:    vi.mocked(vectorIndex.getDb).mockReturnValue(null);
.opencode/skills/system-spec-kit/mcp_server/tests/dual-scope-hooks.vitest.ts:481:    vi.mocked(vectorIndex.getDb).mockReturnValue(null);
.opencode/skills/system-spec-kit/mcp_server/tests/dual-scope-hooks.vitest.ts:504:    vi.mocked(vectorIndex.getDb).mockReturnValue(null);
.opencode/skills/system-spec-kit/mcp_server/tests/dual-scope-hooks.vitest.ts:554:    vi.mocked(vectorIndex.getDb).mockReturnValue(null);
.opencode/skills/system-spec-kit/mcp_server/tests/dual-scope-hooks.vitest.ts:572:    vi.mocked(vectorIndex.getDb).mockReturnValue(null);
.opencode/skills/system-spec-kit/mcp_server/tests/dual-scope-hooks.vitest.ts:589:    vi.mocked(vectorIndex.getDb).mockReturnValue(null);
.opencode/skills/system-spec-kit/mcp_server/tests/dual-scope-hooks.vitest.ts:612:    vi.mocked(vectorIndex.getDb).mockReturnValue(null);
.opencode/skills/system-spec-kit/mcp_server/tests/dual-scope-hooks.vitest.ts:641:    vi.mocked(vectorIndex.getDb).mockReturnValue(null);
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/manual_testing_playbook/05--auto-update-daemon/005-rebuild-from-source.md:3:description: "Manual validation that corruption of the skill graph SQLite database triggers a rebuild-from-source recovery path without crashing the runtime."
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/manual_testing_playbook/05--auto-update-daemon/005-rebuild-from-source.md:8:  - "daemon recovery rebuild"
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/manual_testing_playbook/05--auto-update-daemon/005-rebuild-from-source.md:26:Validate the rebuild-from-source recovery path in `lib/freshness/rebuild-from-source.ts` when the advisor SQLite database is corrupted, including fail-open behavior and cache-invalidation wiring.
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/manual_testing_playbook/05--auto-update-daemon/005-rebuild-from-source.md:84:- Scenario [OP-003](../04--operator-h5/003-unavailable-daemon.md) — operator recovery flow.
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:401:      '../lib/search/vector-index',
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:402:      '../lib/search/vector-index.ts',
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:403:      '../lib/search/vector-index.js',
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:404:      '../lib/search/vector-index-store',
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:405:      '../lib/search/vector-index-store.ts',
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:406:      '../lib/search/vector-index-store.js',
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:415:      '../lib/search/hybrid-search',
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:416:      '../lib/search/bm25-index',
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:481:      bm25Enabled?: boolean
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:790:      vi.doMock('../lib/search/vector-index', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:797:        vectorSearch: vi.fn(),
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:799:      vi.doMock('../lib/search/vector-index.ts', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:806:        vectorSearch: vi.fn(),
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:808:      vi.doMock('../lib/search/vector-index.js', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:815:        vectorSearch: vi.fn(),
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:817:      vi.doMock('../lib/search/vector-index-store', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:818:        const actual = await vi.importActual('../lib/search/vector-index-store.js') as Record<string, unknown>
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:836:      vi.doMock('../lib/search/vector-index-store.ts', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:837:        const actual = await vi.importActual('../lib/search/vector-index-store.js') as Record<string, unknown>
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:855:      vi.doMock('../lib/search/vector-index-store.js', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:856:        const actual = await vi.importActual('../lib/search/vector-index-store.js') as Record<string, unknown>
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:899:      vi.doMock('../lib/search/hybrid-search', () => ({ init: vi.fn() }))
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:900:      vi.doMock('../lib/search/hybrid-search.js', () => ({ init: vi.fn() }))
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:908:      vi.doMock('../lib/search/bm25-index', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:909:        isBm25Enabled: vi.fn(() => options?.bm25Enabled ?? false),
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:912:      vi.doMock('../lib/search/bm25-index.js', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:913:        isBm25Enabled: vi.fn(() => options?.bm25Enabled ?? false),
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:1819:        warning: 'DIMENSION MISMATCH: Database has 1024-dim vectors, but provider expects 768.',
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:1822:      expect(sourceCode).toMatch(/const\s+dimValidation\s*=\s*vectorIndex\.validateEmbeddingDimension\(\)/)
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:1859:      const channels = ['vector', 'fts5', 'bm25', 'degree']
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:1875:      expect(instructions).toContain('Search channels: vector, fts5, bm25, degree.')
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:1886:        const channels = ['vector', 'fts5']
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2097:    // T24: Error response contains recovery hints (REQ-004)
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2486:      expect(sourceCode).toMatch(/fatalShutdown[\s\S]*?vectorIndex\.closeDb\(\)/)
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2546:      expect(sourceCode).toMatch(/vectorIndex\.initializeDb\(\)/)
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2715:    it('T63c: pending recovery location helper is defined', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2739:    it('T64d: pending recovery reuses shared startup root expansion', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2750:    it('T66: Pending file recovery errors caught', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2751:      const recoveryCatch = /recoverPendingFiles[\s\S]*?catch\s*\(error/
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2752:      expect(recoveryCatch.test(sourceCode)).toBe(true)
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2773:      { module: './lib/search/vector-index.js', name: 'Vector index' },
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2777:      { module: './lib/search/hybrid-search.js', name: 'Hybrid search' },
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2778:      { module: './lib/search/bm25-index.js', name: 'BM25 index' },
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2818:        bm25Enabled?: boolean
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2828:      const channels: string[] = ['vector', 'fts5']
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2829:      if (opts.bm25Enabled) channels.push('bm25')
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2871:      expect(result).toContain('vector')
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2872:      expect(result).toContain('fts5')
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-stats-edge.vitest.ts:4:import * as vectorIndex from '../lib/search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-stats-edge.vitest.ts:23:  const database = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-stats-edge.vitest.ts:51:  const database = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-stats-edge.vitest.ts:74:  vectorIndex.closeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-stats-edge.vitest.ts:75:  vectorIndex.initializeDb(':memory:');
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-stats-edge.vitest.ts:79:  vectorIndex.closeDb();
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:3:description: "5-channel hybrid search architecture combining vector, lexical (BM25/FTS5), graph-based and structure-aware graph retrieval with Reciprocal Rank Fusion (RRF) and Adaptive Fusion."
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:6:  - "hybrid search"
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:7:  - "vector search"
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:12:> 5-channel hybrid search architecture combining vector, lexical (BM25/FTS5), graph-based and structure-aware graph retrieval, fused with Reciprocal Rank Fusion (RRF) and Adaptive Fusion.
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:27:- [FTS CAPABILITY CASCADE FLOOR](#fts-capability-cascade-floor)
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:39:The search subsystem provides production-grade hybrid search capabilities with multiple retrieval methods fused via RRF scoring. It handles query expansion, intent classification, typo tolerance and optional cross-encoder reranking.
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:45:- **RRF Score Fusion**: Industry-standard k=40 with convergence bonuses
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:47:- **Query Enhancement**: Fuzzy matching (Levenshtein) + acronym expansions (via hybrid-search.ts inline logic)
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:65:RRF Fusion (k=40) + Adaptive Fusion -> Unified scores
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:77:`vector-index.ts` is the primary typed export surface for the vector index and re-exports the split schema, query, mutation, store and alias modules. `vector-index-impl.ts` is now a 14-line backward-compatibility shim that simply re-exports `vector-index.ts` for older import paths.
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:95:| Vector | `vector-index.ts` | Semantic similarity via sqlite-vec through the split vector-index modules |
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:96:| BM25 | `bm25-index.ts` | Pure TypeScript keyword matching |
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:97:| FTS5 | `sqlite-fts.ts` | SQLite FTS5 BM25 weighted scoring |
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:111:6. Intent weights — non-hybrid only (G2 double-weighting prevention: `isHybrid` boolean guard)
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:130:### Reciprocal Rank Fusion (RRF)
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:134:**Why RRF?**
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:137:- Citation: Cormack et al. "RRF outperforms Condorcet" (SIGIR 2009)
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:142:- **Adaptive Fusion**: Intent-aware weighted RRF with opt-in evaluation mode (feature flag `SPECKIT_ADAPTIVE_FUSION`)
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:150:// RRF score = 1/(40+2) + 1/(40+5) + 1.5/(40+1)
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:174:<a id="fts-capability-cascade-floor"></a>
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:177:Packet `026-graph-and-context-optimization/010-fts-capability-cascade-floor` freezes the lexical capability contract that packet `002-implement-cache-warning-hooks` now consumes. `memory_search` responses expose:
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:179:- `lexicalPath`: the lane that actually ran for lexical retrieval. Current packet-owned values are `fts5` and `unavailable`. The wider response schema also allows `like`, but packet `010` does not claim that lane for this runtime seam.
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:186:| `ok` | FTS5 compile probe passed, `memory_fts` exists, and BM25 ranking executed normally | `fts5` |
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:188:| `missing_table` | FTS5 support is present, but `memory_fts` is missing at runtime | `unavailable` |
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:189:| `no_such_module_fts5` | The SQLite engine rejects FTS5 usage with `no such module: fts5` | `unavailable` |
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:190:| `bm25_runtime_failure` | The FTS5 table exists, but the `bm25(...)` ranking call fails at runtime | `unavailable` |
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:248:| **TypeScript**       | `hybrid-search.ts`, `cross-encoder.ts`, `intent-classifier.ts`, `bm25-index.ts`             |
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:249:| **TypeScript**       | `vector-index.ts` (typed export surface) + `vector-index-impl.ts` (14-line compatibility shim) |
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:255:### Facade Pattern: vector-index
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:261:vector-index.ts          (166 LOC)
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:264:    - vector-index-types.ts
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:265:    - vector-index-schema.ts
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:266:    - vector-index-mutations.ts
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:267:    - vector-index-queries.ts
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:268:    - vector-index-store.ts
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:269:    - vector-index-aliases.ts
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:272:vector-index-impl.ts     (14 LOC)
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:274:  - Re-exports from './vector-index'
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:278:**NOTE**: Most vector-index logic now lives in the split `vector-index-*` modules. `vector-index-impl.ts` is only a compatibility adapter, so runtime changes should be made in `vector-index.ts` or the underlying split modules.
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:284:| `vector-index.ts`          | 166    | TypeScript | Typed export surface re-exporting the split vector-index modules |
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:285:| `vector-index-impl.ts`     | 14     | TypeScript | Backward-compatibility shim that re-exports `vector-index.ts` |
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:286:| `vector-index-types.ts`    | -      | TypeScript | Shared type definitions for vector index modules    |
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:287:| `vector-index-schema.ts`   | -      | TypeScript | Schema creation and migration logic                 |
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:288:| `vector-index-mutations.ts`| -      | TypeScript | Insert, update, and delete operations for vector index |
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:289:| `vector-index-queries.ts`  | -      | TypeScript | Query builders and search operations for vector index |
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:290:| `vector-index-aliases.ts`  | -      | TypeScript | Re-export aliases for backward-compatible imports   |
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:291:| `vector-index-store.ts`    | -      | TypeScript | Low-level storage operations and reconsolidation helpers |
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:292:| `hybrid-search.ts`         | ~900   | TypeScript | Orchestrates vector/FTS/BM25/graph/degree fusion via adaptive RRF |
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:296:| `bm25-index.ts`            | ~280   | TypeScript | Pure TypeScript BM25 (REQ-028, v1.2.0)              |
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:311:| `evidence-gap-detector.ts` | -      | TypeScript | Z-score confidence check on RRF scores to detect low-confidence retrieval |
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:313:| `sqlite-fts.ts`            | -      | TypeScript | SQLite FTS5 BM25 weighted scoring, extracted from hybrid-search for independent use |
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:325:| `embedding-expansion.ts`   | -      | TypeScript | Embedding-based query expansion for R12 multi-vector retrieval |
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:346:| `recovery-payload.ts`      | -      | TypeScript | Builds structured recovery payloads for weak or empty results |
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:361:   hybrid-search.ts -> Expand acronyms + fix typos (inline)
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:368:   vector-index.ts -> Vector search (semantic)
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:369:   bm25-index.ts -> BM25 search (keyword)
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:377:   rrf-fusion.ts -> RRF with k=40, convergence bonus
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:379:   hybrid-search.ts -> Orchestrate multi-source fusion
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:432:**RRF Parameters** (hardcoded, REQ-011):
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:457:| v7      | `partial` embedding_status + `idx_embedding_pending` + `idx_fts_fallback` (REQ-031, T096) |
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:512:// -> RRF + Adaptive Fusion -> MMR diversity -> Sorted by combined score
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:518:hybridSearch("authentication", { specFolder: "specs/<###-spec-name>" })
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:523:- If RRF disabled: Vector-only with basic metadata
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:565:// Log warning with recovery hint
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:599:| **Storage** | Summaries stored with embeddings in SQLite for vector search |
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:644:The 5th RRF channel computes degree centrality with per-edge-type weights:
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:720:**Lexical Normalization + BM25 Document Text** (`bm25-index.ts`):
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:763:`wasUseful=false` validations apply a demotion multiplier to composite scores. Penalty: -0.1 per negative validation, floor at 0.3 (never suppress below 30%). 30-day half-life recovery: penalty halves over time if no further negative feedback. Gated via `SPECKIT_NEGATIVE_FEEDBACK` (default ON).
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:781:import { initializeDb } from './vector-index';
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:782:import { init, unifiedSearch } from './hybrid-search';
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:783:import { vectorSearch } from './vector-index';
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:788:init(db, vectorSearch);
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:799:// - sources: ['vector', 'bm25', 'graph']
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:800:// - vectorRank, bm25Rank, graphRank
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:808:import { unifiedSearch } from './hybrid-search';
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:845:import * as bm25Index from './bm25-index';
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:848:if (bm25Index.isBm25Enabled()) {
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:850:  const results = bm25Index.getIndex().search('authentication', {
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:862:import { initializeDb, getDb } from './vector-index';
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:889:- Quality floor corrected from 0.2 to 0.005 (D3) — aligns with RRF score range
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:920:| Search weights configuration | Loaded via SERVER_DIR in the split vector-index modules (compat imports still route through `vector-index-impl.ts`) |
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:946:- **RRF**: Cormack et al. "Reciprocal Rank Fusion outperforms Condorcet" (SIGIR 2009)
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:955:| REQ-011 | RRF fusion enhancement           | hybrid-search.ts                |
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:958:| REQ-014 | BM25 hybrid search               | bm25-index.ts, hybrid-search.ts |
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:959:| REQ-018 | Query expansion (fuzzy)          | hybrid-search.ts                |
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:960:| REQ-027 | Fuzzy acronym matching           | hybrid-search.ts                |
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:961:| REQ-028 | Pure TypeScript BM25             | bm25-index.ts                   |
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:973:- `vector-index.ts` is the primary typed export surface. `vector-index-impl.ts` is a 14-line compatibility shim, and the core implementation lives in the split vector-index modules for types, schema, mutations, queries, aliases, and store
.opencode/skills/system-spec-kit/mcp_server/tests/adaptive-fallback.vitest.ts:28: * In production this wraps the Promise.all scatter block in hybrid-search.ts.
.opencode/skills/system-spec-kit/mcp_server/tests/integration-138-pipeline.vitest.ts:10:   Simulates the full hybridSearchEnhanced() flow from spec 138.
.opencode/skills/system-spec-kit/mcp_server/tests/integration-138-pipeline.vitest.ts:54:  // Simulate vector + FTS5 + graph returning mixed results
.opencode/skills/system-spec-kit/mcp_server/tests/integration-138-pipeline.vitest.ts:68:function adaptiveRRFFuse(results: SearchResult[], intent: string): SearchResult[] {
.opencode/skills/system-spec-kit/mcp_server/tests/integration-138-pipeline.vitest.ts:69:  // Sort by score (simulate RRF)
.opencode/skills/system-spec-kit/mcp_server/tests/integration-138-pipeline.vitest.ts:127:function hybridSearchEnhanced(query: string, mode: string, flags: Record<string, boolean>): EnhancedMCPResponse {
.opencode/skills/system-spec-kit/mcp_server/tests/integration-138-pipeline.vitest.ts:136:  // L2: Adaptive RRF
.opencode/skills/system-spec-kit/mcp_server/tests/integration-138-pipeline.vitest.ts:138:    results = adaptiveRRFFuse(results, intent);
.opencode/skills/system-spec-kit/mcp_server/tests/integration-138-pipeline.vitest.ts:164:      sourcesHit: ['vector', 'fts5', 'graph'],
.opencode/skills/system-spec-kit/mcp_server/tests/integration-138-pipeline.vitest.ts:190:    const response = hybridSearchEnhanced('fix auth token error', 'auto', ALL_FLAGS_ON);
.opencode/skills/system-spec-kit/mcp_server/tests/integration-138-pipeline.vitest.ts:197:    const response = hybridSearchEnhanced('explain architecture', 'deep', ALL_FLAGS_ON);
.opencode/skills/system-spec-kit/mcp_server/tests/integration-138-pipeline.vitest.ts:204:  it('T3: pipeline hits vector, fts5, and graph sources', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/integration-138-pipeline.vitest.ts:205:    const response = hybridSearchEnhanced('find spec for auth', 'auto', ALL_FLAGS_ON);
.opencode/skills/system-spec-kit/mcp_server/tests/integration-138-pipeline.vitest.ts:207:    expect(response.metrics.sourcesHit).toContain('vector');
.opencode/skills/system-spec-kit/mcp_server/tests/integration-138-pipeline.vitest.ts:208:    expect(response.metrics.sourcesHit).toContain('fts5');
.opencode/skills/system-spec-kit/mcp_server/tests/integration-138-pipeline.vitest.ts:214:    const response = hybridSearchEnhanced('fix bug in login', 'auto', ALL_FLAGS_ON);
.opencode/skills/system-spec-kit/mcp_server/tests/integration-138-pipeline.vitest.ts:224:    const response = hybridSearchEnhanced('bake bread recipe', 'auto', ALL_FLAGS_ON);
.opencode/skills/system-spec-kit/mcp_server/tests/integration-138-pipeline.vitest.ts:237:    const response = hybridSearchEnhanced('fix auth error', 'auto', ALL_FLAGS_OFF);
.opencode/skills/system-spec-kit/mcp_server/tests/integration-138-pipeline.vitest.ts:246:    const withFlags = hybridSearchEnhanced('understand architecture', 'auto', ALL_FLAGS_ON);
.opencode/skills/system-spec-kit/mcp_server/tests/integration-138-pipeline.vitest.ts:247:    const withoutFlags = hybridSearchEnhanced('understand architecture', 'auto', ALL_FLAGS_OFF);
.opencode/skills/system-spec-kit/mcp_server/tests/integration-138-pipeline.vitest.ts:256:    const fixBug = hybridSearchEnhanced('fix the login bug', 'auto', ALL_FLAGS_ON);
.opencode/skills/system-spec-kit/mcp_server/tests/integration-138-pipeline.vitest.ts:257:    const understand = hybridSearchEnhanced('explain the login system', 'auto', ALL_FLAGS_ON);
.opencode/skills/system-spec-kit/mcp_server/tests/integration-138-pipeline.vitest.ts:266:    const response = hybridSearchEnhanced('fix login error', 'deep', ALL_FLAGS_ON);
.opencode/skills/system-spec-kit/mcp_server/tests/integration-138-pipeline.vitest.ts:274:    const response = hybridSearchEnhanced('test query', 'auto', ALL_FLAGS_ON);
.opencode/skills/system-spec-kit/mcp_server/tests/integration-138-pipeline.vitest.ts:454:   Ensures hybrid retrieval and graph coverage checks keep
.opencode/skills/system-spec-kit/mcp_server/tests/integration-138-pipeline.vitest.ts:459:  it('hybridAdaptiveFuse returns standard results when SPECKIT_ADAPTIVE_FUSION is off', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/integration-138-pipeline.vitest.ts:460:    const { hybridAdaptiveFuse } = await import('../../shared/algorithms/adaptive-fusion');
.opencode/skills/system-spec-kit/mcp_server/tests/integration-138-pipeline.vitest.ts:461:    // With flag off, should return standard RRF results (equal weights)
.opencode/skills/system-spec-kit/mcp_server/tests/integration-138-pipeline.vitest.ts:466:    // When flag is off, hybridAdaptiveFuse returns standard fusion results.
.opencode/skills/system-spec-kit/mcp_server/tests/integration-138-pipeline.vitest.ts:467:    const result = hybridAdaptiveFuse(semantic, keyword, 'understand');
.opencode/skills/system-spec-kit/mcp_server/tests/intent-weighting.vitest.ts:14:  hybridAdaptiveFuse,
.opencode/skills/system-spec-kit/mcp_server/tests/intent-weighting.vitest.ts:151:    const result = hybridAdaptiveFuse(semantic, keyword, intent);
.opencode/skills/system-spec-kit/mcp_server/tests/intent-weighting.vitest.ts:188:  it('RRF fusion scores are RANK-based, not attribute-based (no overlap with System B)', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/intent-weighting.vitest.ts:191:      source: 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/intent-weighting.vitest.ts:212:    // Verify RRF scores are rank-based, NOT derived from similarity/score values
.opencode/skills/system-spec-kit/mcp_server/tests/intent-weighting.vitest.ts:223:    expect(item2!.sources).toContain('vector');
.opencode/skills/system-spec-kit/mcp_server/tests/intent-weighting.vitest.ts:232:    const bugResult = hybridAdaptiveFuse(semantic, keyword, 'fix_bug');
.opencode/skills/system-spec-kit/mcp_server/tests/intent-weighting.vitest.ts:233:    const understandResult = hybridAdaptiveFuse(semantic, keyword, 'understand');
.opencode/skills/system-spec-kit/mcp_server/tests/intent-weighting.vitest.ts:269:    const result = hybridAdaptiveFuse(semantic, keyword, 'understand');
.opencode/skills/system-spec-kit/mcp_server/tests/intent-weighting.vitest.ts:287:    const result = hybridAdaptiveFuse(semantic, keyword, 'fix_bug');
.opencode/skills/system-spec-kit/mcp_server/tests/intent-weighting.vitest.ts:300:    const result1 = hybridAdaptiveFuse(semantic, keyword, 'fix_bug');
.opencode/skills/system-spec-kit/mcp_server/tests/intent-weighting.vitest.ts:301:    const result2 = hybridAdaptiveFuse(semantic, keyword, 'fix_bug');
.opencode/skills/system-spec-kit/mcp_server/tests/intent-weighting.vitest.ts:345:  it('RRF scores are in expected range (normalized [0,1])', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/intent-weighting.vitest.ts:349:    const result = hybridAdaptiveFuse(semantic, keyword, 'understand');
.opencode/skills/system-spec-kit/mcp_server/tests/intent-weighting.vitest.ts:379:  it('channel weights influence RRF score distribution', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/intent-weighting.vitest.ts:381:    // The vector-only item should score higher than keyword-only item
.opencode/skills/system-spec-kit/mcp_server/tests/intent-weighting.vitest.ts:383:      { id: 'only-vec', title: 'vector only result' },
.opencode/skills/system-spec-kit/mcp_server/tests/intent-weighting.vitest.ts:389:    const result = hybridAdaptiveFuse(semantic, keyword, 'understand');
.opencode/skills/system-spec-kit/mcp_server/tests/intent-weighting.vitest.ts:398:    // So vector-only result should have higher RRF score
.opencode/skills/system-spec-kit/mcp_server/tests/intent-weighting.vitest.ts:431:describe('T017-G2: Normalization Method — RRF + Composite Score', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/intent-weighting.vitest.ts:432:  it('RRF uses rank-based normalization (1/(k+rank)) not value-based', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/intent-weighting.vitest.ts:433:    // Items with wildly different raw scores should get similar RRF scores
.opencode/skills/system-spec-kit/mcp_server/tests/intent-weighting.vitest.ts:436:      source: 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/intent-weighting.vitest.ts:455:    // All rank-1 items should get the same base RRF score regardless of raw values
.opencode/skills/system-spec-kit/mcp_server/tests/intent-weighting.vitest.ts:485:    // This is by design: each channel's weight scales its RRF contribution independently
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage2-fusion.ts:11://     - Intent weights are NEVER applied to hybrid results (G2 double-weighting guard)
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage2-fusion.ts:29:// 4.  Intent weights          — non-hybrid search post-scoring adjustment
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage2-fusion.ts:37:// Internally (RRF / RSF fusion). Post-search intent weighting is
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage2-fusion.ts:38:// Therefore ONLY applied for non-hybrid search types (vector,
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage2-fusion.ts:39:// Multi-concept). Applying it to hybrid results would double-count.
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage2-fusion.ts:596: * G2 PREVENTION: This function is ONLY called for non-hybrid search types.
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage2-fusion.ts:597: * Hybrid search (RRF / RSF) already incorporates intent-weighted signals
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage2-fusion.ts:598: * during fusion. Calling this on hybrid results would double-count intent.
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage2-fusion.ts:934: *   1.  Session boost      (hybrid only — working memory attention)
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage2-fusion.ts:936: *   2.  Causal boost       (hybrid only — graph-traversal amplification)
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage2-fusion.ts:941: *   4.  Intent weights     (non-hybrid only — G2 prevention)
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage2-fusion.ts:979:  const isHybrid = config.searchType === 'hybrid';
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage2-fusion.ts:982:  // Only for hybrid search type — session attention signals are most meaningful
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage2-fusion.ts:983:  // When the full hybrid result set is available for ordering.
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage2-fusion.ts:1004:  // Uses computeRecencyScore (already imported but previously unused in hybrid path).
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage2-fusion.ts:1044:  // Only for hybrid search type — causal graph traversal is seeded from the
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage2-fusion.ts:1070:  // Appear in the co-activation graph. Matches V1 hybrid-search behavior.
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage2-fusion.ts:1223:  // G2 PREVENTION: Only apply for non-hybrid search types.
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage2-fusion.ts:1224:  // Hybrid search (RRF / RSF) incorporates intent weighting during fusion —
.opencode/skills/system-spec-kit/mcp_server/code_graph/lib/ops-hardening.ts:90:        'fts_consistency',
.opencode/skills/system-spec-kit/mcp_server/code_graph/lib/ops-hardening.ts:93:        'orphan_vectors',
.opencode/skills/system-spec-kit/mcp_server/tests/handler-eval-reporting.vitest.ts:39:vi.mock('../lib/search/vector-index', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/handler-eval-reporting.vitest.ts:44:  vectorSearch: mocks.mockVectorSearch,
.opencode/skills/system-spec-kit/mcp_server/tests/handler-eval-reporting.vitest.ts:47:vi.mock('../lib/search/hybrid-search', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/handler-eval-reporting.vitest.ts:49:  hybridSearchEnhanced: mocks.mockHybridSearchEnhanced,
.opencode/skills/system-spec-kit/mcp_server/tests/handler-eval-reporting.vitest.ts:50:  bm25Search: mocks.mockBm25Search,
.opencode/skills/system-spec-kit/mcp_server/tests/handler-eval-reporting.vitest.ts:51:  ftsSearch: mocks.mockFtsSearch,
.opencode/skills/system-spec-kit/mcp_server/tests/handler-eval-reporting.vitest.ts:106:      channels: ['vector'],
.opencode/skills/system-spec-kit/mcp_server/tests/handler-eval-reporting.vitest.ts:110:        channel: 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/handler-eval-reporting.vitest.ts:250:        ['vector', 'not-real', 'fts5'] as unknown as RunAblationArgs['channels'];
.opencode/skills/system-spec-kit/mcp_server/tests/handler-eval-reporting.vitest.ts:254:      expect(call[1].channels).toEqual(['vector', 'fts5']);
.opencode/skills/system-spec-kit/mcp_server/tests/handler-eval-reporting.vitest.ts:258:      await evalReporting.handleEvalRunAblation({ channels: ['vector'] });
.opencode/skills/system-spec-kit/mcp_server/tests/handler-eval-reporting.vitest.ts:265:      await evalReporting.handleEvalRunAblation({ channels: ['vector'], recallK: 0 });
.opencode/skills/system-spec-kit/mcp_server/tests/handler-eval-reporting.vitest.ts:275:        evalReporting.handleEvalRunAblation({ channels: ['vector'] })
.opencode/skills/system-spec-kit/mcp_server/tests/handler-eval-reporting.vitest.ts:284:        evalReporting.handleEvalRunAblation({ channels: ['vector'] })
.opencode/skills/system-spec-kit/mcp_server/tests/handler-eval-reporting.vitest.ts:290:        channels: ['vector'],
.opencode/skills/system-spec-kit/mcp_server/tests/handler-eval-reporting.vitest.ts:304:        channels: ['vector'],
.opencode/skills/system-spec-kit/mcp_server/tests/handler-eval-reporting.vitest.ts:374:      await evalReporting.handleEvalRunAblation({ channels: ['vector'] });
.opencode/skills/system-spec-kit/mcp_server/tests/handler-eval-reporting.vitest.ts:396:      mocks.mockFtsSearch.mockReturnValue([{ id: 22, score: 0.88, source: 'fts' }]);
.opencode/skills/system-spec-kit/mcp_server/tests/handler-eval-reporting.vitest.ts:397:      mocks.mockBm25Search.mockReturnValue([{ id: 33, score: 0.76, source: 'bm25' }]);
.opencode/skills/system-spec-kit/mcp_server/tests/handler-eval-reporting.vitest.ts:403:        queries: ['hybrid retrieval graph diagnosis'],
.opencode/skills/system-spec-kit/mcp_server/tests/handler-eval-reporting.vitest.ts:408:      expect(graphSearch).toHaveBeenCalledWith('hybrid retrieval graph diagnosis', { limit: 7 });
.opencode/skills/system-spec-kit/mcp_server/tests/handler-eval-reporting.vitest.ts:412:      expect(data.queriesUsed).toEqual(['hybrid retrieval graph diagnosis']);
.opencode/skills/system-spec-kit/mcp_server/tests/handler-eval-reporting.vitest.ts:427:          ? [{ id: 1, score: 0.88, source: 'bm25' }, { id: 2, score: 0.72, source: 'bm25' }]
.opencode/skills/system-spec-kit/mcp_server/tests/handler-eval-reporting.vitest.ts:428:          : [{ id: 4, score: 0.86, source: 'bm25' }, { id: 3, score: 0.74, source: 'bm25' }]
.opencode/skills/system-spec-kit/mcp_server/tests/handler-eval-reporting.vitest.ts:459:        channelFilter: ['vector'],
.opencode/skills/system-spec-kit/mcp_server/tests/handler-eval-reporting.vitest.ts:467:        channelFilter: ['vector'],
.opencode/skills/system-spec-kit/mcp_server/tests/entity-linker.vitest.ts:206:      const entry = catalog.get('bm25 index')!;
.opencode/skills/system-spec-kit/mcp_server/tests/entity-linker.vitest.ts:615:        VALUES ('2', '3', 'supports', 0.7, 'Cross-doc entity: bm25 index', 'entity_linker')`)
.opencode/skills/system-spec-kit/mcp_server/lib/search/entity-linker.ts:104:  'vector': 'embedding',
.opencode/skills/system-spec-kit/mcp_server/lib/search/entity-linker.ts:105:  'vectors': 'embedding',
.opencode/skills/system-spec-kit/mcp_server/lib/search/entity-linker.ts:171: * nounPhrases('How does vector search indexing work?');
.opencode/skills/system-spec-kit/mcp_server/lib/search/entity-linker.ts:172: * // ['vector', 'search', 'indexing', 'work']
.opencode/skills/system-spec-kit/mcp_server/tests/token-budget.vitest.ts:15:} from '../lib/search/hybrid-search';
.opencode/skills/system-spec-kit/mcp_server/tests/token-budget.vitest.ts:21:} from '../lib/search/hybrid-search';
.opencode/skills/system-spec-kit/mcp_server/tests/token-budget.vitest.ts:275:   The formula lives inline in hybrid-search.ts (line ~971).
.opencode/skills/system-spec-kit/mcp_server/tests/token-budget.vitest.ts:281:   * Replicates the inline formula from hybrid-search.ts:
.opencode/skills/system-spec-kit/mcp_server/tests/token-budget.vitest.ts:321:    // Simulate what hybrid-search.ts does: compute adjusted budget, pass to truncateToBudget
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:5:// Split from vector-index-store.ts — contains ALL query/search functions,
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:21:} from './vector-index-types.js';
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:32:} from './vector-index-store.js';
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:33:import { delete_memory_from_database } from './vector-index-mutations.js';
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:39:} from './vector-index-types.js';
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:60: * @throws {VectorIndexError} Propagates store initialization failures from the vector index.
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:158: * Searches indexed memories by vector similarity.
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:162: * @throws {VectorIndexError} Propagates store initialization failures from the vector index.
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:165: * const rows = vector_search(queryEmbedding, { limit: 5, specFolder: 'specs/001-demo' });
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:168:export function vector_search(
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:175:    console.warn('[vector-index] Vector search unavailable - sqlite-vec not loaded');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:322:    console.warn('[vector-index] Multi-concept search unavailable - sqlite-vec not loaded');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:499:    console.warn('[vector-index] extract_tags: invalid content type, expected string');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:551:        console.warn('[vector-index-queries] Date parsing failed', { error: _e instanceof Error ? _e.message : String(_e) });
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:586:    console.warn('[vector-index] Empty query provided for embedding');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:595:    console.warn(`[vector-index] Query embedding failed: ${get_error_message(error)}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:618:    console.warn('[vector-index] keyword_search: invalid query, expected non-empty string');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:624:    console.warn('[vector-index] keyword_search: no valid search terms after tokenization');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:687: * Runs enriched vector search for a text query.
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:692: * @throws {VectorIndexError} Propagates vector-store initialization failures from the underlying search pipeline.
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:695: * const results = await vector_search_enriched('sqlite vec mismatch', 10, { specFolder: 'specs/001-demo' });
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:698:export async function vector_search_enriched(
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:710:  let search_method = 'vector';
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:714:    raw_results = vector_search(query_embedding, {
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:720:    console.warn('[vector-index] Falling back to keyword search');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:737:    const similarity = search_method === 'vector'
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:759:    console.warn(`[vector-index] Enriched search took ${elapsed}ms (target <500ms)`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:775: * @throws {VectorIndexError} When concept validation fails or the vector search pipeline cannot execute.
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:778: * const results = await multi_concept_search_enriched(['sqlite', 'vector'], 10, { specFolder: 'specs/001-demo' });
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:799:        console.warn(`[vector-index] Failed to embed concept: "${concept}"`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:810:    console.warn('[vector-index] Falling back to keyword multi-concept search');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:845:    console.warn(`[vector-index] Multi-concept search took ${elapsed}ms (target <500ms)`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:866:    console.warn('[vector-index] multi_concept_keyword_search: empty concepts array');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:935:    console.warn('[vector-index] parse_quoted_terms: invalid query, expected non-empty string');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1074:    console.warn(`[vector-index] Failed to get related memories for ${memory_id}: ${get_error_message(error)}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1175:    console.warn(`[vector-index] find_cleanup_candidates error: ${get_error_message(e)}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1228:    console.warn(`[vector-index] get_memory_preview query error: ${get_error_message(e)}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1249:    console.warn('[vector-index] get_memory_preview file read warning', {
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1281: * Verifies vector-index consistency and optional cleanup results.
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1288:): { totalMemories: number; totalVectors: number; orphanedVectors: number; missingVectors: number; orphanedFiles: Array<{ id: number; file_path: string; reason: string }>; orphanedChunks: number; isConsistent: boolean; cleaned?: { vectors: number; chunks: number } } {
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1292:  const find_orphaned_vector_ids = () => {
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1294:      console.warn('[vector-index] find_orphaned_vector_ids: sqlite-vec not available');
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1303:      console.warn('[vector-index] Could not query orphaned vectors:', get_error_message(e));
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1308:  const orphaned_vector_ids = find_orphaned_vector_ids();
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1309:  const orphaned_vectors = orphaned_vector_ids.length;
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1311:  let cleaned_vectors = 0;
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1312:  if (autoClean && orphaned_vectors > 0 && sqlite_vec) {
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1313:    logger.info(`Auto-cleaning ${orphaned_vectors} orphaned vectors...`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1315:    for (const rowid of orphaned_vector_ids) {
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1318:        cleaned_vectors++;
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1320:        console.warn(`[vector-index] Failed to clean orphaned vector ${rowid}: ${get_error_message(e)}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1323:    logger.info(`Cleaned ${cleaned_vectors} orphaned vectors`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1328:  const missing_vectors = sqlite_vec
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1337:  const total_vectors = sqlite_vec
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1373:      console.warn('[vector-index] Could not query orphaned chunks:', get_error_message(e));
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1399:        console.warn(`[vector-index] Failed to clean orphaned chunk ${chunk.id}: ${get_error_message(e)}`);
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1409:    totalVectors: total_vectors,
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1410:    orphanedVectors: autoClean ? orphaned_vectors - cleaned_vectors : orphaned_vectors,
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1411:    missingVectors: missing_vectors,
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1414:    isConsistent: (orphaned_vectors - cleaned_vectors) === 0 && missing_vectors === 0 && orphaned_files.length === 0 && effective_orphaned_chunks === 0,
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1415:    cleaned: (autoClean && (cleaned_vectors > 0 || cleaned_chunks > 0))
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1416:      ? { vectors: cleaned_vectors, chunks: cleaned_chunks }
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1427:export { vector_search as vectorSearch };
.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1436:export { vector_search_enriched as vectorSearchEnriched };
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-store-remediation.vitest.ts:15:} from '../lib/search/vector-index-store';
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-store-remediation.vitest.ts:16:import { getMemoriesByFolder, indexMemoryDeferred } from '../lib/search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-store-remediation.vitest.ts:48:describe('vector-index-store remediation regressions', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-comparison.vitest.ts:95:  'create an automated data pipeline for ETL processing with error recovery idempotency and observability instrumentation',
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-comparison.vitest.ts:114: * The vector + fts channels are considered "core" and always return
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-comparison.vitest.ts:261:    const ch2 = simulatedLatencyMs(['vector', 'fts']);
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-comparison.vitest.ts:262:    const ch3 = simulatedLatencyMs(['vector', 'fts', 'bm25']);
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-comparison.vitest.ts:295:    // Simple uses vector + fts (subset of full pipeline)
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-comparison.vitest.ts:365:        expect(result.channels).toEqual(['vector', 'fts', 'bm25', 'graph', 'degree']);
.opencode/skills/system-spec-kit/mcp_server/tests/retrieval-telemetry.vitest.ts:212:    recordFallback(t, 'hybrid search failed');
.opencode/skills/system-spec-kit/mcp_server/tests/retrieval-telemetry.vitest.ts:214:    expect(t.fallback.fallbackReason).toBe('hybrid search failed');
.opencode/skills/system-spec-kit/mcp_server/lib/search/artifact-routing.ts:23:  /** Weight for semantic (vector) search component, 0-1 */
.opencode/skills/system-spec-kit/mcp_server/lib/search/artifact-routing.ts:189:    keywords: ['research', 'investigation', 'analysis', 'findings', 'study', 'evaluation', 'search', 'retrieval', 'pipeline', 'indexing', 'embedding', 'vector', 'semantic'],
.opencode/skills/system-spec-kit/mcp_server/tests/save-quality-gate.vitest.ts:24:import * as vectorIndex from '../lib/search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/tests/save-quality-gate.vitest.ts:26:type VectorDb = NonNullable<ReturnType<typeof vectorIndex.getDb>>;
.opencode/skills/system-spec-kit/mcp_server/tests/save-quality-gate.vitest.ts:49:/** Create a simple embedding vector of given dimension */
.opencode/skills/system-spec-kit/mcp_server/tests/save-quality-gate.vitest.ts:218:      const getDbSpy = vi.spyOn(vectorIndex, 'getDb');
.opencode/skills/system-spec-kit/mcp_server/tests/save-quality-gate.vitest.ts:243:      const getDbSpy = vi.spyOn(vectorIndex, 'getDb').mockReturnValue(asVectorDb(persistedDb.db));
.opencode/skills/system-spec-kit/mcp_server/tests/save-quality-gate.vitest.ts:678:    it('CS1: Identical vectors have similarity 1.0', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/save-quality-gate.vitest.ts:684:    it('CS2: Orthogonal vectors have similarity 0.0', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/save-quality-gate.vitest.ts:690:    it('CS3: Opposite vectors have similarity -1.0', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/save-quality-gate.vitest.ts:696:    it('CS4: Different length vectors return 0', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/save-quality-gate.vitest.ts:702:    it('CS5: Zero vectors return 0', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:15:} from '../lib/search/bm25-index';
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:18:type HybridSearchModule = typeof import('../lib/search/hybrid-search');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:23:let hybridSearch: HybridSearchModule | null = null;
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:26:  hybridSearch = await import('../lib/search/hybrid-search');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:217:      index.addDocument('doc1', 'memory search retrieval document indexing testing vector semantic hybrid bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:222:      index.addDocument('doc1', 'memory search retrieval document indexing testing vector semantic hybrid bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:229:      index.addDocument('doc1', 'memory search retrieval document indexing testing vector semantic hybrid bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:234:      index.addDocument('doc1', 'memory search retrieval document indexing testing vector semantic hybrid bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:241:      index.addDocument('doc1', 'memory search retrieval document indexing testing vector semantic hybrid bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:246:      index.addDocument('doc1', 'memory search retrieval document indexing testing vector semantic hybrid bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:251:      index.addDocument('doc1', 'memory search retrieval document indexing testing vector semantic hybrid bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:252:      index.addDocument('doc2', 'another document context memory retrieval testing search hybrid vector semantic');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:260:        { id: 'bulk1', text: 'first document memory search retrieval testing vector semantic hybrid bm25' },
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:261:        { id: 'bulk2', text: 'second document context retrieval testing memory search semantic vector hybrid' },
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:262:        { id: 'bulk3', text: 'third document testing memory retrieval search vector semantic bm25 hybrid' },
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:274:      index.addDocument('doc1', 'memory search retrieval document indexing testing vector semantic hybrid bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:292:        { id: 'doc1', text: 'memory retrieval search testing document indexing vector semantic hybrid bm25' },
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:293:        { id: 'doc2', text: 'memory context search document retrieval testing vector semantic hybrid bm25' },
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:294:        { id: 'doc3', text: 'another document different context testing retrieval search vector semantic hybrid' },
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:337:        { id: 'doc1', text: 'memory memory memory retrieval search testing document indexing vector semantic' },
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:338:        { id: 'doc2', text: 'memory context search document retrieval testing vector semantic hybrid bm25' },
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:339:        { id: 'doc3', text: 'another document different context testing retrieval search vector semantic hybrid' },
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:384:      idx.addDocument('sf1', 'memory retrieval search testing document indexing vector semantic hybrid bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:385:      idx.addDocument('sf2', 'memory retrieval search testing document indexing vector semantic hybrid bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:418:      index.addDocument('test', 'memory retrieval search testing document indexing vector semantic hybrid bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:444:      idx.addDocument('test', 'memory retrieval search testing document indexing vector semantic hybrid bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:452:     T038: BM25 integration with hybrid search pipeline
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:455:  describe('T038: BM25 integration with hybrid search pipeline', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:456:    it.skipIf(!hybridSearch)('T038.1: bm25Search exported from hybrid-search', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:457:      expect(typeof hybridSearch!.bm25Search).toBe('function');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:460:    it.skipIf(!hybridSearch)('T038.2: isBm25Available exported from hybrid-search', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:461:      expect(typeof hybridSearch!.isBm25Available).toBe('function');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:464:    it.skipIf(!hybridSearch)('T038.3: hybridSearchEnhanced exported', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:465:      expect(typeof hybridSearch!.hybridSearchEnhanced).toBe('function');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:468:    it.skipIf(!hybridSearch)('T038.4: isBm25Available() true when index populated', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:470:      const bm25idx = getIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:471:      bm25idx.addDocument('int1', 'memory retrieval search testing document indexing vector semantic hybrid integration');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:472:      bm25idx.addDocument('int2', 'context memory search testing retrieval document vector semantic hybrid integration');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:473:      const available = hybridSearch!.isBm25Available();
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:481:    it.skipIf(!hybridSearch)('T038.5: bm25Search returns results via hybrid-search', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:483:      const bm25idx = getIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:484:      bm25idx.addDocument('int1', 'memory retrieval search testing document indexing vector semantic hybrid integration');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:485:      bm25idx.addDocument('int2', 'context memory search testing retrieval document vector semantic hybrid integration');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:486:      const results = hybridSearch!.bm25Search('memory search', { limit: 5 });
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:491:    it.skipIf(!hybridSearch)('T038.6: Legacy camelCase aliases available', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:492:      expect(typeof hybridSearch!.bm25Search).toBe('function');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:493:      expect(typeof hybridSearch!.isBm25Available).toBe('function');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:502:    it.skipIf(!hybridSearch)('T039.1: combinedLexicalSearch exported', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:503:      expect(typeof hybridSearch!.combinedLexicalSearch).toBe('function');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:506:    it.skipIf(!hybridSearch)('T039.2: combinedLexicalSearch returns array', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:508:      const results = hybridSearch!.combinedLexicalSearch('test query', { limit: 10 });
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:512:    it.skipIf(!hybridSearch)('T039.3: combinedLexicalSearch returns BM25 results', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:514:      const bm25comb = getIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:515:      bm25comb.addDocument('comb1', 'memory retrieval search testing document indexing vector semantic hybrid combined');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:516:      bm25comb.addDocument('comb2', 'context memory search testing retrieval document vector semantic hybrid combined');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:517:      const results = hybridSearch!.combinedLexicalSearch('memory search', { limit: 5 });
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:521:    it.skipIf(!hybridSearch)('T039.4: Results include score', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:523:      const bm25 = getIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:524:      bm25.addDocument('comb1', 'memory retrieval search testing document indexing vector semantic hybrid combined');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:525:      const results = hybridSearch!.combinedLexicalSearch('memory', { limit: 5 });
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:530:    it.skipIf(!hybridSearch)('T039.5: Results include source or bm25 score', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:532:      const bm25 = getIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:533:      bm25.addDocument('comb1', 'memory retrieval search testing document indexing vector semantic hybrid combined');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:534:      const results = hybridSearch!.combinedLexicalSearch('memory', { limit: 5 });
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:541:    it.skipIf(!hybridSearch)('T039.6: Results include combined or bm25 score', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:543:      const bm25 = getIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:544:      bm25.addDocument('comb1', 'memory retrieval search testing document indexing vector semantic hybrid combined');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:545:      const results = hybridSearch!.combinedLexicalSearch('memory', { limit: 5 });
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:552:    it.skipIf(!hybridSearch || !isBm25Enabled())('T039.7: Respects limit parameter', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:554:      const bm25 = getIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:555:      bm25.addDocument('comb1', 'memory retrieval search testing document indexing vector semantic hybrid combined');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:556:      bm25.addDocument('comb2', 'context memory search testing retrieval document vector semantic hybrid combined');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:557:      const results = hybridSearch!.combinedLexicalSearch('memory', { limit: 1 });
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:561:    it.skipIf(!hybridSearch || !isBm25Enabled())('T039.8: combinedLexicalSearch returns results', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:563:      const bm25 = getIndex();
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:564:      bm25.addDocument('filt1', 'memory retrieval search testing document indexing vector semantic hybrid filter');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:565:      bm25.addDocument('filt2', 'memory retrieval search testing document indexing vector semantic hybrid filter');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:566:      const results = hybridSearch!.combinedLexicalSearch('memory', { limit: 10 });
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:571:    it.skipIf(!hybridSearch)('T039.9: Legacy alias combinedLexicalSearch available', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:572:      expect(typeof hybridSearch!.combinedLexicalSearch).toBe('function');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:615:      trigger_phrases: ['hybrid-search', 'bm25-sync'],
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:621:    expect(text).toContain('hybrid-search');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:622:    expect(text).toContain('bm25-sync');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:715:    vi.doMock('../lib/search/vector-index', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:729:    vi.doMock('../lib/search/bm25-index', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:814:      throw new Error('bad bm25 payload');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:819:      .toThrow('BM25 re-index failed: bad bm25 payload');
.opencode/skills/system-spec-kit/mcp_server/tests/description/fixtures/017-review-findings-remediation.description.json:6:  "description": "Remediation charter for 27 consolidated tasks closing the Phase 017 review backlog across four waves. The headline fix is H-56-1: the canonical `/memory:save` path had been a deterministic metadata-freshness no-op because of a dead-code guard, a full-auto-only graph refresh gate, and the default plan-only execution mode; the packet also closes the code-graph readiness asymmetry, the Copilot compact-cache observability gap, the session-resume auth binding work, and the deferred maintainability follow-ups that Phase 018 depends on for traceable recovery and rollout hygiene.",
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-quality-filter.vitest.ts:174:  it('falls back to snake_case context_type for hybrid rows', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/handler-checkpoints-edge.vitest.ts:4:import * as vectorIndex from '../lib/search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/tests/handler-checkpoints-edge.vitest.ts:92:      vectorIndex,
.opencode/skills/system-spec-kit/mcp_server/tests/handler-checkpoints-edge.vitest.ts:95:    const db = vectorIndex.initializeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/handler-checkpoints-edge.vitest.ts:100:    vectorIndex.closeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/handler-checkpoints-edge.vitest.ts:211:    const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/tests/errors-comprehensive.vitest.ts:12:} from '../lib/errors/recovery-hints';
.opencode/skills/system-spec-kit/mcp_server/tests/errors-comprehensive.vitest.ts:108:  it('B10: recoveryHint undefined by default', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/errors-comprehensive.vitest.ts:110:    expect(err.recoveryHint).toBeUndefined();
.opencode/skills/system-spec-kit/mcp_server/tests/errors-comprehensive.vitest.ts:352:  it('G3: recoveryHint attached when toolName provided', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/errors-comprehensive.vitest.ts:354:    expect(err.recoveryHint).toBeDefined();
.opencode/skills/system-spec-kit/mcp_server/tests/errors-comprehensive.vitest.ts:355:    expect(typeof err.recoveryHint!.hint).toBe('string');
.opencode/skills/system-spec-kit/mcp_server/tests/errors-comprehensive.vitest.ts:358:  it('G4: No recoveryHint when toolName is null', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/errors-comprehensive.vitest.ts:360:    expect(err.recoveryHint).toBeUndefined();
.opencode/skills/system-spec-kit/mcp_server/tests/errors-comprehensive.vitest.ts:365:   H. ERROR_CODES (recovery-hints.ts)
.opencode/skills/system-spec-kit/mcp_server/tests/errors-comprehensive.vitest.ts:368:describe('H. ERROR_CODES (recovery-hints.ts)', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/db-dimension-integrity.vitest.ts:7:import { close_db, getEmbeddingDim, initializeDb } from '../lib/search/vector-index-store';
.opencode/skills/system-spec-kit/mcp_server/code_graph/README.md:168:| **Runtime startup hooks** (Claude/Gemini/Copilot `session-prime.ts`, Codex `session-start.ts`) | Yes | Yes | Same `graphQualitySummary` + `sharedPayloadTransport` envelope delivered through the hook-specific transport for each runtime | All four supported runtimes transport the same compact startup payload; `session_bootstrap()` remains available as a manual recovery path rather than a Codex-only substitute |
.opencode/skills/system-spec-kit/mcp_server/tests/session-bootstrap-gate-d.vitest.ts:84:      'Use `session_resume({ specFolder })` when you need the fuller merged recovery payload.',
.opencode/skills/system-spec-kit/mcp_server/tests/session-bootstrap-gate-d.vitest.ts:85:      'Resume recovery follows `handover.md` -> `_memory.continuity` -> spec docs.',
.opencode/skills/system-spec-kit/mcp_server/tests/integration-search-pipeline.vitest.ts:5:import * as hybridSearch from '../lib/search/hybrid-search';
.opencode/skills/system-spec-kit/mcp_server/tests/integration-search-pipeline.vitest.ts:6:import * as vectorIndex from '../lib/search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/tests/integration-search-pipeline.vitest.ts:7:import * as bm25Index from '../lib/search/bm25-index';
.opencode/skills/system-spec-kit/mcp_server/tests/integration-search-pipeline.vitest.ts:50:        { name: 'hybridSearch', ref: hybridSearch },
.opencode/skills/system-spec-kit/mcp_server/tests/integration-search-pipeline.vitest.ts:51:        { name: 'vectorIndex', ref: vectorIndex },
.opencode/skills/system-spec-kit/mcp_server/tests/integration-search-pipeline.vitest.ts:52:        { name: 'bm25Index', ref: bm25Index },
.opencode/skills/system-spec-kit/mcp_server/tests/chunking-orchestrator-swap.vitest.ts:28:vi.mock('../lib/search/vector-index', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/chunking-orchestrator-swap.vitest.ts:70:vi.mock('../lib/search/bm25-index', () => ({
.opencode/skills/system-spec-kit/mcp_server/tests/chunking-orchestrator-swap.vitest.ts:103:import * as vectorIndex from '../lib/search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/tests/chunking-orchestrator-swap.vitest.ts:104:import * as bm25Index from '../lib/search/bm25-index';
.opencode/skills/system-spec-kit/mcp_server/tests/chunking-orchestrator-swap.vitest.ts:226:  vi.mocked(vectorIndex.indexMemory).mockImplementation((params) => insertIndexedRow(params, 'success'));
.opencode/skills/system-spec-kit/mcp_server/tests/chunking-orchestrator-swap.vitest.ts:227:  vi.mocked(vectorIndex.indexMemoryDeferred).mockImplementation((params) => insertIndexedRow(params, 'pending'));
.opencode/skills/system-spec-kit/mcp_server/tests/chunking-orchestrator-swap.vitest.ts:228:  vi.mocked(vectorIndex.deleteMemory).mockImplementation((id: number) => {
.opencode/skills/system-spec-kit/mcp_server/tests/chunking-orchestrator-swap.vitest.ts:400:    const deleteMemoryCalls = vi.mocked(vectorIndex.deleteMemory).mock.calls.map(([memoryId]) => memoryId);
.opencode/skills/system-spec-kit/mcp_server/tests/chunking-orchestrator-swap.vitest.ts:447:    const deleteMemoryCalls = vi.mocked(vectorIndex.deleteMemory).mock.calls.map(([memoryId]) => memoryId);
.opencode/skills/system-spec-kit/mcp_server/tests/chunking-orchestrator-swap.vitest.ts:456:    const realDelete = vi.mocked(vectorIndex.deleteMemory).getMockImplementation();
.opencode/skills/system-spec-kit/mcp_server/tests/chunking-orchestrator-swap.vitest.ts:457:    vi.mocked(vectorIndex.deleteMemory).mockImplementation((id: number) => {
.opencode/skills/system-spec-kit/mcp_server/tests/chunking-orchestrator-swap.vitest.ts:502:    expect(vi.mocked(vectorIndex.indexMemoryDeferred).mock.calls.length).toBeGreaterThanOrEqual(1);
.opencode/skills/system-spec-kit/mcp_server/tests/chunking-orchestrator-swap.vitest.ts:503:    expect(vi.mocked(vectorIndex.indexMemory).mock.calls.length).toBeGreaterThanOrEqual(1);
.opencode/skills/system-spec-kit/mcp_server/tests/chunking-orchestrator-swap.vitest.ts:563:    const filePath = '/tmp/specs/test-safe-swap/memory-bm25-rollback.md';
.opencode/skills/system-spec-kit/mcp_server/tests/chunking-orchestrator-swap.vitest.ts:567:    const bm25AddDocument = vi.fn();
.opencode/skills/system-spec-kit/mcp_server/tests/chunking-orchestrator-swap.vitest.ts:568:    const bm25RemoveDocument = vi.fn();
.opencode/skills/system-spec-kit/mcp_server/tests/chunking-orchestrator-swap.vitest.ts:569:    vi.mocked(bm25Index.isBm25Enabled).mockReturnValue(true);
.opencode/skills/system-spec-kit/mcp_server/tests/chunking-orchestrator-swap.vitest.ts:570:    vi.mocked(bm25Index.getIndex).mockReturnValue({
.opencode/skills/system-spec-kit/mcp_server/tests/chunking-orchestrator-swap.vitest.ts:571:      addDocument: bm25AddDocument,
.opencode/skills/system-spec-kit/mcp_server/tests/chunking-orchestrator-swap.vitest.ts:572:      removeDocument: bm25RemoveDocument,
.opencode/skills/system-spec-kit/mcp_server/tests/chunking-orchestrator-swap.vitest.ts:573:    } as unknown as ReturnType<typeof bm25Index.getIndex>);
.opencode/skills/system-spec-kit/mcp_server/tests/chunking-orchestrator-swap.vitest.ts:583:    expect(bm25AddDocument).not.toHaveBeenCalledWith(String(parentId), expect.any(String));
.opencode/skills/system-spec-kit/mcp_server/tests/chunking-orchestrator-swap.vitest.ts:584:    expect(bm25AddDocument).not.toHaveBeenCalled();
.opencode/skills/system-spec-kit/mcp_server/tests/calibrated-overlap-bonus.vitest.ts:196:      { source: SOURCE_TYPES.BM25,   results: [{ id: 'only-bm25', title: 'B' }] },
.opencode/skills/system-spec-kit/mcp_server/tests/calibrated-overlap-bonus.vitest.ts:199:    const bm25Only = fused.find(r => r.id === 'only-bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/calibrated-overlap-bonus.vitest.ts:201:    expect(bm25Only?.convergenceBonus).toBe(0);
.opencode/skills/system-spec-kit/mcp_server/tests/calibrated-overlap-bonus.vitest.ts:240:        { id: 'bm25-only', title: 'B' },
.opencode/skills/system-spec-kit/mcp_server/tests/encoding-intent.vitest.ts:69:      'The team discussed several options and ultimately chose to implement RRF',
.opencode/skills/system-spec-kit/mcp_server/tests/encoding-intent.vitest.ts:74:      'We evaluated BM25, vector search, and hybrid approaches. The hybrid',
.opencode/skills/system-spec-kit/mcp_server/tests/encoding-intent.vitest.ts:350:      'independently. The retrieval stage handles both BM25 and vector',
.opencode/skills/system-spec-kit/mcp_server/tests/encoding-intent.vitest.ts:408:    const vectorIndex = await import('../lib/search/vector-index');
.opencode/skills/system-spec-kit/mcp_server/tests/encoding-intent.vitest.ts:409:    vectorIndex.initializeDb(dbPath);
.opencode/skills/system-spec-kit/mcp_server/tests/encoding-intent.vitest.ts:410:    const embeddingDim = vectorIndex.getEmbeddingDim();
.opencode/skills/system-spec-kit/mcp_server/tests/encoding-intent.vitest.ts:412:    const memoryId = vectorIndex.indexMemory({
.opencode/skills/system-spec-kit/mcp_server/tests/encoding-intent.vitest.ts:423:    const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/tests/encoding-intent.vitest.ts:428:    vectorIndex.closeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/encoding-intent.vitest.ts:439:    const vectorIndex = await import('../lib/search/vector-index');
.opencode/skills/system-spec-kit/mcp_server/tests/encoding-intent.vitest.ts:440:    vectorIndex.initializeDb(dbPath);
.opencode/skills/system-spec-kit/mcp_server/tests/encoding-intent.vitest.ts:442:    const memoryId = vectorIndex.indexMemoryDeferred({
.opencode/skills/system-spec-kit/mcp_server/tests/encoding-intent.vitest.ts:453:    const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/tests/encoding-intent.vitest.ts:458:    vectorIndex.closeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-schema-compatibility.vitest.ts:3:import { SCHEMA_VERSION, validateBackwardCompatibility } from '../lib/search/vector-index-schema';
.opencode/skills/system-spec-kit/mcp_server/tests/schema-migration.vitest.ts:6:import * as vectorIndex from '../lib/search/vector-index.js';
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-pipeline-enforcement.vitest.ts:7:import * as vectorIndex from '../lib/search/vector-index';
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-pipeline-enforcement.vitest.ts:208:  mandatorySections['recovery-hints'] = `
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-pipeline-enforcement.vitest.ts:209:${removeAnchors.includes('recovery-hints') ? '' : '<!-- ANCHOR:recovery-hints -->'}
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-pipeline-enforcement.vitest.ts:213:- If this fixture starts failing insufficiency again, add more concrete file, decision, blocker, next action, or outcome evidence instead of weakening the gate.
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-pipeline-enforcement.vitest.ts:216:${removeAnchors.includes('recovery-hints') ? '' : '<!-- /ANCHOR:recovery-hints -->'}
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-pipeline-enforcement.vitest.ts:255:${mandatorySections['recovery-hints'] ?? ''}
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-pipeline-enforcement.vitest.ts:278:  const db = vectorIndex.getDb();
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-pipeline-enforcement.vitest.ts:300:    vectorIndex.closeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-pipeline-enforcement.vitest.ts:304:  vectorIndex.initializeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-pipeline-enforcement.vitest.ts:321:    vectorIndex.closeDb();
.opencode/skills/system-spec-kit/mcp_server/tests/learned-combiner.vitest.ts:268:      // Add a 9th example (zero vector) to anchor the bias
.opencode/skills/system-spec-kit/mcp_server/tests/learned-combiner.vitest.ts:280:      // Verify bias is close to the zero-vector label
.opencode/skills/system-spec-kit/mcp_server/tests/envelope.vitest.ts:60:        data: { searchType: 'hybrid', count: 5, results: ['a', 'b', 'c', 'd', 'e'] },
.opencode/skills/system-spec-kit/mcp_server/tests/envelope.vitest.ts:65:      expect(envelope.data.searchType).toBe('hybrid');
.opencode/skills/system-spec-kit/mcp_server/tests/envelope.vitest.ts:173:  describe('T152: createErrorResponse() includes recovery hints', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/envelope.vitest.ts:204:    it('should include recovery hints from recovery object', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/envelope.vitest.ts:208:        recovery: {
.opencode/skills/system-spec-kit/mcp_server/tests/envelope.vitest.ts:231:    it('should set severity from recovery object', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/envelope.vitest.ts:235:        recovery: { severity: 'critical' }
.opencode/skills/system-spec-kit/mcp_server/tests/db-state-graph-reinit.vitest.ts:31:    const vectorIndex = {
.opencode/skills/system-spec-kit/mcp_server/tests/db-state-graph-reinit.vitest.ts:35:      vectorSearch: vi.fn(),
.opencode/skills/system-spec-kit/mcp_server/tests/db-state-graph-reinit.vitest.ts:40:    const hybridSearch = { init: vi.fn() };
.opencode/skills/system-spec-kit/mcp_server/tests/db-state-graph-reinit.vitest.ts:45:      vectorIndex,
.opencode/skills/system-spec-kit/mcp_server/tests/db-state-graph-reinit.vitest.ts:48:      hybridSearch,
.opencode/skills/system-spec-kit/mcp_server/tests/db-state-graph-reinit.vitest.ts:56:    expect(vectorIndex.closeDb).toHaveBeenCalled();
.opencode/skills/system-spec-kit/mcp_server/tests/db-state-graph-reinit.vitest.ts:57:    expect(vectorIndex.initializeDb).toHaveBeenCalled();
.opencode/skills/system-spec-kit/mcp_server/tests/db-state-graph-reinit.vitest.ts:58:    expect(hybridSearch.init).toHaveBeenCalledWith(fakeDb, vectorIndex.vectorSearch, fakeGraphFn);
.opencode/skills/system-spec-kit/mcp_server/tests/db-state-graph-reinit.vitest.ts:72:      const vectorIndex = {
.opencode/skills/system-spec-kit/mcp_server/tests/db-state-graph-reinit.vitest.ts:76:        vectorSearch: vi.fn(),
.opencode/skills/system-spec-kit/mcp_server/tests/db-state-graph-reinit.vitest.ts:80:      const hybridSearch = { init: vi.fn() };
.opencode/skills/system-spec-kit/mcp_server/tests/db-state-graph-reinit.vitest.ts:85:        vectorIndex,
.opencode/skills/system-spec-kit/mcp_server/tests/db-state-graph-reinit.vitest.ts:88:        hybridSearch,
.opencode/skills/system-spec-kit/mcp_server/tests/db-state-graph-reinit.vitest.ts:99:      expect(vectorIndex.initializeDb).toHaveBeenCalledTimes(2);
.opencode/skills/system-spec-kit/mcp_server/tests/db-state-graph-reinit.vitest.ts:112:    const vectorIndex = {
.opencode/skills/system-spec-kit/mcp_server/tests/db-state-graph-reinit.vitest.ts:116:      vectorSearch: vi.fn(),
.opencode/skills/system-spec-kit/mcp_server/tests/db-state-graph-reinit.vitest.ts:120:    const hybridSearch = { init: vi.fn() };
.opencode/skills/system-spec-kit/mcp_server/tests/db-state-graph-reinit.vitest.ts:125:      vectorIndex,
.opencode/skills/system-spec-kit/mcp_server/tests/db-state-graph-reinit.vitest.ts:128:      hybridSearch,
.opencode/skills/system-spec-kit/mcp_server/tests/db-state-graph-reinit.vitest.ts:138:  it('rebinds all registered database consumers when the vector index swaps connections directly', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/db-state-graph-reinit.vitest.ts:143:    const vectorIndex = {
.opencode/skills/system-spec-kit/mcp_server/tests/db-state-graph-reinit.vitest.ts:147:      vectorSearch: vi.fn(),
.opencode/skills/system-spec-kit/mcp_server/tests/db-state-graph-reinit.vitest.ts:158:    const hybridSearch = { init: vi.fn() };
.opencode/skills/system-spec-kit/mcp_server/tests/db-state-graph-reinit.vitest.ts:164:      vectorIndex,
.opencode/skills/system-spec-kit/mcp_server/tests/db-state-graph-reinit.vitest.ts:167:      hybridSearch,
.opencode/skills/system-spec-kit/mcp_server/tests/db-state-graph-reinit.vitest.ts:174:    expect(vectorIndex.onDatabaseConnectionChange).toHaveBeenCalledTimes(1);
.opencode/skills/system-spec-kit/mcp_server/tests/db-state-graph-reinit.vitest.ts:181:    expect(hybridSearch.init).toHaveBeenCalledWith(reboundDb, vectorIndex.vectorSearch, null);
.opencode/skills/system-spec-kit/mcp_server/tests/db-state-graph-reinit.vitest.ts:187:  it('logs when a direct vector-index rebind listener returns false', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/db-state-graph-reinit.vitest.ts:193:    const vectorIndex = {
.opencode/skills/system-spec-kit/mcp_server/tests/db-state-graph-reinit.vitest.ts:197:      vectorSearch: vi.fn(),
.opencode/skills/system-spec-kit/mcp_server/tests/db-state-graph-reinit.vitest.ts:207:      vectorIndex,
.opencode/skills/system-spec-kit/mcp_server/tests/db-state-graph-reinit.vitest.ts:210:      hybridSearch: { init: vi.fn() },
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-integration.vitest.ts:46:import * as vectorIndex from '../lib/search/vector-index.js';
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-integration.vitest.ts:47:import * as hybridSearch from '../lib/search/hybrid-search.js';
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-integration.vitest.ts:53:const VECTOR_INDEX_QUERIES_SOURCE = fs.readFileSync(path.join(SERVER_ROOT, 'lib', 'search', 'vector-index-queries.ts'), 'utf-8');
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-integration.vitest.ts:54:const HYBRID_SEARCH_SOURCE = fs.readFileSync(path.join(SERVER_ROOT, 'lib', 'search', 'hybrid-search.ts'), 'utf-8');
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-integration.vitest.ts:55:const VECTOR_INDEX_SCHEMA_SOURCE = fs.readFileSync(path.join(SERVER_ROOT, 'lib', 'search', 'vector-index-schema.ts'), 'utf-8');
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-integration.vitest.ts:197:      expect(typeof vectorIndex.multiConceptSearch).toBe('function');
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-integration.vitest.ts:234:    it('T631: hybrid-search.js loads', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-integration.vitest.ts:235:      expect(hybridSearch).toBeTruthy();
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-integration.vitest.ts:238:    it('T632: hybridSearch function exported', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-integration.vitest.ts:239:      expect(typeof hybridSearch.hybridSearch).toBe('function');
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-integration.vitest.ts:243:      expect(typeof hybridSearch.searchWithFallback).toBe('function');
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-integration.vitest.ts:247:      expect(typeof hybridSearch.isFtsAvailable).toBe('function');
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-integration.vitest.ts:252:      // that verifies hybridSearch output uses fuseResultsMulti ranking.
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-integration.vitest.ts:256:    it('T636: Hybrid combines vector + FTS', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-integration.vitest.ts:259:      expect(HYBRID_SEARCH_SOURCE).toContain('hybridSearchEnhanced');
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-integration.vitest.ts:262:    it('T637: RRF fusion available for hybrid ranking', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-integration.vitest.ts:266:    it('T638: Deduplication handled in RRF fusion', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-integration.vitest.ts:268:        { source: 'vector', results: [{ id: 1 }, { id: 2 }] },
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-integration.vitest.ts:273:      expect(item!.sources).toContain('vector');
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-integration.vitest.ts:277:    it('T639: searchWithFallback falls back to FTS after empty hybrid results', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-integration.vitest.ts:280:      expect(HYBRID_SEARCH_SOURCE).toContain('const ftsResults = ftsSearch(query, options);');
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-integration.vitest.ts:281:      expect(HYBRID_SEARCH_SOURCE).toContain('if (ftsResults.length > 0) return ftsResults;');
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-integration.vitest.ts:286:      expect(HYBRID_SEARCH_SOURCE).toContain('const bm25Results = bm25Search(query, options);');
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-integration.vitest.ts:287:      expect(HYBRID_SEARCH_SOURCE).toContain('if (bm25Results.length > 0) return bm25Results;');
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-integration.vitest.ts:389:    it.todo('hybrid search fallback chain works end-to-end (requires DB fixture)');
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-integration.vitest.ts:392:    it.todo('searchWithFallback cascades through vector -> FTS -> BM25 (requires DB fixture)');
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-schema-migration-refinements.vitest.ts:10:} from '../lib/search/vector-index-schema';
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-schema-migration-refinements.vitest.ts:22:describe('vector-index schema migration refinements', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search-flags.vitest.ts:7:import * as hybridSearch from '../lib/search/hybrid-search';
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search-flags.vitest.ts:9:type HybridSearchOptions = NonNullable<Parameters<typeof hybridSearch.hybridSearchEnhanced>[2]>;
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search-flags.vitest.ts:10:type VectorSearchFn = NonNullable<Parameters<typeof hybridSearch.init>[1]>;
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search-flags.vitest.ts:16:  source: 'vector';
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search-flags.vitest.ts:32:        if (sql.includes('sqlite_master') && sql.includes('memory_fts')) {
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search-flags.vitest.ts:52:    { id: 1, similarity: 0.91, score: 0.91, source: 'vector' },
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search-flags.vitest.ts:53:    { id: 2, similarity: 0.88, score: 0.88, source: 'vector' },
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search-flags.vitest.ts:54:    { id: 3, similarity: 0.85, score: 0.85, source: 'vector' },
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search-flags.vitest.ts:62:    hybridSearch.init(createMockDb(), mockVectorSearch);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search-flags.vitest.ts:67:    await hybridSearch.hybridSearchEnhanced('test query', embedding, { limit: 3 } satisfies HybridSearchOptions);
.opencode/skills/system-spec-kit/mcp_server/tests/hybrid-search-flags.vitest.ts:74:    await hybridSearch.hybridSearchEnhanced('test query', embedding, { limit: 3 } satisfies HybridSearchOptions);
.opencode/skills/system-spec-kit/mcp_server/tests/folder-relevance.vitest.ts:422:        makeResult(1, 0.9, { title: 'Memory One', source: 'vector', customField: 42 }),
.opencode/skills/system-spec-kit/mcp_server/tests/folder-relevance.vitest.ts:423:        makeResult(2, 0.7, { title: 'Memory Two', source: 'bm25' }),
.opencode/skills/system-spec-kit/mcp_server/tests/folder-relevance.vitest.ts:434:      expect((enriched[0] as Record<string, unknown>).source).toBe('vector');
.opencode/skills/system-spec-kit/mcp_server/tests/folder-relevance.vitest.ts:437:      expect((enriched[1] as Record<string, unknown>).source).toBe('bm25');
.opencode/skills/system-spec-kit/mcp_server/tests/memory-summaries.vitest.ts:48:  // Normalize to unit vector for meaningful cosine similarity
.opencode/skills/system-spec-kit/mcp_server/tests/memory-summaries.vitest.ts:290:      'The system uses vector embeddings for semantic search.',
.opencode/skills/system-spec-kit/mcp_server/tests/memory-summaries.vitest.ts:313:      'Cosine similarity measures vector closeness.',
.opencode/skills/system-spec-kit/mcp_server/tests/memory-summaries.vitest.ts:327:      'Beta sentence about embedding generation and vector storage.',
.opencode/skills/system-spec-kit/mcp_server/tests/memory-summaries.vitest.ts:451:    await generateAndStoreSummary(db, 1, 'The search pipeline retrieves documents using vector similarity over embedding space.', mockEmbeddingFn);
.opencode/skills/system-spec-kit/mcp_server/tests/memory-summaries.vitest.ts:453:    await generateAndStoreSummary(db, 3, 'The retrieval system uses semantic search and vector embeddings for matching.', mockEmbeddingFn);
.opencode/skills/system-spec-kit/mcp_server/tests/memory-summaries.vitest.ts:456:    const queryEmb = await mockEmbeddingFn('search pipeline vector similarity retrieval');
.opencode/skills/system-spec-kit/mcp_server/tests/memory-summaries.vitest.ts:586:  it('returns 1.0 for identical vectors', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/memory-summaries.vitest.ts:591:  it('returns 0 for orthogonal vectors', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/memory-summaries.vitest.ts:597:  it('returns -1.0 for opposite vectors', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/memory-summaries.vitest.ts:603:  it('returns 0 for zero-length vectors', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/session-manager-extended.vitest.ts:513:      // After recovery, session should be reactivated
.opencode/skills/system-spec-kit/mcp_server/tests/session-manager-extended.vitest.ts:525:    it('rejects recovery when bound identity mismatches', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/memory-lineage-state.vitest.ts:4:import { createSchema, ensureSchemaVersion, validateLineageSchemaSupport } from '../lib/search/vector-index-schema';
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-store.vitest.ts:12:} from '../lib/search/vector-index-store';
.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-store.vitest.ts:59:describe('vector-index-store constitutional cache isolation', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/shadow-scoring-holdout.vitest.ts:1329:    expect(tableNames).not.toContain('memory_fts');
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-4-stage-search-pipeline.vitest.ts:83:describe('Gate D regression 13 — 4-stage search pipeline / RRF fusion', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-4-stage-search-pipeline.vitest.ts:95:  it('keeps only canonical reader sources in the final RRF-ranked response and never revives legacy memory fallback rows', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-4-stage-search-pipeline.vitest.ts:105:          sources: ['vector', 'fts'],
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-4-stage-search-pipeline.vitest.ts:115:          sources: ['vector', 'graph'],
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-4-stage-search-pipeline.vitest.ts:124:          sources: ['fts'],
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-4-stage-search-pipeline.vitest.ts:134:          sources: ['vector'],
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-4-stage-search-pipeline.vitest.ts:143:          sources: ['fts'],
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-4-stage-search-pipeline.vitest.ts:148:          searchType: 'hybrid',
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-4-stage-search-pipeline.vitest.ts:205:    expect(stage1.searchType).toBe('hybrid');
.opencode/skills/system-spec-kit/mcp_server/tests/mcp-response-envelope.vitest.ts:52:    fts_score: 0.42,
.opencode/skills/system-spec-kit/mcp_server/tests/mcp-response-envelope.vitest.ts:62:    source: 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/mcp-response-envelope.vitest.ts:63:    sources: ['vector', 'fts'],
.opencode/skills/system-spec-kit/mcp_server/tests/mcp-response-envelope.vitest.ts:71:        vector: [101],
.opencode/skills/system-spec-kit/mcp_server/tests/mcp-response-envelope.vitest.ts:72:        fts: [101],
.opencode/skills/system-spec-kit/mcp_server/tests/mcp-response-envelope.vitest.ts:82:    const response = await formatSearchResults([createMockResult()], 'hybrid');
.opencode/skills/system-spec-kit/mcp_server/tests/mcp-response-envelope.vitest.ts:92:    const response = await formatSearchResults([createMockResult()], 'hybrid');
.opencode/skills/system-spec-kit/mcp_server/tests/mcp-response-envelope.vitest.ts:104:      'hybrid',
.opencode/skills/system-spec-kit/mcp_server/tests/mcp-response-envelope.vitest.ts:115:                channel: 'vector',
.opencode/skills/system-spec-kit/mcp_server/tests/mcp-response-envelope.vitest.ts:116:                channels: ['vector', 'fts'],
.opencode/skills/system-spec-kit/mcp_server/tests/mcp-response-envelope.vitest.ts:162:    expect(result.trace?.channelsUsed).toEqual(expect.arrayContaining(['vector', 'fts']));
.opencode/skills/system-spec-kit/mcp_server/tests/mcp-response-envelope.vitest.ts:188:      'hybrid',
.opencode/skills/system-spec-kit/mcp_server/code_graph/tests/code-graph-query-handler.vitest.ts:645:  it('aggregates payload-level edge trust from the weakest returned edge', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-baseline.vitest.ts:43:} from '../lib/eval/bm25-baseline';
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-baseline.vitest.ts:83:      source: 'bm25',
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-baseline.vitest.ts:113:    expect(result.bm25MRR).toBe(0.85);
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-baseline.vitest.ts:121:    expect(result.bm25MRR).toBe(0.65);
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-baseline.vitest.ts:129:    expect(result.bm25MRR).toBe(0.30);
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-baseline.vitest.ts:130:    expect(result.interpretation).toContain('weak');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-baseline.vitest.ts:166:    // BM25=0.72, hybrid=0.80 → ratio=0.90 → PAUSE
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-baseline.vitest.ts:171:    expect(result.hybridMRR).toBe(0.80);
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-baseline.vitest.ts:176:    // BM25=0.40, hybrid=0.70 → ratio=0.571 → RATIONALIZE
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-baseline.vitest.ts:184:    // BM25=0.20, hybrid=0.75 → ratio=0.267 → PROCEED
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-baseline.vitest.ts:193:    // BM25=0.40, hybrid=0.50 → ratio=0.80 exactly
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-baseline.vitest.ts:200:    // BM25=0.25, hybrid=0.50 → ratio=0.50 exactly
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-baseline.vitest.ts:206:  it('T008.18: hybridMRR=0 → safe fallback to PROCEED', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-baseline.vitest.ts:224:    expect(result.hybridMRR).toBeUndefined();
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-baseline.vitest.ts:331:      `SELECT * FROM eval_metric_snapshots WHERE channel = 'bm25'`
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-baseline.vitest.ts:344:       WHERE metric_name = 'bm25_contingency_decision'`
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-baseline.vitest.ts:362:      `SELECT metric_name FROM eval_metric_snapshots WHERE channel = 'bm25'`
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-baseline.vitest.ts:369:    expect(metricNames).toContain('bm25_contingency_decision');
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-baseline.vitest.ts:437:    expect(contingencyDecision.bm25MRR).toBe(result.metrics.mrr5);
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-baseline.vitest.ts:442:    // To call vector, graph, or trigger search paths (those are controlled by
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-baseline.vitest.ts:446:      calls.push(`bm25:${query.slice(0, 10)}`);
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-baseline.vitest.ts:454:    // All calls should be tagged as bm25 (our tracking tag)
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-baseline.vitest.ts:455:    expect(calls.every(c => c.startsWith('bm25:'))).toBe(true);
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-baseline.vitest.ts:480:        return [{ id: 999_001, score: 1.0, source: 'bm25' }];
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-baseline.vitest.ts:484:        { id: 999_000, score: 1.0, source: 'bm25' }, // non-relevant at rank 1
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-baseline.vitest.ts:485:        { id: relevantId, score: 0.9, source: 'bm25' }, // relevant at rank 2
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-baseline.vitest.ts:493:    expect(withKOverride.contingencyDecision.bm25MRR).toBeCloseTo(baseline.contingencyDecision.bm25MRR, 10);
.opencode/skills/system-spec-kit/mcp_server/tests/resume-ladder.vitest.ts:175:  it('returns a no-recovery package when the packet has no canonical docs', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/resume-ladder.vitest.ts:184:    expect(result.summary).toContain('No recovery context found');
.opencode/skills/system-spec-kit/mcp_server/tests/resume-ladder.vitest.ts:227:    // The ladder should return a none/error recovery since the path is invalid
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/README.md:252:| `manual_testing_playbook/` | Native tools, hooks, compatibility, H5 recovery, auto-update daemon, auto-indexing, lifecycle, scorer, Python compat scenarios (9 groups / 42 scenarios). |
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/README.md:288:Unset the controls after recovery:
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/README.md:306:Follow the OP and AU scenarios in the [manual playbook](./manual_testing_playbook/manual_testing_playbook.md) for detailed recovery steps.
.opencode/skills/system-spec-kit/mcp_server/tests/temporal-contiguity.vitest.ts:68:      const boosted = mod.vectorSearchWithContiguity(results_arr, 3600); // 1-hour window
.opencode/skills/system-spec-kit/mcp_server/tests/temporal-contiguity.vitest.ts:83:      const boosted = mod.vectorSearchWithContiguity(results_arr, 1800);
.opencode/skills/system-spec-kit/mcp_server/tests/temporal-contiguity.vitest.ts:99:      const boosted = mod.vectorSearchWithContiguity(results_arr, 3600); // 1 hour window
.opencode/skills/system-spec-kit/mcp_server/tests/temporal-contiguity.vitest.ts:108:      const result = mod.vectorSearchWithContiguity([], 3600);
.opencode/skills/system-spec-kit/mcp_server/tests/temporal-contiguity.vitest.ts:114:      const result = mod.vectorSearchWithContiguity(null, 3600);
.opencode/skills/system-spec-kit/mcp_server/tests/temporal-contiguity.vitest.ts:182:    it('T502-09: vector contiguity clamps non-positive windows to minimum bound', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/temporal-contiguity.vitest.ts:189:      const boosted = mod.vectorSearchWithContiguity(results_arr, 0);
.opencode/skills/system-spec-kit/mcp_server/tests/cross-feature-integration-eval.vitest.ts:27:// -- RRF Fusion --
.opencode/skills/system-spec-kit/mcp_server/tests/cross-feature-integration-eval.vitest.ts:206:      // RRF fusion with normalization
.opencode/skills/system-spec-kit/mcp_server/tests/cross-feature-integration-eval.vitest.ts:231:      // S1 features: co-activation, RRF (on by default)
.opencode/skills/system-spec-kit/mcp_server/tests/cross-feature-integration-eval.vitest.ts:249:      // RRF fusion works
.opencode/skills/system-spec-kit/mcp_server/tests/cross-feature-integration-eval.vitest.ts:251:        makeRankedList('vector', [1, 2, 3]),
.opencode/skills/system-spec-kit/mcp_server/tests/cross-feature-integration-eval.vitest.ts:252:        makeRankedList('fts', [2, 3, 4]),
.opencode/skills/system-spec-kit/mcp_server/tests/cross-feature-integration-eval.vitest.ts:287:        'how does the cross encoder reranker work with the hybrid search pipeline and vector index',
.opencode/skills/system-spec-kit/mcp_server/tests/cross-feature-integration-eval.vitest.ts:436:      // RRF with empty lists
.opencode/skills/system-spec-kit/mcp_server/tests/cross-feature-integration-eval.vitest.ts:456:      // RRF normalize with empty
.opencode/skills/system-spec-kit/mcp_server/tests/cross-feature-integration-eval.vitest.ts:477:      // RRF with single item
.opencode/skills/system-spec-kit/mcp_server/tests/cross-feature-integration-eval.vitest.ts:492:      // Single RRF result normalization
.opencode/skills/system-spec-kit/mcp_server/tests/cross-feature-integration-eval.vitest.ts:496:        sources: ['vector'],
.opencode/skills/system-spec-kit/mcp_server/tests/cross-feature-integration-eval.vitest.ts:527:      // RRF normalization of identical scores
.opencode/skills/system-spec-kit/mcp_server/tests/cross-feature-integration-eval.vitest.ts:578:      const query = 'fix the memory search scoring bug in hybrid pipeline';
.opencode/skills/system-spec-kit/mcp_server/tests/cross-feature-integration-eval.vitest.ts:594:      // Step 5: Fuse search results via RRF
.opencode/skills/system-spec-kit/mcp_server/tests/cross-feature-integration-eval.vitest.ts:595:      const vectorResults: RrfItem[] = [
.opencode/skills/system-spec-kit/mcp_server/tests/cross-feature-integration-eval.vitest.ts:600:      const ftsResults: RrfItem[] = [
.opencode/skills/system-spec-kit/mcp_server/tests/cross-feature-integration-eval.vitest.ts:606:        { source: 'vector', results: vectorResults },
.opencode/skills/system-spec-kit/mcp_server/tests/cross-feature-integration-eval.vitest.ts:607:        { source: 'fts', results: ftsResults },
.opencode/skills/system-spec-kit/mcp_server/tests/cross-feature-integration-eval.vitest.ts:656:    it('18. Channel representation promotes missing channels after RRF fusion', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/cross-feature-integration-eval.vitest.ts:659:      // Simulate: top-k only has vector results, but graph also returned results
.opencode/skills/system-spec-kit/mcp_server/tests/cross-feature-integration-eval.vitest.ts:661:        { id: 1, score: 0.9, source: 'vector' },
.opencode/skills/system-spec-kit/mcp_server/tests/cross-feature-integration-eval.vitest.ts:662:        { id: 2, score: 0.8, source: 'vector' },
.opencode/skills/system-spec-kit/mcp_server/tests/cross-feature-integration-eval.vitest.ts:663:        { id: 3, score: 0.7, source: 'vector' },
.opencode/skills/system-spec-kit/mcp_server/tests/cross-feature-integration-eval.vitest.ts:667:        ['vector', [{ id: 1, score: 0.9 }, { id: 2, score: 0.8 }]],
.opencode/skills/system-spec-kit/mcp_server/tests/cross-feature-integration-eval.vitest.ts:710:    it('20. RRF normalization maps scores to [0,1] while preserving order', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/cross-feature-integration-eval.vitest.ts:712:        { id: 1, rrfScore: 0.13, sources: ['vector', 'fts'], sourceScores: {}, convergenceBonus: 0.1 },
.opencode/skills/system-spec-kit/mcp_server/tests/cross-feature-integration-eval.vitest.ts:713:        { id: 2, rrfScore: 0.08, sources: ['vector'], sourceScores: {}, convergenceBonus: 0 },
.opencode/skills/system-spec-kit/mcp_server/tests/cross-feature-integration-eval.vitest.ts:714:        { id: 3, rrfScore: 0.05, sources: ['fts'], sourceScores: {}, convergenceBonus: 0 },
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/manual_testing_playbook/04--operator-h5/003-unavailable-daemon.md:3:description: "H5 operator playbook for corrupted SQLite and rebuild-from-source recovery."
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/manual_testing_playbook/04--operator-h5/003-unavailable-daemon.md:25:Validate the recovery path when the native advisor graph state is unavailable because SQLite is corrupt or unreadable.
.opencode/skills/system-spec-kit/mcp_server/skill_advisor/manual_testing_playbook/04--operator-h5/003-unavailable-daemon.md:70:| Runtime crashes on corrupt DB | MCP server exits or throws raw SQLite stack to user | Block release; recovery must fail open. |
.opencode/skills/system-spec-kit/mcp_server/tests/fsrs-hybrid-decay.vitest.ts:13:describe('FSRS hybrid decay policy', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/fsrs-hybrid-decay.vitest.ts:40:  it('makes applyClassificationDecay honor the hybrid no-decay override when enabled', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/fsrs-hybrid-decay.vitest.ts:48:  it('gates hybrid behavior behind SPECKIT_HYBRID_DECAY_POLICY', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/feedback-denylist.vitest.ts:49:  const technicalTerms = ['vector', 'pipeline', 'database', 'embedding', 'reranker', 'checkpoint', 'ablation'];
.opencode/skills/system-spec-kit/mcp_server/tests/fixtures/similarity-test-cases.json:81:      "a": "Use vector embeddings for search",

exec
/bin/zsh -lc "find .opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation -maxdepth 3 -type f \\( -name 'spec.md' -o -name 'plan.md' -o -name 'tasks.md' -o -name 'implementation-summary.md' -o -name 'handover.md' -o -name 'decision-record.md' \\) | sort" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/001-search-scenario-design/implementation-summary.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/001-search-scenario-design/plan.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/001-search-scenario-design/spec.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/001-search-scenario-design/tasks.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/implementation-summary.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/plan.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/spec.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/002-search-scenario-execution/tasks.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/implementation-summary.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/plan.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/spec.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/001-search-intelligence-stress-playbook/tasks.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/002-mcp-runtime-improvement-research/implementation-summary.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/002-mcp-runtime-improvement-research/plan.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/002-mcp-runtime-improvement-research/spec.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/002-mcp-runtime-improvement-research/tasks.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/003-memory-context-truncation-telemetry-contract/implementation-summary.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/003-memory-context-truncation-telemetry-contract/plan.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/003-memory-context-truncation-telemetry-contract/spec.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/003-memory-context-truncation-telemetry-contract/tasks.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/004-cocoindex-overfetch-dedup-rerank/implementation-summary.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/004-cocoindex-overfetch-dedup-rerank/plan.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/004-cocoindex-overfetch-dedup-rerank/spec.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/004-cocoindex-overfetch-dedup-rerank/tasks.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/005-code-graph-fail-fast-routing/implementation-summary.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/005-code-graph-fail-fast-routing/plan.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/005-code-graph-fail-fast-routing/spec.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/005-code-graph-fail-fast-routing/tasks.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/006-causal-graph-relation-window-metrics/implementation-summary.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/006-causal-graph-relation-window-metrics/plan.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/006-causal-graph-relation-window-metrics/spec.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/006-causal-graph-relation-window-metrics/tasks.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/007-intent-classifier-stability-telemetry/implementation-summary.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/007-intent-classifier-stability-telemetry/plan.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/007-intent-classifier-stability-telemetry/spec.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/007-intent-classifier-stability-telemetry/tasks.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/008-mcp-daemon-rebuild-protocol/implementation-summary.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/008-mcp-daemon-rebuild-protocol/plan.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/008-mcp-daemon-rebuild-protocol/spec.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/008-mcp-daemon-rebuild-protocol/tasks.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/009-memory-search-citation-response-policy/implementation-summary.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/009-memory-search-citation-response-policy/plan.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/009-memory-search-citation-response-policy/spec.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/009-memory-search-citation-response-policy/tasks.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/010-stress-test-close-loop-measurement-rerun/implementation-summary.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/010-stress-test-close-loop-measurement-rerun/plan.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/010-stress-test-close-loop-measurement-rerun/spec.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/010-stress-test-close-loop-measurement-rerun/tasks.md
.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/spec.md

exec
/bin/zsh -lc "rg -n \"memory_search|formatSearchResults|requestQuality|EMPTY_RESULT_RECOVERY|suggestedQueries|low_confidence|weak\" .opencode/skills/system-spec-kit/mcp_server/handlers .opencode/skills/system-spec-kit/mcp_server/lib .opencode/skills/system-spec-kit/mcp_server/tests -g '"'!dist'"'" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:1263:      ? `memory_search({ sessionId: "${sessionId}" })`
.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:1264:      : 'memory_search({ query: "last session" })';
.opencode/skills/system-spec-kit/mcp_server/lib/session/README.md:95:1. User queries memory_search
.opencode/skills/system-spec-kit/mcp_server/tests/provenance-envelope.vitest.ts:4:import { formatSearchResults, type MemoryResultEnvelope } from '../formatters/search-results';
.opencode/skills/system-spec-kit/mcp_server/tests/provenance-envelope.vitest.ts:379:    const response = await formatSearchResults([
.opencode/skills/system-spec-kit/mcp_server/tests/tool-input-schema.vitest.ts:146:      validateToolArgs('memory_search', { query: 'valid query', unexpected: true } as Record<string, unknown>);
.opencode/skills/system-spec-kit/mcp_server/tests/tool-input-schema.vitest.ts:150:    expect(errorSpy.mock.calls.some((call) => String(call[0]).includes('[schema-validation] memory_search:'))).toBe(true);
.opencode/skills/system-spec-kit/mcp_server/tests/tool-input-schema.vitest.ts:286:   4. memory_search LIMIT CONTRACT (schema + runtime alignment)
.opencode/skills/system-spec-kit/mcp_server/tests/tool-input-schema.vitest.ts:289:describe('memory_search limit contract', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/tool-input-schema.vitest.ts:292:      validateToolInputSchema('memory_search', { cursor: 'opaque-cursor-token' }, TOOL_DEFINITIONS);
.opencode/skills/system-spec-kit/mcp_server/tests/tool-input-schema.vitest.ts:298:      validateToolArgs('memory_search', { cursor: 'opaque-cursor-token' });
.opencode/skills/system-spec-kit/mcp_server/tests/tool-input-schema.vitest.ts:304:      validateToolInputSchema('memory_search', { concepts: ['alpha', 'beta'] }, TOOL_DEFINITIONS);
.opencode/skills/system-spec-kit/mcp_server/tests/tool-input-schema.vitest.ts:310:      validateToolInputSchema('memory_search', {}, TOOL_DEFINITIONS);
.opencode/skills/system-spec-kit/mcp_server/tests/tool-input-schema.vitest.ts:316:      validateToolArgs('memory_search', { query: 'ab', limit: 100 });
.opencode/skills/system-spec-kit/mcp_server/tests/tool-input-schema.vitest.ts:322:      validateToolArgs('memory_search', { query: 'ab', limit: 101 });
.opencode/skills/system-spec-kit/mcp_server/tests/tool-input-schema.vitest.ts:328:      validateToolInputSchema('memory_search', { query: 'ab', limit: 101 }, TOOL_DEFINITIONS);
.opencode/skills/system-spec-kit/mcp_server/tests/tool-input-schema.vitest.ts:334:      validateToolArgs('memory_search', { concepts: ['solo'] });
.opencode/skills/system-spec-kit/mcp_server/tests/tool-input-schema.vitest.ts:338:  it('public schema rejects unknown memory_search parameters', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/tool-input-schema.vitest.ts:340:      validateToolInputSchema('memory_search', { query: 'valid query', unexpected: true }, TOOL_DEFINITIONS);
.opencode/skills/system-spec-kit/mcp_server/tests/tool-input-schema.vitest.ts:346:      validateToolInputSchema('memory_search', { query: 'a' }, TOOL_DEFINITIONS);
.opencode/skills/system-spec-kit/mcp_server/tests/tool-input-schema.vitest.ts:350:  it('runtime rejects unknown memory_search parameters', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/tool-input-schema.vitest.ts:352:      validateToolArgs('memory_search', { query: 'valid query', unexpected: true } as Record<string, unknown>);
.opencode/skills/system-spec-kit/mcp_server/tests/tool-input-schema.vitest.ts:356:  it('runtime accepts governed scope fields for memory_search', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/tool-input-schema.vitest.ts:358:      validateToolArgs('memory_search', {
.opencode/skills/system-spec-kit/mcp_server/tests/tool-input-schema.vitest.ts:367:  it('public and runtime schemas accept response profiles for memory_search', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/tool-input-schema.vitest.ts:374:      validateToolInputSchema('memory_search', args, TOOL_DEFINITIONS);
.opencode/skills/system-spec-kit/mcp_server/tests/tool-input-schema.vitest.ts:376:    expect(validateToolArgs('memory_search', args)).toEqual(args);
.opencode/skills/system-spec-kit/mcp_server/tests/search-results-format.vitest.ts:9:  formatSearchResults,
.opencode/skills/system-spec-kit/mcp_server/tests/search-results-format.vitest.ts:132:   SECTION C: formatSearchResults
.opencode/skills/system-spec-kit/mcp_server/tests/search-results-format.vitest.ts:135:describe('formatSearchResults', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/search-results-format.vitest.ts:137:    const res = await formatSearchResults(null, 'semantic');
.opencode/skills/system-spec-kit/mcp_server/tests/search-results-format.vitest.ts:144:    const res = await formatSearchResults([], 'trigger');
.opencode/skills/system-spec-kit/mcp_server/tests/search-results-format.vitest.ts:151:    const res = await formatSearchResults([], 'semantic', false, null, null, null, {
.opencode/skills/system-spec-kit/mcp_server/tests/search-results-format.vitest.ts:174:    const res = await formatSearchResults(mockResults, 'semantic');
.opencode/skills/system-spec-kit/mcp_server/tests/search-results-format.vitest.ts:192:    const res = await formatSearchResults(mockResults, 'semantic');
.opencode/skills/system-spec-kit/mcp_server/tests/search-results-format.vitest.ts:205:    const res = await formatSearchResults(mockResults, 'semantic');
.opencode/skills/system-spec-kit/mcp_server/tests/search-results-format.vitest.ts:216:    const res = await formatSearchResults(mockResults, 'semantic');
.opencode/skills/system-spec-kit/mcp_server/tests/search-results-format.vitest.ts:231:    const res = await formatSearchResults(mockResults, 'multi-concept');
.opencode/skills/system-spec-kit/mcp_server/tests/search-results-format.vitest.ts:238:    const res = await formatSearchResults(mockResults, 'semantic');
.opencode/skills/system-spec-kit/mcp_server/tests/search-results-format.vitest.ts:247:    const res = await formatSearchResults(mockResults, 'semantic', false);
.opencode/skills/system-spec-kit/mcp_server/tests/search-results-format.vitest.ts:254:    const res = await formatSearchResults([], 'semantic');
.opencode/skills/system-spec-kit/mcp_server/tests/search-results-format.vitest.ts:262:    const res = await formatSearchResults([], 'semantic', false, null, null, null, {
.opencode/skills/system-spec-kit/mcp_server/tests/search-results-format.vitest.ts:290:    const res = await formatSearchResults(
.opencode/skills/system-spec-kit/mcp_server/tests/search-results-format.vitest.ts:334:    const res = await formatSearchResults(mockResults, 'semantic', false, null, null, null, {}, false);
.opencode/skills/system-spec-kit/mcp_server/tests/search-results-format.vitest.ts:356:    const res = await formatSearchResults(mockResults, 'semantic', false, null, null, null, {}, true);
.opencode/skills/system-spec-kit/mcp_server/tests/search-results-format.vitest.ts:372:    const res = await formatSearchResults(mockResults, 'semantic', false, null, null, null, { myExtra: 'data' }, true);
.opencode/skills/system-spec-kit/mcp_server/tests/search-results-format.vitest.ts:379:    const res = await formatSearchResults(mockResults, 'multi-concept');
.opencode/skills/system-spec-kit/mcp_server/tests/search-results-format.vitest.ts:384:  it('C13: Response meta.tool is memory_search', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/search-results-format.vitest.ts:386:    const res = await formatSearchResults(mockResults, 'semantic');
.opencode/skills/system-spec-kit/mcp_server/tests/search-results-format.vitest.ts:388:    expect(envelope.meta.tool).toBe('memory_search');
.opencode/skills/system-spec-kit/mcp_server/tests/search-results-format.vitest.ts:398:    const res = await formatSearchResults(mockResults, 'semantic', true);
.opencode/skills/system-spec-kit/mcp_server/tests/search-results-format.vitest.ts:420:    const res = await formatSearchResults(mockResults, 'semantic', true);
.opencode/skills/system-spec-kit/mcp_server/tests/search-results-format.vitest.ts:446:    const res = await formatSearchResults(
.opencode/skills/system-spec-kit/mcp_server/tests/search-results-format.vitest.ts:473:    const res = await formatSearchResults(mockResults, 'semantic', false, null, null, null, {}, true);
.opencode/skills/system-spec-kit/mcp_server/tests/intent-classifier.vitest.ts:564:describe('T059: autoDetectIntent Parameter (memory_search)', () => {
.opencode/skills/system-spec-kit/mcp_server/lib/extraction/extraction-adapter.ts:42:    toolPattern: /^(read|memory_context|memory_search|memory_list)$/i,
.opencode/skills/system-spec-kit/mcp_server/lib/extraction/extraction-adapter.ts:49:    toolPattern: /^(grep|memory_search)$/i,
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-search.vitest.ts:59:    it('T516-2: handle_memory_search alias is exported', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-search.vitest.ts:60:      expect(typeof handler.handle_memory_search).toBe('function');
.opencode/skills/system-spec-kit/mcp_server/tests/memory/trust-badges.test.ts:6:  formatSearchResults,
.opencode/skills/system-spec-kit/mcp_server/tests/memory/trust-badges.test.ts:67:// the public `formatSearchResults` envelope path because it does not depend
.opencode/skills/system-spec-kit/mcp_server/tests/memory/trust-badges.test.ts:168:    // `formatSearchResults`. It does not depend on the database — the
.opencode/skills/system-spec-kit/mcp_server/tests/memory/trust-badges.test.ts:172:    const response = await formatSearchResults([
.opencode/skills/system-spec-kit/mcp_server/tests/memory/trust-badges.test.ts:208:      const response = await formatSearchResults([
.opencode/skills/system-spec-kit/mcp_server/tests/memory/trust-badges.test.ts:236:      const response = await formatSearchResults([
.opencode/skills/system-spec-kit/mcp_server/tests/response-profile-formatters.vitest.ts:34:      tool: 'memory_search',
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-ux-regressions.vitest.ts:124:- If this fixture starts failing insufficiency again, add more concrete file, decision, blocker, next action, or outcome evidence instead of weakening the gate.
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:4:  formatSearchResults,
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:8:const RECOVERY_FLAG = 'SPECKIT_EMPTY_RESULT_RECOVERY_V1';
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:9:const VALID_RECOVERY_STATUSES = ['no_results', 'low_confidence', 'partial'] as const;
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:34:  suggestedQueries: string[];
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:56:function parseEnvelope(response: Awaited<ReturnType<typeof formatSearchResults>>): SearchEnvelope {
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:83:  const response = await formatSearchResults(
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:142:        suggestedQueries: expect.any(Array),
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:152:  it('classifies weak result sets as low_confidence', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:181:    expect(envelope.data.recovery?.status).toBe('low_confidence');
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:242:    expect(envelope.data.requestQuality).toEqual({ label: 'good' });
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:280:    const suggestedQueries = envelope.data.recovery?.suggestedQueries ?? [];
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:281:    expectReasonableSuggestions(suggestedQueries, originalQuery, [
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:347:    const suggestions = envelope.data.recovery?.suggestedQueries ?? [];
.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts:354:  it('omits the recovery payload when SPECKIT_EMPTY_RESULT_RECOVERY_V1 is false', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-benchmark-memory-search.vitest.ts:77:  formatSearchResults: vi.fn(async (
.opencode/skills/system-spec-kit/mcp_server/handlers/index.ts:213:export const handle_memory_search = lazyFunction(getMemorySearchModule, 'handle_memory_search');
.opencode/skills/system-spec-kit/mcp_server/tests/context-server-error-envelope.vitest.ts:9:    const response = buildErrorResponse('memory_search', err, { input: 'test' });
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:31:  const ORIGINAL = process.env.SPECKIT_EMPTY_RESULT_RECOVERY_V1;
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:34:    if (ORIGINAL === undefined) delete process.env.SPECKIT_EMPTY_RESULT_RECOVERY_V1;
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:35:    else process.env.SPECKIT_EMPTY_RESULT_RECOVERY_V1 = ORIGINAL;
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:39:    delete process.env.SPECKIT_EMPTY_RESULT_RECOVERY_V1;
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:44:    process.env.SPECKIT_EMPTY_RESULT_RECOVERY_V1 = 'true';
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:49:    process.env.SPECKIT_EMPTY_RESULT_RECOVERY_V1 = 'TRUE';
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:54:    process.env.SPECKIT_EMPTY_RESULT_RECOVERY_V1 = 'false';
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:59:    process.env.SPECKIT_EMPTY_RESULT_RECOVERY_V1 = '1';
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:144:  it('emits status "low_confidence" when avgConfidence < threshold', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:149:    expect(payload.status).toBe('low_confidence');
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:251:  it('recommends "ask_user" for low_confidence + knowledge_gap', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:258:    expect(payload.status).toBe('low_confidence');
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:262:  it('recommends "ask_disambiguation" for low_confidence + low_signal_query', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:269:    expect(payload.status).toBe('low_confidence');
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:275:// -- buildRecoveryPayload — suggestedQueries field --
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:277:describe('buildRecoveryPayload() — suggestedQueries', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:280:    expect(Array.isArray(payload.suggestedQueries)).toBe(true);
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:285:    expect(payload.suggestedQueries.length).toBeLessThanOrEqual(3);
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:290:    expect(payload.suggestedQueries.length).toBeGreaterThan(0);
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:291:    expect(payload.suggestedQueries.every((s) => typeof s === 'string' && s.length > 0)).toBe(true);
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:296:    expect(payload.suggestedQueries.length).toBeGreaterThan(0);
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:303:    const hasShortened = payload.suggestedQueries.some((s) =>
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:313:    const hasParenFree = payload.suggestedQueries.some((s) => !s.includes('('));
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:319:    const unique = new Set(payload.suggestedQueries);
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:320:    expect(unique.size).toBe(payload.suggestedQueries.length);
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:321:    expect(payload.suggestedQueries.every((s) => s.trim().length > 0)).toBe(true);
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:333:    expect(payload.suggestedQueries.length).toBeGreaterThanOrEqual(2);
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:334:    expect(payload.suggestedQueries.every((s) => s.trim().length > 0)).toBe(true);
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:345:    expect(payload).toHaveProperty('suggestedQueries');
.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts:350:    const validStatuses = ['no_results', 'low_confidence', 'partial'] as const;
.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:338:    const { requestQuality } = assessRequestQuality([], []);
.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:339:    expect(requestQuality.label).toBe('gap');
.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:349:    const { requestQuality } = assessRequestQuality(results, confidences);
.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:350:    expect(requestQuality.label).toBe('good');
.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:356:    const { requestQuality } = assessRequestQuality(results, confidences);
.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:357:    expect(requestQuality.label).toBe('gap');
.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:360:  it('returns "weak" for results with mediocre scores and mixed confidence', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:363:    const { requestQuality } = assessRequestQuality(results, confidences);
.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:364:    // Scores around 0.4–0.45 → should be "weak" (not gap, not good)
.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:365:    expect(['weak', 'good']).toContain(requestQuality.label);
.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:368:  it('requestQuality.label is one of the valid literals', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:369:    const validLabels = ['good', 'weak', 'gap'];
.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:372:    const { requestQuality } = assessRequestQuality(results, confidences);
.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:373:    expect(validLabels).toContain(requestQuality.label);
.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:376:  it('always returns an object with requestQuality.label', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:380:    expect(assessment).toHaveProperty('requestQuality');
.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:381:    expect(assessment.requestQuality).toHaveProperty('label');
.opencode/skills/system-spec-kit/mcp_server/tests/d5-confidence-scoring.vitest.ts:382:    expect(typeof assessment.requestQuality.label).toBe('string');
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-context.ts:89:  includeTrace?: boolean; // CHK-040: Forward to internal memory_search calls
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-context.ts:125:  includeTrace?: boolean; // CHK-040: Forward to internal memory_search calls
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-context.ts:564:            tool: 'memory_search',
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-context.ts:576:            tool: 'memory_search',
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-context.ts:593:          tool: 'memory_search',
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-context.ts:604:          tool: 'memory_search',
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-context.ts:1767:      `For more granular control, use L2 tools: memory_search, memory_match_triggers`,
.opencode/skills/system-spec-kit/mcp_server/tests/rrf-degree-channel.vitest.ts:432:      // Lower similarity = lower boost (fan-effect: many weak connections matter less)
.opencode/skills/system-spec-kit/mcp_server/tests/recovery-hints.vitest.ts:181:  it('T022: memory_search has tool-specific hints', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/recovery-hints.vitest.ts:182:    expect(TOOL_SPECIFIC_HINTS.memory_search).toBeDefined();
.opencode/skills/system-spec-kit/mcp_server/tests/recovery-hints.vitest.ts:183:    expect(typeof TOOL_SPECIFIC_HINTS.memory_search).toBe('object');
.opencode/skills/system-spec-kit/mcp_server/tests/recovery-hints.vitest.ts:221:  it('T029: memory_search EMBEDDING_FAILED has contextual hint', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/recovery-hints.vitest.ts:224:      TOOL_SPECIFIC_HINTS.memory_search?.[ERROR_CODES.EMBEDDING_FAILED];
.opencode/skills/system-spec-kit/mcp_server/tests/recovery-hints.vitest.ts:244:    const searchHint = getRecoveryHint('memory_search', ERROR_CODES.EMBEDDING_FAILED);
.opencode/skills/system-spec-kit/mcp_server/tests/recovery-hints.vitest.ts:246:      TOOL_SPECIFIC_HINTS.memory_search[ERROR_CODES.EMBEDDING_FAILED];
.opencode/skills/system-spec-kit/mcp_server/tests/recovery-hints.vitest.ts:301:      'memory_search',
.opencode/skills/system-spec-kit/mcp_server/tests/recovery-hints.vitest.ts:315:    const hasSearch = hasSpecificHint('memory_search', ERROR_CODES.EMBEDDING_FAILED);
.opencode/skills/system-spec-kit/mcp_server/tests/recovery-hints.vitest.ts:356:    const searchHints = getAvailableHints('memory_search');
.opencode/skills/system-spec-kit/mcp_server/tests/recovery-hints.vitest.ts:362:    const searchHints = getAvailableHints('memory_search');
.opencode/skills/system-spec-kit/mcp_server/tests/recovery-hints.vitest.ts:365:      TOOL_SPECIFIC_HINTS.memory_search[ERROR_CODES.EMBEDDING_FAILED];
.opencode/skills/system-spec-kit/mcp_server/tests/recovery-hints.vitest.ts:713:    const toolSpecific = getRecoveryHint('memory_search', ERROR_CODES.EMBEDDING_FAILED);
.opencode/skills/system-spec-kit/mcp_server/tests/recovery-hints.vitest.ts:718:      TOOL_SPECIFIC_HINTS.memory_search[ERROR_CODES.EMBEDDING_FAILED]
.opencode/skills/system-spec-kit/mcp_server/tests/recovery-hints.vitest.ts:725:    const allSearchHints = getAvailableHints('memory_search');
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-constitutional-memory.vitest.ts:32:  formatSearchResults: vi.fn(async (
.opencode/skills/system-spec-kit/mcp_server/tests/causal-edges-unit.vitest.ts:694:     R-007-12: Generation counter for memory_search cache invalidation
.opencode/skills/system-spec-kit/mcp_server/tests/causal-edges-unit.vitest.ts:776:    // wiring at memory_search level. This test verifies the gating
.opencode/skills/system-spec-kit/mcp_server/tests/anchor-prefix-matching.vitest.ts:4:  formatSearchResults,
.opencode/skills/system-spec-kit/mcp_server/tests/anchor-prefix-matching.vitest.ts:10:// Covers: Prefix matching in filterByAnchors / formatSearchResults
.opencode/skills/system-spec-kit/mcp_server/tests/anchor-prefix-matching.vitest.ts:46: * the full formatSearchResults pipeline.
.opencode/skills/system-spec-kit/mcp_server/tests/anchor-prefix-matching.vitest.ts:310:// INTEGRATION TESTS — formatSearchResults with mock parser
.opencode/skills/system-spec-kit/mcp_server/tests/anchor-prefix-matching.vitest.ts:313:describe('ANCHOR PREFIX MATCHING — formatSearchResults integration', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/anchor-prefix-matching.vitest.ts:315:   * Helper: call formatSearchResults with a mock parser and anchor filter,
.opencode/skills/system-spec-kit/mcp_server/tests/anchor-prefix-matching.vitest.ts:324:    // But formatSearchResults still reads the file via fs.readFile. We use
.opencode/skills/system-spec-kit/mcp_server/tests/anchor-prefix-matching.vitest.ts:333:    const response = await formatSearchResults(
.opencode/skills/system-spec-kit/mcp_server/tests/anchor-prefix-matching.vitest.ts:418:    const response = await formatSearchResults(
.opencode/skills/system-spec-kit/mcp_server/tests/mcp-tool-dispatch.vitest.ts:7:  { tool: 'memory_search', handler: 'handleMemorySearch', layer: 'L2' },
.opencode/skills/system-spec-kit/mcp_server/tests/mcp-tool-dispatch.vitest.ts:33:  { camel: 'handleMemorySearch', snake: 'handle_memory_search' },
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-eval-channels.vitest.ts:1:// TEST: memory_search per-channel eval logging (T056)
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-eval-channels.vitest.ts:57:  formatSearchResults: vi.fn(async (results: Array<Record<string, unknown>>) => ({
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-eval-channels.vitest.ts:106:describe('T056: memory_search emits per-channel eval rows', () => {
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:58:import { formatSearchResults } from '../formatters/index.js';
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:106:// Feature catalog: Semantic and lexical search (memory_search)
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:467:    tool: 'memory_search',
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:609:/** Handle memory_search tool — performs hybrid vector/BM25 search with intent-aware ranking.
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:680:        tool: 'memory_search',
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:692:      tool: 'memory_search',
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:720:          tool: 'memory_search',
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:739:      tool: 'memory_search',
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:751:      tool: 'memory_search',
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:849:  // the affected memory_search entries on the next lookup. We deliberately
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:891:  const cacheKey = toolCache.generateCacheKey('memory_search', cacheArgs);
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:952:    // Phase B T018/T019: Community search fallback — inject community members on weak results
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:1154:    let formatted = await formatSearchResults(
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:1201:      toolCache.set(cacheKey, cachePayload, { toolName: 'memory_search' });
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:1430:            confidence: 'weak',
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:1531:const handle_memory_search = handleMemorySearch;
.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:1534:  handle_memory_search,
.opencode/skills/system-spec-kit/mcp_server/tests/tool-cache.vitest.ts:82:      const key1 = generateCacheKey('memory_search', args);
.opencode/skills/system-spec-kit/mcp_server/tests/tool-cache.vitest.ts:83:      const key2 = generateCacheKey('memory_search', args);
.opencode/skills/system-spec-kit/mcp_server/tests/tool-cache.vitest.ts:88:      const key1 = generateCacheKey('memory_search', { query: 'auth' });
.opencode/skills/system-spec-kit/mcp_server/tests/tool-cache.vitest.ts:89:      const key2 = generateCacheKey('memory_search', { query: 'login' });
.opencode/skills/system-spec-kit/mcp_server/tests/tool-cache.vitest.ts:95:      const key1 = generateCacheKey('memory_search', args);
.opencode/skills/system-spec-kit/mcp_server/tests/tool-cache.vitest.ts:352:      const key1 = generateCacheKey('memory_search', { query: 'test1' });
.opencode/skills/system-spec-kit/mcp_server/tests/tool-cache.vitest.ts:353:      const key2 = generateCacheKey('memory_search', { query: 'test2' });
.opencode/skills/system-spec-kit/mcp_server/tests/tool-cache.vitest.ts:355:      set(key1, 'value1', { toolName: 'memory_search' });
.opencode/skills/system-spec-kit/mcp_server/tests/tool-cache.vitest.ts:356:      set(key2, 'value2', { toolName: 'memory_search' });
.opencode/skills/system-spec-kit/mcp_server/tests/tool-cache.vitest.ts:358:      const invalidated = invalidateByTool('memory_search');
.opencode/skills/system-spec-kit/mcp_server/tests/tool-cache.vitest.ts:366:      const key1 = generateCacheKey('memory_search', { query: 'test1' });
.opencode/skills/system-spec-kit/mcp_server/tests/tool-cache.vitest.ts:369:      set(key1, 'value1', { toolName: 'memory_search' });
.opencode/skills/system-spec-kit/mcp_server/tests/tool-cache.vitest.ts:380:      const key1 = generateCacheKey('memory_search', { query: 'test1' });
.opencode/skills/system-spec-kit/mcp_server/tests/tool-cache.vitest.ts:383:      set(key1, 'value1', { toolName: 'memory_search' });
.opencode/skills/system-spec-kit/mcp_server/tests/tool-cache.vitest.ts:394:      const searchKey = generateCacheKey('memory_search', { query: 'test' });
.opencode/skills/system-spec-kit/mcp_server/tests/tool-cache.vitest.ts:396:      set(searchKey, 'search_result', { toolName: 'memory_search' });
.opencode/skills/system-spec-kit/mcp_server/tests/tool-cache.vitest.ts:423:      const key = generateCacheKey('memory_search', args);
.opencode/skills/system-spec-kit/mcp_server/tests/tool-cache.vitest.ts:427:        'memory_search',
.opencode/skills/system-spec-kit/mcp_server/tests/tool-cache.vitest.ts:436:      expect(invalidateByTool('memory_search')).toBe(0);
.opencode/skills/system-spec-kit/mcp_server/tests/tool-cache.vitest.ts:439:      const second = withCache('memory_search', args, async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/tool-cache.vitest.ts:589:      const key = generateCacheKey('memory_search', args);
.opencode/skills/system-spec-kit/mcp_server/tests/tool-cache.vitest.ts:593:        'memory_search',
.opencode/skills/system-spec-kit/mcp_server/tests/tool-cache.vitest.ts:603:      const second = withCache('memory_search', args, async () => 'fresh-after-shutdown');
.opencode/skills/system-spec-kit/mcp_server/tests/modularization.vitest.ts:258:    'formatSearchResults',
.opencode/skills/system-spec-kit/mcp_server/tests/layer-definitions.vitest.ts:123:        memory_search: 'L2',
.opencode/skills/system-spec-kit/mcp_server/tests/layer-definitions.vitest.ts:207:        { tool: 'memory_search', expected: '[L2:Core]' },
.opencode/skills/system-spec-kit/mcp_server/tests/layer-definitions.vitest.ts:239:        { tool: 'memory_search', desc: 'Search memories', prefix: '[L2:Core]' },
.opencode/skills/system-spec-kit/mcp_server/tests/layer-definitions.vitest.ts:265:        { tool: 'memory_search', expected: 3500 },
.opencode/skills/system-spec-kit/mcp_server/tests/layer-definitions.vitest.ts:313:      const info = expectLayerInfo(mod.getLayerInfo('memory_search'));
.opencode/skills/system-spec-kit/mcp_server/tests/layer-definitions.vitest.ts:442:      const toolSamples = ['memory_context', 'memory_search', 'memory_list',
.opencode/skills/system-spec-kit/mcp_server/lib/errors/core.ts:53:  memory_search: ERROR_CODES.SEARCH_FAILED,
.opencode/skills/system-spec-kit/mcp_server/tests/progressive-disclosure.vitest.ts:111:    expect(summary.digest).toBe('2 strong, 1 moderate, 1 weak');
.opencode/skills/system-spec-kit/mcp_server/tests/progressive-disclosure.vitest.ts:114:  it('classifies results without confidence data as "weak"', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/progressive-disclosure.vitest.ts:116:    // No confidence property → defaults to low/weak
.opencode/skills/system-spec-kit/mcp_server/tests/progressive-disclosure.vitest.ts:118:    expect(summary.digest).toBe('2 weak');
.opencode/skills/system-spec-kit/mcp_server/tests/progressive-disclosure.vitest.ts:157:    expect(buildDigest({ high: 3, medium: 2, low: 1 })).toBe('3 strong, 2 moderate, 1 weak');
.opencode/skills/system-spec-kit/mcp_server/tests/token-budget-enforcement.vitest.ts:20:        memory_search: 3500,
.opencode/skills/system-spec-kit/mcp_server/tests/error-sanitization.vitest.ts:50:    const response = buildErrorResponse('memory_search', error);
.opencode/skills/system-spec-kit/mcp_server/tests/error-sanitization.vitest.ts:68:    const response = buildErrorResponse('memory_search', error);
.opencode/skills/system-spec-kit/mcp_server/tests/error-sanitization.vitest.ts:83:    const response = buildErrorResponse('memory_search', error);
.opencode/skills/system-spec-kit/mcp_server/lib/errors/README.md:40:| Tool-Specific Hints | 6 tools | memory_search, checkpoint_restore, memory_save, memory_index_scan, memory_drift_why, memory_causal_link |
.opencode/skills/system-spec-kit/mcp_server/lib/errors/README.md:133:  return buildErrorResponse('memory_search', error, { query });
.opencode/skills/system-spec-kit/mcp_server/lib/errors/README.md:143:const hint = getRecoveryHint('memory_search', ERROR_CODES.EMBEDDING_FAILED);
.opencode/skills/system-spec-kit/mcp_server/tests/mcp-response-envelope.vitest.ts:5:  formatSearchResults,
.opencode/skills/system-spec-kit/mcp_server/tests/mcp-response-envelope.vitest.ts:82:    const response = await formatSearchResults([createMockResult()], 'hybrid');
.opencode/skills/system-spec-kit/mcp_server/tests/mcp-response-envelope.vitest.ts:86:    expect(envelope.meta.tool).toBe('memory_search');
.opencode/skills/system-spec-kit/mcp_server/tests/mcp-response-envelope.vitest.ts:92:    const response = await formatSearchResults([createMockResult()], 'hybrid');
.opencode/skills/system-spec-kit/mcp_server/tests/mcp-response-envelope.vitest.ts:102:    const response = await formatSearchResults(
.opencode/skills/system-spec-kit/mcp_server/tests/mcp-response-envelope.vitest.ts:179:    const response = await formatSearchResults(
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-embedding-semantic-search.vitest.ts:81:  formatSearchResults: vi.fn(async (
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:162:      'memory_search',
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:296:      'memory_context', 'memory_search', 'memory_quick_search', 'memory_match_triggers',
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:1295:        runAfterToolCallbacks('memory_search', 'call-1', structuredClone(result))
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:1316:      expect(callArgs[0]).toBe('memory_search')
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:1472:          if (name !== 'memory_search' && name !== 'memory_context' && name !== 'memory_quick_search' && name !== 'session_health') {
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:1480:        simulateCall('memory_search', { query: 'recent issues', sessionId: 'sess-sticky-1' })
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:1533:      const memoryAwareTools = new Set<string>(['memory_search'])
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:1560:      const response = await simulateCallToolHandler('memory_search', { query: 'hook validation' })
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:1868:        'Key tools: memory_context, memory_search, memory_save, memory_index_scan, memory_stats.',
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:1869:        'Graph retrieval: memory_search supports retrievalLevel (local/global/auto) for entity-level or community-level search. Graph provenance visible via graphEvidence in results.',
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:1895:          'Key tools: memory_context, memory_search, memory_save, memory_index_scan, memory_stats.',
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:1896:          'Graph retrieval: memory_search supports retrievalLevel (local/global/auto) for entity-level or community-level search. Graph provenance visible via graphEvidence in results.',
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2089:      const response = errorsModule!.buildErrorResponse!('memory_search', testError, { query: 'test' })
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2107:      const hint = errorsModule!.getRecoveryHint!('memory_search', 'UNKNOWN_TOOL')
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2148:    it('T28b: L2 budget = 3500 (memory_search)', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2153:      expect(layerDefs!.getTokenBudget!('memory_search')).toBe(3500)
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2229:    const expectedAwareTools = ['memory_context', 'memory_search', 'memory_match_triggers', 'memory_list', 'memory_save', 'memory_index_scan']
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2611:      'memory_search': '[L2:Core]',
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2840:        'Key tools: memory_context, memory_search, memory_save, memory_index_scan, memory_stats.',
.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2867:      expect(result).toContain('memory_search')
.opencode/skills/system-spec-kit/mcp_server/lib/errors/recovery-hints.ts:539:      'Check memory_search() for existing similar content'
.opencode/skills/system-spec-kit/mcp_server/lib/errors/recovery-hints.ts:694:  memory_search: {
.opencode/skills/system-spec-kit/mcp_server/tests/review-fixes.vitest.ts:41:    const result = validateToolArgs('memory_search', {
.opencode/skills/system-spec-kit/mcp_server/tests/envelope.vitest.ts:20:        tool: 'memory_search',
.opencode/skills/system-spec-kit/mcp_server/tests/envelope.vitest.ts:58:        tool: 'memory_search',
.opencode/skills/system-spec-kit/mcp_server/tests/envelope.vitest.ts:97:        tool: 'memory_search',
.opencode/skills/system-spec-kit/mcp_server/tests/envelope.vitest.ts:108:        tool: 'memory_search',
.opencode/skills/system-spec-kit/mcp_server/tests/envelope.vitest.ts:135:        tool: 'memory_search'
.opencode/skills/system-spec-kit/mcp_server/tests/envelope.vitest.ts:143:        tool: 'memory_search'
.opencode/skills/system-spec-kit/mcp_server/tests/envelope.vitest.ts:152:        tool: 'memory_search'
.opencode/skills/system-spec-kit/mcp_server/tests/envelope.vitest.ts:186:        tool: 'memory_search',
.opencode/skills/system-spec-kit/mcp_server/tests/envelope.vitest.ts:206:        tool: 'memory_search',
.opencode/skills/system-spec-kit/mcp_server/tests/envelope.vitest.ts:254:        tool: 'memory_search',
.opencode/skills/system-spec-kit/mcp_server/tests/envelope.vitest.ts:312:        tool: 'memory_search',
.opencode/skills/system-spec-kit/mcp_server/tests/envelope.vitest.ts:352:        tool: 'memory_search',
.opencode/skills/system-spec-kit/mcp_server/tests/envelope.vitest.ts:363:        tool: 'memory_search',
.opencode/skills/system-spec-kit/mcp_server/tests/envelope.vitest.ts:373:        tool: 'memory_search',
.opencode/skills/system-spec-kit/mcp_server/tests/envelope.vitest.ts:384:        tool: 'memory_search',
.opencode/skills/system-spec-kit/mcp_server/tests/envelope.vitest.ts:409:        tool: 'memory_search'
.opencode/skills/system-spec-kit/mcp_server/tests/feedback-ledger.vitest.ts:34:    confidence: 'weak',
.opencode/skills/system-spec-kit/mcp_server/tests/feedback-ledger.vitest.ts:119:    expect(FEEDBACK_SCHEMA_SQL).toContain('weak');
.opencode/skills/system-spec-kit/mcp_server/tests/feedback-ledger.vitest.ts:126:    expect(resolveConfidence('result_cited', 'weak')).toBe('weak');
.opencode/skills/system-spec-kit/mcp_server/tests/feedback-ledger.vitest.ts:133:    expect(resolveConfidence('same_topic_requery')).toBe('weak');
.opencode/skills/system-spec-kit/mcp_server/tests/feedback-ledger.vitest.ts:134:    expect(resolveConfidence('search_shown')).toBe('weak');
.opencode/skills/system-spec-kit/mcp_server/tests/feedback-ledger.vitest.ts:159:  it('passive signals are weak', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/feedback-ledger.vitest.ts:160:    expect(EVENT_TYPE_CONFIDENCE['search_shown']).toBe('weak');
.opencode/skills/system-spec-kit/mcp_server/tests/feedback-ledger.vitest.ts:161:    expect(EVENT_TYPE_CONFIDENCE['same_topic_requery']).toBe('weak');
.opencode/skills/system-spec-kit/mcp_server/tests/feedback-ledger.vitest.ts:200:    logFeedbackEvent(db, makeEvent({ confidence: 'weak' }));
.opencode/skills/system-spec-kit/mcp_server/tests/feedback-ledger.vitest.ts:205:    expect(tiers).toContain('weak');
.opencode/skills/system-spec-kit/mcp_server/tests/feedback-ledger.vitest.ts:320:    logFeedbackEvent(db, makeEvent({ confidence: 'weak' }));
.opencode/skills/system-spec-kit/mcp_server/tests/feedback-ledger.vitest.ts:391:    expect(summary.weak).toBe(0);
.opencode/skills/system-spec-kit/mcp_server/tests/feedback-ledger.vitest.ts:399:    logFeedbackEvent(db, makeEvent({ memoryId: 'mem-1', confidence: 'weak' }));
.opencode/skills/system-spec-kit/mcp_server/tests/feedback-ledger.vitest.ts:405:    expect(summary.weak).toBe(1);
.opencode/skills/system-spec-kit/mcp_server/tests/feedback-ledger.vitest.ts:412:    logFeedbackEvent(db, makeEvent({ memoryId: 'mem-B', confidence: 'weak' }));
.opencode/skills/system-spec-kit/mcp_server/tests/feedback-ledger.vitest.ts:419:    expect(summaryB.weak).toBe(1);
.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-context.vitest.ts:593:    it('preserves traced resume metadata without routing resume mode through memory_search', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/errors-comprehensive.vitest.ts:287:    const resp = buildErrorResponse('memory_search', err);
.opencode/skills/system-spec-kit/mcp_server/tests/errors-comprehensive.vitest.ts:296:    const resp = buildErrorResponse('memory_search', err);
.opencode/skills/system-spec-kit/mcp_server/tests/errors-comprehensive.vitest.ts:302:    const resp = buildErrorResponse('memory_search', err);
.opencode/skills/system-spec-kit/mcp_server/tests/errors-comprehensive.vitest.ts:310:    const resp = buildErrorResponse('memory_search', err);
.opencode/skills/system-spec-kit/mcp_server/tests/errors-comprehensive.vitest.ts:311:    expect(resp.meta.tool).toBe('memory_search');
.opencode/skills/system-spec-kit/mcp_server/tests/errors-comprehensive.vitest.ts:318:    const resp = buildErrorResponse('memory_search', err);
.opencode/skills/system-spec-kit/mcp_server/tests/errors-comprehensive.vitest.ts:328:  it('F7: Tool-specific hints included for memory_search + E001', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/errors-comprehensive.vitest.ts:330:    const resp = buildErrorResponse('memory_search', err);
.opencode/skills/system-spec-kit/mcp_server/tests/errors-comprehensive.vitest.ts:353:    const err = createErrorWithHint('E040', 'fail', {}, 'memory_search');
.opencode/skills/system-spec-kit/mcp_server/tests/errors-comprehensive.vitest.ts:469:  it('K2: Has memory_search, checkpoint_restore, memory_save', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/errors-comprehensive.vitest.ts:470:    expect('memory_search' in TOOL_SPECIFIC_HINTS).toBe(true);
.opencode/skills/system-spec-kit/mcp_server/tests/errors-comprehensive.vitest.ts:476:    const searchHints = TOOL_SPECIFIC_HINTS['memory_search'];
.opencode/skills/system-spec-kit/mcp_server/tests/errors-comprehensive.vitest.ts:492:  it('L1: Returns tool-specific hint for memory_search + E001', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/errors-comprehensive.vitest.ts:493:    const hint = getRecoveryHint('memory_search', 'E001');
.opencode/skills/system-spec-kit/mcp_server/tests/errors-comprehensive.vitest.ts:512:    const hint = getRecoveryHint('memory_search', 'E040');
.opencode/skills/system-spec-kit/mcp_server/tests/errors-comprehensive.vitest.ts:524:  it('M1: Returns true for known tool+code (memory_search, E001)', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/errors-comprehensive.vitest.ts:525:    expect(hasSpecificHint('memory_search', 'E001')).toBe(true);
.opencode/skills/system-spec-kit/mcp_server/tests/errors-comprehensive.vitest.ts:543:    const hints = getAvailableHints('memory_search');
.opencode/skills/system-spec-kit/mcp_server/tests/errors-comprehensive.vitest.ts:550:    const hints = getAvailableHints('memory_search');
.opencode/skills/system-spec-kit/mcp_server/lib/routing/routing-prototypes.json:258:        "chunk": "Recovery scenarios context loss run resume, state mismatch check git status, memory not found call memory_search, stale context compare timestamps, diagnostic commands list memories, verify file integrity, force re-index. This is generic operator boilerplate repeated across many memory files."
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:113:    expect(CONFIDENCE_WEIGHTS.weak).toBe(0.1);
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:235:      makeEvent({ confidence: 'weak',   sessionId: 'sess-3' }),
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:242:    expect(s.weakCount).toBe(1);
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:292:      makeEvent({ memoryId: 'mem-low',  confidence: 'weak',   sessionId: 's1' }),
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:309:      mediumCount: 0, weakCount: 0, weightedScore: 3.0, computedBoost: 0.05,
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:319:      mediumCount: 0, weakCount: 0, weightedScore: 2.0, computedBoost: 0.05,
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:329:      mediumCount: 0, weakCount: 0, weightedScore: 1.0, computedBoost: 0.01,
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:333:      mediumCount: 0, weakCount: 0, weightedScore: 1.0, computedBoost: 0.01,
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:349:      { memoryId: 'a', sessionCount: 5, strongCount: 1, mediumCount: 0, weakCount: 0, weightedScore: 1.0, computedBoost: 0.01 },
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:350:      { memoryId: 'b', sessionCount: 1, strongCount: 1, mediumCount: 0, weakCount: 0, weightedScore: 1.0, computedBoost: 0.01 },
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:351:      { memoryId: 'c', sessionCount: 3, strongCount: 1, mediumCount: 0, weakCount: 0, weightedScore: 1.0, computedBoost: 0.01 },
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:438:      mediumCount: 1, weakCount: 0, weightedScore: 3.5, computedBoost: 0.08,
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:449:      mediumCount: 2, weakCount: 1, weightedScore: 3.1, computedBoost: 0.09,
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:466:      mediumCount: 0, weakCount: 0, weightedScore: 10.0, computedBoost: 0.99, // above cap
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:480:      mediumCount: 0, weakCount: 0, weightedScore: 4.0, computedBoost: 0.10,
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:554:      makeEvent({ memoryId: 'mem-weak', sessionId: 'sess-1', timestamp: BASE_TS }),
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:555:      makeEvent({ memoryId: 'mem-weak', sessionId: 'sess-2', timestamp: BASE_TS }),
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:565:    expect(getBatchLearningCount(db, 'mem-weak')).toBe(0);
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:658:      mediumCount: 0, weakCount: 0, weightedScore: 3.0, computedBoost: 0.05,
.opencode/skills/system-spec-kit/mcp_server/tests/batch-learning.vitest.ts:685:      mediumCount: 0, weakCount: 0, weightedScore: 3.0, computedBoost: 0.05,
.opencode/skills/system-spec-kit/mcp_server/tests/dual-scope-hooks.vitest.ts:132:  it('returns null for memory_search', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/dual-scope-hooks.vitest.ts:133:    const result = await autoSurfaceAtToolDispatch('memory_search', { query: 'some query' });
.opencode/skills/system-spec-kit/mcp_server/lib/routing/content-router.ts:1294:    'Confidence scale: 0.90-1.00 safe auto-route; 0.70-0.89 strong route; 0.50-0.69 weak route with warning; below 0.50 refuse.',
.opencode/skills/system-spec-kit/mcp_server/tests/mcp-input-validation.vitest.ts:37:    tool: 'memory_search',
.opencode/skills/system-spec-kit/mcp_server/tests/mcp-input-validation.vitest.ts:177:  { tool: 'memory_search', handler: 'handleMemorySearch' },
.opencode/skills/system-spec-kit/mcp_server/tests/search-fallback-tiered.vitest.ts:318:    const weak = __testables.checkDegradation([
.opencode/skills/system-spec-kit/mcp_server/tests/search-fallback-tiered.vitest.ts:324:    expect(weak).toBeTruthy();
.opencode/skills/system-spec-kit/mcp_server/tests/search-fallback-tiered.vitest.ts:325:    expect(['low_quality', 'both']).toContain(weak?.reason);
.opencode/skills/system-spec-kit/mcp_server/tests/gate-d-regression-4-stage-search-pipeline.vitest.ts:28:  formatSearchResults: vi.fn(async (
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-ux-hooks.vitest.ts:53:  formatSearchResults: vi.fn(async (
.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-ux-hooks.vitest.ts:134:describe('memory_search UX hook integration', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/bm25-baseline.vitest.ts:130:    expect(result.interpretation).toContain('weak');
.opencode/skills/system-spec-kit/mcp_server/tests/memory-tools.vitest.ts:12:    content: [{ type: 'text', text: JSON.stringify({ data: { results: [], count: 0 }, meta: { tool: 'memory_search' } }) }],
.opencode/skills/system-spec-kit/mcp_server/tests/session-manager-extended.vitest.ts:626:      expect(md).toContain('memory_search');
.opencode/skills/system-spec-kit/mcp_server/tests/checkpoint-completeness.vitest.ts:297:  `).run(1, 'sess-1', 1, 0.9, now, later, 2, 1, 1, 'memory_search', 'call-1', 'rule-1', 0);
.opencode/skills/system-spec-kit/mcp_server/tests/trace-propagation.vitest.ts:7:import { formatSearchResults } from '../formatters/search-results';
.opencode/skills/system-spec-kit/mcp_server/tests/trace-propagation.vitest.ts:76:function parseFirstResultTraceText(payload: Awaited<ReturnType<typeof formatSearchResults>>) {
.opencode/skills/system-spec-kit/mcp_server/tests/trace-propagation.vitest.ts:130:  it('surfaces runtime queryComplexity through formatSearchResults trace fallback', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/trace-propagation.vitest.ts:132:    const formatted = await formatSearchResults(results, 'semantic', false, null, null, null, {}, true);
.opencode/skills/system-spec-kit/mcp_server/lib/eval/data/ground-truth.json:415:      "query": "the memory_search tool returns stale results after index rebuild",
.opencode/skills/system-spec-kit/mcp_server/lib/eval/data/ground-truth.json:425:      "query": "what is the difference between memory_context and memory_search for context retrieval",
.opencode/skills/system-spec-kit/mcp_server/lib/eval/data/ground-truth.json:430:      "expectedResultDescription": "Should surface both memory_context (L1 unified entry) and memory_search (L2 core) tool schemas and any documentation comparing their use cases.",
.opencode/skills/system-spec-kit/mcp_server/lib/eval/data/ground-truth.json:725:      "query": "when should I use memory_search versus memory_context",
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:4:  formatSearchResults,
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:23:  label: 'good' | 'weak' | 'gap';
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:34:    requestQuality?: RequestQualityPayload;
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:39:function parseEnvelope(response: Awaited<ReturnType<typeof formatSearchResults>>): SearchEnvelope {
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:67:  const response = await formatSearchResults(
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:352:  it('assesses request quality as good, weak, or gap at the query level', async () => {
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:377:    const weakEnvelope = await formatEnvelope([
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:400:    expect(goodEnvelope.data.requestQuality?.label).toBe('good');
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:401:    expect(weakEnvelope.data.requestQuality?.label).toBe('weak');
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:402:    expect(gapEnvelope.data.requestQuality?.label).toBe('gap');
.opencode/skills/system-spec-kit/mcp_server/tests/result-confidence-scoring.vitest.ts:426:    expect(envelope.data.requestQuality).toBeUndefined();
.opencode/skills/system-spec-kit/mcp_server/tests/extraction-adapter.vitest.ts:133:    expect(matchRule('memory_search', 'spec.md error context')).not.toBeNull();
.opencode/skills/system-spec-kit/mcp_server/tests/continue-session.vitest.ts:250:  it('T020-02: Generates memory_search command with sessionId when specFolder is not provided', () => {
.opencode/skills/system-spec-kit/mcp_server/tests/continue-session.vitest.ts:254:  it('T020-03: Generates generic memory_search when neither specFolder nor sessionId is provided', () => {
.opencode/skills/system-spec-kit/mcp_server/lib/README.md:390:// DORMANT (0.02 <= R < 0.05) - Very weak, needs revival
.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-pipeline-enforcement.vitest.ts:213:- If this fixture starts failing insufficiency again, add more concrete file, decision, blocker, next action, or outcome evidence instead of weakening the gate.
.opencode/skills/system-spec-kit/mcp_server/tests/content-router.vitest.ts:245:  it('uses Tier 2 when Tier 1 confidence is too weak', async () => {
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:146: *     BM25 alone is weak — strong justification for multi-channel
.opencode/skills/system-spec-kit/mcp_server/lib/eval/bm25-baseline.ts:186:      'BM25 alone is weak — strong justification for multi-channel retrieval. ' +
.opencode/skills/system-spec-kit/mcp_server/tests/memory-context.vitest.ts:903:      meta: { tool: 'memory_search' }
.opencode/skills/system-spec-kit/mcp_server/lib/cache/README.md:182:const key = generateCacheKey('memory_search', { query: 'test' });
.opencode/skills/system-spec-kit/mcp_server/lib/cache/README.md:185:set(key, searchResults, { toolName: 'memory_search', ttlMs: 30000 });
.opencode/skills/system-spec-kit/mcp_server/lib/cache/README.md:197:  'memory_search',
.opencode/skills/system-spec-kit/mcp_server/lib/cache/README.md:211:// Automatically clears memory_search, memory_match_triggers, etc.
.opencode/skills/system-spec-kit/mcp_server/lib/cache/tool-cache.ts:312:    'memory_search',
.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/prediction-error-gate.ts:149:  // General/weak signals get lower confidence, explicit/strong signals get higher
.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/prediction-error-gate.ts:151:    clarification: 0.45,   // "actually" — weakest, often conversational
.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/prediction-error-gate.ts:178:      // Existing content had a signal that new content dropped — weaker signal
.opencode/skills/system-spec-kit/mcp_server/lib/search/community-search.ts:6:// When primary search returns weak or zero results, this module
.opencode/skills/system-spec-kit/mcp_server/lib/search/community-search.ts:94: * score. Used as a fallback channel when primary search returns weak results.
.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:10:// FEATURE FLAG: SPECKIT_EMPTY_RESULT_RECOVERY_V1 (default ON, graduated)
.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:14://   "status": "no_results" | "low_confidence" | "partial",
.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:16://   "suggestedQueries": ["broader alternative 1", "rephrased alternative 2"],
.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:23:export type RecoveryStatus = 'no_results' | 'low_confidence' | 'partial';
.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:42:  suggestedQueries: string[];
.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:54:  /** How many results were returned (0 = no_results, 1–N = partial/low_confidence). */
.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:83:  ) return 'low_confidence';
.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:85:  return 'low_confidence'; // fallback — should only be called when recovery is warranted
.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:209:  if (status === 'low_confidence') {
.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:225: * Phase B T017: Build graph-expanded fallback query terms on zero/weak results.
.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:246:  if (status !== 'no_results' && status !== 'low_confidence') return [];
.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:314: * Build a structured recovery payload for a failed or weak retrieval.
.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:329:  const suggestedQueries = recommendedAction === 'ask_user' && generatedSuggestions.length === 0
.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:336:    suggestedQueries,
.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:370: * Default: ON (graduated). Set SPECKIT_EMPTY_RESULT_RECOVERY_V1=false to disable.
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/feedback-ledger.ts:12://   weak    — search_shown, same_topic_requery (passive exposure)
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/feedback-ledger.ts:22: * Confidence signal hierarchy (strongest → weakest):
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/feedback-ledger.ts:33:export type FeedbackConfidence = 'strong' | 'medium' | 'weak';
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/feedback-ledger.ts:82:  same_topic_requery:   'weak',
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/feedback-ledger.ts:83:  search_shown:         'weak',
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/feedback-ledger.ts:95:  return EVENT_TYPE_CONFIDENCE[type] ?? 'weak';
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/feedback-ledger.ts:124:    confidence TEXT NOT NULL CHECK(confidence IN ('strong','medium','weak')),
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/feedback-ledger.ts:314:  weak: number;
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/feedback-ledger.ts:330:    const summary: MemoryFeedbackSummary = { memoryId, total: 0, strong: 0, medium: 0, weak: 0 };
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/feedback-ledger.ts:337:    return { memoryId, total: 0, strong: 0, medium: 0, weak: 0 };
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/query-flow-tracker.ts:184:    const confidence = detection.type === 'query_reformulated' ? 'medium' : 'weak';
.opencode/skills/system-spec-kit/mcp_server/lib/search/progressive-disclosure.ts:197: * Format: "3 strong, 2 weak, 1 conflict" style.
.opencode/skills/system-spec-kit/mcp_server/lib/search/progressive-disclosure.ts:211:  if (classification.low > 0) parts.push(`${classification.low} weak`);
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/batch-learning.ts:50:  weak:   0.1,
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/batch-learning.ts:66:  /** Raw count of weak-tier events. */
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/batch-learning.ts:67:  weakCount: number;
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/batch-learning.ts:203:      weak: number;
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/batch-learning.ts:209:        entry = { sessions: new Set<string>(), strong: 0, medium: 0, weak: 0 };
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/batch-learning.ts:224:        data.weak   * CONFIDENCE_WEIGHTS.weak;
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/batch-learning.ts:228:      const totalEvents = data.strong + data.medium + data.weak;
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/batch-learning.ts:237:        weakCount:     data.weak,
.opencode/skills/system-spec-kit/mcp_server/lib/feedback/batch-learning.ts:435:      (sum, s) => sum + s.strongCount + s.mediumCount + s.weakCount, 0
.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/README.md:34:The `pipeline/` directory implements the core retrieval pipeline behind `memory_search`. Each search request flows through four sequential stages, each with a defined I/O contract and clear responsibility boundary. The pipeline supports hybrid, vector and multi-concept search types with optional deep-mode query expansion, cross-encoder reranking, MMR diversity pruning and MPAB chunk-to-parent reassembly.
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:177:Packet `026-graph-and-context-optimization/010-fts-capability-cascade-floor` freezes the lexical capability contract that packet `002-implement-cache-warning-hooks` now consumes. `memory_search` responses expose:
.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:346:| `recovery-payload.ts`      | -      | TypeScript | Builds structured recovery payloads for weak or empty results |
.opencode/skills/system-spec-kit/mcp_server/lib/search/causal-boost.ts:81: * amplify the boost while weaker ones (contradicts) attenuate it.
.opencode/skills/system-spec-kit/mcp_server/lib/search/confidence-scoring.ts:19://   "requestQuality": {
.opencode/skills/system-spec-kit/mcp_server/lib/search/confidence-scoring.ts:20://     "label": "good" | "weak" | "gap"
.opencode/skills/system-spec-kit/mcp_server/lib/search/confidence-scoring.ts:63:export type RequestQualityLabel = 'good' | 'weak' | 'gap';
.opencode/skills/system-spec-kit/mcp_server/lib/search/confidence-scoring.ts:89:  requestQuality: {
.opencode/skills/system-spec-kit/mcp_server/lib/search/confidence-scoring.ts:262:    // should reflect that even when heuristic signals are weak.
.opencode/skills/system-spec-kit/mcp_server/lib/search/confidence-scoring.ts:287: * - "weak":  results exist but signals are mixed or low
.opencode/skills/system-spec-kit/mcp_server/lib/search/confidence-scoring.ts:298:    return { requestQuality: { label: 'gap' } };
.opencode/skills/system-spec-kit/mcp_server/lib/search/confidence-scoring.ts:310:    return { requestQuality: { label: 'good' } };
.opencode/skills/system-spec-kit/mcp_server/lib/search/confidence-scoring.ts:313:    return { requestQuality: { label: 'weak' } };
.opencode/skills/system-spec-kit/mcp_server/lib/search/confidence-scoring.ts:315:  return { requestQuality: { label: 'gap' } };
.opencode/skills/system-spec-kit/mcp_server/lib/search/search-flags.ts:585: * REQ-D5-001: Empty/weak result recovery UX.
.opencode/skills/system-spec-kit/mcp_server/lib/search/search-flags.ts:586: * Default: TRUE (graduated). Set SPECKIT_EMPTY_RESULT_RECOVERY_V1=false to disable.
.opencode/skills/system-spec-kit/mcp_server/lib/search/search-flags.ts:589:  return isFeatureEnabled('SPECKIT_EMPTY_RESULT_RECOVERY_V1');
.opencode/skills/system-spec-kit/mcp_server/lib/search/search-flags.ts:646: * Phase B T017: Graph-expanded fallback on zero/weak results.
.opencode/skills/system-spec-kit/mcp_server/lib/search/search-flags.ts:699: * When primary search returns weak/no results, searches community summaries
.opencode/skills/system-spec-kit/mcp_server/lib/search/sqlite-fts.ts:4:// Feature catalog: Semantic and lexical search (memory_search)
.opencode/skills/system-spec-kit/mcp_server/lib/search/intent-classifier.ts:556:  // This prevents weak single-keyword matches from dominating classification.
.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:162: * value in cache keys (e.g. memory_search when `enableCausalBoost=true`) so
.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:166: * R-007-12 — targeted memory_search cache invalidation.
.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:184:  // includes it (e.g. memory_search when enableCausalBoost=true) becomes
.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:1085:  // R-007-12: Generation counter for memory_search cache invalidation
.opencode/skills/system-spec-kit/mcp_server/lib/architecture/README.md:134:const budget = getTokenBudget('memory_search');
.opencode/skills/system-spec-kit/mcp_server/lib/architecture/README.md:141:const enhanced = enhanceDescription('memory_search', 'Search memories');
.opencode/skills/system-spec-kit/mcp_server/lib/architecture/layer-definitions.ts:59:    tools: ['memory_search', 'memory_quick_search', 'memory_save', 'memory_match_triggers']

exec
/bin/zsh -lc "find .opencode/skills/system-spec-kit/mcp_server -path '*search*' -type f | sort | sed -n '1,220p'" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 108ms:
.opencode/skills/system-spec-kit/mcp_server/api/search.ts
.opencode/skills/system-spec-kit/mcp_server/configs/search-weights.json
.opencode/skills/system-spec-kit/mcp_server/dist/api/search.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/api/search.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/api/search.js
.opencode/skills/system-spec-kit/mcp_server/dist/api/search.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/formatters/search-results.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/formatters/search-results.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/formatters/search-results.js
.opencode/skills/system-spec-kit/mcp_server/dist/formatters/search-results.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/handlers/memory-search.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/handlers/memory-search.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/handlers/memory-search.js
.opencode/skills/system-spec-kit/mcp_server/dist/handlers/memory-search.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/anchor-metadata.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/anchor-metadata.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/anchor-metadata.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/anchor-metadata.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/artifact-routing.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/artifact-routing.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/artifact-routing.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/artifact-routing.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/auto-promotion.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/auto-promotion.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/auto-promotion.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/auto-promotion.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/bm25-index.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/bm25-index.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/bm25-index.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/bm25-index.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/causal-boost.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/causal-boost.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/causal-boost.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/causal-boost.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/channel-enforcement.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/channel-enforcement.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/channel-enforcement.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/channel-enforcement.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/channel-representation.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/channel-representation.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/channel-representation.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/channel-representation.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/chunk-reassembly.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/chunk-reassembly.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/chunk-reassembly.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/chunk-reassembly.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/community-search.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/community-search.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/community-search.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/community-search.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/confidence-scoring.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/confidence-scoring.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/confidence-scoring.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/confidence-scoring.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/confidence-truncation.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/confidence-truncation.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/confidence-truncation.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/confidence-truncation.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/cross-encoder.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/cross-encoder.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/cross-encoder.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/cross-encoder.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/deterministic-extractor.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/deterministic-extractor.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/deterministic-extractor.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/deterministic-extractor.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/dynamic-token-budget.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/dynamic-token-budget.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/dynamic-token-budget.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/dynamic-token-budget.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/embedding-expansion.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/embedding-expansion.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/embedding-expansion.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/embedding-expansion.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/encoding-intent.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/encoding-intent.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/encoding-intent.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/encoding-intent.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/entity-linker.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/entity-linker.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/entity-linker.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/entity-linker.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/evidence-gap-detector.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/evidence-gap-detector.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/evidence-gap-detector.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/evidence-gap-detector.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/feedback-denylist.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/feedback-denylist.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/feedback-denylist.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/feedback-denylist.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/folder-discovery.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/folder-discovery.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/folder-discovery.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/folder-discovery.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/folder-relevance.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/folder-relevance.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/folder-relevance.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/folder-relevance.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/fsrs.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/fsrs.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/fsrs.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/fsrs.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/graph-calibration.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/graph-calibration.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/graph-calibration.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/graph-calibration.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/graph-flags.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/graph-flags.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/graph-flags.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/graph-flags.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/graph-lifecycle.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/graph-lifecycle.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/graph-lifecycle.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/graph-lifecycle.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/graph-search-fn.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/graph-search-fn.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/graph-search-fn.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/graph-search-fn.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/hybrid-search.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/hybrid-search.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/hybrid-search.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/hybrid-search.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/hyde.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/hyde.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/hyde.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/hyde.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/intent-classifier.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/intent-classifier.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/intent-classifier.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/intent-classifier.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/learned-feedback.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/learned-feedback.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/learned-feedback.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/learned-feedback.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/llm-cache.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/llm-cache.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/llm-cache.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/llm-cache.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/llm-reformulation.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/llm-reformulation.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/llm-reformulation.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/llm-reformulation.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/local-reranker.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/local-reranker.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/local-reranker.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/local-reranker.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/memory-summaries.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/memory-summaries.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/memory-summaries.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/memory-summaries.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/pipeline/index.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/pipeline/index.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/pipeline/index.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/pipeline/index.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/pipeline/orchestrator.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/pipeline/orchestrator.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/pipeline/orchestrator.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/pipeline/orchestrator.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/pipeline/ranking-contract.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/pipeline/ranking-contract.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/pipeline/ranking-contract.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/pipeline/ranking-contract.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/pipeline/stage1-candidate-gen.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/pipeline/stage1-candidate-gen.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/pipeline/stage1-candidate-gen.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/pipeline/stage1-candidate-gen.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/pipeline/stage2-fusion.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/pipeline/stage2-fusion.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/pipeline/stage2-fusion.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/pipeline/stage2-fusion.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/pipeline/stage2b-enrichment.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/pipeline/stage2b-enrichment.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/pipeline/stage2b-enrichment.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/pipeline/stage2b-enrichment.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/pipeline/stage3-rerank.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/pipeline/stage3-rerank.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/pipeline/stage3-rerank.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/pipeline/stage3-rerank.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/pipeline/stage4-filter.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/pipeline/stage4-filter.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/pipeline/stage4-filter.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/pipeline/stage4-filter.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/pipeline/types.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/pipeline/types.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/pipeline/types.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/pipeline/types.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/progressive-disclosure.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/progressive-disclosure.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/progressive-disclosure.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/progressive-disclosure.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/query-classifier.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/query-classifier.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/query-classifier.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/query-classifier.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/query-decomposer.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/query-decomposer.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/query-decomposer.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/query-decomposer.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/query-expander.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/query-expander.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/query-expander.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/query-expander.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/query-router.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/query-router.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/query-router.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/query-router.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/query-surrogates.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/query-surrogates.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/query-surrogates.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/query-surrogates.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/recovery-payload.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/recovery-payload.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/recovery-payload.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/recovery-payload.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/reranker.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/reranker.d.ts.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/reranker.js
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/reranker.js.map
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/result-explainability.d.ts
.opencode/skills/system-spec-kit/mcp_server/dist/lib/search/result-explainability.d.ts.map

codex
The implementation has a very clean split: `memory-search` handles orchestration, `formatters/search-results` emits the public envelope, and `lib/search/confidence-scoring` plus `recovery-payload` decide exactly the fields your probe was looking for. I’m reading the corresponding specs now so the starting recommendation lines up with the recent packet history.
exec
/bin/zsh -lc "nl -ba .opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/009-memory-search-citation-response-policy/spec.md | sed -n '1,220p'" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
     1	---
     2	# SPECKIT_TEMPLATE_SOURCE: spec-core | v2.2
     3	title: "Feature Specification: memory_search hard response policy + citation policy [system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/009-memory-search-citation-response-policy/spec]"
     4	description: "Remediation packet for 007/Q4 (and 006 cli-opencode I2 hallucination). Adds responsePolicy.requiredAction / noCanonicalPathClaims / citationRequiredForPaths and citationPolicy fields to memory_search response so weak retrieval becomes a binding refusal contract instead of advisory metadata."
     5	trigger_phrases:
     6	  - "009-memory-search-citation-response-policy"
     7	  - "memory_search response policy"
     8	  - "noCanonicalPathClaims"
     9	  - "citationPolicy do_not_cite_results"
    10	  - "weak retrieval refusal contract"
    11	  - "Q4 hallucination guard"
    12	importance_tier: "important"
    13	contextType: "implementation"
    14	_memory:
    15	  continuity:
    16	    packet_pointer: "system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/009-memory-search-citation-response-policy"
    17	    last_updated_at: "2026-04-27T09:35:00Z"
    18	    last_updated_by: "claude-opus-4-7"
    19	    recent_action: "Scaffolded packet from 007 §5 Q4 + §13 + §15"
    20	    next_safe_action: "Dispatch cli-codex on tasks.md"
    21	    blockers: []
    22	    key_files:
    23	      - "spec.md"
    24	      - "plan.md"
    25	      - "tasks.md"
    26	      - "implementation-summary.md"
    27	    completion_pct: 10
    28	    open_questions: []
    29	    answered_questions: []
    30	template_source_hint: "<!-- SPECKIT_TEMPLATE_SOURCE: spec-core | v2.2 -->"
    31	---
    32	# Feature Specification: memory_search hard response policy + citation policy
    33	
    34	<!-- SPECKIT_LEVEL: 1 -->
    35	<!-- SPECKIT_TEMPLATE_SOURCE: spec-core | v2.2 -->
    36	
    37	---
    38	
    39	<!-- ANCHOR:metadata -->
    40	## 1. METADATA
    41	
    42	| Field | Value |
    43	|-------|-------|
    44	| **Level** | 1 |
    45	| **Priority** | P0 |
    46	| **Status** | Draft |
    47	| **Created** | 2026-04-27 |
    48	| **Branch** | `main` |
    49	| **Sources** | 007/Q4 (sec 2 + 5), 007/§13 Security, 007/§15 API, 006/I2 cli-opencode hallucination |
    50	<!-- /ANCHOR:metadata -->
    51	
    52	---
    53	
    54	<!-- ANCHOR:problem -->
    55	## 2. PROBLEM & PURPOSE
    56	
    57	### Problem Statement
    58	006/I2 cli-opencode received `requestQuality:"weak"` plus `recovery.recommendedAction:"ask_user"` with `suggestedQueries:[]`, yet still synthesized canonical-looking spec folder paths and file references that did not exist. The 007 research isolated the root cause as a soft-contract problem: weak retrieval is exposed as advisory metadata inside a SUCCESS envelope. Model callers treat the success envelope as license to cite, then fill the gap with plausible-looking inventions when no concrete result is present.
    59	
    60	### Purpose
    61	Add hard `responsePolicy` and `citationPolicy` fields to `memory_search` responses so weak retrieval becomes a BINDING claim-authority refusal contract, not advisory text. When `requestQuality.label != "good"` AND `recovery.status` indicates degraded, the response carries `responsePolicy.noCanonicalPathClaims:true` and a `safeResponse` string that the model MUST emit instead of inventing details. Also extend `RecoveryAction` vocabulary to include `ask_disambiguation`, `refuse_without_evidence`, and `broaden_or_ask`.
    62	<!-- /ANCHOR:problem -->
    63	
    64	---
    65	
    66	<!-- ANCHOR:scope -->
    67	## 3. SCOPE
    68	
    69	### In Scope
    70	- Add `responsePolicy: { requiredAction, noCanonicalPathClaims, citationRequiredForPaths, safeResponse }` to `memory_search` response data when retrieval is non-authoritative.
    71	- Add `citationPolicy: "cite_results" | "do_not_cite_results"` field to all `memory_search` responses.
    72	- Extend `RecoveryAction` vocabulary in `mcp_server/lib/search/recovery-payload.ts`.
    73	- Implement `deriveResponsePolicy(requestQuality, recovery)` per 007 §9 example.
    74	- Backfill `suggestedQueries` to never be empty when `recommendedAction:"ask_user"`; either generate safe broadening suggestions or set `requiredAction:"ask_disambiguation"`.
    75	- Update vitest suite to cover the new contract.
    76	
    77	### Out of Scope
    78	- Changes to the underlying search retrieval/ranking pipeline.
    79	- Caller-side enforcement (model behavior); contract is server-side.
    80	- CocoIndex, code-graph, causal-graph (separate packets 009-011).
    81	
    82	### Files to Change
    83	
    84	| File Path | Change Type | Description |
    85	|-----------|-------------|-------------|
    86	| `mcp_server/formatters/search-results.ts` | Modify | Insert responsePolicy + citationPolicy at lines ~951-1035 |
    87	| `mcp_server/lib/search/recovery-payload.ts` | Modify | Extend RecoveryAction enum + suggestedQueries non-empty guarantee |
    88	| `mcp_server/tests/d5-recovery-payload.vitest.ts` | Modify | Add response-policy assertions |
    89	| `mcp_server/tests/empty-result-recovery.vitest.ts` | Modify | Add citation-policy assertions |
    90	| `spec.md` | Create | This file |
    91	| `plan.md` | Create | Root cause + change surface |
    92	| `tasks.md` | Create | Per-defect work units |
    93	| `implementation-summary.md` | Create | Placeholder |
    94	| `description.json` | Create | Spec metadata |
    95	| `graph-metadata.json` | Create | Graph-derived metadata |
    96	<!-- /ANCHOR:scope -->
    97	
    98	---
    99	
   100	<!-- ANCHOR:requirements -->
   101	## 4. REQUIREMENTS
   102	
   103	### P0 — Refusal Contract
   104	
   105	| ID | Requirement | Acceptance Criteria |
   106	|----|-------------|---------------------|
   107	| REQ-001 | When `requestQuality.label != "good"` AND `recovery.status` in {`low_confidence`, `partial`, `no_results`}, response MUST include `responsePolicy.requiredAction` set to one of `ask_disambiguation` \| `broaden_or_ask` \| `refuse_without_evidence`. | After fix, 006/I2 repro returns `responsePolicy.requiredAction:"ask_disambiguation"` (or appropriate value), `noCanonicalPathClaims:true`, and a `safeResponse` string. |
   108	| REQ-002 | All `memory_search` responses MUST carry `citationPolicy` set to `"cite_results"` (good quality) or `"do_not_cite_results"` (weak/partial/no_results). | After fix, every response envelope has `data.citationPolicy` field. |
   109	| REQ-003 | When `recommendedAction:"ask_user"` AND `suggestedQueries.length === 0`, the runtime MUST either synthesize at least 2 safe broadening suggestions OR set `responsePolicy.requiredAction:"ask_disambiguation"`. Empty suggestions MUST never co-exist with no policy guidance. | After fix, the 006/I2 repro shows non-empty suggestedQueries OR responsePolicy.requiredAction set. |
   110	| REQ-004 | `RecoveryAction` enum MUST include `ask_disambiguation`, `refuse_without_evidence`, `broaden_or_ask` in addition to existing values. | After fix, `recovery-payload.ts:28-37` enum lists all 7 action values. |
   111	
   112	### Acceptance Scenarios
   113	
   114	**Given** a weak-retrieval search like 006/I2 (cli-opencode's "find the spec for the cache warning hooks packet"), **when** the response is built, **then** `data.responsePolicy.noCanonicalPathClaims:true`, `data.citationPolicy:"do_not_cite_results"`, and `data.responsePolicy.safeResponse` contains a string instructing the caller to ask for clarification rather than invent paths.
   115	
   116	**Given** a strong retrieval (good quality + concrete results), **when** the response is built, **then** `data.citationPolicy:"cite_results"` and no `responsePolicy` block is emitted.
   117	
   118	**Given** a `recommendedAction:"ask_user"` with empty `suggestedQueries`, **when** the response is built, **then** EITHER `suggestedQueries.length >= 2` OR `responsePolicy.requiredAction:"ask_disambiguation"`. Both empty + no policy is a contract violation.
   119	
   120	<!-- /ANCHOR:requirements -->
   121	
   122	---
   123	
   124	<!-- ANCHOR:success-criteria -->
   125	## 5. SUCCESS CRITERIA
   126	
   127	- **SC-001**: All 4 REQs covered by green vitest assertions.
   128	- **SC-002**: 006/I2 repro (after dist rebuild + daemon restart) shows responsePolicy + citationPolicy on weak-retrieval response.
   129	- **SC-003**: Strong-retrieval probe shows `citationPolicy:"cite_results"`, no responsePolicy.
   130	- **SC-004**: Validation passes via `validate.sh --strict`.
   131	- **SC-005**: dist marker grep confirms new fields compiled.
   132	<!-- /ANCHOR:success-criteria -->
   133	
   134	---
   135	
   136	<!-- ANCHOR:risks -->
   137	## 6. RISKS & DEPENDENCIES
   138	
   139	| Type | Item | Impact | Mitigation |
   140	|------|------|--------|------------|
   141	| Risk | Existing callers may strict-validate response shape; new fields could break them. | Medium | New fields are additive in the optional `data` block. |
   142	| Risk | Phantom-fix recurrence — patches without daemon restart. | High | Verification REQUIRES `npm run build` + documented restart. See packet 013. |
   143	| Dependency | RecoveryAction enum is referenced in multiple files. | Medium | Audit all usages before extending. |
   144	<!-- /ANCHOR:risks -->
   145	
   146	---
   147	
   148	<!-- ANCHOR:questions -->
   149	## 7. OPEN QUESTIONS
   150	
   151	- Should `safeResponse` be a fixed string per `requiredAction` value, or contextual per query? Default: fixed canonical strings keyed by action.
   152	- Do we add a `WARN` log line server-side when policy fires, for analytics? Defer to Phase D.
   153	<!-- /ANCHOR:questions -->

exec
/bin/zsh -lc "nl -ba .opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/009-memory-search-citation-response-policy/implementation-summary.md | sed -n '1,240p'" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
     1	---
     2	# SPECKIT_TEMPLATE_SOURCE: impl-summary-core | v2.2
     3	title: "Implementation Summary: memory_search response policy [system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/009-memory-search-citation-response-policy/implementation-summary]"
     4	description: "Implemented responsePolicy and citationPolicy refusal contract for weak memory_search retrieval."
     5	trigger_phrases:
     6	  - "memory search response policy summary"
     7	importance_tier: "important"
     8	contextType: "implementation"
     9	_memory:
    10	  continuity:
    11	    packet_pointer: "system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/009-memory-search-citation-response-policy"
    12	    last_updated_at: "2026-04-27T09:55:00Z"
    13	    last_updated_by: "codex-gpt-5"
    14	    recent_action: "Implemented Phase 2 source/test patches and Phase 3 build/dist marker verification"
    15	    next_safe_action: "Restart the MCP-owning client/runtime, then run live memory_search probes"
    16	    blockers:
    17	      - "Live runtime probes require user MCP daemon/client restart before they reflect rebuilt dist output"
    18	    key_files:
    19	      - ".opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts"
    20	      - ".opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts"
    21	      - ".opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts"
    22	      - ".opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts"
    23	      - "implementation-summary.md"
    24	    completion_pct: 90
    25	    open_questions: []
    26	    answered_questions: []
    27	---
    28	# Implementation Summary
    29	
    30	<!-- SPECKIT_LEVEL: 1 -->
    31	<!-- SPECKIT_TEMPLATE_SOURCE: impl-summary-core | v2.2 -->
    32	<!-- HVR_REFERENCE: .opencode/skills/sk-doc/references/hvr_rules.md -->
    33	
    34	---
    35	
    36	<!-- ANCHOR:metadata -->
    37	## Metadata
    38	
    39	| Field | Value |
    40	|-------|-------|
    41	| **Spec Folder** | 009-memory-search-citation-response-policy |
    42	| **Completed** | 2026-04-27 |
    43	| **Level** | 1 |
    44	<!-- /ANCHOR:metadata -->
    45	
    46	---
    47	
    48	<!-- ANCHOR:what-built -->
    49	## What Was Built
    50	
    51	Implemented the server-side refusal contract for `memory_search` weak retrieval:
    52	
    53	- Added `citationPolicy: "cite_results" | "do_not_cite_results"` to memory search response data.
    54	- Added conditional `responsePolicy` with `requiredAction`, `noCanonicalPathClaims`, `citationRequiredForPaths`, and `safeResponse` when request quality is not good and recovery is present.
    55	- Extended `RecoveryAction` with `ask_disambiguation`, `refuse_without_evidence`, and `broaden_or_ask`.
    56	- Updated recovery action selection so no-evidence, ambiguous, and partial retrieval states can emit the new action values.
    57	- Guaranteed `ask_user` recovery does not ship with empty `suggestedQueries` by synthesizing two safe broadening suggestions from the original query tokens.
    58	- Added Vitest coverage for weak-quality policy, good-quality citation behavior, and the `ask_user` empty-suggestion guard.
    59	
    60	### Files Changed
    61	
    62	| File | Action | Purpose |
    63	|------|--------|---------|
    64	| `.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts` | Modified | Added `deriveResponsePolicy`, `deriveCitationPolicy`, and response data fields |
    65	| `.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts` | Modified | Extended `RecoveryAction`, mapped new actions, added safe suggestion synthesis |
    66	| `.opencode/skills/system-spec-kit/mcp_server/tests/d5-recovery-payload.vitest.ts` | Modified | Added enum/action and `ask_user` suggestion coverage |
    67	| `.opencode/skills/system-spec-kit/mcp_server/tests/empty-result-recovery.vitest.ts` | Modified | Added responsePolicy/citationPolicy contract cases |
    68	| `.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/009-memory-search-citation-response-policy/implementation-summary.md` | Modified | Recorded implementation and verification evidence |
    69	<!-- /ANCHOR:what-built -->
    70	
    71	---
    72	
    73	<!-- ANCHOR:how-delivered -->
    74	## How It Was Delivered
    75	
    76	Implemented directly against `spec.md`, `tasks.md`, and the 007 research anchors for Q4, security guardrails, code patterns, and API shape. The patch stayed additive to response envelopes and used targeted `npx vitest run` rather than the broader pretest hook.
    77	<!-- /ANCHOR:how-delivered -->
    78	
    79	---
    80	
    81	<!-- ANCHOR:decisions -->
    82	## Key Decisions
    83	
    84	| Decision | Why |
    85	|----------|-----|
    86	| Server-side contract, not caller enforcement | The 006/I2 hallucination happened despite recovery metadata being present; advisory metadata is not enough. |
    87	| Additive fields | Backward compatibility. |
    88	| Citation defaults to `do_not_cite_results` unless request quality is explicitly `good` | Unknown or weak quality should not authorize canonical path claims. |
    89	| `ask_user` empty suggestions are repaired in recovery payload construction | Keeps the recovery payload itself actionable before formatter policy fallback is needed. |
    90	<!-- /ANCHOR:decisions -->
    91	
    92	---
    93	
    94	<!-- ANCHOR:verification -->
    95	## Verification
    96	
    97	| Check | Result |
    98	|-------|--------|
    99	| `cd .opencode/skills/system-spec-kit/mcp_server && npx vitest run tests/d5-recovery-payload.vitest.ts tests/empty-result-recovery.vitest.ts` | PASS: 2 files passed, 48 tests passed |
   100	| `cd .opencode/skills/system-spec-kit/mcp_server && npm run build` | PASS: `tsc --build` completed successfully |
   101	| `grep -l responsePolicy .opencode/skills/system-spec-kit/mcp_server/dist/formatters/search-results.js` | PASS: matched `dist/formatters/search-results.js` |
   102	| `grep -l citationPolicy .opencode/skills/system-spec-kit/mcp_server/dist/formatters/search-results.js` | PASS: matched `dist/formatters/search-results.js` |
   103	| `grep -l ask_disambiguation .opencode/skills/system-spec-kit/mcp_server/dist/lib/search/recovery-payload.js` | PASS: matched `dist/lib/search/recovery-payload.js` |
   104	| `bash .opencode/skills/system-spec-kit/scripts/spec/validate.sh .opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/009-memory-search-citation-response-policy --strict` | PASS: Errors 0, Warnings 0 |
   105	| Live `memory_search({query:"find the spec for the cache warning hooks packet"})` probe | PASS (cite_results branch): recorded 2026-04-27T10:12:37.318Z; `data.citationPolicy:"cite_results"`, `requestQuality.label:"good"`, `intent.type:"find_spec"`, top hit is the `001-cache-warning-hooks` spec at similarity 84.07. `evidenceGapWarning` still surfaces (`Z=1.21`) per 007/Q4 contract. Weak-quality branch (`do_not_cite_results`/`responsePolicy.noCanonicalPathClaims`/`safeResponse`/`ask_disambiguation`) not exercised here — covered by `tests/d5-recovery-payload.vitest.ts` and `tests/empty-result-recovery.vitest.ts`; restart confirms cite_results path is live in production. |
   106	| 006/I2 weak-quality live repro after restart | DEFERRED: still requires the original 006/I2 query that yielded `requestQuality:"weak"`; this probe used a good-quality query to confirm cite_results path. Recommend running 006/I2 reproduction during item 2.2 sweep re-run. |
   107	<!-- /ANCHOR:verification -->
   108	
   109	---
   110	
   111	<!-- ANCHOR:limitations -->
   112	## Known Limitations
   113	
   114	1. **Server-side contract only.** This packet adds the policy fields; caller-side enforcement (model behavior to honor noCanonicalPathClaims) is out of scope. CLI runtimes need their own contract to read these fields.
   115	2. **MCP daemon restart required.** The rebuilt `dist` files are on disk, but live MCP probes will not reflect this change until the user restarts the MCP-owning client/runtime.
   116	<!-- /ANCHOR:limitations -->

exec
/bin/zsh -lc "nl -ba .opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/010-stress-test-close-loop-measurement-rerun/spec.md | sed -n '1,220p'" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
     1	---
     2	# SPECKIT_TEMPLATE_SOURCE: spec-core + level2-verify | v2.2
     3	title: "Feature Specification: Stress-Test Rerun v1.0.2 — close-the-loop measurement"
     4	template_source: "SPECKIT_TEMPLATE_SOURCE: spec-core + level2-verify | v2.2"
     5	description: "Re-run the v1.0.1 30-cell stress-test sweep against the post-fix dist (fork v0.2.3+spec-kit-fork.0.2.0; remediation packets 003-009 landed). Score under the same 4-dim rubric, classify per-cell deltas as WIN / NEUTRAL / REGRESSION, and produce a per-packet verdict so we know whether each fix actually moved the needle."
     6	trigger_phrases:
     7	  - "010-stress-test-close-loop-measurement-rerun"
     8	  - "v1.0.2 stress test rerun"
     9	  - "post-fix sweep"
    10	  - "close-the-loop measurement"
    11	  - "30-cell rerun"
    12	  - "per-packet verdict"
    13	importance_tier: "important"
    14	contextType: "implementation"
    15	_memory:
    16	  continuity:
    17	    packet_pointer: "system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/010-stress-test-close-loop-measurement-rerun"
    18	    last_updated_at: "2026-04-27T15:00:00Z"
    19	    last_updated_by: "claude-opus-4-7"
    20	    recent_action: "Scaffolded packet"
    21	    next_safe_action: "T001 daemon-restart attestation pre-flight"
    22	    blockers: []
    23	    key_files:
    24	      - "spec.md"
    25	      - "plan.md"
    26	      - "tasks.md"
    27	      - "checklist.md"
    28	    session_dedup:
    29	      fingerprint: null
    30	      session_id: "010-stress-test-close-loop-measurement-rerun-scaffold-2026-04-27"
    31	      parent_session_id: null
    32	    completion_pct: 5
    33	    open_questions: []
    34	    answered_questions: []
    35	---
    36	
    37	<!-- SPECKIT_TEMPLATE_SOURCE: spec-core + level2-verify | v2.2 -->
    38	<!-- SPECKIT_LEVEL: 1 -->
    39	
    40	# Feature Specification: Stress-Test Rerun v1.0.2 — close-the-loop measurement
    41	
    42	<!-- ANCHOR:metadata -->
    43	## 1. METADATA
    44	
    45	| Field | Value |
    46	|-------|-------|
    47	| **Level** | 2 |
    48	| **Priority** | P1 |
    49	| **Status** | Draft (scaffold; execution pending) |
    50	| **Created** | 2026-04-27 |
    51	| **Branch** | `main` |
    52	| **Parent Spec** | `../spec.md` |
    53	| **Parent Packet** | `011-mcp-runtime-stress-remediation` |
    54	| **Predecessor** | `../001-search-intelligence-stress-playbook` (v1.0.1 baseline; frozen) |
    55	| **Successor** | None (current tail) |
    56	| **Handoff Criteria** | All 30 cells have v1.0.2 score.md entries with v1.0.1 baseline + delta classification; per-packet verdict table populated for packets 003-009; no REGRESSION cells unresolved. |
    57	<!-- /ANCHOR:metadata -->
    58	
    59	---
    60	
    61	<!-- ANCHOR:problem -->
    62	## 2. PROBLEM & PURPOSE
    63	
    64	### Problem Statement
    65	The v1.0.1 stress-test sweep (`../001-search-intelligence-stress-playbook/002-search-scenario-execution/findings.md`) baselined the four MCP-runtime surfaces against a 30-cell scenario matrix on 2026-04-26 and surfaced the regressions that drove the eight remediation packets shipped earlier this session (003-009 in the renumbered phase tree, originally tracked as 008-014). All eight remediation packets landed source patches plus rebuilt `dist/`, and live MCP probes earlier this session confirmed the fork dist is loaded in production. What is *not yet measured* is the impact: did the contract additions (`preEnforcementTokens`, `fallbackDecision`, `path_class` rerank, `responsePolicy.noCanonicalPathClaims`, normalized `IntentTelemetry`, `deltaByRelation`, daemon rebuild protocol) actually move the per-cell quality, latency, and hallucination scores compared to the v1.0.1 baseline? Without that measurement, the remediation cycle is "shipped but unconfirmed" and `HANDOVER-deferred.md` §2.1 stays open indefinitely.
    66	
    67	### Purpose
    68	Re-run the same 30-cell sweep on the post-fix dist, score it under the same v1.0.1 rubric (4 dimensions, 0-2 scale, 8 pts max per cell — no recalibration; the rubric stays canonical so deltas are directly comparable), and aggregate per-cell deltas into per-packet verdicts. Headline question this packet exists to answer: **"For each remediation packet 003-009, did at least one cell improve by ≥1 point under the v1.0.1 rubric?"** A YES across the board closes HANDOVER-deferred §2.1 with green evidence; any NO is an indicator that the source-code patches shipped but didn't reach the runtime path the rubric exercises.
    69	
    70	This packet is **scaffold-stage** — spec, plan, task ledger, and metadata are authored now; the actual sweep dispatch and findings.md synthesis run in a follow-on session after a daemon-restart attestation gate passes (per packet 008's rebuild protocol).
    71	<!-- /ANCHOR:problem -->
    72	
    73	---
    74	
    75	<!-- ANCHOR:scope -->
    76	## 3. SCOPE
    77	
    78	### In Scope
    79	- **Pre-flight daemon-restart attestation**: confirm `ccc --version` reports `+spec-kit-fork.0.2.0`, `memory_context` smoke probe returns `meta.tokenBudgetEnforcement.preEnforcementTokens` populated, `code_graph_status` returns `freshnessAuthority:"live"`, and `memory_causal_stats` returns all 6 `by_relation` keys. ABORT if any probe is stale.
    80	- **30-cell sweep dispatch** verbatim from v1.0.1: 9 scenarios (S1/S2/S3, Q1/Q2/Q3, I1/I2/I3) × 3 base CLIs (cli-codex, cli-copilot, cli-opencode) + 3 ablation cells (cli-opencode-pure on S1/S2/S3 only) = 30 cells.
    81	- **Score under v1.0.1 rubric** (4 dims, 8 pts max). No rubric recalibration; the rubric is the constant against which v1.0.2 measures change.
    82	- **Per-cell delta classification** vs v1.0.1 baseline scores from `../001-search-intelligence-stress-playbook/002-search-scenario-execution/findings.md` Per-Scenario Comparison table: WIN (delta ≥ +1), NEUTRAL (|delta| < 1), REGRESSION (delta ≤ −1).
    83	- **Per-cell fork-telemetry assertions** woven into each `score.md` (see Requirements REQ-008..013 below): assertions exercise the new contract fields shipped by packets 003-009.
    84	- **Per-packet verdict aggregation**: a table mapping each remediation packet (003-009) to the cells that exercise its REQs, the classifications of those cells, and a verdict (PROVEN / NEUTRAL / NEGATIVE).
    85	- **Findings.md (v1.0.2)** authored at this packet's root after dispatch, mirroring the v1.0.1 findings.md shape: executive summary → per-scenario comparison → per-CLI averages → cross-reference (now to packets 003-009 instead of 005) → recommendations.
    86	
    87	### Out of Scope
    88	- **Rubric recalibration**. The v1.0.1 rubric is canonical; deltas only meaningful if rubric is held constant. If the v1.0.2 sweep surfaces a need for v1.0.3 calibration, that is a future packet.
    89	- **Corpus changes**. The 9 scenarios are unchanged. v1.0.2 does NOT add new prompts; if the sweep surfaces gaps, they are recommendations, not in-scope edits.
    90	- **Modifying the v1.0.1 baseline**. The frozen `findings.md` in `../001-search-intelligence-stress-playbook/002-search-scenario-execution/` is read-only evidence; this packet appends a 1-line forward pointer at file end, no other mutation.
    91	- **Modifying the 003-009 remediation packets**. They are complete and frozen. v1.0.2 reads from them, doesn't write to them.
    92	- **Statistical significance / N>1 runs per cell**. v1.0.2 stays at N=1 per cell (same as v1.0.1) for direct comparability. The `tasks.md` REQ-006 in v1.0.1 already classified N>1 as P2 / future.
    93	
    94	### Files to Change
    95	
    96	| File Path | Change Type | Description |
    97	|-----------|-------------|-------------|
    98	| `./spec.md` | Create | This file. |
    99	| `./plan.md` | Create | Technical context, architecture, phases, testing strategy, dependencies, rollback. |
   100	| `./tasks.md` | Create | T001-T003 pre-flight, T101-T130 per-cell dispatch, T201-T209 per-scenario scoring, T301-T305 findings synthesis. |
   101	| `./checklist.md` | Create | P0/P1/P2 quality gates the sweep must clear before findings.md ships. |
   102	| `./description.json` | Create | Indexer metadata. |
   103	| `./graph-metadata.json` | Create | Graph metadata; `parent_id` = 011, `status` = `draft`. |
   104	| `./scripts/` | Create at execution time | `dispatch-cli-{codex,copilot,opencode}.sh` + `prompts/{S,Q,I}*.md` mirrored from `../001/001-search-scenario-design/scripts/`. NOT created in this scaffold pass. |
   105	| `./runs/` | Create at execution time | Per-cell artifacts `{prompt.md, output.txt, meta.json, score.md}`. NOT created in this scaffold pass. |
   106	| `./findings.md` | Create at execution time | v1.0.2 findings synthesis. NOT created in this scaffold pass. |
   107	| `../spec.md` | Modify | Add row 10 to PHASE DOCUMENTATION MAP. |
   108	| `../description.json` | Modify | Append child to `migration.child_phase_folders`. |
   109	| `../graph-metadata.json` | Modify | Append child to `derived.children_ids`; bump `last_active_child_id` to 010. |
   110	| `../HANDOVER-deferred.md` | Modify | §2.1 status: `Pending` → `Scaffolded — see ./010-stress-test-close-loop-measurement-rerun/`. |
   111	| `../resource-map.md` | Modify | Add new 010 row to §Specs; bump Generated timestamp + Total references. |
   112	| `../001-search-intelligence-stress-playbook/002-search-scenario-execution/findings.md` | Modify | Append 1-line forward pointer to 010 at file end (preserves the v1.0.1 frozen baseline above it). |
   113	<!-- /ANCHOR:scope -->
   114	
   115	---
   116	
   117	<!-- ANCHOR:requirements -->
   118	## 4. REQUIREMENTS
   119	
   120	### P0 — Blockers (MUST complete before findings.md ships)
   121	
   122	| ID | Requirement | Acceptance Criteria |
   123	|----|-------------|---------------------|
   124	| REQ-001 | Pre-flight daemon-restart attestation passes | All four probes (cocoindex `ccc --version`, `memory_context` smoke, `code_graph_status`, `memory_causal_stats`) return live values matching the post-fix contract. Pre-flight log captured to `./runs/preflight.log`. |
   125	| REQ-002 | All 30 cells dispatched and produce artifacts | `./runs/{S1,S2,S3,Q1,Q2,Q3,I1,I2,I3}/{cli-codex-1,cli-copilot-1,cli-opencode-1}/{prompt.md,output.txt,meta.json,score.md}` exist. Plus `./runs/{S1,S2,S3}/cli-opencode-pure-1/...` ablation cells. `meta.json.exit_code` = 0 for all 30. |
   126	| REQ-003 | All 30 cells scored under v1.0.1 rubric | Each `score.md` has a v1.0.1 4-dim table summing 0-8. No re-deriving of the rubric — copy verbatim from v1.0.1 baseline rubric in `../001-search-intelligence-stress-playbook/001-search-scenario-design/spec.md` §Scoring Rubric. |
   127	| REQ-004 | Per-cell delta classified | Each `score.md` includes a "Delta vs v1.0.1" line citing the v1.0.1 baseline score (from `../001-…/findings.md` Per-Scenario Comparison) and a classification (WIN / NEUTRAL / REGRESSION). |
   128	| REQ-005 | Per-packet verdict table populated in findings.md | One row per remediation packet (003-009), listing the cells that exercise it, their classifications, and the packet verdict (PROVEN if ≥1 WIN; NEUTRAL if all NEUTRAL; NEGATIVE if any REGRESSION). |
   129	| REQ-006 | No REGRESSION cells unresolved | If any cell scores REGRESSION (delta ≤ −1), findings.md must include a per-cell explanation and (a) confirm it's a measurement artifact, (b) confirm it's a known regression already tracked, OR (c) escalate as a P0 follow-up. |
   130	| REQ-007 | Frozen v1.0.1 baseline preserved | `git diff ../001-search-intelligence-stress-playbook/002-search-scenario-execution/findings.md` shows ONLY a single appended forward-pointer line; zero deletions or modifications above the pointer. |
   131	
   132	### P0 — New fork-telemetry assertions woven into per-cell scoring
   133	
   134	These extend (not replace) the v1.0.1 4-dim rubric. They live in each cell's `score.md` as a "Fork-Telemetry Assertions" sub-section after the v1.0.1 rubric table. Each assertion is PASS / FAIL / N-A based on captured `output.txt` evidence.
   135	
   136	| ID | Cells | Assertion | Source |
   137	|----|-------|-----------|--------|
   138	| REQ-008 | S1, S2, S3 (search via cocoindex paths) | `dedupedAliases ≥ 0` per result row, `uniqueResultCount ≤ requested limit` at top level, `rankingSignals` present per result with `vectorSim` + `pathClassDelta` keys | Packet 004 — `references/tool_reference.md` §7 |
   139	| REQ-009 | Q1 (callers query) | If graph fresh: no `fallbackDecision` field. If graph blocked: `fallbackDecision.nextTool ∈ {code_graph_scan, rg}`, `reason` populated, `retryAfter` populated | Packet 005 — `005-code-graph-fail-fast-routing/spec.md` REQ-001..005 |
   140	| REQ-010 | Q3 (path-scoped implementation-intent query) | `path_class` field present per result; `raw_score` preserved alongside `score`; if intent classified as implementation, the result-rank delta should favor `path_class:implementation` rows | Packets 004 + 005 |
   141	| REQ-011 | I2 (debug intent) | If `memory_search` returns `requestQuality.label:"weak"`: `responsePolicy.noCanonicalPathClaims:true` AND `safeResponse` non-empty AND `recommendedAction` populated. v1.0.1's I2/opencode hallucination MUST NOT recur | Packet 009 — `009-memory-search-citation-response-policy/spec.md` REQ-001..004 |
   142	| REQ-012 | All I-cells | `meta.intent.taskIntent.classificationKind:"task-intent"` present, `paraphraseGroup` populated, `meta.intent.backendRouting.classificationKind:"backend-routing"` present | Packet 007 — `007-intent-classifier-stability-telemetry/spec.md` REQ-001 |
   143	| REQ-013 | Token-budget envelope (any cell using `memory_context`) | `meta.tokenBudgetEnforcement.preEnforcementTokens` populated, `returnedTokens` populated, `actualTokens === returnedTokens`, `droppedAllResultsReason` only when `returnedResultCount === 0` | Packet 003 — `003-memory-context-truncation-telemetry-contract/spec.md` REQ-001..005 |
   144	
   145	### P1 — Required (complete OR user-approved deferral)
   146	
   147	| ID | Requirement | Acceptance Criteria |
   148	|----|-------------|---------------------|
   149	| REQ-014 | I2 prompt forces weak-quality path | The I2 prompt OR a deterministic preamble guarantees `memory_search` returns `quality:weak` so REQ-011 can be exercised. v1.0.1 I2 happened to land in weak path organically; v1.0.2 must guarantee it (this is the sub-target from `../HANDOVER-deferred.md` §2.1 baseline). |
   150	| REQ-015 | Per-CLI averages re-tabulated | findings.md includes a v1.0.2 per-CLI averages table (cli-codex / cli-copilot / cli-opencode / cli-opencode-pure) under the v1.0.1 rubric, side-by-side with the v1.0.1 averages. |
   151	| REQ-016 | Memory DB re-indexed on this packet | After scaffolding lands, run `memory_index_scan({ specFolder: "system-spec-kit/.../011-mcp-runtime-stress-remediation/010-stress-test-close-loop-measurement-rerun" })`. Tracked as T305 in `tasks.md`. |
   152	
   153	### P2 — Refinements
   154	
   155	| ID | Requirement | Acceptance Criteria |
   156	|----|-------------|---------------------|
   157	| REQ-017 | Recommend rubric v1.0.3 candidates | findings.md §Recommendations identifies any dimensions where v1.0.2 results suggest the v1.0.1 rubric is now collapsing or saturating — same kind of analysis the v1.0.1 amendment did to v1.0.0. |
   158	| REQ-018 | N=3 variance pass per cell | Optional second + third runs of each cell to assess single-scorer variance. Out of scope for the initial v1.0.2 sweep; tracked as future work. |
   159	<!-- /ANCHOR:requirements -->
   160	
   161	---
   162	
   163	<!-- ANCHOR:cell-packet-attribution -->
   164	## CELL → PACKET ATTRIBUTION
   165	
   166	> Each of the 9 scenario cells exercises specific remediation packets. The per-packet verdict in findings.md aggregates the cells listed in this table. Read this as: "if Packet X's fix is real, cells in Column 'Cells' should show WIN deltas under the v1.0.1 rubric vs the baseline scores in Column 'v1.0.1 baselines'".
   167	
   168	| Packet | Slug | Cells exercising this packet | v1.0.1 baselines (cli-codex / cli-copilot / cli-opencode / pure) | Expected v1.0.2 signal |
   169	|--------|------|------------------------------|------------------------------------------------------------------|------------------------|
   170	| 003 | memory-context-truncation-contract | All cells using `memory_context` (S1, S2, Q2, I1, I2, I3) | per-cell score.md token-budget metadata absent in v1.0.1 | `meta.tokenBudgetEnforcement.*` fields present (REQ-013); no scoring delta expected from this *alone* — improves auditability |
   171	| 004 | cocoindex-overfetch-dedup | S1: 7/7/7/6, S2: 5/5/6/5, S3: 7/6/7/5 (cli-codex/cli-copilot/cli-opencode/pure under v1.0.0; mapped to v1.0.1 in findings amendment) | S2 (vague memory) where dedup + path-class rerank should push implementation-relevant results higher; S3 (specific decision) where canonical path identity should improve dedup-aware ranking | WIN on S2 across all CLIs; WIN on S3 cli-codex / cli-copilot |
   172	| 005 | code-graph-fast-fail | Q1 (callers query): 6/3/4/n-a | Q1 cli-copilot truncated and cli-opencode 4-min latency; v1.0.2 with `fallbackDecision` should let cli-copilot/cli-opencode either succeed or fall back cleanly | WIN on Q1 cli-copilot + cli-opencode |
   173	| 006 | causal-graph-window-metrics | Indirect: any cell relying on causal-graph signal cleanliness — primarily Q2 (vague search system) where causal edges support graph traversal | Q2: 5/5/6/n-a | NEUTRAL expected; this packet is detection-only at default cap — actual quality lift requires production tuning (HANDOVER-deferred §2.2) |
   174	| 007 | intent-classifier-stability | All I-cells (I1, I2, I3) — intent classification drives routing | I1: 6/1/7/n-a; I2: 6/5/1/n-a; I3: 3/3/7/n-a | WIN on I3 cli-codex + cli-copilot (intent now reliably routes preflight); WIN on I2 cli-opencode (paraphrase grouping; combined with REQ-011 should prevent hallucination) |
   175	| 008 | mcp-daemon-rebuild-protocol | Pre-flight (REQ-001) — gates the entire sweep | n/a | PROVEN if pre-flight passes; ABORT if not |
   176	| 009 | memory-search-response-policy | I2 specifically (the v1.0.1 1/10 catastrophic hallucination cell on cli-opencode) | I2 cli-opencode: 1/10 — FOUR fabricated paths + TWO fabricated packet IDs | WIN ≥ +5 (1/8 → 6/8 minimum) on I2 cli-opencode; v1.0.1 hallucination MUST NOT recur per REQ-011 |
   177	<!-- /ANCHOR:cell-packet-attribution -->
   178	
   179	---
   180	
   181	<!-- ANCHOR:success-criteria -->
   182	## 5. SUCCESS CRITERIA
   183	
   184	| ID | Criterion |
   185	|----|-----------|
   186	| SC-001 | Headline criterion — at least one WIN per remediation packet 003-009 in the per-packet verdict table. NEUTRAL across the board for any single packet means the fix shipped but produced no measurable improvement under the v1.0.1 rubric. |
   187	| SC-002 | Zero REGRESSION cells unresolved. Every REGRESSION must either be explained as a measurement artifact, mapped to a known existing regression, or escalated as a P0 follow-up before findings.md ships. |
   188	| SC-003 | I2 cli-opencode recovers from the v1.0.1 catastrophic hallucination (1/10) to at least 6/8 (75%) under v1.0.1 rubric. This is the load-bearing single cell that REQ-011 + packet 009 was authored to fix. |
   189	| SC-004 | All 30 cells produce score.md entries with the v1.0.1 4-dim table AND the new Fork-Telemetry Assertions sub-section AND the Delta-vs-v1.0.1 classification line. |
   190	| SC-005 | findings.md v1.0.2 ships with: executive summary, per-scenario comparison table including v1.0.1 baseline + delta columns, per-CLI averages side-by-side with v1.0.1, per-packet verdict table, novel findings (anything in v1.0.2 that v1.0.1 didn't see), recommendations. |
   191	| SC-006 | `validate.sh --strict` passes on this packet — same clean error profile (zero blocking errors) as the other leaf packets in the 011 tree. |
   192	| SC-007 | Frozen-baseline invariant: `git diff` on `../001-…/002-search-scenario-execution/findings.md` shows insertions only, zero deletions. |
   193	<!-- /ANCHOR:success-criteria -->
   194	
   195	---
   196	
   197	<!-- ANCHOR:risks -->
   198	## 6. RISKS & DEPENDENCIES
   199	
   200	| Risk | Mitigation |
   201	|------|------------|
   202	| Daemon hasn't actually picked up the rebuilt dist (the "phantom-fix" failure mode that packet 008 was authored to prevent) | REQ-001 pre-flight attestation MUST pass before any cell dispatches. Hard gate. |
   203	| Single scorer (this AI session) introduces scoring bias relative to v1.0.1's single-scorer baseline | Use the v1.0.1 score-card structure verbatim (4 dims, anchors per dim) so within-rubric variance is bounded. Recommend a second-reviewer pass as a P2 follow-up if variance is suspected. |
   204	| cli-copilot concurrency cap 3 (per memory `feedback_copilot_concurrency_override`) slows the sweep | Same as v1.0.1: bake the `pgrep -f copilot \| wc -l ≥ 3 → wait 2s` guard into `dispatch-cli-copilot.sh`. |
   205	| cli-codex `service_tier="fast"` REQUIRED (per memory `feedback_codex_cli_fast_mode`) | Bake `-c service_tier="fast"` into `dispatch-cli-codex.sh` — same as v1.0.1. |
   206	| I2 organic weak-path triggering didn't repro deterministically | REQ-014: prepend a deterministic preamble to the I2 prompt that guarantees `memory_search` returns `quality:weak` (e.g., a query for a non-existent canonical phrase). |
   207	| v1.0.1 rubric saturating now that fixes shipped (i.e., scores ceiling near 8/8) | If saturation observed, REQ-017 records v1.0.3 candidate dimensions for a future packet — does NOT block v1.0.2 findings ship. |
   208	| Memory DB index stale on this packet's path | REQ-016 runs `memory_index_scan` post-scaffold. |
   209	| File-IO race during parallel dispatch corrupts `runs/` artifacts | Same as v1.0.1: `dispatch-cli-*.sh` writes to a per-CLI temp dir, then atomic rename into `runs/{cell}/{cli-N}/`. v1.0.1 had no such corruption — pattern reused as-is. |
   210	
   211	### Dependencies
   212	
   213	- Live MCP daemon at version `0.2.3+spec-kit-fork.0.2.0` (verified via REQ-001).
   214	- All three CLIs installed and authenticated: `codex`, `copilot`, `opencode`.
   215	- Rubric source-of-truth: `../001-search-intelligence-stress-playbook/001-search-scenario-design/spec.md` §Scoring Rubric v1.0.1.
   216	- Corpus source-of-truth: `../001-search-intelligence-stress-playbook/001-search-scenario-design/spec.md` §Scenario Corpus.
   217	- Dispatch script template: `../001-search-intelligence-stress-playbook/001-search-scenario-design/scripts/`.
   218	- Live-probe template (REQ-001): `../008-mcp-daemon-rebuild-protocol/references/live-probe-template.md`.
   219	<!-- /ANCHOR:risks -->
   220	

exec
/bin/zsh -lc "nl -ba .opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/004-cocoindex-overfetch-dedup-rerank/spec.md | sed -n '1,220p'" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
     1	---
     2	# SPECKIT_TEMPLATE_SOURCE: spec-core | v2.2
     3	title: "Feature Specification: CocoIndex over-fetch + canonical-identity dedup + path-class rerank [system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/004-cocoindex-overfetch-dedup-rerank/spec]"
     4	description: "Remediation packet for 005/REQ-018 (mirror duplicates) + 005/REQ-019 (markdown outranks source). Excludes runtime spec mirrors from index, adds canonical identity (source_realpath + content_hash), over-fetches limit*4 candidates, dedups by canonical key, and reranks by path_class so implementation source surfaces above research markdown for code-intent queries."
     5	trigger_phrases:
     6	  - "004-cocoindex-overfetch-dedup-rerank"
     7	  - "cocoindex mirror duplicate dedup"
     8	  - "cocoindex source_realpath canonical identity"
     9	  - "cocoindex path_class rerank"
    10	  - "cocoindex over-fetch limit times 4"
    11	  - "REQ-018 REQ-019 cocoindex"
    12	importance_tier: "important"
    13	contextType: "implementation"
    14	_memory:
    15	  continuity:
    16	    packet_pointer: "system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/004-cocoindex-overfetch-dedup-rerank"
    17	    last_updated_at: "2026-04-27T09:38:00Z"
    18	    last_updated_by: "claude-opus-4-7"
    19	    recent_action: "Scaffolded packet from 007 §5 Q2/Q3 + §11 Rec #2"
    20	    next_safe_action: "Dispatch cli-codex"
    21	    blockers: []
    22	    key_files:
    23	      - "spec.md"
    24	      - "plan.md"
    25	      - "tasks.md"
    26	      - "implementation-summary.md"
    27	    completion_pct: 10
    28	    open_questions: []
    29	    answered_questions: []
    30	template_source_hint: "<!-- SPECKIT_TEMPLATE_SOURCE: spec-core | v2.2 -->"
    31	---
    32	# Feature Specification: CocoIndex over-fetch + canonical-identity dedup + path-class rerank
    33	
    34	<!-- SPECKIT_LEVEL: 1 -->
    35	<!-- SPECKIT_TEMPLATE_SOURCE: spec-core | v2.2 -->
    36	
    37	---
    38	
    39	<!-- ANCHOR:metadata -->
    40	## 1. METADATA
    41	
    42	| Field | Value |
    43	|-------|-------|
    44	| **Level** | 1 |
    45	| **Priority** | P1 |
    46	| **Status** | Draft |
    47	| **Created** | 2026-04-27 |
    48	| **Sources** | 005/REQ-018 (mirror dups), 005/REQ-019 (md vs source rank), 007/Q2 + Q3, 007/§11 Rec #2 |
    49	<!-- /ANCHOR:metadata -->
    50	
    51	---
    52	
    53	<!-- ANCHOR:problem -->
    54	## 2. PROBLEM & PURPOSE
    55	
    56	### Problem Statement
    57	005/REQ-018 documented that CocoIndex returned the SAME research-06 markdown chunk 10 times under different mirror paths (`.gemini/specs/`, `.agents/specs/`, `.claude/specs/`, `.codex/specs/`, `specs/`, `.opencode/specs/`) — all with identical scores. Effective unique-result rate: 10%. 005/REQ-019 documented that for code-intent queries, markdown research notes outranked actual implementation source code (e.g., `mcp_server/handlers/code-graph/query.ts` ranked #10 behind 9 markdown duplicates). 007/Q2-Q3 isolated three independent root causes: (a) mirror folders are symlinks to `.opencode/specs` but the indexer stores the alias path as `file_path`, (b) query path returns raw nearest-neighbor rows with no dedup, (c) ranking is pure vector distance with no path-class awareness.
    58	
    59	### Purpose
    60	Make CocoIndex code-first by default. Exclude runtime spec mirrors at index time. Add `source_realpath` and `content_hash` canonical identity fields. Over-fetch `limit * 4` candidates, dedup by `(source_realpath, line_range)` or `(content_hash, line_range)`, prefer canonical paths in returned rows. Add `path_class` source-role and bounded reranking that surfaces `implementation` above `spec_research` for implementation-intent queries.
    61	<!-- /ANCHOR:problem -->
    62	
    63	---
    64	
    65	<!-- ANCHOR:scope -->
    66	## 3. SCOPE
    67	
    68	### In Scope
    69	- Update `.cocoindex_code/settings.yml` to exclude runtime spec mirrors (`.gemini/specs`, `.codex/specs`, `.claude/specs`, `.agents/specs` — keep `.opencode/specs` only).
    70	- Add `source_realpath` (resolved real path) and `content_hash` (sha256 of normalized chunk content) to indexer schema.
    71	- Update query path to: (1) fetch `limit * 4` nearest neighbors, (2) group by `(source_realpath || content_hash, start_line, end_line)`, (3) prefer canonical display path within group, (4) rerank by `path_class` for implementation-intent queries, (5) return top `limit` unique results.
    72	- Add `path_class` field with values: `implementation` | `tests` | `docs` | `spec_research` | `generated` | `vendor`.
    73	- Surface `dedupedAliases`, `uniqueResultCount`, `rankingSignals` in query telemetry.
    74	
    75	### Out of Scope
    76	- Rewriting CocoIndex's core vector backend.
    77	- Re-indexing strategy / migration scripts (separate operational task).
    78	- Memory / code-graph / causal-graph (separate packets).
    79	
    80	### Files to Change
    81	
    82	| File Path | Change Type | Description |
    83	|-----------|-------------|-------------|
    84	| `.cocoindex_code/settings.yml` | Modify | Exclude runtime spec mirrors |
    85	| `cocoindex_code/indexer.py` | Modify | Add source_realpath + content_hash + path_class fields (~lines 180-189 per research) |
    86	| `cocoindex_code/query.py` | Modify | Add over-fetch + dedup + rerank logic (~lines 115-145) |
    87	| `cocoindex_code/project.py` | Modify | Pass through new fields (~lines 174-203) |
    88	| `cocoindex_code/server.py` | Modify | Expose new telemetry fields (~lines 139-155) |
    89	| `spec.md` / `plan.md` / `tasks.md` / `implementation-summary.md` | Create | Packet docs |
    90	| `description.json` / `graph-metadata.json` | Create | Spec metadata |
    91	
    92	NOTE: Per 007 §6 Runtime Limitations + §12 Open Questions, `cocoindex_code/*.py` may live in the installed package rather than a tracked repo path. Implementation MUST locate the actual source-of-truth before patching; if it's an installed package, vendor the relevant files into the repo OR fork the package locally per project conventions.
    93	<!-- /ANCHOR:scope -->
    94	
    95	---
    96	
    97	<!-- ANCHOR:requirements -->
    98	## 4. REQUIREMENTS
    99	
   100	### P1 — Mirror Dedup + Source Canonical Identity
   101	
   102	| ID | Requirement | Acceptance Criteria |
   103	|----|-------------|---------------------|
   104	| REQ-001 | CocoIndex MUST NOT index runtime spec mirrors (`.gemini/specs`, `.codex/specs`, `.claude/specs`, `.agents/specs`). | After fix, `.cocoindex_code/settings.yml` excludes those paths and a reindex shows `path_aliases` count drops to ~0 for spec content. |
   105	| REQ-002 | Indexer MUST store `source_realpath` (resolved real path) and `content_hash` (sha256 of normalized chunk content) per chunk. | After fix, sqlite query against the index shows non-null values for these fields on new chunks. |
   106	| REQ-003 | Query path MUST over-fetch `limit * 4` nearest neighbors and dedup by `(source_realpath, start_line, end_line)` falling back to `(content_hash, start_line, end_line)`. | After fix, the 005/REQ-018 repro ("semantic search vector embedding implementation") returns ≤ 1 unique chunk per `(realpath, line_range)` group. `uniqueResultCount` field is populated. |
   107	| REQ-004 | Indexer MUST classify each chunk's `path_class` per the 007 §5 vocabulary. | After fix, query results carry `path_class` field. Default is `implementation` when none of the other patterns match. |
   108	
   109	### P1 — Path-Class Reranking
   110	
   111	| ID | Requirement | Acceptance Criteria |
   112	|----|-------------|---------------------|
   113	| REQ-005 | For implementation-intent queries (containing keywords like "implementation", "function", "handler", "callers"), the rerank MUST apply a bounded boost (+0.05) for `implementation` and a bounded penalty (-0.05) for `spec_research` / `docs`. | After fix, the 005/REQ-019 repro ("code graph traversal callers query") returns the actual `mcp_server/handlers/code_graph/handlers/query.ts` (or equivalent) in the top 3, not behind 9 markdown duplicates. |
   114	| REQ-006 | Query response MUST expose `rankingSignals` listing applied boosts/penalties per result. | After fix, response includes `rankingSignals: ["implementation_boost", "spec_research_penalty"]` (or similar) per relevant row. |
   115	
   116	### Acceptance Scenarios
   117	
   118	**Given** a search for "semantic search vector embedding implementation", **when** the query runs, **then** the same chunk appears at most once per logical location (no mirror duplicates) and the actual implementation source surfaces in top 3.
   119	
   120	**Given** a search for "code graph traversal callers query", **when** the query runs, **then** `mcp_server/handlers/code_graph/handlers/query.ts` (or equivalent implementation file) ranks above pure-markdown research notes.
   121	
   122	<!-- /ANCHOR:requirements -->
   123	
   124	---
   125	
   126	<!-- ANCHOR:success-criteria -->
   127	## 5. SUCCESS CRITERIA
   128	
   129	- **SC-001**: All 6 REQs covered by tests (Python pytest if available, or manual `ccc search` probe runs).
   130	- **SC-002**: 005 Probe REQ-018 re-run after reindex shows ≤ 1 unique chunk per logical location.
   131	- **SC-003**: 005 Probe REQ-019 re-run shows implementation source in top 3.
   132	- **SC-004**: `validate.sh --strict` PASS.
   133	<!-- /ANCHOR:success-criteria -->
   134	
   135	---
   136	
   137	<!-- ANCHOR:risks -->
   138	## 6. RISKS & DEPENDENCIES
   139	
   140	| Type | Item | Impact | Mitigation |
   141	|------|------|--------|------------|
   142	| Risk | Schema migration may require full reindex. | High | Document reindex command; consider dual-read during transition. |
   143	| Risk | path_class classifier could be wrong on edge cases. | Medium | Conservative default to `implementation`; add tests for known patterns. |
   144	| Risk | CocoIndex source may be in an installed package, not in the repo. | High | Locate source-of-truth FIRST per 007 §12 open question. If installed, vendor or fork. |
   145	| Dependency | Reindex requires CocoIndex daemon running. | Medium | Document daemon health check before reindex. |
   146	<!-- /ANCHOR:risks -->
   147	
   148	---
   149	
   150	<!-- ANCHOR:questions -->
   151	## 7. OPEN QUESTIONS
   152	
   153	- Where is CocoIndex's source-of-truth — installed package or repo? Implementation MUST resolve this first.
   154	- Should the boost/penalty values be tunable via env or settings? Default: hardcoded constants for v1, tunable in v2.
   155	<!-- /ANCHOR:questions -->

exec
/bin/zsh -lc "nl -ba .opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts | sed -n '1,220p;860,1080p'" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
     1	// ────────────────────────────────────────────────────────────────
     2	// MODULE: Search Results Formatter
     3	// ────────────────────────────────────────────────────────────────
     4	
     5	// Node stdlib
     6	import fs from 'fs';
     7	
     8	// Internal modules
     9	import { estimateTokens } from './token-metrics.js';
    10	
    11	// Import path security utilities (migrated from shared/utils.js)
    12	import { validateFilePath } from '../lib/utils/path-security.js';
    13	import {
    14	  readSessionTransitionTrace,
    15	  type SessionTransitionTrace,
    16	} from '../lib/search/session-transition.js';
    17	import { formatAgeString } from '../lib/utils/format-helpers.js';
    18	
    19	// Import memory parser for anchor extraction (SK-005)
    20	import * as memoryParser from '../lib/parsing/memory-parser.js';
    21	import { requireDb } from '../utils/index.js';
    22	
    23	// REQ-019: Standardized Response Structure
    24	import {
    25	  createMCPSuccessResponse,
    26	  createMCPEmptyResponse,
    27	  type MCPResponse,
    28	} from '../lib/response/envelope.js';
    29	
    30	// REQ-D5-001: Empty/Weak Result Recovery UX
    31	import {
    32	  buildRecoveryPayload,
    33	  shouldTriggerRecovery,
    34	  isEmptyResultRecoveryEnabled,
    35	  type RecoveryPayload,
    36	} from '../lib/search/recovery-payload.js';
    37	
    38	// REQ-D5-004: Per-Result Calibrated Confidence
    39	import {
    40	  computeResultConfidence,
    41	  assessRequestQuality,
    42	  isResultConfidenceEnabled,
    43	  type ScoredResult,
    44	  type RequestQualityAssessment,
    45	} from '../lib/search/confidence-scoring.js';
    46	
    47	// REQ-D5-002: Two-Tier Explainability
    48	import {
    49	  attachExplainabilityToResults,
    50	  isResultExplainEnabled,
    51	  type ExplainabilityOptions,
    52	} from '../lib/search/result-explainability.js';
    53	
    54	// Consolidated path validation from core/config.js (single source of truth)
    55	import { ALLOWED_BASE_PATHS } from '../core/config.js';
    56	
    57	// ────────────────────────────────────────────────────────────────
    58	// 1. TYPES 
    59	
    60	// ────────────────────────────────────────────────────────────────
    61	
    62	/** Token metrics for anchor-filtered content */
    63	export interface AnchorTokenMetrics {
    64	  originalTokens: number;
    65	  returnedTokens: number;
    66	  savingsPercent: number;
    67	  anchorsRequested: number;
    68	  anchorsFound: number;
    69	}
    70	
    71	/** Raw search result from database/vector search */
    72	export interface RawSearchResult {
    73	  id: number | string;
    74	  spec_folder?: string;
    75	  file_path?: string;
    76	  specFolder?: string;
    77	  filePath?: string;
    78	  title?: string | null;
    79	  /** Raw vector cosine similarity (0-100 scale from sqlite-vec). */
    80	  similarity?: number;
    81	  /** Average similarity across multi-concept queries (0-100 scale). */
    82	  averageSimilarity?: number;
    83	  isConstitutional?: boolean;
    84	  importance_tier?: string;
    85	  triggerPhrases?: string | string[];
    86	  created_at?: string;
    87	  [key: string]: unknown;
    88	}
    89	
    90	/** Formatted search result */
    91	export interface FormattedSearchResult {
    92	  id: number;
    93	  specFolder: string;
    94	  filePath: string;
    95	  title: string | null;
    96	  /** Raw vector cosine similarity (0-100 scale from sqlite-vec), or averageSimilarity for multi-concept. */
    97	  similarity?: number;
    98	  isConstitutional: boolean;
    99	  importanceTier?: string;
   100	  triggerPhrases: string[];
   101	  createdAt?: string;
   102	  content?: string | null;
   103	  contentError?: string;
   104	  tokenMetrics?: AnchorTokenMetrics;
   105	  isChunk?: boolean;
   106	  parentId?: number | null;
   107	  chunkIndex?: number | null;
   108	  chunkLabel?: string | null;
   109	  chunkCount?: number | null;
   110	  contentSource?: 'reassembled_chunks' | 'file_read_fallback';
   111	}
   112	
   113	export interface MemoryResultScores {
   114	  semantic: number | null;
   115	  lexical: number | null;
   116	  fusion: number | null;
   117	  intentAdjusted: number | null;
   118	  composite: number | null;
   119	  rerank: number | null;
   120	  attention: number | null;
   121	}
   122	
   123	export interface MemoryResultSource {
   124	  file: string | null;
   125	  anchorIds: string[];
   126	  anchorTypes: string[];
   127	  lastModified: string | null;
   128	  memoryState: string | null;
   129	}
   130	
   131	export interface MemoryResultTrace {
   132	  channelsUsed: string[];
   133	  pipelineStages: string[];
   134	  fallbackTier: number | null;
   135	  queryComplexity: string | null;
   136	  expansionTerms: string[];
   137	  budgetTruncated: boolean;
   138	  scoreResolution: 'intentAdjusted' | 'fusion' | 'score' | 'semantic' | 'none';
   139	  graphContribution?: {
   140	    sources: string[];
   141	    totalDelta: number;
   142	    injected: boolean;
   143	    raw?: number;
   144	    normalized?: number;
   145	    appliedBonus?: number;
   146	    capApplied?: boolean;
   147	    rolloutState?: string | null;
   148	  };
   149	  adaptiveMode?: string | null;
   150	  sessionTransition?: SessionTransitionTrace;
   151	  /**
   152	   * R-007-P2-11: Observability flag for trust-badge derivation.
   153	   * Populated when `includeTrace` is set so operators can see
   154	   * whether the derivation query was attempted, how many badges
   155	   * actually came from the DB-side path (vs. fallback/explicit),
   156	   * and why derivation failed when it did.
   157	   *
   158	   * - `attempted`: true if the DB query ran (i.e. there were
   159	   *   numeric IDs to query); false if no IDs were resolvable.
   160	   * - `derivedCount`: number of result rows for which a derived
   161	   *   snapshot was returned by the DB query.
   162	   * - `failureReason`: structured reason when `attempted` was
   163	   *   true but `derivedCount` is zero or the query crashed:
   164	   *   * `'no_db'`           — `requireDb` threw / returned null
   165	   *   * `'no_results'`      — query ran cleanly, returned 0 rows
   166	   *   * `'query_error'`     — query threw during execute/iterate
   167	   *   * `null`              — no failure to attribute
   168	   */
   169	  trustBadgeDerivation?: {
   170	    attempted: boolean;
   171	    derivedCount: number;
   172	    failureReason:
   173	      | 'no_db'
   174	      | 'no_results'
   175	      | 'query_error'
   176	      | null;
   177	  };
   178	}
   179	
   180	export interface MemoryTrustBadges {
   181	  confidence: number | null;
   182	  extractionAge: string;
   183	  lastAccessAge: string;
   184	  orphan: boolean;
   185	  weightHistoryChanged: boolean;
   186	}
   187	
   188	export interface MemoryResultEnvelope extends FormattedSearchResult {
   189	  scores?: MemoryResultScores;
   190	  source?: MemoryResultSource;
   191	  trace?: MemoryResultTrace;
   192	  trustBadges?: MemoryTrustBadges;
   193	  /** Phase C T025: Graph evidence provenance — edges, communities, and boost factors. */
   194	  graphEvidence?: {
   195	    edges: Array<{ sourceId: number; targetId: number; relation: string; strength: number }>;
   196	    communities: Array<{ communityId: number; summary?: string }>;
   197	    boostFactors: Array<{ type: string; delta: number }>;
   198	  };
   199	}
   200	
   201	/** Memory parser interface (for optional override) */
   202	export interface MemoryParserLike {
   203	  extractAnchors(content: string): Record<string, string>;
   204	}
   205	
   206	type ResponsePolicyAction = 'ask_disambiguation' | 'broaden_or_ask' | 'refuse_without_evidence';
   207	type CitationPolicy = 'cite_results' | 'do_not_cite_results';
   208	
   209	interface ResponsePolicy {
   210	  requiredAction: ResponsePolicyAction;
   211	  noCanonicalPathClaims: boolean;
   212	  citationRequiredForPaths: boolean;
   213	  safeResponse: string;
   214	}
   215	
   216	export interface TrustBadgeSnapshot {
   217	  confidence: number | null;
   218	  extractedAt: string | null;
   219	  lastAccessed: string | null;
   220	  orphan: boolean;
   860	        derivedCount: trustBadgeFetch.derivedCount,
   861	        failureReason: trustBadgeFetch.failureReason,
   862	      };
   863	    }
   864	
   865	    // Phase C T029: Include graphEvidence provenance when present on the pipeline row.
   866	    // The field is populated by Stage 2 when SPECKIT_RESULT_PROVENANCE is enabled.
   867	    if (rawResult.graphEvidence && typeof rawResult.graphEvidence === 'object') {
   868	      const evidence = rawResult.graphEvidence as Record<string, unknown>;
   869	      formattedResult.graphEvidence = {
   870	        edges: Array.isArray(evidence.edges)
   871	          ? (evidence.edges as Array<Record<string, unknown>>).map((e) => ({
   872	              sourceId: typeof e.sourceId === 'number' ? e.sourceId : 0,
   873	              targetId: typeof e.targetId === 'number' ? e.targetId : 0,
   874	              relation: typeof e.relation === 'string' ? e.relation : 'unknown',
   875	              strength: typeof e.strength === 'number' ? e.strength : 1.0,
   876	            }))
   877	          : [],
   878	        communities: Array.isArray(evidence.communities)
   879	          ? (evidence.communities as Array<Record<string, unknown>>).map((c) => ({
   880	              communityId: typeof c.communityId === 'number' ? c.communityId : 0,
   881	              ...(typeof c.summary === 'string' ? { summary: c.summary } : {}),
   882	            }))
   883	          : [],
   884	        boostFactors: Array.isArray(evidence.boostFactors)
   885	          ? (evidence.boostFactors as Array<Record<string, unknown>>).map((b) => ({
   886	              type: typeof b.type === 'string' ? b.type : 'unknown',
   887	              delta: typeof b.delta === 'number' ? b.delta : 0,
   888	            }))
   889	          : [],
   890	      };
   891	    }
   892	
   893	    // Include file content if requested.
   894	    // Prefer precomputed chunk reassembly from memory-search to avoid disk reads.
   895	    if (includeContent) {
   896	      try {
   897	        let content: string | null = null;
   898	
   899	        if (typeof rawResult.precomputedContent === 'string' && rawResult.precomputedContent.length > 0) {
   900	          content = rawResult.precomputedContent;
   901	          if (!formattedResult.contentSource) {
   902	            formattedResult.contentSource = 'reassembled_chunks';
   903	          }
   904	        } else if (rawResult.file_path) {
   905	          // SEC-002: Validate DB-stored file paths before reading (CWE-22 defense-in-depth)
   906	          const validatedPath = validateFilePathLocal(rawResult.file_path);
   907	          content = await fs.promises.readFile(validatedPath, 'utf-8');
   908	          if (!formattedResult.contentSource) {
   909	            formattedResult.contentSource = 'file_read_fallback';
   910	          }
   911	        } else {
   912	          formattedResult.content = null;
   913	          formattedResult.contentError = 'File not found';
   914	          return formattedResult;
   915	        }
   916	
   917	        // SK-005: Anchor System Implementation
   918	        const parser: MemoryParserLike = parserOverride || memoryParser;
   919	        if (anchors && Array.isArray(anchors) && anchors.length > 0 && parser && typeof content === 'string') {
   920	          // BUG-017 FIX: Capture original tokens BEFORE any content reassignment
   921	          const originalTokens = estimateTokens(content);
   922	
   923	          const extracted = parser.extractAnchors(content);
   924	          const filteredParts: string[] = [];
   925	          let foundCount = 0;
   926	
   927	          for (const anchorId of anchors) {
   928	            // SK-005 Prefix matching: try exact match first, then fall back to
   929	            // Prefix match for composite anchor IDs (e.g. 'summary' matches
   930	            // 'summary-session-1770903150838-...'). Prefers shortest match to
   931	            // Select the most specific key when multiple keys share a prefix.
   932	            const matchingKey = extracted[anchorId] !== undefined
   933	              ? anchorId
   934	              : Object.keys(extracted)
   935	                  .filter(key => key.startsWith(anchorId + '-'))
   936	                  .sort((a, b) => a.length - b.length)[0] ?? undefined;
   937	
   938	            if (matchingKey !== undefined) {
   939	              filteredParts.push(`<!-- ANCHOR:${matchingKey} -->\n${extracted[matchingKey]}\n<!-- /ANCHOR:${matchingKey} -->`);
   940	              foundCount++;
   941	            }
   942	          }
   943	
   944	          if (filteredParts.length > 0) {
   945	            // SK-005 Fix: Warn about missing anchors in partial match
   946	            // Use same prefix-matching logic for consistency
   947	            const missingAnchors = anchors.filter(a => {
   948	              if (extracted[a] !== undefined) return false;
   949	              return !Object.keys(extracted).some(key => key.startsWith(a + '-'));
   950	            });
   951	            if (missingAnchors.length > 0) {
   952	              filteredParts.push(`<!-- WARNING: Requested anchors not found: ${missingAnchors.join(', ')} -->`);
   953	            }
   954	
   955	            content = filteredParts.join('\n\n');
   956	            const newTokens = estimateTokens(content);
   957	            const savings = Math.round((1 - newTokens / Math.max(originalTokens, 1)) * 100);
   958	
   959	            formattedResult.tokenMetrics = {
   960	              originalTokens: originalTokens,
   961	              returnedTokens: newTokens,
   962	              savingsPercent: savings,
   963	              anchorsRequested: anchors.length,
   964	              anchorsFound: foundCount
   965	            };
   966	          } else {
   967	            // No anchors found - return warning
   968	            content = `<!-- WARNING: Requested anchors not found: ${anchors.join(', ')} -->`;
   969	            formattedResult.tokenMetrics = {
   970	              originalTokens: originalTokens,
   971	              returnedTokens: 0,
   972	              savingsPercent: 100,
   973	              anchorsRequested: anchors.length,
   974	              anchorsFound: 0
   975	            };
   976	          }
   977	        }
   978	
   979	        formattedResult.content = content;
   980	      } catch (err: unknown) {
   981	        formattedResult.content = null;
   982	        const message = err instanceof Error ? err.message : String(err);
   983	        // BUG-023 FIX: Sanitize error messages to prevent information leakage
   984	        formattedResult.contentError = message.includes('Access denied')
   985	          ? 'Security: Access denied'
   986	          : message.includes('ENOENT')
   987	            ? 'File not found'
   988	            : 'Failed to read file';
   989	      }
   990	    }
   991	
   992	    return formattedResult;
   993	  }));
   994	
   995	  // REQ-D5-004: Compute per-result confidence when flag is enabled (additive, no side-effects)
   996	  const confidenceEnabled = isResultConfidenceEnabled();
   997	  let confidenceData: ReturnType<typeof computeResultConfidence> | null = null;
   998	  let requestQualityData: ReturnType<typeof assessRequestQuality> | null = null;
   999	  if (confidenceEnabled) {
  1000	    // Cast to ScoredResult — RawSearchResult extends Record<string,unknown> and has the same shape
  1001	    const scoredResults = results as unknown as ScoredResult[];
  1002	    confidenceData = computeResultConfidence(scoredResults);
  1003	    requestQualityData = assessRequestQuality(scoredResults, confidenceData);
  1004	  }
  1005	
  1006	  // REQ-D5-001: Compute recovery payload for weak/partial results when flag is enabled
  1007	  let recoveryPayload: RecoveryPayload | null = null;
  1008	  if (isEmptyResultRecoveryEnabled() && formatted.length > 0) {
  1009	    // Compute average confidence for recovery decision
  1010	    let avgConfidence: number | undefined;
  1011	    if (confidenceData && confidenceData.length > 0) {
  1012	      const sum = confidenceData.reduce((acc, c) => acc + c.confidence.value, 0);
  1013	      avgConfidence = sum / confidenceData.length;
  1014	    }
  1015	
  1016	    const recoveryCtx = {
  1017	      query,
  1018	      hasSpecFolderFilter: specFolder !== null && specFolder.length > 0,
  1019	      evidenceGap: Boolean(extraData?.evidenceGap),
  1020	      resultCount: formatted.length,
  1021	      avgConfidence,
  1022	    };
  1023	
  1024	    if (shouldTriggerRecovery(recoveryCtx)) {
  1025	      recoveryPayload = buildRecoveryPayload(recoveryCtx);
  1026	    }
  1027	  }
  1028	
  1029	  // REQ-019: Build summary based on result characteristics
  1030	  const summary = constitutionalCount > 0
  1031	    ? `Found ${formatted.length} memories (${constitutionalCount} constitutional)`
  1032	    : `Found ${formatted.length} memories`;
  1033	
  1034	  // REQ-019: Build hints based on context
  1035	  const hints: string[] = [];
  1036	  if (includeContent && anchors && anchors.length > 0) {
  1037	    hints.push('Anchor filtering applied for token efficiency');
  1038	  }
  1039	  if (!includeContent && formatted.length > 0) {
  1040	    hints.push('Use includeContent: true to embed file contents in results');
  1041	  }
  1042	  if (formatted.some(r => r.contentError)) {
  1043	    hints.push('Some files could not be read - check file paths');
  1044	  }
  1045	
  1046	  // Merge per-result confidence into the formatted result array (additive)
  1047	  const resultsWithConfidence: Array<Record<string, unknown>> = formatted.map(
  1048	    (r, i): Record<string, unknown> => {
  1049	      if (!confidenceData) return r as unknown as Record<string, unknown>;
  1050	      const conf = confidenceData[i];
  1051	      if (!conf) return r as unknown as Record<string, unknown>;
  1052	      return { ...(r as unknown as Record<string, unknown>), ...conf };
  1053	    }
  1054	  );
  1055	
  1056	  // REQ-D5-002: Attach explainability (slim tier) to every result when flag is ON.
  1057	  // Pass results as PipelineRow-compatible — they share the same Record<string,unknown> base.
  1058	  // Debug tier is opt-in via SPECKIT_RESULT_EXPLAIN_DEBUG env var.
  1059	  const explainOptions: ExplainabilityOptions = {
  1060	    debugEnabled: process.env.SPECKIT_RESULT_EXPLAIN_DEBUG?.toLowerCase().trim() === 'true',
  1061	  };
  1062	  const resultsWithExplain = isResultExplainEnabled()
  1063	    ? attachExplainabilityToResults(
  1064	        resultsWithConfidence as Parameters<typeof attachExplainabilityToResults>[0],
  1065	        explainOptions
  1066	      ) as Array<Record<string, unknown>>
  1067	    : resultsWithConfidence;
  1068	
  1069	  const responsePolicy = deriveResponsePolicy(requestQualityData, recoveryPayload);
  1070	  const citationPolicy = deriveCitationPolicy(requestQualityData);
  1071	
  1072	  // REQ-019: Use standardized success response envelope
  1073	  const responseData: Record<string, unknown> = {
  1074	    searchType: searchType,
  1075	    count: formatted.length,
  1076	    constitutionalCount: constitutionalCount,
  1077	    results: resultsWithExplain,
  1078	    // REQ-D5-004: Request-level quality assessment (additive)
  1079	    ...(requestQualityData !== null ? requestQualityData : {}),
  1080	    // REQ-D5-001: Recovery payload for weak/partial results (additive)

exec
/bin/zsh -lc "nl -ba .opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts | sed -n '1,380p'" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
     1	// ───────────────────────────────────────────────────────────────
     2	// MODULE: Recovery Payload
     3	// ───────────────────────────────────────────────────────────────
     4	// REQ-D5-001: Empty/Weak Result Recovery UX
     5	//
     6	// PURPOSE: Generate structured recovery payloads when search returns
     7	// no results, very low-confidence results, or only partial matches.
     8	// Provides the calling agent with actionable next steps.
     9	//
    10	// FEATURE FLAG: SPECKIT_EMPTY_RESULT_RECOVERY_V1 (default ON, graduated)
    11	//
    12	// OUTPUT SHAPE:
    13	// {
    14	//   "status": "no_results" | "low_confidence" | "partial",
    15	//   "reason": "spec_filter_too_narrow" | "low_signal_query" | "knowledge_gap",
    16	//   "suggestedQueries": ["broader alternative 1", "rephrased alternative 2"],
    17	//   "recommendedAction": "retry_broader" | "switch_mode" | "save_memory" | "ask_user" | "ask_disambiguation" | "refuse_without_evidence" | "broaden_or_ask"
    18	// }
    19	
    20	// -- Types --
    21	
    22	/** The retrieval outcome state. */
    23	export type RecoveryStatus = 'no_results' | 'low_confidence' | 'partial';
    24	
    25	/** Root cause classification of the failure. */
    26	export type RecoveryReason = 'spec_filter_too_narrow' | 'low_signal_query' | 'knowledge_gap';
    27	
    28	/** Recommended next action for the calling agent. */
    29	export type RecoveryAction =
    30	  | 'retry_broader'
    31	  | 'switch_mode'
    32	  | 'save_memory'
    33	  | 'ask_user'
    34	  | 'ask_disambiguation'
    35	  | 'refuse_without_evidence'
    36	  | 'broaden_or_ask';
    37	
    38	/** Structured recovery payload attached to search responses. */
    39	export interface RecoveryPayload {
    40	  status: RecoveryStatus;
    41	  reason: RecoveryReason;
    42	  suggestedQueries: string[];
    43	  recommendedAction: RecoveryAction;
    44	}
    45	
    46	/** Input context used to build the recovery payload. */
    47	export interface RecoveryContext {
    48	  /** The original search query (may be null/empty if concepts were used). */
    49	  query: string | null;
    50	  /** Whether a specFolder filter was applied. */
    51	  hasSpecFolderFilter: boolean;
    52	  /** Whether upstream search logic detected an evidence gap for this result set. */
    53	  evidenceGap?: boolean;
    54	  /** How many results were returned (0 = no_results, 1–N = partial/low_confidence). */
    55	  resultCount: number;
    56	  /** Average confidence value across returned results (0–1). Only meaningful when resultCount > 0. */
    57	  avgConfidence?: number;
    58	  /** Low-confidence threshold — results below this trigger recovery. */
    59	  lowConfidenceThreshold?: number;
    60	}
    61	
    62	// -- Constants --
    63	
    64	const DEFAULT_LOW_CONFIDENCE_THRESHOLD = 0.4;
    65	
    66	// Minimum result count considered "good enough" — fewer than this triggers partial recovery.
    67	const PARTIAL_RESULT_MIN = 3;
    68	
    69	// -- Internal helpers --
    70	
    71	/**
    72	 * Classify retrieval status based on result count and confidence signals.
    73	 */
    74	function classifyStatus(ctx: RecoveryContext): RecoveryStatus {
    75	  const threshold = ctx.lowConfidenceThreshold ?? DEFAULT_LOW_CONFIDENCE_THRESHOLD;
    76	
    77	  if (ctx.resultCount === 0) return 'no_results';
    78	  if (ctx.evidenceGap) return 'partial';
    79	  if (
    80	    typeof ctx.avgConfidence === 'number' &&
    81	    Number.isFinite(ctx.avgConfidence) &&
    82	    ctx.avgConfidence < threshold
    83	  ) return 'low_confidence';
    84	  if (ctx.resultCount < PARTIAL_RESULT_MIN) return 'partial';
    85	  return 'low_confidence'; // fallback — should only be called when recovery is warranted
    86	}
    87	
    88	/**
    89	 * Classify root cause from context signals.
    90	 */
    91	function classifyReason(ctx: RecoveryContext, status: RecoveryStatus): RecoveryReason {
    92	  // If a narrow filter was applied and no results returned, that is most likely the cause
    93	  if (ctx.hasSpecFolderFilter && status === 'no_results') {
    94	    return 'spec_filter_too_narrow';
    95	  }
    96	  // Very short or generic queries (< 3 words) suggest low signal
    97	  const wordCount = ctx.query ? ctx.query.trim().split(/\s+/).filter(Boolean).length : 0;
    98	  if (wordCount > 0 && wordCount <= 2) {
    99	    return 'low_signal_query';
   100	  }
   101	  // Default to knowledge_gap — the information may simply not be indexed
   102	  return 'knowledge_gap';
   103	}
   104	
   105	/**
   106	 * Generate suggested reformulations from the original query.
   107	 *
   108	 * Heuristics applied (in order):
   109	 * 1. Remove parenthetical or bracketed clauses (focus term extraction)
   110	 * 2. Keep only the first N words (shorten complex queries)
   111	 * 3. Strip trailing conjunctions / stop words
   112	 * 4. Suggest dropping the spec folder constraint when it was set
   113	 */
   114	function generateSuggestedQueries(ctx: RecoveryContext): string[] {
   115	  const suggestions: string[] = [];
   116	  const q = ctx.query?.trim() ?? '';
   117	
   118	  if (q.length === 0) {
   119	    suggestions.push('memory save context', 'recent decisions', 'project overview');
   120	    return suggestions.slice(0, 2);
   121	  }
   122	
   123	  // 1. Remove parentheticals/brackets — often over-specifying
   124	  const withoutParens = q.replace(/\([^)]*\)/g, '').replace(/\[[^\]]*\]/g, '').replace(/\s{2,}/g, ' ').trim();
   125	  if (withoutParens.length > 0 && withoutParens !== q) {
   126	    suggestions.push(withoutParens);
   127	  }
   128	
   129	  // 2. Shorten: keep first 3 words
   130	  const words = q.split(/\s+/).filter(Boolean);
   131	  if (words.length > 4) {
   132	    suggestions.push(words.slice(0, 3).join(' '));
   133	  }
   134	
   135	  // 3. Remove trailing stop-words (and, or, the, in, for, with, to, of, a)
   136	  const stopWords = new Set(['and', 'or', 'the', 'in', 'for', 'with', 'to', 'of', 'a', 'an']);
   137	  const trimmedWords = [...words].reverse().reduce<string[]>((acc, word) => {
   138	    if (acc.length === 0 && stopWords.has(word.toLowerCase())) return acc;
   139	    return [word, ...acc];
   140	  }, []);
   141	  const stopTrimmed = trimmedWords.join(' ');
   142	  if (stopTrimmed.length > 0 && stopTrimmed !== q && !suggestions.includes(stopTrimmed)) {
   143	    suggestions.push(stopTrimmed);
   144	  }
   145	
   146	  // 4. If spec folder filter was active, suggest the same query without it
   147	  if (ctx.hasSpecFolderFilter && !suggestions.includes(q)) {
   148	    suggestions.push(q); // exact same query but without folder constraint
   149	  }
   150	
   151	  // Deduplicate, remove empties, cap at 3
   152	  const unique = [...new Set(suggestions.filter((s) => s.length > 0))];
   153	  return unique.slice(0, 3);
   154	}
   155	
   156	/**
   157	 * Synthesize broad, safe suggestions when the normal heuristics cannot
   158	 * reformulate the query. These are intentionally generic: they keep only
   159	 * caller-supplied tokens and avoid inventing packet IDs or paths.
   160	 */
   161	function synthesizeBroadeningSuggestions(ctx: RecoveryContext): string[] {
   162	  const q = ctx.query?.trim() ?? '';
   163	  const rawTokens = q.split(/\s+/).filter(Boolean);
   164	  const stopWords = new Set([
   165	    'a',
   166	    'an',
   167	    'and',
   168	    'for',
   169	    'from',
   170	    'in',
   171	    'of',
   172	    'on',
   173	    'or',
   174	    'the',
   175	    'to',
   176	    'with',
   177	  ]);
   178	  const tokens = rawTokens
   179	    .map((token) => token.replace(/^[^\w-]+|[^\w-]+$/g, '').toLowerCase())
   180	    .filter((token) => token.length > 0 && !stopWords.has(token));
   181	
   182	  if (tokens.length === 0) {
   183	    return ['recent memory context', 'related implementation notes'];
   184	  }
   185	  if (tokens.length === 1) {
   186	    return [`${tokens[0]} context`, `${tokens[0]} implementation`];
   187	  }
   188	
   189	  const firstPair = tokens.slice(0, 2).join(' ');
   190	  const firstTriple = tokens.slice(0, 3).join(' ');
   191	  const suggestions = [
   192	    firstPair,
   193	    firstTriple,
   194	    tokens.join(' '),
   195	  ].filter((suggestion) => suggestion.length > 0);
   196	
   197	  return [...new Set(suggestions)].slice(0, 2);
   198	}
   199	
   200	/**
   201	 * Map status + reason to a recommended next action.
   202	 */
   203	function recommendAction(status: RecoveryStatus, reason: RecoveryReason): RecoveryAction {
   204	  if (status === 'no_results') {
   205	    if (reason === 'spec_filter_too_narrow') return 'retry_broader';
   206	    if (reason === 'low_signal_query') return 'switch_mode';
   207	    return 'refuse_without_evidence';
   208	  }
   209	  if (status === 'low_confidence') {
   210	    if (reason === 'knowledge_gap') return 'ask_user';
   211	    if (reason === 'low_signal_query') return 'ask_disambiguation';
   212	    return 'switch_mode';
   213	  }
   214	  // partial
   215	  return 'broaden_or_ask';
   216	}
   217	
   218	// -- Graph-Expanded Fallback (Phase B T017) -----------------------------------
   219	
   220	import type Database from 'better-sqlite3';
   221	import { routeQueryConcepts } from './entity-linker.js';
   222	import { isGraphFallbackEnabled } from './search-flags.js';
   223	
   224	/**
   225	 * Phase B T017: Build graph-expanded fallback query terms on zero/weak results.
   226	 *
   227	 * When the search produces no results or low-confidence results, this function
   228	 * queries the causal_edges table for nodes related to the matched concepts from
   229	 * concept routing, returning up to 5 expanded query terms derived from neighbor
   230	 * node titles.
   231	 *
   232	 * Feature-gated by SPECKIT_GRAPH_FALLBACK (default ON).
   233	 * Fail-open: returns empty array on any error.
   234	 *
   235	 * @param ctx - Recovery context with query and result state.
   236	 * @param db - SQLite database instance for graph lookups.
   237	 * @returns Array of up to 5 expanded query terms from graph neighbors.
   238	 */
   239	export function buildGraphExpandedFallback(
   240	  ctx: RecoveryContext,
   241	  db: Database.Database,
   242	): string[] {
   243	  if (!isGraphFallbackEnabled()) return [];
   244	
   245	  const status = classifyStatus(ctx);
   246	  if (status !== 'no_results' && status !== 'low_confidence') return [];
   247	
   248	  try {
   249	    const routing = routeQueryConcepts(ctx.query ?? '', db);
   250	    if (!routing.graphActivated || routing.concepts.length === 0) return [];
   251	
   252	    // Find memory IDs matching the routed concepts via title keyword search,
   253	    // then walk causal_edges to find neighbors with distinct titles.
   254	
   255	    // Step 1: Find seed memory IDs whose titles contain matched concepts
   256	    const likeClauses = routing.concepts.map(() => 'LOWER(mi.title) LIKE ?').join(' OR ');
   257	    const likeParams = routing.concepts.map((c) => `%${c.toLowerCase()}%`);
   258	
   259	    const seedRows = (db.prepare(`
   260	      SELECT mi.id FROM memory_index mi
   261	      WHERE (${likeClauses})
   262	      LIMIT 10
   263	    `) as Database.Statement).all(...likeParams) as Array<{ id: number }>;
   264	
   265	    if (seedRows.length === 0) return [];
   266	
   267	    const seedIds = seedRows.map((r) => String(r.id));
   268	    const seedPlaceholdersSql = seedIds.map(() => '?').join(', ');
   269	
   270	    // Step 2: Walk 1-hop causal edges from seeds to find neighbor nodes
   271	    const neighborRows = (db.prepare(`
   272	      SELECT DISTINCT mi.title
   273	      FROM causal_edges ce
   274	      JOIN memory_index mi ON (
   275	        (ce.source_id IN (${seedPlaceholdersSql}) AND mi.id = CAST(ce.target_id AS INTEGER))
   276	        OR
   277	        (ce.target_id IN (${seedPlaceholdersSql}) AND mi.id = CAST(ce.source_id AS INTEGER))
   278	      )
   279	      WHERE mi.id NOT IN (${seedPlaceholdersSql})
   280	      LIMIT 10
   281	    `) as Database.Statement).all(
   282	      ...seedIds,
   283	      ...seedIds,
   284	      ...seedIds,
   285	    ) as Array<{ title: string }>;
   286	
   287	    if (neighborRows.length === 0) return [];
   288	
   289	    // Step 3: Extract short keyword phrases from neighbor titles
   290	    const terms: string[] = [];
   291	    const seen = new Set<string>();
   292	
   293	    for (const row of neighborRows) {
   294	      if (!row.title || terms.length >= 5) break;
   295	      // Take the first 3 words of the title as a search term
   296	      const words = row.title.trim().split(/\s+/).slice(0, 3).join(' ').toLowerCase();
   297	      if (words.length > 0 && !seen.has(words)) {
   298	        seen.add(words);
   299	        terms.push(words);
   300	      }
   301	    }
   302	
   303	    return terms;
   304	  } catch (error: unknown) {
   305	    const message = error instanceof Error ? error.message : String(error);
   306	    console.warn(`[recovery-payload] buildGraphExpandedFallback failed (fail-open): ${message}`);
   307	    return [];
   308	  }
   309	}
   310	
   311	// -- Public API --
   312	
   313	/**
   314	 * Build a structured recovery payload for a failed or weak retrieval.
   315	 *
   316	 * Call this when:
   317	 *  - No results are returned (resultCount === 0)
   318	 *  - Results are returned but avgConfidence < threshold
   319	 *  - Fewer than PARTIAL_RESULT_MIN results (partial match)
   320	 *
   321	 * @param ctx - Retrieval outcome context
   322	 * @returns Structured recovery payload
   323	 */
   324	export function buildRecoveryPayload(ctx: RecoveryContext): RecoveryPayload {
   325	  const status = classifyStatus(ctx);
   326	  const reason = classifyReason(ctx, status);
   327	  const recommendedAction = recommendAction(status, reason);
   328	  const generatedSuggestions = generateSuggestedQueries(ctx);
   329	  const suggestedQueries = recommendedAction === 'ask_user' && generatedSuggestions.length === 0
   330	    ? synthesizeBroadeningSuggestions(ctx)
   331	    : generatedSuggestions;
   332	
   333	  return {
   334	    status,
   335	    reason,
   336	    suggestedQueries,
   337	    recommendedAction,
   338	  };
   339	}
   340	
   341	/**
   342	 * Determine whether a search result set warrants recovery.
   343	 *
   344	 * Returns true when:
   345	 *  - No results returned, OR
   346	 *  - Average confidence below threshold, OR
   347	 *  - Fewer than PARTIAL_RESULT_MIN results and avgConfidence is below mid-range
   348	 *
   349	 * @param ctx - Retrieval outcome context
   350	 */
   351	export function shouldTriggerRecovery(ctx: RecoveryContext): boolean {
   352	  if (ctx.resultCount === 0) return true;
   353	  if (ctx.evidenceGap) return true;
   354	
   355	  const threshold = ctx.lowConfidenceThreshold ?? DEFAULT_LOW_CONFIDENCE_THRESHOLD;
   356	
   357	  if (
   358	    typeof ctx.avgConfidence === 'number' &&
   359	    Number.isFinite(ctx.avgConfidence) &&
   360	    ctx.avgConfidence < threshold
   361	  ) return true;
   362	
   363	  if (ctx.resultCount < PARTIAL_RESULT_MIN) return true;
   364	
   365	  return false;
   366	}
   367	
   368	/**
   369	 * Check whether the empty-result recovery feature flag is enabled.
   370	 * Default: ON (graduated). Set SPECKIT_EMPTY_RESULT_RECOVERY_V1=false to disable.
   371	 */
   372	export { isEmptyResultRecoveryEnabled } from './search-flags.js';

exec
/bin/zsh -lc "nl -ba .opencode/skills/system-spec-kit/mcp_server/lib/search/confidence-scoring.ts | sed -n '1,340p'" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
     1	// ───────────────────────────────────────────────────────────────
     2	// MODULE: Confidence Scoring
     3	// ───────────────────────────────────────────────────────────────
     4	// REQ-D5-004: Per-result calibrated confidence scoring
     5	//
     6	// PURPOSE: Combine margin, multi-channel agreement, reranker support,
     7	// and anchor density into a single calibrated confidence score per
     8	// result. V1 uses heuristic scoring only — no LLM calls in the hot path.
     9	//
    10	// FEATURE FLAG: SPECKIT_RESULT_CONFIDENCE_V1 (default ON, graduated)
    11	//
    12	// OUTPUT SHAPE (per result):
    13	// {
    14	//   "confidence": {
    15	//     "label": "high" | "medium" | "low",
    16	//     "value": 0.78,
    17	//     "drivers": ["large_margin", "multi_channel_agreement"]
    18	//   },
    19	//   "requestQuality": {
    20	//     "label": "good" | "weak" | "gap"
    21	//   }
    22	// }
    23	//
    24	// IMPORTANT: This module only models ranking confidence for retrieval ordering.
    25	// It is not freshness authority and it is not a substitute for StructuralTrust.
    26	import { resolveEffectiveScore, type PipelineRow } from './pipeline/types.js';
    27	
    28	declare const rankingConfidenceBrand: unique symbol;
    29	
    30	// -- Constants --
    31	
    32	const HIGH_THRESHOLD = 0.7;
    33	const LOW_THRESHOLD = 0.4;
    34	
    35	// Weights for each confidence factor (must sum to 1.0)
    36	const WEIGHT_MARGIN = 0.35;
    37	const WEIGHT_CHANNEL_AGREEMENT = 0.30;
    38	const WEIGHT_RERANKER = 0.20;
    39	const WEIGHT_ANCHOR_DENSITY = 0.15;
    40	
    41	// Margin thresholds (gap between top score and next score, 0–1 scale)
    42	const LARGE_MARGIN_THRESHOLD = 0.15;
    43	const SMALL_MARGIN_THRESHOLD = 0.05;
    44	
    45	// Channel count thresholds
    46	const STRONG_CHANNEL_AGREEMENT_MIN = 2;
    47	
    48	// -- Types --
    49	
    50	/** Confidence label for a single result. */
    51	export type ConfidenceLabel = 'high' | 'medium' | 'low';
    52	
    53	/**
    54	 * Branded ranking score for retrieval ordering only.
    55	 * Consumers must not reuse this as parser provenance, evidence status,
    56	 * freshness authority, or any other StructuralTrust axis.
    57	 */
    58	export type RankingConfidenceValue = number & {
    59	  readonly [rankingConfidenceBrand]: 'RankingConfidenceValue';
    60	};
    61	
    62	/** Quality label at the request level (across all results). */
    63	export type RequestQualityLabel = 'good' | 'weak' | 'gap';
    64	
    65	/** Which factors drove the confidence score upward. */
    66	export type ConfidenceDriver =
    67	  | 'large_margin'
    68	  | 'multi_channel_agreement'
    69	  | 'reranker_boost'
    70	  | 'anchor_density';
    71	
    72	/** Per-result confidence payload. */
    73	export interface RankingConfidenceContract {
    74	  label: ConfidenceLabel;
    75	  value: RankingConfidenceValue;
    76	  drivers: ConfidenceDriver[];
    77	  structuralTrust?: never;
    78	  parserProvenance?: never;
    79	  evidenceStatus?: never;
    80	  freshnessAuthority?: never;
    81	}
    82	
    83	export interface ResultConfidence {
    84	  confidence: RankingConfidenceContract;
    85	}
    86	
    87	/** Request-level quality assessment (one per search call). */
    88	export interface RequestQualityAssessment {
    89	  requestQuality: {
    90	    label: RequestQualityLabel;
    91	  };
    92	}
    93	
    94	/**
    95	 * Minimal result shape needed for confidence computation.
    96	 * Uses `Record<string, unknown>` to stay compatible with both
    97	 * `RawSearchResult` and `PipelineRow` without importing either.
    98	 */
    99	export interface ScoredResult extends Record<string, unknown> {
   100	  id: number;
   101	  /** Composite score (0–1). */
   102	  score?: number;
   103	  /** RRF fusion score (0–1). */
   104	  rrfScore?: number;
   105	  /** Intent-adjusted score (0–1). */
   106	  intentAdjustedScore?: number;
   107	  /** Raw cosine similarity (0–100 scale from sqlite-vec). */
   108	  similarity?: number;
   109	  /** Reranker cross-encoder score if available. */
   110	  rerankerScore?: number;
   111	  /** Explicit reranker application marker from the pipeline. */
   112	  rerankerApplied?: boolean;
   113	  /** Score origin metadata for distinguishing real reranks from fallbacks. */
   114	  scoringMethod?: string;
   115	  /** Anchor metadata array populated by Stage 2. */
   116	  anchorMetadata?: Array<Record<string, unknown>>;
   117	  /** Source channels that contributed this result. */
   118	  sources?: string[];
   119	  /** Single source channel string (legacy). */
   120	  source?: string;
   121	  /** Trace metadata containing channel attribution. */
   122	  traceMetadata?: Record<string, unknown>;
   123	}
   124	
   125	// -- Internal helpers --
   126	
   127	function resolveScore(result: ScoredResult): number {
   128	  return resolveEffectiveScore(result as PipelineRow);
   129	}
   130	
   131	/**
   132	 * Count the number of unique channels that retrieved this result.
   133	 * Inspects `sources`, `source`, and traceMetadata.attribution.
   134	 */
   135	function countChannels(result: ScoredResult): number {
   136	  const channels = new Set<string>();
   137	
   138	  if (Array.isArray(result.sources)) {
   139	    for (const s of result.sources) {
   140	      if (typeof s === 'string' && s.trim().length > 0) channels.add(s.trim());
   141	    }
   142	  }
   143	
   144	  if (typeof result.source === 'string' && result.source.trim().length > 0) {
   145	    channels.add(result.source.trim());
   146	  }
   147	
   148	  // Check traceMetadata.attribution for richer channel data
   149	  const numericId = typeof result.id === 'number' ? result.id : null;
   150	  const attribution = result.traceMetadata?.attribution;
   151	  if (attribution && typeof attribution === 'object' && numericId !== null) {
   152	    for (const [channel, memoryIds] of Object.entries(attribution as Record<string, unknown>)) {
   153	      if (!Array.isArray(memoryIds)) continue;
   154	      const matched = memoryIds.some((mid) => {
   155	        const n = typeof mid === 'number' ? mid : typeof mid === 'string' ? Number(mid) : NaN;
   156	        return Number.isFinite(n) && n === numericId;
   157	      });
   158	      if (matched && typeof channel === 'string' && channel.trim().length > 0) {
   159	        channels.add(channel.trim());
   160	      }
   161	    }
   162	  }
   163	
   164	  return channels.size;
   165	}
   166	
   167	/**
   168	 * Count anchors present in this result's anchorMetadata array.
   169	 * A result with multiple named anchors is considered "dense" and
   170	 * more likely to be a high-quality, well-structured memory.
   171	 */
   172	function countAnchors(result: ScoredResult): number {
   173	  if (!Array.isArray(result.anchorMetadata)) return 0;
   174	  return result.anchorMetadata.length;
   175	}
   176	
   177	function hasRerankerSignal(result: ScoredResult): boolean {
   178	  const hasFiniteRerankerScore = typeof result.rerankerScore === 'number' && Number.isFinite(result.rerankerScore);
   179	  if (!hasFiniteRerankerScore) return false;
   180	  if (result.scoringMethod === 'fallback') return false;
   181	  if (result.rerankerApplied === true) return true;
   182	  return typeof result.scoringMethod === 'string' && result.scoringMethod.trim().length > 0;
   183	}
   184	
   185	/**
   186	 * Compute the score margin between result[i] and result[i+1].
   187	 * Tail results have no successor, so they receive no synthetic margin boost.
   188	 */
   189	function computeMargin(score: number, nextScore: number | null): number {
   190	  if (nextScore === null) return 0;
   191	  const gap = score - nextScore;
   192	  return Math.max(0, gap);
   193	}
   194	
   195	/**
   196	 * Map raw confidence value to a coarse label.
   197	 */
   198	function toConfidenceLabel(value: number): ConfidenceLabel {
   199	  if (value >= HIGH_THRESHOLD) return 'high';
   200	  if (value >= LOW_THRESHOLD) return 'medium';
   201	  return 'low';
   202	}
   203	
   204	export function asRankingConfidenceValue(value: number): RankingConfidenceValue {
   205	  const clamped = Math.max(0, Math.min(1, value));
   206	  return (Math.round(clamped * 1000) / 1000) as RankingConfidenceValue;
   207	}
   208	
   209	// -- Public API --
   210	
   211	/**
   212	 * Compute per-result confidence for a ranked list of results.
   213	 *
   214	 * Each result receives a confidence object derived from:
   215	 *   - Score margin to the next result (35% weight)
   216	 *   - Number of channels that contributed this result (30%)
   217	 *   - Presence of a reranker score (20%)
   218	 *   - Anchor density in anchorMetadata (15%)
   219	 *
   220	 * @param results - Ranked results (highest score first). Ordering is assumed.
   221	 * @returns Array of ResultConfidence objects, parallel to `results`.
   222	 */
   223	export function computeResultConfidence(results: ScoredResult[]): ResultConfidence[] {
   224	  if (!Array.isArray(results) || results.length === 0) return [];
   225	
   226	  const scores = results.map(resolveScore);
   227	
   228	  return results.map((result, i): ResultConfidence => {
   229	    const score = scores[i] ?? 0;
   230	    const nextScore = i + 1 < scores.length ? (scores[i + 1] ?? null) : null;
   231	
   232	    const margin = computeMargin(score, nextScore);
   233	    const channelCount = countChannels(result);
   234	    const anchorCount = countAnchors(result);
   235	    const hasReranker = hasRerankerSignal(result);
   236	
   237	    // Factor scores (each 0–1)
   238	    const marginFactor = margin >= LARGE_MARGIN_THRESHOLD
   239	      ? 1.0
   240	      : margin >= SMALL_MARGIN_THRESHOLD
   241	        ? margin / LARGE_MARGIN_THRESHOLD
   242	        : 0;
   243	
   244	    const channelFactor = channelCount >= STRONG_CHANNEL_AGREEMENT_MIN
   245	      ? 1.0
   246	      : channelCount === 1
   247	        ? 0.5
   248	        : 0;
   249	
   250	    const rerankerFactor = hasReranker ? 1.0 : 0;
   251	
   252	    // Anchor density: 1 anchor → 0.3, 2 → 0.6, 3+ → 1.0
   253	    const anchorFactor = Math.min(1, anchorCount * 0.33);
   254	
   255	    const rawValue =
   256	      WEIGHT_MARGIN * marginFactor +
   257	      WEIGHT_CHANNEL_AGREEMENT * channelFactor +
   258	      WEIGHT_RERANKER * rerankerFactor +
   259	      WEIGHT_ANCHOR_DENSITY * anchorFactor;
   260	
   261	    // Base score is a strong prior: if the score itself is very high, confidence
   262	    // should reflect that even when heuristic signals are weak.
   263	    const scorePrior = score * 0.4;
   264	    const heuristicValue = rawValue * 0.6;
   265	    const value = Math.max(0, Math.min(1, heuristicValue + scorePrior));
   266	
   267	    const drivers: ConfidenceDriver[] = [];
   268	    if (margin >= LARGE_MARGIN_THRESHOLD) drivers.push('large_margin');
   269	    if (channelCount >= STRONG_CHANNEL_AGREEMENT_MIN) drivers.push('multi_channel_agreement');
   270	    if (hasReranker) drivers.push('reranker_boost');
   271	    if (anchorCount >= 2) drivers.push('anchor_density');
   272	
   273	      return {
   274	        confidence: {
   275	          label: toConfidenceLabel(value),
   276	          value: asRankingConfidenceValue(value),
   277	          drivers,
   278	        },
   279	      };
   280	  });
   281	}
   282	
   283	/**
   284	 * Compute request-level quality assessment based on the overall result set.
   285	 *
   286	 * - "good":  most results have high/medium confidence and a healthy top score
   287	 * - "weak":  results exist but signals are mixed or low
   288	 * - "gap":   no results, or all results have low confidence
   289	 *
   290	 * @param results   - The scored results for the query.
   291	 * @param confidences - Parallel confidence array from `computeResultConfidence`.
   292	 */
   293	export function assessRequestQuality(
   294	  results: ScoredResult[],
   295	  confidences: ResultConfidence[],
   296	): RequestQualityAssessment {
   297	  if (!Array.isArray(results) || results.length === 0) {
   298	    return { requestQuality: { label: 'gap' } };
   299	  }
   300	
   301	  const highOrMediumCount = confidences.filter(
   302	    (c) => c.confidence.label === 'high' || c.confidence.label === 'medium',
   303	  ).length;
   304	
   305	  const topScore = resolveScore(results[0]);
   306	
   307	  const qualityRatio = highOrMediumCount / results.length;
   308	
   309	  if (topScore >= HIGH_THRESHOLD && qualityRatio >= 0.6) {
   310	    return { requestQuality: { label: 'good' } };
   311	  }
   312	  if (results.length > 0 && (topScore >= LOW_THRESHOLD || qualityRatio >= 0.3)) {
   313	    return { requestQuality: { label: 'weak' } };
   314	  }
   315	  return { requestQuality: { label: 'gap' } };
   316	}
   317	
   318	/**
   319	 * Check whether the per-result confidence feature flag is enabled.
   320	 * Default: ON (graduated). Set SPECKIT_RESULT_CONFIDENCE_V1=false to disable.
   321	 */
   322	export { isResultConfidenceEnabled } from './search-flags.js';

exec
/bin/zsh -lc "nl -ba .opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts | sed -n '1,280p;520,760p'" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
     1	// ───────────────────────────────────────────────────────────────
     2	// MODULE: Memory Search
     3	// ───────────────────────────────────────────────────────────────
     4	/* ───────────────────────────────────────────────────────────────
     5	   1. DEPENDENCIES
     6	──────────────────────────────────────────────────────────────── */
     7	
     8	import * as toolCache from '../lib/cache/tool-cache.js';
     9	import * as causalEdges from '../lib/storage/causal-edges.js';
    10	import * as sessionManager from '../lib/session/session-manager.js';
    11	import * as intentClassifier from '../lib/search/intent-classifier.js';
    12	// TierClassifier, crossEncoder imports removed — only used by legacy V1 pipeline.
    13	import { isSessionBoostEnabled, isCausalBoostEnabled, isCommunitySearchFallbackEnabled, isDualRetrievalEnabled, isIntentAutoProfileEnabled } from '../lib/search/search-flags.js';
    14	import { searchCommunities } from '../lib/search/community-search.js';
    15	// 4-stage pipeline architecture
    16	import { executePipeline } from '../lib/search/pipeline/index.js';
    17	import type { PipelineConfig, PipelineResult } from '../lib/search/pipeline/index.js';
    18	import type { IntentWeightsConfig } from '../lib/search/pipeline/types.js';
    19	import { initConsumptionLog, logConsumptionEvent } from '../lib/telemetry/consumption-logger.js';
    20	import * as retrievalTelemetry from '../lib/telemetry/retrieval-telemetry.js';
    21	// Artifact-class routing (spec/plan/tasks/checklist/memory)
    22	import { getStrategyForQuery } from '../lib/search/artifact-routing.js';
    23	// Chunk reassembly (extracted from this file)
    24	import { collapseAndReassembleChunkResults } from '../lib/search/chunk-reassembly.js';
    25	// Search utilities (extracted from this file)
    26	import {
    27	  filterByMinQualityScore,
    28	  resolveQualityThreshold,
    29	  buildCacheArgs,
    30	  resolveRowContextType,
    31	  resolveArtifactRoutingQuery,
    32	  applyArtifactRouting,
    33	} from '../lib/search/search-utils.js';
    34	// CacheArgsInput used internally by buildCacheArgs (lib/search/search-utils.ts)
    35	// Eval channel tracking (extracted from this file)
    36	import {
    37	  collectEvalChannelsFromRow,
    38	  buildEvalChannelPayloads,
    39	  summarizeGraphWalkDiagnostics,
    40	} from '../lib/telemetry/eval-channel-tracking.js';
    41	import type { EvalChannelPayload } from '../lib/telemetry/eval-channel-tracking.js';
    42	
    43	// Eval logger — fail-safe, no-op when SPECKIT_EVAL_LOGGING !== "true"
    44	import { logSearchQuery, logChannelResult, logFinalResult } from '../lib/eval/eval-logger.js';
    45	import {
    46	  logFeedbackEvents,
    47	  isImplicitFeedbackLogEnabled,
    48	} from '../lib/feedback/feedback-ledger.js';
    49	import type { FeedbackEvent } from '../lib/feedback/feedback-ledger.js';
    50	import { trackQueryAndDetect, logResultCited } from '../lib/feedback/query-flow-tracker.js';
    51	
    52	// Core utilities
    53	import { checkDatabaseUpdated, isEmbeddingModelReady, waitForEmbeddingModel } from '../core/index.js';
    54	import { validateQuery, requireDb, toErrorMessage } from '../utils/index.js';
    55	
    56	// Response envelope + formatters
    57	import { createMCPErrorResponse, createMCPSuccessResponse } from '../lib/response/envelope.js';
    58	import { formatSearchResults } from '../formatters/index.js';
    59	
    60	// Shared handler types
    61	import type { MCPResponse, IntentClassification } from './types.js';
    62	
    63	// Retrieval trace contracts (C136-08)
    64	import { createTrace } from '@spec-kit/shared/contracts/retrieval-trace';
    65	import { buildAdaptiveShadowProposal } from '../lib/cognitive/adaptive-ranking.js';
    66	import { normalizeScopeContext } from '../lib/governance/scope-governance.js';
    67	import {
    68	  attachSessionTransitionTrace,
    69	  type SessionTransitionTrace,
    70	} from '../lib/search/session-transition.js';
    71	
    72	// REQ-D5-003: Mode-Aware Response Shape
    73	import {
    74	  applyProfileToEnvelope,
    75	  isResponseProfileEnabled,
    76	} from '../lib/response/profile-formatters.js';
    77	import {
    78	  buildProgressiveResponse,
    79	  extractSnippets,
    80	  isProgressiveDisclosureEnabled,
    81	  resolveCursor,
    82	} from '../lib/search/progressive-disclosure.js';
    83	import {
    84	  SPEC_DOCUMENT_FILENAMES,
    85	  canClassifyAsSpecDocument,
    86	  normalizeSpecPath,
    87	} from '../lib/config/spec-doc-paths.js';
    88	import {
    89	  getLastLexicalCapabilitySnapshot,
    90	  resetLastLexicalCapabilitySnapshot,
    91	} from '../lib/search/sqlite-fts.js';
    92	import type { LexicalCapabilitySnapshot } from '../lib/search/sqlite-fts.js';
    93	import { evaluatePublicationGate } from '../lib/context/publication-gate.js';
    94	import {
    95	  deduplicateResults as deduplicateWithSessionState,
    96	  isSessionRetrievalStateEnabled,
    97	  manager as retrievalSessionStateManager,
    98	  refineForGoal,
    99	} from '../lib/search/session-state.js';
   100	
   101	// Type imports for casting
   102	import type { IntentType, IntentWeights as IntentClassifierWeights } from '../lib/search/intent-classifier.js';
   103	import type { RawSearchResult } from '../formatters/index.js';
   104	// RoutingResult, WeightedResult — now used internally by lib/search/search-utils.ts
   105	
   106	// Feature catalog: Semantic and lexical search (memory_search)
   107	// Feature catalog: Hybrid search pipeline
   108	// Feature catalog: 4-stage pipeline architecture
   109	// Feature catalog: Quality-aware 3-tier search fallback
   110	
   111	
   112	/* ───────────────────────────────────────────────────────────────
   113	   2. TYPES
   114	──────────────────────────────────────────────────────────────── */
   115	
   116	/**
   117	 * Internal search result row — enriched DB row used within this handler.
   118	 * NOT the same as the canonical SearchResult in shared/types.ts.
   119	 * Self-contained: uses local types instead of the deprecated MemoryRow/MemoryRecord shapes.
   120	 * This can migrate to MemoryDbRow & Record<string, unknown> later without changing the handler contract.
   121	 */
   122	interface MemorySearchRow extends Record<string, unknown> {
   123	  id: number;
   124	  similarity?: number;
   125	  importance_tier?: string;
   126	  contextType?: string;
   127	  context_type?: string;
   128	  attentionScore?: number;
   129	  retrievability?: number;
   130	  stability?: number;
   131	  last_review?: string | null;
   132	  created_at?: string;
   133	  last_accessed?: number;
   134	  content?: string;
   135	  memoryState?: string;
   136	  file_path?: string;
   137	  parent_id?: number | null;
   138	  chunk_index?: number | null;
   139	  chunk_label?: string | null;
   140	  isChunk?: boolean;
   141	  parentId?: number | null;
   142	  chunkIndex?: number | null;
   143	  chunkLabel?: string | null;
   144	  chunkCount?: number | null;
   145	  contentSource?: 'reassembled_chunks' | 'file_read_fallback';
   146	  precomputedContent?: string;
   147	}
   148	
   149	interface DedupResult {
   150	  results: MemorySearchRow[];
   151	  dedupStats: Record<string, unknown>;
   152	}
   153	
   154	interface SearchCachePayload {
   155	  summary: string;
   156	  data: Record<string, unknown>;
   157	  hints: string[];
   158	}
   159	
   160	type SessionAwareResult = Record<string, unknown> & {
   161	  id: number | string;
   162	  score?: number;
   163	  content?: string;
   164	};
   165	
   166	type CanonicalSourceKind = 'spec_doc' | 'continuity' | 'constitutional';
   167	
   168	interface CanonicalSourceStats {
   169	  retained: number;
   170	  dropped: number;
   171	  bySourceKind: Record<CanonicalSourceKind, number>;
   172	}
   173	
   174	const CONTINUITY_ANCHOR_ID = '_memory.continuity';
   175	const CANONICAL_READER_CACHE_VERSION = 'gate-d-reader-ready-v1';
   176	const CANONICAL_SPEC_DOC_DOCUMENT_TYPES = new Set([
   177	  'spec',
   178	  'plan',
   179	  'tasks',
   180	  'checklist',
   181	  'decision_record',
   182	  'implementation_summary',
   183	  'research',
   184	  'handover',
   185	  'graph_metadata',
   186	  'spec_doc',
   187	]);
   188	const NON_CANONICAL_DOCUMENT_TYPES = new Set([
   189	  'memory',
   190	  'scratch',
   191	]);
   192	
   193	function normalizeDocumentType(value: unknown): string | null {
   194	  if (typeof value !== 'string') {
   195	    return null;
   196	  }
   197	  const normalized = value.trim().toLowerCase();
   198	  return normalized.length > 0 ? normalized : null;
   199	}
   200	
   201	function resolveAnchorId(row: Record<string, unknown>): string | null {
   202	  const value = row.anchor_id ?? row.anchorId;
   203	  return typeof value === 'string' && value.trim().length > 0
   204	    ? value.trim()
   205	    : null;
   206	}
   207	
   208	function resolveFilePath(row: Record<string, unknown>): string | null {
   209	  const value = row.file_path ?? row.filePath;
   210	  return typeof value === 'string' && value.trim().length > 0
   211	    ? value
   212	    : null;
   213	}
   214	
   215	function resolveCanonicalSourceKind(row: Record<string, unknown>): CanonicalSourceKind | null {
   216	  const documentType = normalizeDocumentType(row.document_type ?? row.documentType);
   217	  const importanceTier = normalizeDocumentType(row.importance_tier ?? row.importanceTier);
   218	  const anchorId = resolveAnchorId(row);
   219	
   220	  if (importanceTier === 'constitutional' || documentType === 'constitutional') {
   221	    return 'constitutional';
   222	  }
   223	
   224	  if (anchorId === CONTINUITY_ANCHOR_ID || documentType === 'continuity') {
   225	    return 'continuity';
   226	  }
   227	
   228	  if (documentType && CANONICAL_SPEC_DOC_DOCUMENT_TYPES.has(documentType)) {
   229	    return 'spec_doc';
   230	  }
   231	
   232	  if (documentType && NON_CANONICAL_DOCUMENT_TYPES.has(documentType)) {
   233	    return null;
   234	  }
   235	
   236	  const filePath = resolveFilePath(row);
   237	  if (!filePath) {
   238	    return null;
   239	  }
   240	  const normalizedPath = normalizeSpecPath(filePath);
   241	  const basename = normalizedPath.split('/').filter(Boolean).pop() ?? '';
   242	
   243	  if (
   244	    basename.length > 0 &&
   245	    SPEC_DOCUMENT_FILENAMES.has(basename) &&
   246	    canClassifyAsSpecDocument(normalizedPath)
   247	  ) {
   248	    return anchorId === CONTINUITY_ANCHOR_ID ? 'continuity' : 'spec_doc';
   249	  }
   250	
   251	  return null;
   252	}
   253	
   254	function filterCanonicalSourceRows<T extends SessionAwareResult>(
   255	  results: T[],
   256	): { results: T[]; stats: CanonicalSourceStats } {
   257	  const stats: CanonicalSourceStats = {
   258	    retained: 0,
   259	    dropped: 0,
   260	    bySourceKind: {
   261	      spec_doc: 0,
   262	      continuity: 0,
   263	      constitutional: 0,
   264	    },
   265	  };
   266	
   267	  const filtered: T[] = [];
   268	  for (const result of results) {
   269	    const sourceKind = resolveCanonicalSourceKind(result);
   270	    if (!sourceKind) {
   271	      stats.dropped += 1;
   272	      continue;
   273	    }
   274	
   275	    filtered.push({
   276	      ...result,
   277	      canonicalSource: sourceKind,
   278	      canonicalSourceType: sourceKind,
   279	      documentType: sourceKind,
   280	    });
   520	    ? data.results as Array<Record<string, unknown>>
   521	    : null;
   522	
   523	  if (!data || !results) {
   524	    return response;
   525	  }
   526	
   527	  data.results = results.map((result) => {
   528	    if (!hasPublicationContractFields(result)) {
   529	      return result;
   530	    }
   531	
   532	    const gateResult = evaluatePublicationGate({
   533	      certainty: result.certainty,
   534	      methodologyStatus: result.methodologyStatus as 'provisional' | 'published' | null | undefined,
   535	      schemaVersion: result.schemaVersion as string | null | undefined,
   536	      provenance: Array.isArray(result.provenance) ? result.provenance as string[] : null,
   537	      multiplierAuthorityFields: result.multiplierAuthorityFields as Record<string, unknown> | null | undefined,
   538	    });
   539	
   540	    return gateResult.publishable
   541	      ? {
   542	        ...result,
   543	        publishable: true,
   544	      }
   545	      : {
   546	        ...result,
   547	        publishable: false,
   548	        exclusionReason: gateResult.exclusionReason,
   549	      };
   550	  });
   551	
   552	  parsed.envelope.data = data;
   553	  return replaceResponseEnvelope(response, parsed.firstEntry, parsed.envelope);
   554	}
   555	
   556	// summarizeGraphWalkDiagnostics, buildEvalChannelPayloads — now imported from lib/telemetry/eval-channel-tracking.ts
   557	
   558	// filterByMinQualityScore, resolveQualityThreshold, buildCacheArgs,
   559	// resolveArtifactRoutingQuery, applyArtifactRouting — now imported from lib/search/search-utils.ts
   560	// CacheArgsInput — now imported from lib/search/search-utils.ts
   561	// parseNullableInt, collapseAndReassembleChunkResults — now imported from lib/search/chunk-reassembly.ts
   562	
   563	/* ───────────────────────────────────────────────────────────────
   564	   3. CONFIGURATION
   565	──────────────────────────────────────────────────────────────── */
   566	
   567	// Sections 3–5 (STATE_PRIORITY, MAX_DEEP_QUERY_VARIANTS, buildDeepQueryVariants,
   568	// StrengthenOnAccess, applyTestingEffect, filterByMemoryState) removed in
   569	// These were only used by the legacy V1 pipeline.
   570	// The V2 4-stage pipeline handles state filtering (Stage 4), testing effect, and
   571	// Query expansion through its own stages.
   572	
   573	/* ───────────────────────────────────────────────────────────────
   574	   6. SESSION DEDUPLICATION UTILITIES
   575	──────────────────────────────────────────────────────────────── */
   576	
   577	function applySessionDedup(results: MemorySearchRow[], sessionId: string, enableDedup: boolean): DedupResult {
   578	  if (!enableDedup || !sessionId || !sessionManager.isEnabled()) {
   579	    return {
   580	      results,
   581	      dedupStats: { enabled: false, sessionId: null }
   582	    };
   583	  }
   584	
   585	  const { filtered, dedupStats } = sessionManager.filterSearchResults(sessionId, results as Parameters<typeof sessionManager.filterSearchResults>[1]);
   586	
   587	  if (filtered.length > 0) {
   588	    sessionManager.markResultsSent(sessionId, filtered as Parameters<typeof sessionManager.markResultsSent>[1]);
   589	  }
   590	
   591	  return {
   592	    results: filtered as MemorySearchRow[],
   593	    dedupStats: {
   594	      ...dedupStats,
   595	      sessionId
   596	    }
   597	  };
   598	}
   599	
   600	// Sections 7–9 (applyCrossEncoderReranking, applyIntentWeightsToResults,
   601	// ShouldApplyPostSearchIntentWeighting, postSearchPipeline) removed in
   602	// These were only used by the legacy V1 pipeline
   603	// Path. The V2 4-stage pipeline handles all equivalent functionality.
   604	
   605	/* ───────────────────────────────────────────────────────────────
   606	   10. MAIN HANDLER
   607	──────────────────────────────────────────────────────────────── */
   608	
   609	/** Handle memory_search tool — performs hybrid vector/BM25 search with intent-aware ranking.
   610	 * @param args - Search arguments (query, concepts, mode, specFolder, etc.)
   611	 * @returns MCP response with ranked search results
   612	 */
   613	async function handleMemorySearch(args: SearchArgs): Promise<MCPResponse> {
   614	  const _searchStartTime = Date.now();
   615	  resetLastLexicalCapabilitySnapshot();
   616	  // BUG-001: Check for external database updates before processing
   617	  await checkDatabaseUpdated();
   618	
   619	  const {
   620	    cursor,
   621	    query,
   622	    concepts,
   623	    specFolder,
   624	    folderBoost,
   625	    tenantId,
   626	    userId,
   627	    agentId,
   628	    limit: rawLimit = 10,
   629	    tier,
   630	    contextType,
   631	    useDecay: useDecay = true,
   632	    includeContiguity: includeContiguity = false,
   633	    includeConstitutional: includeConstitutional = true,
   634	    includeContent: includeContent = false,
   635	    anchors,
   636	    bypassCache: bypassCache = false,
   637	    sessionId,
   638	    enableDedup: enableDedup = true,
   639	    intent: explicitIntent,
   640	    autoDetectIntent: autoDetectIntent = true,
   641	    minState,  // No default — memoryState column not yet in schema; defaulting to 'WARM' filters all rows
   642	    applyStateLimits: applyStateLimits = false,
   643	    rerank = true, // Enable reranking by default for better result quality
   644	    applyLengthPenalty: applyLengthPenalty = true,
   645	    trackAccess: trackAccess = false, // opt-in, off by default
   646	    includeArchived: includeArchivedRequested = false, // compatibility-only after Gate B cleanup
   647	    enableSessionBoost: enableSessionBoost = isSessionBoostEnabled(),
   648	    enableCausalBoost: enableCausalBoost = isCausalBoostEnabled(),
   649	    minQualityScore,
   650	    min_quality_score,
   651	    mode,
   652	    includeTrace: includeTraceArg = false,
   653	    sessionTransition,
   654	    profile,
   655	    retrievalLevel: retrievalLevel = 'auto',
   656	  } = args;
   657	  const includeTraceByFlag = process.env.SPECKIT_RESPONSE_TRACE === 'true';
   658	  const includeTrace = includeTraceByFlag || includeTraceArg === true;
   659	  const includeArchived = false;
   660	  const normalizedScope = normalizeScopeContext({ tenantId, userId, agentId, sessionId });
   661	  const progressiveScopeKey = JSON.stringify({
   662	    tenantId: normalizedScope.tenantId ?? null,
   663	    userId: normalizedScope.userId ?? null,
   664	    agentId: normalizedScope.agentId ?? null,
   665	    sessionId: normalizedScope.sessionId ?? null,
   666	  });
   667	
   668	  // Validate at least one search input is provided (moved from schema superRefine for GPT compatibility)
   669	  const hasCursor = typeof cursor === 'string' && cursor.trim().length > 0;
   670	  const hasQuery = typeof query === 'string' && query.trim().length > 0;
   671	  const hasConcepts = Array.isArray(concepts) && concepts.length >= 2;
   672	  if (!hasCursor && !hasQuery && !hasConcepts) {
   673	    return { content: [{ type: 'text', text: JSON.stringify({ error: 'Either "query" (string), "concepts" (array with 2-5 items), or "cursor" (string) is required.' }) }] };
   674	  }
   675	
   676	  if (hasCursor) {
   677	    const resolved = resolveCursor(cursor.trim(), undefined, { scopeKey: progressiveScopeKey });
   678	    if (!resolved) {
   679	      return createMCPErrorResponse({
   680	        tool: 'memory_search',
   681	        error: 'Cursor is invalid, expired, or out of scope',
   682	        code: 'E_VALIDATION',
   683	        details: { parameter: 'cursor' },
   684	        recovery: {
   685	          hint: 'Retry the original search to generate a fresh continuation cursor',
   686	        },
   687	      });
   688	    }
   689	
   690	    const snippetResults = extractSnippets(resolved.results);
   691	    return createMCPSuccessResponse({
   692	      tool: 'memory_search',
   693	      summary: `Returned ${snippetResults.length} continuation results`,
   694	      data: {
   695	        count: snippetResults.length,
   696	        results: snippetResults,
   697	        continuation: resolved.continuation,
   698	      },
   699	      startTime: _searchStartTime,
   700	      cacheHit: false,
   701	    });
   702	  }
   703	
   704	  const qualityThreshold = resolveQualityThreshold(minQualityScore, min_quality_score);
   705	
   706	  // Validate numeric limit parameter
   707	  const limit = (typeof rawLimit === 'number' && Number.isFinite(rawLimit) && rawLimit > 0)
   708	    ? Math.min(Math.floor(rawLimit), 100)
   709	    : 10;
   710	
   711	  // BUG-007: Validate query first with proper error handling
   712	  let normalizedQuery: string | null = null;
   713	  if (query !== undefined) {
   714	    try {
   715	      normalizedQuery = validateQuery(query);
   716	    } catch (validationError: unknown) {
   717	      if (!concepts || !Array.isArray(concepts) || concepts.length < 2) {
   718	        const message = toErrorMessage(validationError);
   719	        return createMCPErrorResponse({
   720	          tool: 'memory_search',
   721	          error: message,
   722	          code: 'E_VALIDATION',
   723	          details: { parameter: 'query' },
   724	          recovery: {
   725	            hint: 'Provide a valid query string or use concepts array instead'
   726	          }
   727	        });
   728	      }
   729	      normalizedQuery = null;
   730	    }
   731	  }
   732	
   733	  const hasValidQuery = normalizedQuery !== null;
   734	  const hasValidConcepts = Array.isArray(concepts) && concepts.length >= 2;
   735	  const effectiveQuery = normalizedQuery ?? (hasValidConcepts ? concepts.join(', ') : '');
   736	
   737	  if (!hasValidQuery && !hasValidConcepts) {
   738	    return createMCPErrorResponse({
   739	      tool: 'memory_search',
   740	      error: 'Either query (string), concepts (array of 2-5 strings), or cursor (string) is required',
   741	      code: 'E_VALIDATION',
   742	      details: { parameter: 'query' },
   743	      recovery: {
   744	        hint: 'Provide a query string, concepts array with 2-5 entries, or a continuation cursor'
   745	      }
   746	    });
   747	  }
   748	
   749	  if (specFolder !== undefined && typeof specFolder !== 'string') {
   750	    return createMCPErrorResponse({
   751	      tool: 'memory_search',
   752	      error: 'specFolder must be a string',
   753	      code: 'E_VALIDATION',
   754	      details: { parameter: 'specFolder' },
   755	      recovery: {
   756	        hint: 'Provide specFolder as a string path'
   757	      }
   758	    });
   759	  }
   760	

exec
/bin/zsh -lc "nl -ba .opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts | sed -n '1068,1148p;1220,1305p'" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
  1068	
  1069	  const responsePolicy = deriveResponsePolicy(requestQualityData, recoveryPayload);
  1070	  const citationPolicy = deriveCitationPolicy(requestQualityData);
  1071	
  1072	  // REQ-019: Use standardized success response envelope
  1073	  const responseData: Record<string, unknown> = {
  1074	    searchType: searchType,
  1075	    count: formatted.length,
  1076	    constitutionalCount: constitutionalCount,
  1077	    results: resultsWithExplain,
  1078	    // REQ-D5-004: Request-level quality assessment (additive)
  1079	    ...(requestQualityData !== null ? requestQualityData : {}),
  1080	    // REQ-D5-001: Recovery payload for weak/partial results (additive)
  1081	    ...(recoveryPayload !== null ? { recovery: recoveryPayload } : {}),
  1082	    citationPolicy,
  1083	    ...(responsePolicy !== null ? { responsePolicy } : {}),
  1084	  };
  1085	  // Always spread caller-provided extraData (pipeline trace, timing, evidence gaps, etc.).
  1086	  // Spread extraData first, then re-assert canonical keys to prevent overwrites.
  1087	  if (extraData && Object.keys(extraData).length > 0) {
  1088	    const {
  1089	      searchType: _s,
  1090	      count: _c,
  1091	      constitutionalCount: _cc,
  1092	      results: _r,
  1093	      citationPolicy: _cp,
  1094	      responsePolicy: _rp,
  1095	      ...safeExtra
  1096	    } = extraData as Record<string, unknown>;
  1097	    Object.assign(responseData, safeExtra);
  1098	  }
  1099	
  1100	  return createMCPSuccessResponse({
  1101	    tool: 'memory_search',
  1102	    summary,
  1103	    data: responseData,
  1104	    hints,
  1105	    startTime: startMs
  1106	  });
  1107	}
  1108	
  1109	/* ───────────────────────────────────────────────────────────────
  1110	   5. (ESM exports above — no CommonJS module.exports needed)
  1111	   ──────────────────────────────────────────────────────────────── */

exec
/bin/zsh -lc 'rg -n "function deriveResponsePolicy|deriveCitationPolicy|safeResponse" .opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts' in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
213:  safeResponse: string;
273:function deriveResponsePolicy(
285:      safeResponse: 'No canonical context found from the current retrieval. Ask a clarifying question or request a broader query.',
293:    safeResponse: 'Retrieval quality is weak. Broaden the query or ask the user for disambiguation before citing any path.',
297:function deriveCitationPolicy(requestQuality: RequestQualityAssessment | null): CitationPolicy {
767:    const citationPolicy = deriveCitationPolicy(requestQualityData);
1070:  const citationPolicy = deriveCitationPolicy(requestQualityData);

exec
/bin/zsh -lc "nl -ba .opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts | sed -n '250,305p;740,790p'" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
   250	  if (!str) return fallback;
   251	  try {
   252	    return JSON.parse(str) as T;
   253	  } catch (_error: unknown) {
   254	    return fallback;
   255	  }
   256	}
   257	
   258	function toNullableNumber(value: unknown): number | null {
   259	  if (typeof value === 'number' && Number.isFinite(value)) return value;
   260	  if (typeof value === 'string' && value.trim().length > 0) {
   261	    const parsed = Number(value);
   262	    if (Number.isFinite(parsed)) return parsed;
   263	  }
   264	  return null;
   265	}
   266	
   267	function clampConfidence(value: unknown): number | null {
   268	  const numeric = toNullableNumber(value);
   269	  if (numeric === null) return null;
   270	  return Math.max(0, Math.min(1, numeric));
   271	}
   272	
   273	function deriveResponsePolicy(
   274	  requestQuality: RequestQualityAssessment | null,
   275	  recovery: RecoveryPayload | null,
   276	): ResponsePolicy | null {
   277	  if (!requestQuality || requestQuality.requestQuality?.label === 'good') return null;
   278	  if (!recovery) return null;
   279	
   280	  if (recovery.recommendedAction === 'ask_user' && recovery.suggestedQueries.length === 0) {
   281	    return {
   282	      requiredAction: 'ask_disambiguation',
   283	      noCanonicalPathClaims: true,
   284	      citationRequiredForPaths: true,
   285	      safeResponse: 'No canonical context found from the current retrieval. Ask a clarifying question or request a broader query.',
   286	    };
   287	  }
   288	
   289	  return {
   290	    requiredAction: 'broaden_or_ask',
   291	    noCanonicalPathClaims: true,
   292	    citationRequiredForPaths: true,
   293	    safeResponse: 'Retrieval quality is weak. Broaden the query or ask the user for disambiguation before citing any path.',
   294	  };
   295	}
   296	
   297	function deriveCitationPolicy(requestQuality: RequestQualityAssessment | null): CitationPolicy {
   298	  const label = requestQuality?.requestQuality?.label;
   299	  return label === 'good' ? 'cite_results' : 'do_not_cite_results';
   300	}
   301	
   302	/**
   303	 * R-007-P2-10: Allowlisted grammar for explicit `extractionAge` /
   304	 * `lastAccessAge` strings. Mirrors the output of `formatAgeString`:
   305	 *
   740	  searchType: string,
   741	  include_content: boolean = false,
   742	  anchors: string[] | null = null,
   743	  parserOverride: MemoryParserLike | null = null,
   744	  startTime: number | null = null,
   745	  extraData: Record<string, unknown> = {},
   746	  includeTrace: boolean = false,
   747	  query: string | null = null,
   748	  specFolder: string | null = null
   749	): Promise<MCPResponse> {
   750	  const startMs = startTime || Date.now();
   751	  const includeContent = include_content;
   752	
   753	  if (!results || results.length === 0) {
   754	    // REQ-D5-001: Attach recovery payload when flag is enabled
   755	    let recoveryPayload: RecoveryPayload | null = null;
   756	    const requestQualityData = isResultConfidenceEnabled()
   757	      ? assessRequestQuality([], [])
   758	      : null;
   759	    if (isEmptyResultRecoveryEnabled()) {
   760	      recoveryPayload = buildRecoveryPayload({
   761	        query,
   762	        hasSpecFolderFilter: specFolder !== null && specFolder.length > 0,
   763	        resultCount: 0,
   764	      });
   765	    }
   766	    const responsePolicy = deriveResponsePolicy(requestQualityData, recoveryPayload);
   767	    const citationPolicy = deriveCitationPolicy(requestQualityData);
   768	
   769	    // REQ-019: Use standardized empty response envelope
   770	    return createMCPEmptyResponse({
   771	      tool: 'memory_search',
   772	      summary: 'No matching memories found',
   773	      data: {
   774	        searchType: searchType,
   775	        constitutionalCount: 0,
   776	        ...(requestQualityData ?? {}),
   777	        // Always spread caller-provided extraData (pipeline trace, timing, evidence gaps, etc.)
   778	        ...(extraData ?? {}),
   779	        // REQ-D5-001: Attach recovery payload (additive, only when flag enabled)
   780	        ...(recoveryPayload !== null ? { recovery: recoveryPayload } : {}),
   781	        citationPolicy,
   782	        ...(responsePolicy !== null ? { responsePolicy } : {}),
   783	      },
   784	      hints: [
   785	        'Try broadening your search query',
   786	        'Use memory_list() to browse available memories',
   787	        'Check if specFolder filter is too restrictive'
   788	      ],
   789	      startTime: startMs
   790	    });

exec
/bin/zsh -lc "find . -maxdepth 4 \\( -path './.git' -o -path './node_modules' \\) -prune -o -path '*cocoindex_code*' -type f -print | sed -n '1,200p'" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
./.cocoindex_code/target_sqlite.db
./.cocoindex_code/daemon_runtime/global_settings.yml
./.cocoindex_code/daemon_runtime/daemon.log
./.cocoindex_code/cocoindex.db/mdb/lock.mdb
./.cocoindex_code/cocoindex.db/mdb/data.mdb
./.cocoindex_code/settings.yml

exec
/bin/zsh -lc pwd in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public

exec
/bin/zsh -lc "find . -maxdepth 4 -path './.cocoindex_code/*' -type f -print | sort" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
./.cocoindex_code/cocoindex.db/mdb/data.mdb
./.cocoindex_code/cocoindex.db/mdb/lock.mdb
./.cocoindex_code/daemon_runtime/daemon.log
./.cocoindex_code/daemon_runtime/global_settings.yml
./.cocoindex_code/settings.yml
./.cocoindex_code/target_sqlite.db

exec
/bin/zsh -lc 'command -v ccc || true' in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
/Users/michelkerkmeester/.local/bin/ccc

exec
/bin/zsh -lc "rg -n \"def search|class.*Search|path_class|dedupedAliases|uniqueResultCount|rankingSignals|source_realpath|content_hash\" . -g '"'!*node_modules*'"' -g '"'!*.log'"' -g '"'!*.db'"' -g '"'!*.mdb'"'" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 253ms:
./.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/042-post-merge-refinement-5/decision-record.md:366:    'SELECT content_hash FROM memory_index WHERE file_path = ?'
./.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/042-post-merge-refinement-5/decision-record.md:369:  if (!force && stored?.content_hash === currentHash) {
./.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/042-post-merge-refinement-5/decision-record.md:446:Add indexes for frequently queried columns: `file_path`, `content_hash`, `last_accessed`.
./.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/042-post-merge-refinement-5/decision-record.md:459:CREATE INDEX IF NOT EXISTS idx_memory_content_hash 
./.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/042-post-merge-refinement-5/decision-record.md:460:  ON memory_index(content_hash);
./.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/042-post-merge-refinement-5/decision-record.md:578:2. Add content_hash column if missing
./.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/006-auto-indexing/scratch/legacy-memory-quarantine/16-12-25_11-39__docs-alignment-v12.md:158:- Updated database schema with new columns: importance_tier, content_hash, context_type, confidence_score, validation_count, last_accessed_at
./.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/081-speckit-reimagined-pre-analysis/001-b-analysis-repository-comparison.md:350:class SemanticSearchEngine:
./.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/081-speckit-reimagined-pre-analysis/001-b-analysis-repository-comparison.md:414:    def search(self, query_embedding: list[float], top_k: int) -> list[tuple[str, float]]: ...
./.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/042-post-merge-refinement-5/checklist.md:291:| CHK067 | [P2] Index on content_hash column | |
./.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/042-post-merge-refinement-5/checklist.md:296:- [ ] CHK067 [P2] Index on content_hash column
./.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/042-post-merge-refinement-5/tasks.md:507:- [ ] Add index on `content_hash` column
./.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/006-auto-indexing/scratch/legacy-memory-quarantine/16-12-24_00-00__memory-docs-cleanup.md:262:- `content_hash` (change detection)
./.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/006-auto-indexing/scratch/legacy-memory-quarantine/16-12-24_00-00__memory-docs-cleanup.md:277:// Added columns: importance_tier, context_type, content_hash, channel,
./.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/042-post-merge-refinement-5/analysis.md:208:| DB-04 | Missing indexes for common query patterns (file_path, content_hash) | P1 |
./.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/042-post-merge-refinement-5/analysis.md:434:| SR-08 | Missing index on content_hash for deduplication queries | P2 |
./.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/042-post-merge-refinement-5/analysis.md:499:| memories.content_hash | Deduplication | O(n) instead of O(1) |
./.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:63:  'content_hash',
./.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:139:      content_hash TEXT,
./.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:179:    CREATE INDEX IF NOT EXISTS idx_content_hash ON memory_index(content_hash);
./.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/feature-summary.md:456:- `content_hash`, `mtime` columns
./.opencode/skills/system-spec-kit/mcp_server/lib/storage/post-insert-metadata.ts:23:  content_hash?: string;
./.opencode/skills/system-spec-kit/mcp_server/lib/storage/post-insert-metadata.ts:59:  'content_hash', 'context_type', 'importance_tier', 'memory_type',
./.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1248:    'content_hash',
./.opencode/skills/system-spec-kit/mcp_server/lib/storage/README.md:67:- `incremental-index.ts` uses `file_mtime_ms`, `content_hash`, and `embedding_status` together, so unchanged-path fast paths still requeue rows whose embeddings are unhealthy.
./.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:40:  content_hash?: string | null;
./.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:349:    contentHash: typeof row.content_hash === 'string' ? row.content_hash : null,
./.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:496:    content_hash: parsed.contentHash,
./.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/checklist.md:324:- [x] CHK-151 [P1] Content hash tracking implemented for change detection - content_hash column + compute_content_hash() in memory-parser.js, verified in tests
./.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/checklist.md:342:  - [E:test] tests/preflight.test.js:test_duplicate_check_no_database, test_content_hash_computation passing
./.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:316:        content_hash: mergedHash,
./.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:344:        content_hash: mergedHash,
./.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:518:                AND ((content_hash = @contentHash) OR (content_hash IS NULL AND @contentHash IS NULL))
./.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:560:                  content_hash = ?,
./.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:564:                AND ((content_hash = ?) OR (content_hash IS NULL AND ? IS NULL))
./.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:878:  const rawContentHash = row.content_hash;
./.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:911:  const currentContentHash = typeof currentRow.content_hash === 'string' ? currentRow.content_hash : null;
./.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:1048:    content_hash: existingRow.content_hash,
./.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:37:  content_hash: string | null;
./.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:119:          SELECT file_path, canonical_file_path, file_mtime_ms, content_hash, embedding_status
./.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:126:          SELECT file_path, file_mtime_ms, content_hash, embedding_status
./.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:179:    if (stored.content_hash) {
./.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:181:      if (currentContentHash && currentContentHash !== stored.content_hash) {
./.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/055-cognitive-memory-upgrade/research/research.md:162:  embedding_status, content_hash, ...
./.opencode/skills/system-spec-kit/references/memory/embedding_resilience.md:261:│ content_hash  │ TEXT (SHA-256 of source content)                │
./.opencode/skills/system-spec-kit/references/memory/memory_system.md:529:This hash is stored as `content_hash` in the database and used by `memory_save()` to detect whether a file has changed — if the hash matches, re-embedding is skipped.
./.opencode/skills/system-spec-kit/references/memory/memory_system.md:541:  if (memory.content_hash) {
./.opencode/skills/system-spec-kit/references/memory/memory_system.md:542:    hashInput = memory.content_hash;
./.opencode/skills/system-spec-kit/references/memory/memory_system.md:557:The hash priority: `content_hash` > `id:anchorId:file_path` > JSON of `{anchor, path, title}`. Truncated to 16 hex chars for storage efficiency.
./.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/tests/test-implementation-guide.md:313:      content_hash TEXT,
./.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/082-speckit-reimagined/tasks.md:423:  - `compute_content_hash()` uses SHA-256 for exact matching
./.opencode/skills/system-spec-kit/ARCHITECTURE.md:312:The `ccc_*` handlers are TypeScript facades that spawn the coco-index CLI binary from `.opencode/skills/mcp-coco-index/mcp_server/.venv/bin/ccc` — specifically the spec-kit fork at version `0.2.3+spec-kit-fork.0.2.0`, NOT a vanilla upstream `cocoindex-code` install. This isolates the Python-based semantic index behind a uniform MCP interface without pulling it into the TypeScript process boundary. Because the binary is the fork, search results emit fork-specific telemetry fields (`dedupedAliases`, `uniqueResultCount`, `rankingSignals`, etc.) that the facade layer passes through verbatim. Schema details: `.opencode/skills/mcp-coco-index/references/tool_reference.md` §7.
./.opencode/skills/system-spec-kit/scripts/tests/test-retry-manager-behavioral.js:93:      content_hash TEXT DEFAULT ''
./.opencode/specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/018-generate-context-fix/implementation-summary.md:54:- Timestamps: `created_at`, `updated_at`, `content_hash`
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/003-sprint-2-scoring-calibration/spec.md:87:- **R18**: Embedding cache — `embedding_cache` table with content_hash + model_id key for instant rebuild
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/003-sprint-2-scoring-calibration/spec.md:123:| REQ-S2-001 | **R18**: Embedding cache with content_hash + model_id key | Cache hit rate >90% on re-index of unchanged content; cache lookup adds <1ms p95; stale entries never served (content_hash key guarantees); cross-ref CHK-010, CHK-060, T001 |
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/003-sprint-2-scoring-calibration/spec.md:158:| Risk | R18 cache invalidation — stale embeddings used after content change | Low | Cache key includes content_hash; any content change = cache miss |
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/003-sprint-2-scoring-calibration/spec.md:176:- **NFR-S01**: Embedding cache stores only content_hash (not raw content) — no sensitive data duplication
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/003-sprint-2-scoring-calibration/spec.md:194:- **R18 content_hash collision**: Astronomically unlikely with SHA-256; if occurs, embedding regenerated (correct but wasteful)
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/implementation-summary-sprints.md:222:| `mcp_server/lib/cache/embedding-cache.ts` | New: R18 embedding cache with content_hash + model_id composite key; SHA-256 content hashing; LRU eviction by last_used_at; cache stats and clear operations | ~195 |
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/implementation-summary-sprints.md:231:- **How:** SQLite `embedding_cache` table with composite primary key (content_hash, model_id); lookup updates last_used_at on hit; INSERT OR REPLACE for store; LRU eviction by configurable max age; cache stats API for monitoring
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/003-sprint-2-scoring-calibration/plan.md:51:- [ ] R18 cache schema finalized: `CREATE TABLE embedding_cache (content_hash TEXT, model_id TEXT, embedding BLOB, dimensions INT, created_at TEXT, last_used_at TEXT, PRIMARY KEY (content_hash, model_id))`
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/003-sprint-2-scoring-calibration/plan.md:73:- **Embedding cache** (R18): New `embedding_cache` table in primary DB. Schema: `content_hash TEXT, model_id TEXT, embedding BLOB, dimensions INT, created_at TEXT, last_used_at TEXT, PRIMARY KEY (content_hash, model_id)`. Cache lookup on re-index path; miss = normal embedding generation.
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/003-sprint-2-scoring-calibration/plan.md:92:- [ ] Implement cache lookup + store logic in embedding pipeline (4-6h) — WHY: Cache key is `(content_hash, model_id)` ensuring correctness across model changes; SHA-256 hash collision risk is astronomically low.
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/003-sprint-2-scoring-calibration/plan.md:143:| Unit | R18 cache hit/miss paths, content_hash key correctness | Vitest | 2-3 tests |
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/003-sprint-2-scoring-calibration/checklist.md:43:- [x] CHK-S2-002 [P1] R18 cache schema reviewed: `embedding_cache (content_hash, model_id, embedding, dimensions, created_at, last_used_at)` — HOW: Verify CREATE TABLE statement matches schema; confirm PRIMARY KEY is (content_hash, model_id). Cross-ref T001. [EVIDENCE: documented in phase spec/plan/tasks artifacts]
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/003-sprint-2-scoring-calibration/checklist.md:68:- [x] CHK-S2-022 [P1] R18 cache hit/miss paths tested (content_hash match, model_id match, both) [EVIDENCE: documented in phase spec/plan/tasks artifacts]
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/003-sprint-2-scoring-calibration/checklist.md:79:- [x] CHK-S2-030 [P1] R18 stores only content_hash (not raw content) — no sensitive data duplication [EVIDENCE: documented in phase spec/plan/tasks artifacts]
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/003-sprint-2-scoring-calibration/tasks.md:46:- [x] T001 [P] Create `embedding_cache` table with migration — schema: `content_hash TEXT, model_id TEXT, embedding BLOB, dimensions INT, created_at TEXT, last_used_at TEXT, PRIMARY KEY (content_hash, model_id)` [8-12h] — R18 (REQ-S2-001)
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/003-sprint-2-scoring-calibration/tasks.md:48:  - [x] T001b Implement cache lookup logic in embedding pipeline — Implementation hint: Check `SELECT embedding FROM embedding_cache WHERE content_hash = ? AND model_id = ?` before calling embedding API; update `last_used_at` on hit
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/003-sprint-2-scoring-calibration/tasks.md:50:  - [x] T001d Add `last_used_at` update for cache eviction support — Enables future LRU eviction; `UPDATE embedding_cache SET last_used_at = datetime('now') WHERE content_hash = ? AND model_id = ?`
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/001-sprint-0-measurement-foundation/checklist.md:125:- [x] CHK-S0B [P0] TM-02 content-hash dedup active — exact duplicate saves rejected without embedding generation; distinct content passes without false-positive rejection (`memory-save.ts`) — HOW: Re-save identical content, verify no embedding API call; modify content, verify embedding is generated; cross-ref T054 (verified: SHA256 fast-path dedup active in memory-save.ts) [EVIDENCE: memory-parser.ts:558-560 `computeContentHash()` uses `crypto.createHash('sha256')` for content hashing; handlers/save/dedup.ts:43-70 `checkContentHashDedup()` queries `content_hash` column to reject duplicates before embedding; returns status 'duplicate' with no embedding API call]
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-002-codex-A2.md:832:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:619:    const id = existing && existing.content_hash !== parsed.contentHash
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-002-codex-A2.md:833:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:641:      predecessorMemoryId: existing && existing.content_hash !== parsed.contentHash
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-002-codex-A2.md:834:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:645:      transitionEvent: existing && existing.content_hash !== parsed.contentHash
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/research/iterations/iteration-002.md:46:| PIPELINE-005 | MEDIUM | Incremental indexing is mtime-fast-path only (<1000ms delta). `content_hash` stored but not consulted during categorization. |
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-003-copilot-C1.md:58:  │ teContentHash\(|embedding_status|content_hash" in **/*.{ts,js}
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/research/research.md:180:**Evidence:** Only mtime-fast-path (<1000ms delta). `content_hash` stored but not consulted during categorization. Clock skew or preserved mtimes can miss real changes.
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/research/research.md:181:**Recommendation:** Add `content_hash` comparison as secondary reindex signal.
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/research/research.md:380:14. **PIPELINE-005**: Add content_hash comparison to incremental index
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-002-copilot-C2.md:23:  │ ntmatter|tier|inline marker|marker|stat\(|lstat\(|readdir|scan|content_hash" in
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-002-copilot-C2.md:198:  │ "canonicalFilePath|canonical_file_path|content_hash|SELECT .*memory_index|UPDATE
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-002-copilot-C2.md:249:- `PIPELINE-005` `MEDIUM` Incremental indexing is mtime-fast-path only: `<1000ms` absolute delta skips reindex unless embedding is `pending/failed` (`incremental-index.ts:19`, `145-172`). `content_hash` is stored but not consulted during categorization, so coarse mtimes, preserved mtimes, or sub-second edits can miss content changes.
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/deep-research-strategy.md:14:- [x] Q11. Is the save pipeline (handlers/save/) robust? Memory quality gates effective? Dedup working? **Answer: The save pipeline is architecturally robust -- 7-module decomposition with 3-layer dedup (same-path hash, cross-path hash, semantic PE gate), 4-dimension quality loop (triggers/anchors/budget/coherence, threshold 0.6, 2 auto-fix retries), 5-action PE arbitration (CREATE/REINFORCE/SUPERSEDE/UPDATE/CREATE_LINKED), append-only versioning for updates, 4-step post-insert enrichment with per-step try/catch, and 5-dimensional tenant isolation. THREE gaps found: (a) embedding cache key ignores model ID -- model swap produces stale embeddings, (b) no transaction isolation around dedup check-then-insert (concurrent saves can create duplicates), (c) quality loop content mutations create caller-contract dependency -- fixedContent MUST be consumed or content_hash mismatches.**
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/scratch/agent-output-iter-009-codex-A1.md:13:- `checkExistingRow()` is same-path dedup. It matches the latest top-level row in the same scope and returns `unchanged` only when `content_hash` matches exactly, `embedding_status` is one of `success|pending|partial`, trigger phrases and quality flags are equivalent, quality score matches within epsilon, and `force` is false. Refs: [dedup.ts](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/save/dedup.ts#L14), [dedup.ts](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/save/dedup.ts#L67), [dedup.ts](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/save/dedup.ts#L90), [dedup.ts](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/save/dedup.ts#L146).
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/scratch/agent-output-iter-009-codex-A1.md:14:- `checkContentHashDedup()` is cross-path exact-hash dedup. It looks for a top-level row in the same spec folder/scope with identical `content_hash` and `embedding_status` in `success|partial`; it can exclude the current path via `file_path` and `canonical_file_path`. Refs: [dedup.ts](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/save/dedup.ts#L15), [dedup.ts](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/save/dedup.ts#L162), [dedup.ts](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/save/dedup.ts#L248).
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/scratch/agent-output-iter-009-codex-A1.md:29:- Cache separation is by `(content_hash, model_id)`, not just content hash. Refs: [embedding-cache.ts](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/mcp_server/lib/cache/embedding-cache.ts#L38), [embedding-cache.ts](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/mcp_server/lib/cache/embedding-cache.ts#L67), [embedding-cache.ts](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/mcp_server/lib/cache/embedding-cache.ts#L127).
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/scratch/agent-output-iter-009-codex-A1.md:39:- Remaining risk: the mutex is process-local only. Two separate MCP server processes can still race through dedup-before-insert. There is no DB uniqueness on `content_hash` or canonical path for ordinary top-level memories; `memory_index` only declares `UNIQUE(spec_folder, file_path, anchor_id)`, which does not protect rows where `anchor_id` is `NULL`. Refs: [vector-index-schema.ts](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts#L1843), [vector-index-schema.ts](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts#L1901).
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/iterations/iteration-014.md:125:1. **Same-path hash**: `content_hash = ?` comparison (SHA-256, line 146)
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/iterations/iteration-014.md:126:2. **Cross-path hash**: SQL query `WHERE content_hash = ? AND embedding_status IN (?, ?)` (lines 180-198)
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/026-memory-database-refinement/review/iterations/iteration-034.md:162:1. Checks if `stored.content_hash` exists
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/002-indexing-normalization/scratch/agent-output-iter-001-codex-A1.md:315:      "text": "{\n  \"success\": true,\n  \"results\": [\n    {\n      \"file_path\": \"specs/system-spec-kit/022-hybrid-rag-fusion/system-spec-kit/mcp_server/lib/README.md\",\n      \"language\": \"markdown\",\n      \"content\": \"### Key Features\\n\\n| Feature | Description |\\n|---------|-------------|\\n| **Semantic Search** | Vector-based similarity search with SQLite vector index and hybrid keyword matching |\\n| **Cognitive Memory** | Human-like memory features including attention decay, working memory and co-activation |\\n| **Importance Scoring** | Six-tier importance classification (constitutional, critical, important, normal, temporary, deprecated) |\\n| **Folder Ranking** | Composite scoring for spec folders based on recency, relevance and importance |\",\n      \"start_line\": 50,\n      \"end_line\": 57,\n      \"score\": 0.6857385145793113\n    },\n    {\n      \"file_path\": \"specs/system-spec-kit/022-hybrid-rag-fusion/system-spec-kit/mcp_server/lib/scoring/README.md\",\n      \"language\": \"markdown\",\n      \"content\": \"# Scoring Algorithms\\n\\n> Multi-factor scoring system for memory retrieval with composite weighting, importance tiers, folder ranking and confidence tracking.\\n\\n---\\n\\n## TABLE OF CONTENTS\\n<!-- ANCHOR:table-of-contents -->\\n\\n- [1. OVERVIEW](#1--overview)\\n- [2. KEY CONCEPTS](#2--key-concepts)\\n- [3. STRUCTURE](#3--structure)\\n- [4. USAGE](#4--usage)\\n- [5. RELATED RESOURCES](#5--related-resources)\\n\\n<!-- /ANCHOR:table-of-contents -->\\n\\n---\\n\\n## 1. OVERVIEW\\n<!-- ANCHOR:overview -->\\n\\n### What is the Scoring Module?\\n\\nThe scoring module provides multi-factor algorithms for ranking memories in the Spec Kit Memory system. It combines similarity scores with temporal decay, importance tiers, usage patterns and validation feedback to surface the most relevant memories.\\n\\n### Key Features\\n\\n| Feature | Description |\\n|---------|-------------|\\n| **5-Factor Composite** | REQ-017 compliant scoring with temporal, usage, importance, pattern and citation factors |\",\n      \"start_line\": 10,\n      \"end_line\": 40,\n      \"score\": 0.6600219080477228\n    },\n    {\n      \"file_path\": \"specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/070-memory-ranking/research.md\",\n      \"language\": \"markdown\",\n      \"content\": \"---\\ntitle: \\\"Research: Memory & Folder Ranking Approaches [070-memory-ranking/research]\\\"\\ndescription: \\\"Ranking memories and folders for relevance requires balancing multiple, sometimes competing, factors\\\"\\ntrigger_phrases:\\n  - \\\"research\\\"\\n  - \\\"memory\\\"\\n  - \\\"folder\\\"\\n  - \\\"ranking\\\"\\n  - \\\"approaches\\\"\\n  - \\\"070\\\"\\nimportance_tier: \\\"normal\\\"\\ncontextType: \\\"research\\\"\\n---\\n<!-- SPECKIT_TEMPLATE_SOURCE: research | v1.0 -->\\n# Research: Memory & Folder Ranking Approaches\\n\\n> **Spec:** `071-memory-ranking`  \\n> **Purpose:** Document prior art, alternatives, and evidence supporting design decisions  \\n> **Created:** 2026-01-16\\n\\n---\",\n      \"start_line\": 1,\n      \"end_line\": 21,\n      \"score\": 0.6228492209581802\n    },\n    {\n      \"file_path\": \"specs/system-spec-kit/z_archive/001-fix-command-dispatch/z_archive/044-speckit-test-suite/scratch/test-agent-09-tiers/TEST-REPORT.md\",\n      \"language\": \"markdown\",\n      \"content\": \"### Importance Weight (T9.9) - OBSERVE\\n- Weights observed: 0.5 (default), 0.79, 0.89, 1.0\\n- Weight is stored and updateable via `memory_update`\\n- Search results ordered primarily by similarity score\\n- Weight not shown in search result output (only stored)\\n- **Recommendation:** Clarify if weight should affect ranking or is for other purposes\\n\\n## Cleanup Status\\n- Test memory ID 398 deleted\\n- Test memory file removed\\n- No test data remains in system\\n- Verified: `memory_list` for test folder returns 0 results\",\n      \"start_line\": 66,\n      \"end_line\": 77,\n      \"score\": 0.6115574155204069\n    },\n    {\n      \"file_path\": \"specs/system-spec-kit/022-hybrid-rag-fusion/system-spec-kit/mcp_server/README.md\",\n      \"language\": \"markdown\",\n      \"content\": \"### L2: Core (3 tools, token budget: 1500)\\n\\n#### `memory_search`\\n\\nSemantic search using vector similarity with optional BM25, FTS5 and graph channels. Returns ranked results with scores. Constitutional tier always surfaces at the top.\\n\\n| Parameter | Type | Notes |\\n|-----------|------|-------|\",\n      \"start_line\": 289,\n      \"end_line\": 296,\n      \"score\": 0.606314753147835\n    }\n  ],\n  \"total_returned\": 5,\n  \"offset\": 0,\n  \"message\": null\n}"
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/026-memory-database-refinement/review/iterations/iteration-014.md:28:- The no-distinct-ID branch of `executeConflict()` overwrites `content_text`, `title`, `content_hash`, and embedding in place and creates no `supersedes` edge at [`reconsolidation.ts:377-396`](../../../../../../skill/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts#L377).
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/026-memory-database-refinement/review/iterations/iteration-005.md:34:**Issue**: Cache rows store `dimensions`, but `lookupEmbedding()` ignores that field and keys lookups only by `(content_hash, model_id)`. In `retryEmbedding()`, a cache hit is rehydrated directly into a `Float32Array` and treated as authoritative without checking the stored dimension against the current embedding dimension. If the same model name is reused with a different configured dimension, the retry path can serve a stale cached vector and attempt to persist it into the current index.
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/008-hydra-db-based-features/research/iterations/iteration-001-opus.md:28:7. **Refinement: `insertAppendOnlyMemoryIndexRow` has an anchor_id column missing from INSERT** — The INSERT statement (lines 299-339) does not include `anchor_id` or `content_hash` columns. These are set only via `applyPostInsertMetadata` (line 342-353), requiring an extra UPDATE. This is a performance concern for high-throughput append paths.
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/iterations/iteration-013.md:10:1. **BM25 spec-folder filter is a classic N+1 query.** In `bm25Search()`, when `specFolder` is provided, EVERY result from the in-memory BM25 index triggers an individual `SELECT spec_folder FROM memory_index WHERE id = ?` query inside a `.filter()` loop (lines 283-294). If BM25 returns 50 results, that is 50 separate SQLite queries. This should be a single `WHERE id IN (...)` batch query followed by a Set lookup.
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/scratch/w6-a4-s1-s2-decomposition.md:60:| **S2-2** | 4-6h | No | **Yes** | Design and add embedding-cache schema/path (`content_hash + model_id`), including migration plan and cache invalidation rules. | Current indexing schema, re-index flow, S2 cache requirements | Cache table/schema update, migration/test plan | Sprint 0 exit gate |
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/research.md:86:- **Refuted**: 1 (embedding cache correctly uses compound PK `(content_hash, model_id)` -- original cache-key bug claim was incorrect)
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/research.md:457:| 6 | Embedding cache key | Ignores model ID | Compound PK `(content_hash, model_id)`, correct lookups | **REFUTED** |
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/008-hydra-db-based-features/research/research.md:89:| R2 | lineage-state.ts | Two-step INSERT+UPDATE for anchor_id/content_hash could be single INSERT | lineage-state.ts:299-353 |
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/iterations/iteration-018.md:50:**Fresh evidence:** embedding-cache.ts has a compound PRIMARY KEY `(content_hash, model_id)` (line 45). The `lookupEmbedding()` function (line 62-80) takes both `contentHash` AND `modelId` as parameters and queries with both: `WHERE content_hash = ? AND model_id = ?` (line 68).
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/iterations/iteration-018.md:113:| 6 | Embedding cache ignores model ID | REFUTED | Cache has compound PK (content_hash, model_id) |
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/iterations/iteration-009.md:20:**Layer 1 (same-path)**: `checkExistingRow()` finds existing memory by `canonical_file_path OR file_path` within the same spec_folder + scope (tenant/user/agent/session/shared_space). Returns `status: 'unchanged'` when content_hash matches, embedding status is valid (success|pending|partial), AND metadata is equivalent (trigger phrases, quality score, quality flags all compared). This prevents re-indexing identical files.
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/iterations/iteration-009.md:22:**Layer 2 (cross-path)**: `checkContentHashDedup()` finds any memory with the same content_hash across different file paths (excluding the same-path match via `samePathExclusion`). Returns `status: 'duplicate'` and skips embedding generation entirely. Only considers rows with `embedding_status IN ('success', 'partial')`.
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/iterations/iteration-009.md:125:When the quality loop applies auto-fixes (trigger phrase re-extraction, anchor normalization, content trimming), it returns `fixedContent` and `fixedTriggerPhrases`. The caller MUST use these mutated values for the final INSERT, and MUST recompute the content_hash. If the caller ignores the fixedContent, the stored content_hash will mismatch the actual stored content -- a data integrity violation.
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/iterations/iteration-019.md:49:- **Description:** The quality-loop's auto-fix feature mutates content (fixedContent). Callers MUST consume the fixed content or content_hash will mismatch. This is an implicit contract that is not enforced or documented.
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/research/iterations/iteration-019.md:383:| Embedding cache | Ignores model ID | Correctly uses compound PK (content_hash, model_id) | REFUTED -- removed from recommendations |
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/026-memory-database-refinement/review/iterations/iteration-026.md:10:**Evidence** `memory-save.ts:845-861` calls `runPreflight()` with only `content`, `spec_folder`, `database`, and `find_similar`, and `memory-save.ts:920-940` throws immediately when preflight fails. The exact-duplicate query in `preflight.ts:399-404` is only `WHERE content_hash = ? AND spec_folder = ? LIMIT 1`, so it has no same-path exclusion, no `parent_id IS NULL`, no `embedding_status` guard, and no tenant/user/agent/session/shared-space filtering. The runtime helpers do have those protections: `dedup.ts:93-148` handles same-path `unchanged`, while `dedup.ts:165-249` applies scope-aware cross-path dedup with healthy-status filtering and same-path exclusion. The current tests also reflect that split: `tests/content-hash-dedup.vitest.ts:323-544` exercises the runtime same-path and scope-aware cases, but `tests/preflight.vitest.ts:420-445` only verifies a generic hash match.
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/026-memory-database-refinement/review/iterations/iteration-026.md:19:**Evidence** `memory-save.ts:391-407` branches to `indexChunkedMemoryFile()` immediately after `checkExistingRow()`, while the first runtime content-hash precheck is later at `memory-save.ts:478-484`. Inside the chunking path, `chunking-orchestrator.ts:155-173` only queries for an existing parent on `(canonical_file_path = ? OR file_path = ?)`, and the rest of the function never performs a `content_hash` lookup even though it persists `parsed.contentHash` onto the parent and child rows at `chunking-orchestrator.ts:221-233` and `chunking-orchestrator.ts:326-337`. This means duplicate behavior now depends on save surface and file size: `handleMemorySave(skipPreflight=true)`, `indexMemoryFile()`, and internal atomic-save flows can all reach the chunking path without any cross-path hash dedup.
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/026-memory-database-refinement/review/iterations/iteration-026.md:23:### [P2] PE reinforcement can backfill `content_text` without updating `content_hash`
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/026-memory-database-refinement/review/iterations/iteration-026.md:26:**Issue** The reinforcement path mutates stored content by backfilling `content_text` when it is null, but it never refreshes the row's `content_hash`. On legacy or partially populated rows, that can leave the persisted text and persisted hash out of sync, weakening future exact-dedup checks and any downstream tooling that treats `content_hash` as the canonical fingerprint of the stored content.
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/026-memory-database-refinement/review/iterations/iteration-026.md:28:**Evidence** `pe-gating.ts:114-149` reads only `id`, scheduling fields, and `title`, then runs `UPDATE memory_index SET ... content_text = COALESCE(content_text, ?), ... WHERE id = ?`. No `content_hash` field is selected or updated anywhere in that path, even though the incoming `parsed` object already includes `contentHash` at `pe-gating.ts:22-34`. If the existing row has `content_text IS NULL`, reinforcement will write new text while preserving whatever hash value was already present, including `NULL` or a stale legacy value.
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/026-memory-database-refinement/review/iterations/iteration-026.md:30:**Fix** Keep reinforcement metadata-only, or update `content_hash` in the same statement whenever `content_text` is backfilled. If the intent is to preserve immutable content, remove the `COALESCE(content_text, ?)` write entirely and leave content hydration to a dedicated repair/backfill path that recomputes hashes atomically.
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/026-memory-database-refinement/review/iterations/iteration-026.md:35:**Issue** Both exact-dedup helpers treat a matching `content_hash` as conclusive and never verify that the stored content actually matches the incoming content. A real SHA-256 collision is unlikely, but the same blind trust also means a corrupted backfill, manual DB edit, or stale hash can silently alias unrelated memories and force the wrong duplicate decision.
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/026-memory-database-refinement/review/iterations/iteration-026.md:37:**Evidence** `dedup.ts:231-249` selects `id`, `file_path`, and `title` by `content_hash` and returns `status: 'duplicate'` immediately; it never loads `content_text` or recomputes the stored hash. `preflight.ts:399-413` does the same for the preflight path. The codebase clearly expects `content_hash` integrity to matter because it is indexed and used as a first-class dedup key, but these paths have no fallback verification when the stored hash is wrong.
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/scratch/agent-output-iter-014-codex-A1.md:11:| `9. "Dedup cosine"` | `FALSE` | `handlers/save/dedup.ts` dedups by `content_hash`, file path, canonical path, and embedding status in [dedup:104](/Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/save/dedup.ts#L104) and [dedup:176](/Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/save/dedup.ts#L176); cosine similarity lives elsewhere in [save-quality-gate:523](/Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/system-spec-kit/mcp_server/lib/validation/save-quality-gate.ts#L523), not in `save/dedup.ts`. |
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/scratch/agent-output-iter-018-codex-A1.md:15:6. **REFUTED:** the embedding cache is model-aware. The schema uses `(content_hash, model_id)` as the primary key at [`embedding-cache.ts`](#/Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/system-spec-kit/mcp_server/lib/cache/embedding-cache.ts#L38), and lookup filters by both keys at [`embedding-cache.ts`](#/Users/michelkerkmeester/MEGA/Development/Opencode Env/Public/.opencode/skills/system-spec-kit/mcp_server/lib/cache/embedding-cache.ts#L62).
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/scratch/codex-review-report.md:85:    `storeMemory` writes `content_hash` from `parsed.contentHash` instead of actual `memory.content`. Reconsolidated variants get mismatched hashes. Fix: compute hash from actual content.
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/001-hybrid-rag-fusion-epic/scratch/codex-review-validation.md:46:| 14 | reconsolidation-bridge.ts:112 content_hash | May be intentional design (file-level hash for chunks). Needs verification before fixing |
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/026-memory-database-refinement/review/iterations/iteration-033.md:216:SELECT embedding FROM embedding_cache WHERE content_hash = ? AND model_id = ? AND dimensions = ?
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/026-memory-database-refinement/review/iterations/iteration-033.md:218:The `dimensions` column is part of both the lookup predicate and the `UPDATE last_used_at` predicate at line 79. The table schema at lines 38-47 uses `PRIMARY KEY (content_hash, model_id)` — note that `dimensions` is NOT part of the primary key.
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/026-memory-database-refinement/review/iterations/iteration-033.md:220:**P1 finding:** The primary key does not include `dimensions`. `storeEmbedding()` at line 128-133 uses `INSERT OR REPLACE`, keyed on `(content_hash, model_id)`. If the same content is re-embedded with a different model that produces a different dimension count (e.g., model upgrade from 1536-dim to 3072-dim embeddings), `INSERT OR REPLACE` will overwrite the old entry. The `lookupEmbedding` call with the new `dimensions` value will then find the new entry correctly. However, if the model produces the same `model_id` string with a different `dimensions` value (dimension mismatch bug in the provider), `INSERT OR REPLACE` will silently replace the correctly-dimensioned embedding with the wrong one. The `lookupEmbedding` dimension filter prevents returning wrong-dimension embeddings on read, but the store step can silently corrupt a valid cache entry with an identically-named model that returns different dimensions. This is an edge case but represents a correctness risk for deployments that modify embedding models without changing the model ID string.
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/026-memory-database-refinement/review/iterations/iteration-033.md:283:The `embedding_cache` table defines `PRIMARY KEY (content_hash, model_id)`. The `storeEmbedding()` function uses `INSERT OR REPLACE` (line 128), which replaces an existing `(content_hash, model_id)` entry regardless of the `dimensions` value. If a model ID is reused with a different dimension count (e.g., A/B model testing, silent provider config change), a store call with the new dimension will silently overwrite the correctly-dimensioned cached embedding. The `lookupEmbedding()` dimension filter protects reads, but the corrupt entry remains in the cache and blocks future correct-dimension lookups until eviction.
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/026-memory-database-refinement/review/iterations/iteration-033.md:285:**Fix:** Add `dimensions` to the primary key: `PRIMARY KEY (content_hash, model_id, dimensions)`. This requires a schema migration to drop and recreate the table or add a unique index, and `INSERT OR REPLACE` will then correctly handle dimension mismatches as distinct entries.
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/026-memory-database-refinement/review/iterations/iteration-033.md:292:The comment at line 671 acknowledges that `checkContentHashDedup` runs outside the `writeTransaction` for performance reasons ("reads are safe outside the transaction"). However, without a unique index on `content_hash` in `memory_index`, two concurrent saves of identical content can both pass the dedup check before either acquires the write lock. The `writeTransaction.immediate()` at line 737 serializes DB writes across processes via SQLite's write-ahead-lock, but the dedup read is not covered. If `memory_index` has a unique constraint on `content_hash`, the second writer gets an SQLite constraint error inside the transaction, which is caught and handled. If not, a duplicate row is silently inserted.
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/026-memory-database-refinement/review/iterations/iteration-033.md:294:**Fix:** Confirm that `memory_index.content_hash` has a unique constraint (or add one with `WHERE content_hash IS NOT NULL`), OR move `checkContentHashDedup` inside the `writeTransaction` body, accepting the minor performance cost of running under the write lock.
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/026-memory-database-refinement/review/iterations/iteration-017.md:10:The scan's incremental fast path trusts `categorizeFilesForIndexing()` to skip files based only on `file_mtime_ms` and embedding status. That means real content changes can be missed whenever a rewrite preserves mtime or lands within the `< 1000ms` tolerance window, even though the stored row already carries `content_hash` and the stat call already has `size`.
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/026-memory-database-refinement/review/iterations/iteration-017.md:13:`handleMemoryIndexScan()` sends every discovered file through `incrementalIndex.categorizeFilesForIndexing(files)` and then treats `categorized.toSkip` as already up to date at `.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:344-364`. In the helper, `shouldReindex()` returns `skip` whenever `Math.abs(fileInfo.mtime - stored.file_mtime_ms) < MTIME_FAST_PATH_MS` unless embedding is pending/failed at `.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:145-172`. The same helper reads `content_hash` from storage and `size` from `fs.statSync()`, but neither value participates in the skip decision at `.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:25-37` and `.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:91-99`.
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/011-scoring-and-calibration/checklist.md:76:- [x] CHK-033 [P0] 028 (Embedding cache R18) executed: cache hit skips embedding call; hit updates lastAccessed timestamp; sandbox restored; evidence captured -- `embedding-cache.ts:62-81`: `lookupEmbedding()` returns Buffer on hit (skips embedding API); line 76-78: updates `last_used_at` on hit; null on miss triggers embedding call; cache key = (content_hash, model_id) primary key at line 46 [EVIDENCE: tasks.md; implementation-summary.md]
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/026-memory-database-refinement/checklist.md:176:- [x] CHK-112 [P1] C-3 Reconsolidation stale-merge guard — compare-and-swap on predecessor [Evidence: content_hash/updated_at revalidation in executeMerge(); predecessor_changed/predecessor_gone abort statuses; 50 tests pass]
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/026-memory-database-refinement/checklist.md:189:- [x] CHK-130 [P1] Q-1 Save-path dedup queries rewritten with composite partial indexes [Evidence: dynamic exact-match SQL; two-probe path lookup; idx_save_canonical_path + idx_save_parent_content_hash_scope]
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/015-manual-testing-per-playbook/011-scoring-and-calibration/tasks.md:77:- [x] T019 Execute 028 -- Embedding cache (R18): **PASS** -- `embedding-cache.ts:62-81` implements `lookupEmbedding()`: returns cached Buffer on hit, null on miss; updates `last_used_at` on hit at line 76-78; `storeEmbedding()` at line 106 stores new embeddings; cache key is (content_hash, model_id) composite primary key at line 46
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/026-memory-database-refinement/scratch/phase-13-fix-prompt.md:85:2. Compare content_hash or updated_at with the value captured before the await
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/026-memory-database-refinement/scratch/phase-13-fix-prompt.md:165:- (spec_folder, content_hash, embedding_status, tenant_id, user_id, agent_id, session_id, shared_space_id, id DESC) WHERE parent_id IS NULL
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/026-memory-database-refinement/tasks.md:98:- [x] T047 [P] Fix embedding cache — dimension-aware cache key `(content_hash, model_id, dimensions)` (`lib/cache/embedding-cache.ts`) [iter-005]
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/026-memory-database-refinement/scratch/p2-triage-agent1.md:33:- **Reason**: Backfilling `content_text` while leaving `content_hash` stale breaks downstream change detection and hash-based dedup assumptions. Reinforcement now updates `content_hash` in the same statement when it backfills missing content.
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/026-memory-database-refinement/research/iterations/iteration-003.md:24:  - `checkContentHashDedup()` repeats the same nullable-scope pattern on top of `spec_folder`, `content_hash`, `parent_id IS NULL`, and `embedding_status IN (?, ?)`, again with `ORDER BY id DESC LIMIT 1`: [dedup.ts](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/save/dedup.ts#L188), [dedup.ts](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/save/dedup.ts#L216)
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/026-memory-database-refinement/research/iterations/iteration-003.md:26:  - The schema only provides separate indexes for `spec_folder`, `content_hash`, `canonical_file_path`, and a broad governance scope tuple; it does not provide a composite index aligned to these dedup predicates: [vector-index-schema.ts](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts#L2261), [vector-index-schema.ts](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts#L2271), [vector-index-schema.ts](/Users/michelkerkmeester/MEGA/Development/Opencode%20Env/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts#L2277)
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/026-memory-database-refinement/research/iterations/iteration-003.md:33:  - Add a composite partial index for the content-hash path, for example `(spec_folder, content_hash, embedding_status, tenant_id, user_id, agent_id, session_id, shared_space_id, id DESC) WHERE parent_id IS NULL`, and consider a sister index for exact-path dedup keyed by `(spec_folder, canonical_file_path, id DESC)` plus a file-path fallback.
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/026-memory-database-refinement/research/iterations/iteration-001.md:73:- There is no compare-and-swap guard on `updated_at`, `content_hash`, or archival state before applying the merge.
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/026-memory-database-refinement/research/iterations/iteration-001.md:80:- Carry `existingMemory.id` plus the predecessor's `content_hash` or `updated_at` from the planning phase.
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C08.md:709:  if (memory.content_hash) {
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C08.md:710:    hashInput = memory.content_hash;
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C08.md:1286:.opencode/skills/system-spec-kit/mcp_server/lib/cache/embedding-cache.ts:65:    'SELECT embedding, dimensions FROM embedding_cache WHERE content_hash = ? AND model_id = ?',
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C08.md:1287:.opencode/skills/system-spec-kit/mcp_server/lib/cache/embedding-cache.ts:74:    "UPDATE embedding_cache SET last_used_at = datetime('now') WHERE content_hash = ? AND model_id = ?",
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C08.md:1412:    SELECT id, content_hash FROM memory_index
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/007-code-audit-per-feature-catalog/008-bug-fixes-and-data-integrity/scratch/reaudit-2026-03-23/codex53-verifier.md:71:  - Same-path unchanged short-circuit uses `content_hash` + eligible statuses + metadata equivalence + `!force`: `dedup.ts:129-136`.
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/007-code-audit-per-feature-catalog/008-bug-fixes-and-data-integrity/scratch/reaudit-2026-03-23/codex53-verifier.md:73:  - O(1)-style indexed lookup criteria: `spec_folder`, `content_hash`, `embedding_status IN ('success','partial')`: `dedup.ts:168-171`, `184-187`.
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C15.md:638:    SELECT id, content_hash FROM memory_index
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C02.md:792:    database.exec(`CREATE INDEX IF NOT EXISTS idx_content_hash ON memory_index(content_hash)`);
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C02.md:793:    logger.info('Created idx_content_hash index');
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C02.md:1384:  'content_hash', 'context_type', 'importance_tier', 'memory_type',
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/investigation-X10.md:218:    19	  content_hash: string | null;
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C05.md:233:/bin/zsh -lc 'rg -n "SHA-256|SHA256|sha256|content_hash|contentHash|embedding step|embedding generation|duplicate" .opencode/skills/system-spec-kit/mcp_server .opencode/skills/system-spec-kit/shared' in /Users/michelkerkmeester/MEGA/Development/Opencode Env/Publicexec
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C05.md:325:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-types.ts:63:  content_hash: string | null;
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C05.md:333:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:137:    // AI-WHY: Persist mutated content from quality loop; recompute content_hash
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C05.md:335:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:245:    SELECT id, content_hash FROM memory_index
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C05.md:336:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:251:  `).get(parsed.specFolder, canonicalFilePath, filePath) as { id: number; content_hash: string } | undefined;
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C05.md:895:/bin/zsh -lc "rg -n \"checkContentHashDedup|content_hash.*spec_folder|duplicate content|embedding.*skip|status === 'duplicate'|content-hash dedup\" .opencode/skills/system-spec-kit/mcp_server/handlers .opencode/skills/system-spec-kit/mcp_server/lib .opencode/skills/system-spec-kit/mcp_server/tests" in /Users/michelkerkmeester/MEGA/Development/Opencode Env/Public succeeded in 51ms:
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C05.md:903:   803	  if (!column_names.includes('content_hash')) {
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C05.md:905:   805	      database.exec(`ALTER TABLE memory_index ADD COLUMN content_hash TEXT`);
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C05.md:906:   806	      console.warn('[vector-index] Migration: Added content_hash column');
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C05.md:917:     6	// same content_hash) and proceeds to embed for changed content.
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C05.md:954:.opencode/skills/system-spec-kit/mcp_server/lib/validation/preflight.ts:398:        ? 'SELECT id, file_path FROM memory_index WHERE content_hash = ? AND spec_folder = ? LIMIT 1'
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C05.md:955:.opencode/skills/system-spec-kit/mcp_server/lib/validation/preflight.ts:401:      const paramsArray: unknown[] = spec_folder ? [content_hash, spec_folder] : [content_hash];
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C05.md:959:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-delete.ts:116:          SELECT id, content_hash, spec_folder, file_path
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C05.md:960:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-health.ts:251:        SELECT file_path, content_hash, spec_folder
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C05.md:996:    19	    SELECT id, content_hash FROM memory_index
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C11.md:235:.opencode/skills/system-spec-kit/mcp_server/lib/cache/embedding-cache.ts:42:      PRIMARY KEY (content_hash, model_id)
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C11.md:238:.opencode/skills/system-spec-kit/mcp_server/lib/cache/embedding-cache.ts:65:    'SELECT embedding, dimensions FROM embedding_cache WHERE content_hash = ? AND model_id = ?',
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C11.md:240:.opencode/skills/system-spec-kit/mcp_server/lib/cache/embedding-cache.ts:74:    "UPDATE embedding_cache SET last_used_at = datetime('now') WHERE content_hash = ? AND model_id = ?",
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C11.md:242:.opencode/skills/system-spec-kit/mcp_server/lib/cache/embedding-cache.ts:89: * Uses INSERT OR REPLACE so duplicate (content_hash, model_id) pairs
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C11.md:248:.opencode/skills/system-spec-kit/mcp_server/lib/cache/embedding-cache.ts:126:       (content_hash, model_id, embedding, dimensions, last_used_at)
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C11.md:290:.opencode/skills/system-spec-kit/mcp_server/lib/cache/embedding-cache.ts:65:    'SELECT embedding, dimensions FROM embedding_cache WHERE content_hash = ? AND model_id = ?',
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C11.md:291:.opencode/skills/system-spec-kit/mcp_server/lib/cache/embedding-cache.ts:74:    "UPDATE embedding_cache SET last_used_at = datetime('now') WHERE content_hash = ? AND model_id = ?",
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C11.md:754:NOTES: The cache table, SHA-256 keying, `last_used_at` LRU behavior, and cache-first lookup all exist. The weak spot is the description of `INSERT OR REPLACE`: it refreshes the same `(content_hash, model_id)` entry, but model-version separation is really handled by the composite key, not by replace semantics alone.
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C11.md:811:NOTES: The cache table, SHA-256 keying, `last_used_at` LRU behavior, and cache-first lookup all exist. The weak spot is the description of `INSERT OR REPLACE`: it refreshes the same `(content_hash, model_id)` entry, but model-version separation is really handled by the composite key, not by replace semantics alone.
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/investigation-X03.md:125:    19	  content_hash: string | null;
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/verification-C03.md:415:  content_hash: string | null;
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/agent-02-mutation-v2.md:396:  │ "same-path|healthy state|partial|content_hash|same path|unchanged|duplicate"
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/agent-02-mutation-v2.md:405:  │ "canonical_file_path|content_hash|embedding_status|success|pending|partial|complete"
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/agent-08-scoring.md:435:`06-embedding-cache.md | ALIGNED | `mcp_server/lib/cache/embedding-cache.ts` creates the SQLite `(content_hash, model_id)` cache, updates `last_used_at`, and evicts LRU-style; no scripts implementation.`
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/agent-05-bugfixes.md:140:  │ "sha-?256|content_hash|hash|embedding"
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/agent-05-bugfixes.md:220:  │ lti_concept_search|vector_search|content_hash|temporal-contiguity|co-activation|boostScore" in
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/agent-05-bugfixes.md:260:  │ "graph-search-fn|canonicalResultId|cleanupOldSessions|enforceEntryLimit|content_hash|co-activati
./.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/006-feature-catalog/scratch/agents/agent-05-bugfixes.md:332:`04-sha-256-content-hash-deduplication.md` | `ALIGNED` | `mcp_server/handlers/save/dedup.ts:93-105,165-193,237-248` checks `content_hash` within `spec_folder` and skips embedding generation for exact duplicates; `scripts` has adjacent dedup utilities, not the same save-path feature.
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/002-mex-main/research/iterations/iteration-010.md:508:/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/save/dedup.ts:95:    SELECT id, content_hash, embedding_status, trigger_phrases, quality_score, quality_flags
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/002-mex-main/research/iterations/iteration-010.md:2316:    94	  content_hash: string | null;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/002-mex-main/research/iterations/iteration-010.md:2405:   183	    bucket.variants.set(normalizedPath, row.content_hash ?? null);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/002-mex-main/research/iterations/iteration-010.md:2406:   184	    if (typeof row.content_hash === 'string' && row.content_hash.trim().length > 0) {
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/002-mex-main/research/iterations/iteration-010.md:2407:   185	      bucket.hashes.add(row.content_hash.trim());
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/002-mex-main/research/iterations/iteration-010.md:2540:   318	        SELECT file_path, content_hash, spec_folder
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/002-mex-main/research/iterations/iteration-010.md:4757:/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/save/dedup.ts:95:    SELECT id, content_hash, embedding_status, trigger_phrases, quality_score, quality_flags
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/002-mex-main/research/iterations/iteration-024.md:6632:/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/19--feature-flag-reference/028-1-search-pipeline-features-speckit.md:29:| EX-028 | 1. Search Pipeline Features (SPECKIT_*) | Flag catalog verification with inert and retired surface cleanup | `List SPECKIT search-pipeline flags as active, inert compatibility shims, or retired. Capture the evidence needed to prove active flags stay separated from inert compatibility shims such as SPECKIT_RSF_FUSION and SPECKIT_SHADOW_SCORING, and that retired topics such as full-context ceiling eval, index refresh, context budget, PageRank, and entity scope are not presented as active manual-test scenarios. Return a concise user-facing pass/fail verdict with the main reason.` | `memory_search({ query: "SPECKIT search pipeline flags active inert retired RSF shadow scoring", limit: 20 })` -> `memory_context({ input: "Classify live search-pipeline flags versus inert compatibility shims and retired topics", mode: "deep", sessionId: "ex028" })` | Accurate active/inert/retired classification; retired topics absent from active manual-test guidance | Search/context outputs + catalog cross-check notes | PASS if classifications are internally consistent and retired topics are not framed as active checks | Validate against code/config docs; remove any manual-test wording that still treats retired topics as live search-pipeline behavior |
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/002-mex-main/research/iterations/iteration-024.md:6655:/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/13--memory-quality-and-indexing/044-reconsolidation-on-save-tm-06.md:30:| 044 | Reconsolidation-on-save (TM-06) | Abort stale merge when predecessor changes before commit | `Validate reconsolidation-on-save (TM-06) stale-predecessor protection. Reproduce a case where executeMerge() snapshots a predecessor, another writer updates that predecessor during embedding generation, and the merge path returns predecessor_changed or predecessor_gone instead of archiving/inserting a stale merged row. Capture the evidence needed to prove the original predecessor remains the only active row after the abort. Return a concise user-facing pass/fail verdict with the main reason.` | 1) Seed a merge-eligible predecessor with known `content_hash` and `updated_at` 2) start merge with async embedding generation 3) mutate, archive, or delete the predecessor before the transaction body resumes 4) verify complement-style abort with `predecessor_changed` or `predecessor_gone` 5) verify no merged row was inserted and predecessor lineage stayed intact 6) `npx vitest run .opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts -t \"Aborts merge when predecessor changes during embedding generation\"` | Merge returns `action: complement` with `status: predecessor_changed` or `status: predecessor_gone`; no stale merged row is inserted; predecessor row reflects only the concurrent writer change | Targeted vitest output plus `memory_index` row dump showing the predecessor remained active and no new merged row was created | PASS: Stale predecessor detection blocks the merge and preserves the current predecessor state; FAIL: Merge still archives/inserts despite predecessor mutation or deletion | Verify predecessor snapshot capture (`content_hash`, `updated_at`) → Check in-transaction reload → Inspect `hasPredecessorChanged()` branch → Confirm archive/delete handling |
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/002-mex-main/research/iterations/iteration-004.md:3293:.opencode/skills/system-spec-kit/manual_testing_playbook/19--feature-flag-reference/028-1-search-pipeline-features-speckit.md:29:| EX-028 | 1. Search Pipeline Features (SPECKIT_*) | Flag catalog verification with inert and retired surface cleanup | `List SPECKIT search-pipeline flags as active, inert compatibility shims, or retired. Capture the evidence needed to prove active flags stay separated from inert compatibility shims such as SPECKIT_RSF_FUSION and SPECKIT_SHADOW_SCORING, and that retired topics such as full-context ceiling eval, index refresh, context budget, PageRank, and entity scope are not presented as active manual-test scenarios. Return a concise user-facing pass/fail verdict with the main reason.` | `memory_search({ query: "SPECKIT search pipeline flags active inert retired RSF shadow scoring", limit: 20 })` -> `memory_context({ input: "Classify live search-pipeline flags versus inert compatibility shims and retired topics", mode: "deep", sessionId: "ex028" })` | Accurate active/inert/retired classification; retired topics absent from active manual-test guidance | Search/context outputs + catalog cross-check notes | PASS if classifications are internally consistent and retired topics are not framed as active checks | Validate against code/config docs; remove any manual-test wording that still treats retired topics as live search-pipeline behavior |
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/002-mex-main/research/iterations/iteration-004.md:3357:.opencode/skills/system-spec-kit/feature_catalog/08--bug-fixes-and-data-integrity/07-canonical-id-dedup-hardening.md:20:The save-path dedup path is now hardened around the same canonicalization principle. Instead of a single `(canonical_file_path = ? OR file_path = ?)` lookup, same-path detection performs two direct probes and keeps the newest parent-memory match. The supporting schema now includes parent-only partial indexes for the hot save-path and content-hash checks: `idx_save_parent_canonical_path` on `(spec_folder, canonical_file_path, id DESC)` and `idx_save_parent_content_hash_scope` on `(spec_folder, content_hash, embedding_status, tenant_id, user_id, agent_id, session_id, shared_space_id, id DESC) WHERE parent_id IS NULL`. Together, they remove nullable OR predicates from the save path and keep dedup lookups targeted to top-level memory rows.
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/002-mex-main/research/iterations/iteration-030.md:4426:    94	  content_hash: string | null;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/002-mex-main/research/iterations/iteration-030.md:4515:   183	    bucket.variants.set(normalizedPath, row.content_hash ?? null);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/002-mex-main/research/iterations/iteration-030.md:4516:   184	    if (typeof row.content_hash === 'string' && row.content_hash.trim().length > 0) {
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/002-mex-main/research/iterations/iteration-030.md:4517:   185	      bucket.hashes.add(row.content_hash.trim());
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/002-mex-main/research/iterations/iteration-030.md:7373:   318	        SELECT file_path, content_hash, spec_folder
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/002-mex-main/research/iterations/iteration-020.md:4035:    94	  content_hash: string | null;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/002-mex-main/research/iterations/iteration-020.md:4124:   183	    bucket.variants.set(normalizedPath, row.content_hash ?? null);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/002-mex-main/research/iterations/iteration-020.md:4125:   184	    if (typeof row.content_hash === 'string' && row.content_hash.trim().length > 0) {
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/002-mex-main/research/iterations/iteration-020.md:4126:   185	      bucket.hashes.add(row.content_hash.trim());
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/002-mex-main/research/iterations/iteration-020.md:4259:   318	        SELECT file_path, content_hash, spec_folder
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/002-mex-main/research/iterations/iteration-014.md:3806:  content_hash: string | null;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/002-mex-main/research/iterations/iteration-014.md:3895:    bucket.variants.set(normalizedPath, row.content_hash ?? null);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/002-mex-main/research/iterations/iteration-014.md:3896:    if (typeof row.content_hash === 'string' && row.content_hash.trim().length > 0) {
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/002-mex-main/research/iterations/iteration-014.md:3897:      bucket.hashes.add(row.content_hash.trim());
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/002-mex-main/research/iterations/iteration-014.md:7655:   318	        SELECT file_path, content_hash, spec_folder
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/002-mex-main/research/iterations/iteration-005.md:2293:/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/save/dedup.ts:95:    SELECT id, content_hash, embedding_status, trigger_phrases, quality_score, quality_flags
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/002-mex-main/research/iterations/iteration-005.md:4436:/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/05--lifecycle/08-constitutional-memory-end-to-end-lifecycle.md:29:- **Storage schema.** `create-record.ts` persists constitutional memories through the same `memory_index` path used by other saved memories: `indexMemory()` for successful embeddings and `indexMemoryDeferred()` when embeddings are delayed. After the base row is created, `applyPostInsertMetadata()` stamps the metadata that matters for lifecycle behavior, including `content_hash`, `context_type`, `importance_tier`, `memory_type`, `type_inference_source`, FSRS defaults, `file_mtime_ms`, `document_type`, `quality_score`, and `quality_flags`. The fresh-schema definition in `vector-index-schema.ts` shows the wider storage contract around that row: `memory_index` stores location, canonical path, trigger phrases, embedding status, governance scope fields, context type, chunk parentage, learned triggers, interference score, and archive state; companion storage includes `vec_memories` for vector search, `memory_fts` for text retrieval, lineage tables for active-version projection, and the initialized `embedding_cache` table.
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/002-mex-main/research/iterations/iteration-005.md:5560:/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/13--memory-quality-and-indexing/044-reconsolidation-on-save-tm-06.md:30:| 044 | Reconsolidation-on-save (TM-06) | Abort stale merge when predecessor changes before commit | `Validate reconsolidation-on-save (TM-06) stale-predecessor protection. Reproduce a case where executeMerge() snapshots a predecessor, another writer updates that predecessor during embedding generation, and the merge path returns predecessor_changed or predecessor_gone instead of archiving/inserting a stale merged row. Capture the evidence needed to prove the original predecessor remains the only active row after the abort. Return a concise user-facing pass/fail verdict with the main reason.` | 1) Seed a merge-eligible predecessor with known `content_hash` and `updated_at` 2) start merge with async embedding generation 3) mutate, archive, or delete the predecessor before the transaction body resumes 4) verify complement-style abort with `predecessor_changed` or `predecessor_gone` 5) verify no merged row was inserted and predecessor lineage stayed intact 6) `npx vitest run .opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts -t \"Aborts merge when predecessor changes during embedding generation\"` | Merge returns `action: complement` with `status: predecessor_changed` or `status: predecessor_gone`; no stale merged row is inserted; predecessor row reflects only the concurrent writer change | Targeted vitest output plus `memory_index` row dump showing the predecessor remained active and no new merged row was created | PASS: Stale predecessor detection blocks the merge and preserves the current predecessor state; FAIL: Merge still archives/inserts despite predecessor mutation or deletion | Verify predecessor snapshot capture (`content_hash`, `updated_at`) → Check in-transaction reload → Inspect `hasPredecessorChanged()` branch → Confirm archive/delete handling |
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/002-mex-main/research/iterations/iteration-005.md:5719:/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/13--memory-quality-and-indexing/165-assistive-reconsolidation-speckit-assistive-reconsolidation.md:30:| 165 | Assistive reconsolidation (SPECKIT_ASSISTIVE_RECONSOLIDATION) | Verify predecessor change detection in companion reconsolidation path | `Test SPECKIT_ASSISTIVE_RECONSOLIDATION=true with companion reconsolidation safety. Reproduce a merge-eligible predecessor that changes during async embedding generation and capture the evidence needed to prove the shared reconsolidation path returns predecessor_changed or predecessor_gone instead of stale-merging while assistive behavior remains non-destructive. Return a concise user-facing pass/fail verdict with the main reason.` | 1) Enable `SPECKIT_ASSISTIVE_RECONSOLIDATION=true` 2) seed a merge-eligible predecessor used by the companion reconsolidation module 3) begin async merge preparation 4) mutate, archive, or delete the predecessor before transaction re-read 5) verify `predecessor_changed` or `predecessor_gone` is surfaced and no stale merged row is inserted 6) `npx vitest run .opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts -t \"Aborts merge when predecessor changes during embedding generation\"` | Companion merge path aborts with `predecessor_changed` or `predecessor_gone`; no stale merged row is inserted; assistive layer remains recommendation/shadow-only rather than performing a destructive content merge | Targeted vitest output plus DB evidence showing no merged row was inserted after predecessor mutation | PASS if predecessor mutation blocks the companion merge and assistive behavior remains non-destructive; FAIL if stale merge still commits or assistive layer mutates state outside its documented bounds | Verify predecessor snapshot comparison (`content_hash`, `updated_at`) → Check shared reconsolidation guardrails → Confirm assistive bridge still limits itself to shadow-archive/recommend behavior |
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/002-mex-main/research/iterations/iteration-015.md:2785:  content_hash: string | null;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/002-mex-main/research/iterations/iteration-015.md:2874:    bucket.variants.set(normalizedPath, row.content_hash ?? null);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/002-mex-main/research/iterations/iteration-015.md:2875:    if (typeof row.content_hash === 'string' && row.content_hash.trim().length > 0) {
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/002-mex-main/research/iterations/iteration-015.md:2876:      bucket.hashes.add(row.content_hash.trim());
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/002-mex-main/research/iterations/iteration-011.md:2940:2026-04-10T20:01:54.137400Z ERROR codex_core::tools::router: error=exec_command failed for `/bin/zsh -lc 'rg -n "memory_hygiene|hygiene_report|stale|staleness|last_accessed|script coverage|undocumented script|dependency mismatch|version mismatch|dead command|sync brief|targeted sync|fix only|pattern add|patterns/INDEX|GROW|Current Project State|refresh queue|review queue|resync|drift score" /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/specs/system-spec-kit/scripts /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts'`: CreateProcess { message: "Codex(Sandbox(Denied { output: ExecToolCallOutput { exit_code: 2, stdout: StreamOutput { text: \"\", truncated_after_lines: None }, stderr: StreamOutput { text: \"rg: /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/specs/system-spec-kit/scripts: No such file or directory (os error 2)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:118:// P4-12/P4-19: Incremental index (passed to db-state for stale handle refresh)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:175:    codeGraphStatus: 'fresh' | 'stale' | 'empty';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:194:  staleCount: number;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:379:// Safe for stdio (single client). TTL in query-flow-tracker bounds staleness.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:712:      return { totalMemories: 0, specFolderCount: 0, activeCount: 0, staleCount: 0 };\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:731:      staleCount: pending + failed + retry,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:734:    return { totalMemories: 0, specFolderCount: 0, activeCount: 0, staleCount: 0 };\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:751:  const staleWarning = stats.staleCount > 10\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:752:    ? ` Warning: ${stats.staleCount} stale memories detected. Consider running memory_index_scan.`\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:757:    `Active memories: ${stats.activeCount}. Stale memories: ${stats.staleCount}.`,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:761:    staleWarning.trim(),\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:787:  lines.push('- If \\\"stale\\\" or \\\"missing\\\": call session_bootstrap first to refresh structural context');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:798:    if (snap.graphFreshness === 'fresh' || snap.graphFreshness === 'stale') {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1191:    // P1 FIX: Wire isCommittedInDb callback so stale pending files are detected at startup.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1313:          staleDeleted: 0,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1314:          staleDeleteFailed: 0,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1481:  // Node version mismatch detection (non-blocking)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1561:  // Refresh their DB handles during reinitializeDatabase(), preventing stale refs.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1843:                    staleDeleted: 0,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1844:                    staleDeleteFailed: 0,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/ENV_REFERENCE.md:223:| `SPECKIT_ARCHIVAL` | `true` | boolean | Archival manager for aging out stale memories (90-day max age). Graduated ON. | `lib/cognitive/archival-manager.ts` |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/ENV_REFERENCE.md:227:| `SPECKIT_CONSOLIDATION` | `true` | boolean | Consolidation engine: contradiction scan, Hebbian strengthening, staleness detection (N3-lite). Graduated ON. | `lib/search/search-flags.ts` |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/save/post-insert.ts:103:      // Data integrity: clean stale auto-entities before re-extraction on update\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/save/response-builder.ts:453:        `-${consolidation.hebbian.decayed} decayed, ${consolidation.stale.flagged} stale flagged`\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/session-resume.ts:79:    | 'stale_summary'\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/session-resume.ts:94:  status: 'fresh' | 'stale' | 'empty' | 'error';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/session-resume.ts:287:      'stale_summary',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/session-resume.ts:473:  if (structuralContext.status === 'stale' || structuralContext.status === 'missing') {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/session-bootstrap.ts:115:  } else if (structuralContext.status === 'stale') {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/session-bootstrap.ts:122:  if (healthStatus === 'warning' || healthStatus === 'stale') {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/session-bootstrap.ts:196:  if (structuralContext.status === 'stale' || structuralContext.status === 'missing') {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/session-bootstrap.ts:317:      : structuralContext.status === 'stale'\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/session-bootstrap.ts:318:        ? 'stale'\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:632:  // Otherwise stale trigger/tool-cache entries persist until next non-chunked save.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/session-health.ts:33:type SessionStatus = 'ok' | 'warning' | 'stale';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/session-health.ts:38:  graphFreshness: 'fresh' | 'stale' | 'empty' | 'error';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/session-health.ts:92:        graphFreshness = 'stale';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/session-health.ts:110:    status = 'stale';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/session-health.ts:111:  } else if (graphFreshness === 'stale' || graphFreshness === 'empty' || lastToolCallAgoMs > FIFTEEN_MINUTES_MS) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/session-health.ts:122:  if (structuralContext.status === 'stale') {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/session-health.ts:123:    hints.push('Structural context is stale. Call session_bootstrap to refresh, or run code_graph_scan for a full rescan.');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/README.md:47:- `spec/` - 12 lifecycle scripts (`create.sh`, `upgrade-level.sh`, `check-placeholders.sh`, `validate.sh`, `progressive-validate.sh`, `test-validation.sh`, `check-completion.sh`, `calculate-completeness.sh`, `recommend-level.sh`, `archive.sh`, `check-template-staleness.sh`, `quality-audit.sh`)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:992:    // Data integrity: clean stale auto-entities before re-extraction on update\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:998:        console.error(`[memory-save] Cleaned stale auto-entities for superseded memory #${existing.id}`);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:1007:        console.error(`[memory-save] Cleaned stale auto-entities for PE-superseded memory #${peResult.supersededId}`);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/code-graph/query.ts:70:  if (readiness.freshness === 'stale') {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/code-graph/query.ts:74:      freshnessAuthority: 'stale',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/code-graph/query.ts:333:    // Non-blocking: continue with potentially stale data\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/README.md:70:- `memory-index.ts` and `mutation-hooks.ts` work together so index, update, and stale-delete flows clear trigger, constitutional, graph, co-activation, and degree caches.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/README.md:80:- Post-mutation invalidation clears `clearDegreeCache()` alongside trigger and constitutional caches so graph-derived retrieval signals cannot serve stale data after mutations.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/memory-surface.ts:46:      staleFiles: number;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/memory-surface.ts:68:  codeGraphStatus: 'fresh' | 'stale' | 'empty';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/memory-surface.ts:218:    const staleCount = (graphDb.getDb().prepare(`\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/memory-surface.ts:229:        staleFiles: staleCount,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/memory-surface.ts:317:    // stale cross-session entries from influencing auto-surface ordering.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/memory-surface.ts:445:      codeGraphStatus = 'stale';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/memory-surface.ts:456:  if (codeGraphStatus === 'stale' || codeGraphStatus === 'empty') {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:127:  last_accessed?: number;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:197:// Track stale session cleanup interval (runs hourly)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:198:let staleCleanupInterval: ReturnType<typeof setInterval> | null = null;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:234:  // Run stale session cleanup on startup and set up hourly interval\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:239:    console.warn(`[session-manager] Initial stale session cleanup failed: ${message}`);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:242:  if (staleCleanupInterval) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:243:    clearInterval(staleCleanupInterval);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:245:  staleCleanupInterval = setInterval(() => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:250:      console.warn(`[session-manager] Periodic stale session cleanup failed: ${message}`);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:253:  if (staleCleanupInterval && typeof staleCleanupInterval === 'object' && 'unref' in staleCleanupInterval) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:254:    staleCleanupInterval.unref();\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:758: * T302: Clean up stale sessions across all session-related tables.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:782:  // 1. Clean stale working_memory entries\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:795:  // 2. Clean stale session_sent_memories entries\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:1382:  if (staleCleanupInterval) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:1383:    clearInterval(staleCleanupInterval);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:1384:    staleCleanupInterval = null;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/claude/session-prime.ts:28:  graphState: 'ready' | 'stale' | 'empty' | 'missing';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/claude/session-prime.ts:58:    hookLog('warn', 'session-prime', `Rejecting stale compact cache for session ${sessionId} (cached at ${cachedAt})`);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/claude/session-prime.ts:166:  if (startupBrief?.graphState === 'stale') {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/claude/session-prime.ts:169:      content: 'Code graph freshness is stale. The first structural read may refresh inline when safe; run `code_graph_scan` for broader stale states.',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/code-graph/context.ts:104:      // Non-blocking: continue with potentially stale data\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/handler-utils.ts:6:// GROWTH POLICY (T033):\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-snapshot.ts:25:  graphFreshness: 'fresh' | 'stale' | 'empty' | 'error';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-snapshot.ts:39:  status: 'ready' | 'stale' | 'missing';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-snapshot.ts:218:  } else if (graphFreshness === 'stale') {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-snapshot.ts:219:    status = 'stale';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-snapshot.ts:240:  } else if (status === 'stale') {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-snapshot.ts:243:      summary = `Code graph: ${stats.totalFiles} files, ${stats.totalNodes} nodes (stale — structural reads may refresh inline or recommend code_graph_scan)`;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-snapshot.ts:245:      summary = 'Code graph data is stale — structural context may be outdated';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-snapshot.ts:254:  } else if (status === 'stale') {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-snapshot.ts:255:    recommendedAction = 'Use a structural read to trigger bounded inline refresh when safe, or run code_graph_scan for broader stale states.';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-snapshot.ts:273:      lastUpdated: status === 'ready' || status === 'stale'\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/context-metrics.ts:34:    graphFreshness: number; // 1.0 fresh, 0.5 stale, 0.0 empty\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/context-metrics.ts:84:// Matches the session-snapshot graph staleness threshold.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/context-metrics.ts:178:/** Compute graph freshness: 1.0 fresh, 0.5 stale, 0.0 empty/error. */\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/context-metrics.ts:217:  //   recency (0.35)       — Highest weight because stale sessions are the primary\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/context-metrics.ts:228:  //   graphFreshness (0.20) — A stale code graph means structural queries return\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/SHARED_MEMORY_DATABASE.md:138:Your shared space contains outdated guidance after a breaking change. Flip the kill switch to block all reads immediately while you update the content. Once the corrections are in place, turn it back off. Nobody acts on stale information during the gap.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/claude/session-stop.ts:23:/** Default max age (ms) for stale state cleanup in --finalize mode */\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/claude/session-stop.ts:324:  // --finalize mode: manual cleanup of stale session states\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/claude/session-stop.ts:327:    hookLog('info', 'session-stop', `Finalize: cleaned ${removed} stale state file(s) older than 24h`);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/tests/test-folder-detector-functional.js:295:    `).run('099-stale-folder', 'T-stale', 'preflight');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/SKILL.md:613:- Preflight parses are revalidated inside the write lock when file contents change, and duplicate short-circuits verify stored content before trusting a stale hash hit.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/SKILL.md:614:- Delete and replacement paths now treat vector cleanup and projection replacement as integrity-critical instead of best-effort, so stale vector/projection rows do not silently survive successful writes.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/SKILL.md:782:**Read-path freshness:** Startup and bootstrap surfaces report graph freshness without mutating the index. Bounded inline refresh happens on structural read paths when stale sets are small; otherwise callers receive `readiness` guidance to run `code_graph_scan`.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/shared/mcp_server/database/README.md:36:**`.db-updated` file:** Contains a Unix timestamp (milliseconds) recording the last database modification. Used by the indexer to detect stale data.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/database/README.md:73:- Structural reads (`code_graph_query`, `code_graph_context`) can perform bounded inline selective refresh against `code-graph.sqlite` when the stale set is small enough.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/database/README.md:74:- Empty or broadly stale structural states still require explicit `code_graph_scan` to rebuild the graph database.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-hierarchy.vitest.ts:505:// 9. Cache behavior (invalidations + TTL stale detection)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-hierarchy.vitest.ts:536:  it('detects stale cache after TTL expiry and rebuilds hierarchy', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-hierarchy.vitest.ts:551:    const staleRefreshedTree = buildHierarchyTree(db);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-hierarchy.vitest.ts:552:    expect(staleRefreshedTree).not.toBe(initialTree);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-hierarchy.vitest.ts:553:    expect(staleRefreshedTree.nodeMap.has('003-foo/140-after-ttl')).toBe(true);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/gemini/session-prime.ts:30:  graphState: 'ready' | 'stale' | 'empty' | 'missing';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/gemini/session-prime.ts:59:    hookLog('warn', 'gemini:session-prime', `Rejecting stale compact cache (cached at ${cachedAt})`);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/gemini/session-prime.ts:132:  if (startupBrief?.graphState === 'stale') {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/gemini/session-prime.ts:135:      content: 'Code graph freshness is stale. The first structural read may refresh inline when safe; run `code_graph_scan` for broader stale states.',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/gemini/session-stop.ts:21:/** Default max age for stale state cleanup in --finalize mode */\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/gemini/session-stop.ts:80:  // --finalize mode: manual cleanup of stale session states\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/gemini/session-stop.ts:83:    hookLog('info', 'gemini:session-stop', `Finalize: cleaned ${removed} stale state file(s) older than 24h`);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:58:  'last_accessed',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:134:      last_accessed INTEGER DEFAULT 0,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:180:    CREATE INDEX IF NOT EXISTS idx_last_accessed ON memory_index(last_accessed DESC);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/gemini/compact-inject.ts:48:    hookLog('warn', 'gemini:compact-inject', `Rejecting stale compact cache (cached at ${cachedAt})`);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/access-tracker.ts:159:          last_accessed = ?\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tool-schemas.ts:734:  description: '[L3:Discovery] Check session readiness: priming status, code graph freshness, time since last tool call. Call periodically during long sessions to check for context drift. Returns ok/warning/stale with actionable hints. No arguments required.',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tool-schemas.ts:770:      structuralContext: { type: 'object', description: 'Structural bootstrap contract (status, summary, recommendedAction); omitted when code graph is unavailable', properties: { status: { type: 'string', enum: ['ready', 'stale', 'missing'] }, summary: { type: 'string' }, recommendedAction: { type: 'string' } } },\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:5:// Strengthening, staleness detection, edge bounds enforcement.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:55:  stale: { flagged: number };\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:346:        SELECT id, strength, last_accessed, created_by FROM causal_edges\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:347:        WHERE last_accessed IS NOT NULL\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:348:          AND last_accessed > datetime('now', '-7 days')\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:369:      const staleDecayEdges = (database.prepare(`\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:370:        SELECT id, strength, last_accessed, created_by FROM causal_edges\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:371:        WHERE (last_accessed IS NULL AND extracted_at < datetime('now', '-' || ? || ' days'))\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:372:           OR (last_accessed IS NOT NULL AND last_accessed < datetime('now', '-' || ? || ' days'))\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:375:      for (const edge of staleDecayEdges) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:396: * Detect stale edges (not accessed in 90+ days).\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:447:  const staleEdges = detectStaleEdges(database);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:471:    stale: { flagged: staleEdges.length },\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/INSTALL_GUIDE.md:106:- Server starts but search returns empty or stale results\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/INSTALL_GUIDE.md:125:- startup and resume surfaces report freshness-aware graph status (`fresh`, `stale`, `empty`, `error`)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/INSTALL_GUIDE.md:126:- `code_graph_query` and `code_graph_context` may repair small stale deltas inline\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/INSTALL_GUIDE.md:127:- empty or broadly stale graphs still require explicit `code_graph_scan`\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/INSTALL_GUIDE.md:449:- if the graph is only lightly stale, the read path may refresh inline before returning results\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/INSTALL_GUIDE.md:786:| `Cannot find module '@spec-kit/shared/...'` | Workspace dependency state is incomplete or stale | Run `npm install && npm run build` from the skill root |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/INSTALL_GUIDE.md:791:| `code_graph_query` reports `full_scan` or `inline full scan skipped for read path` | The graph is empty or too stale for bounded read-path repair | Run `code_graph_scan`, then retry the structural read |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/INSTALL_GUIDE.md:792:| Startup or resume shows graph `stale` | Freshness-aware startup detected drift before a structural read ran | Run a structural read to allow bounded inline repair, or run `code_graph_scan` for broader stale states |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/INSTALL_GUIDE.md:793:| Database appears stale after restore | Client still uses old MCP process with in-memory state | Fully restart OpenCode or Claude Code |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:96:  staleDeleted: number;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:97:  staleDeleteFailed: number;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:252:    const staleRecordIds = incrementalIndex.listIndexedRecordIdsForDeletedPaths(paths);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:256:    for (const staleRecordId of staleRecordIds) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:258:        const staleSnapshot = vectorIndex.getDb()?.prepare(\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:260:        ).get(staleRecordId) as { spec_folder?: string | null; file_path?: string | null } | undefined;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:262:        if (vectorIndex.deleteMemory(staleRecordId)) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:267:              staleRecordId,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:269:              staleSnapshot?.file_path ?? null,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:272:              staleSnapshot?.spec_folder ?? null,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:297:    let staleDeleted = 0;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:298:    let staleDeleteFailed = 0;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:302:      const staleDeleteResult = deleteStaleIndexedRecords(categorized.toDelete);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:303:      staleDeleted = staleDeleteResult.deleted;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:304:      staleDeleteFailed = staleDeleteResult.failed;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:305:      if (staleDeleted > 0) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:306:        runScanInvalidationHooks({ staleDeleted, staleDeleteFailed, operation: 'stale-delete' });\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:321:        staleDeleted,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:322:        staleDeleteFailed,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:325:        ...(staleDeleted > 0 ? [`Removed ${staleDeleted} stale index record(s) for deleted files`] : []),\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:342:    staleDeleted: 0,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:343:    staleDeleteFailed: 0,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:498:      const staleDeleteResult = deleteStaleIndexedRecords(filesToDelete);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:499:      results.staleDeleted = staleDeleteResult.deleted;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:500:      results.staleDeleteFailed = staleDeleteResult.failed;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:502:      console.warn('[memory-index-scan] Deferring stale cleanup because one or more replacement files failed to index');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:576:  if (results.indexed > 0 || results.updated > 0 || results.staleDeleted > 0) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:580:      staleDeleted: results.staleDeleted,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:581:      staleDeleteFailed: results.staleDeleteFailed,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:588:  const summary = `Scan complete: ${results.indexed} indexed, ${results.updated} updated, ${results.unchanged} unchanged, ${results.staleDeleted} deleted, ${results.failed} failed`;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:594:  if (filesToDelete.length > 0 && results.failed > 0 && results.staleDeleted === 0 && results.staleDeleteFailed === 0) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:595:    hints.push('Deferred stale index cleanup because one or more replacement files failed to index');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:597:  if (results.staleDeleted > 0) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:598:    hints.push(`Removed ${results.staleDeleted} stale index record(s) for deleted files`);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:600:  if (results.staleDeleteFailed > 0) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:601:    hints.push(`${results.staleDeleteFailed} stale index record(s) could not be removed`);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/graph-search-fn.vitest.ts:61:      last_accessed TEXT,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/graph-search-fn.vitest.ts:309:      const stale = computeDegreeScores(db, [1]).get('1');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/graph-search-fn.vitest.ts:310:      expect(stale).toBe(before);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/graph-search-fn.vitest.ts:335:      expect(refreshed).not.toBe(stale);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1330:    'last_accessed',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/README.md:258:**Tool-level TTL cache** remembers recent results for 60 seconds. When you save, update or delete a memory, the cache for affected searches clears automatically. You never see stale results.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/README.md:543:**Read-path readiness:** `ensureCodeGraphReady()` runs automatically inside `code_graph_query` and `code_graph_context`. It checks graph freshness, returns a `readiness` block, and performs bounded inline selective reindex only when the stale set is small enough to repair safely on the read path. Empty graphs, large stale sets, and other full-scan cases remain explicit `code_graph_scan` work.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/README.md:601:Resume session with combined memory, code graph and CocoIndex status in a single call. Use when you want the detailed merged resume payload directly. The response carries freshness-aware code-graph status (`fresh`, `stale`, `empty`, `error`) instead of count-only health. For the canonical first-call recovery path on session start or after `/clear`, prefer `session_bootstrap`.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/README.md:765:Run a health check. This is the diagnostic tool for when search quality degrades or something feels off. It checks for stale indexes, divergent aliases, broken embeddings and other issues. It can also attempt automatic repairs.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/README.md:779:Check session readiness: priming status, code graph freshness and time since last tool call. Returns `ok`, `warning` or `stale` with actionable hints. Call periodically during long sessions to detect context drift.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/README.md:1062:Query structural code relationships: `outline` (file symbols), `calls_from` and `calls_to` (call graph), `imports_from` and `imports_to` (dependency graph). Use this instead of Grep for structural queries. Supports multi-hop BFS traversal. Responses include a `readiness` block, and the handler may perform bounded inline selective reindex before answering when the graph is only lightly stale.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/README.md:1077:Get LLM-oriented compact graph neighborhoods. Accepts CocoIndex search results as seeds for structural expansion. Modes: `neighborhood` (1-hop calls plus imports), `outline` (file symbols), `impact` (reverse callers). Responses include a `readiness` block, and the handler may perform bounded inline selective reindex before answering when the graph is only lightly stale.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/README.md:1537:| Repair an empty or broadly stale code graph | `code_graph_scan` | Use when readiness reports `full_scan` or the graph is missing |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/README.md:1643:| BM25 index stale | Set `ENABLE_BM25=false` to fall back to FTS5 |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/README.md:30:- Incremental indexing metadata and stale-record discovery.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/README.md:49:| `consolidation.ts` | N3-lite contradiction, Hebbian, and stale-edge maintenance |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/README.md:52:| `incremental-index.ts` | Stored metadata lookup, content-hash-aware reindex decisions, and stale path discovery |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/entity-extractor.vitest.ts:546:    `).run('stale entry', '[\\\"stale\\\"]', 'technology', 99);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:6:# against the current template version. Reports stale folders.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:9:#   check-template-staleness.sh [--json] [--auto-upgrade] [--root <path>]\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:13:#   1 - stale folders found\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:42:check-template-staleness.sh — Detect spec folders with outdated template versions\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:44:Usage: check-template-staleness.sh [--json] [--auto-upgrade] [--root <path>]\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:48:  --auto-upgrade   Apply safe auto-fixes to stale folders (update version comment)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:124:    local current_count=0 stale_count=0 none_count=0 missing_count=0\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:125:    local stale_folders=()\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:154:            \\\"none\\\") ((none_count++)) || true; stale_folders+=(\\\"$folder_name ($version)\\\") ;;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:156:            *) ((stale_count++)) || true; stale_folders+=(\\\"$folder_name ($version)\\\")\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:179:        local stale_json=\\\"[\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:181:        for s in \\\"${stale_folders[@]+\\\"${stale_folders[@]}\\\"}\\\"; do\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:182:            $first && first=false || stale_json+=\\\",\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:183:            stale_json+=\\\"\\\\\\\"$s\\\\\\\"\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:185:        stale_json+=\\\"]\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:198:{\\\"current_version\\\":\\\"$current_version\\\",\\\"total\\\":$total,\\\"current\\\":$current_count,\\\"stale\\\":$stale_count,\\\"no_version\\\":$none_count,\\\"missing_spec\\\":$missing_count,\\\"versions\\\":$versions_json,\\\"stale_folders\\\":$stale_json}\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:220:        if [[ ${#stale_folders[@]} -gt 0 ]]; then\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:222:            for s in \\\"${stale_folders[@]}\\\"; do\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:234:    [[ $stale_count -gt 0 || $none_count -gt 0 ]] && exit 1\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/shared/trigger-extractor.ts:201:  'pending', 'stale', 'cached', 'expired', 'deprecated', 'legacy',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/shared/trigger-extractor.ts:234:    /\\\\b(simulation|placeholder|fallback|mock|stub|fake|debug|verbose|silent|readonly|disabled|enabled|pending|stale|cached|expired|deprecated|legacy)\\\\s+(mode|data|value|state|behavior|response|output|result|content)\\\\b/gi,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/shared/trigger-extractor.ts:235:    /\\\\b(mode|data|value|state|behavior|response|output|result|content)\\\\s+(simulation|placeholder|fallback|mock|stub|fake|debug|verbose|silent|readonly|disabled|enabled|pending|stale|cached|expired|deprecated|legacy)\\\\b/gi,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:407:  // Evict any stale projection row that maps a *different* logical_key to the\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/unit-normalization.vitest.ts:30:    last_accessed: 1706800000,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/shared/normalization.ts:49:  last_accessed: number;       // Unix timestamp (integer)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/shared/normalization.ts:144:    lastAccessed: row.last_accessed,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/shared/normalization.ts:189:  if (memory.lastAccessed !== undefined) row.last_accessed = memory.lastAccessed;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/shared/normalization.ts:234:  if (row.last_accessed !== undefined) mem.lastAccessed = row.last_accessed;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:78:/** Result when a merge candidate becomes stale before commit */\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/graph/README.md:142:| `memory_index` | usage-tracking.ts, community-detection.ts | access_count column, stale assignment cleanup |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:75:  last_accessed: string | null;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:854:    \\\"UPDATE causal_edges SET last_accessed = datetime('now') WHERE id = ?\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:863:      WHERE (last_accessed IS NULL AND extracted_at < datetime('now', '-' || ? || ' days'))\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:864:         OR (last_accessed IS NOT NULL AND last_accessed < datetime('now', '-' || ? || ' days'))\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:865:      ORDER BY COALESCE(last_accessed, extracted_at) ASC\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/rules/check-phase-links.sh:35:    # TODO: Parse Predecessor/Successor metadata table rows instead of grepping for phase name presence. Current approach may pass with swapped, stale, or duplicated adjacency metadata. See review finding F-035.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:262:  // Include stale indexed paths that are no longer discovered on disk.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:265:  const staleIndexedPaths = listStaleIndexedPaths(filePaths);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:266:  if (staleIndexedPaths.length > 0) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:268:    for (const stalePath of staleIndexedPaths) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:269:      const staleKey = getCanonicalPathKey(stalePath);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:270:      if (!seenDeleteKeys.has(staleKey)) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:271:        result.toDelete.push(stalePath);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:272:        seenDeleteKeys.add(staleKey);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:284:  const stalePaths = new Set<string>();\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:318:        stalePaths.add(row.file_path);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:326:  return Array.from(stalePaths);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/README.md:42:- `archive.sh` - archive completed or stale specs\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/typed-traversal.vitest.ts:27:      last_accessed TEXT\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/shared/embeddings/providers/hf-local.ts:191:        // Detect native module version mismatch (onnxruntime-node, sharp)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/startup-brief.vitest.ts:98:    expect(brief.sharedPayload?.provenance.trustState).toBe('stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/startup-brief.vitest.ts:101:  it('reports stale graph state when freshness detection says stale even with graph counts present', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/startup-brief.vitest.ts:102:    vi.mocked(getGraphFreshness).mockReturnValueOnce('stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/startup-brief.vitest.ts:106:    expect(brief.graphState).toBe('stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/startup-brief.vitest.ts:107:    expect(brief.graphOutline).toContain('Freshness: stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/startup-brief.vitest.ts:108:    expect(brief.startupSurface).toContain('- Code Graph: stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/startup-brief.vitest.ts:111:    expect(brief.sharedPayload?.provenance.trustState).toBe('stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/quality-audit.sh:138:               # --fix: re-run staleness auto-upgrade on failing folders\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/quality-audit.sh:140:                   local staleness_script=\\\"$SCRIPT_DIR/check-template-staleness.sh\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/quality-audit.sh:141:                   if [[ -f \\\"$staleness_script\\\" ]]; then\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/quality-audit.sh:142:                       bash \\\"$staleness_script\\\" --auto-upgrade --root \\\"$folder\\\" 2>/dev/null || true\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/archive.sh:197:    # Clean up any stale temp directories from previous failed runs\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/contracts/README.md:180:| `freshnessAuthority` | `live`, `cached`, `stale`, `unknown` | Whether the structural signal is current and authoritative |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/eval/data/ground-truth.json:415:      \\\"query\\\": \\\"the memory_search tool returns stale results after index rebuild\\\",\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/eval/data/ground-truth.json:420:      \\\"expectedResultDescription\\\": \\\"Should surface incremental-index.ts, retry-manager.ts, and any spec memories about stale cache behavior after indexing operations.\\\",\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/feedback/query-flow-tracker.ts:171:  // Evict stale entries\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/eval/warm-start-variant-runner.ts:37:  freshness: 'fresh' | 'stale';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/rules/check-spec-doc-integrity.sh:99:                issues+=(\\\"$filename has stale Spec Folder metadata: $spec_folder_value\\\")\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/causal-fixes.vitest.ts:34:        last_accessed TEXT,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-extended.vitest.ts:124:        last_accessed TEXT,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-extended.vitest.ts:628:          'stale-hash',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/response/profile-formatters.ts:268:    blockers.push(`${archivedOrCold.length} result(s) are cold/archived — may be stale`);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/context/shared-payload.ts:17:  | 'stale'\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/context/shared-payload.ts:61:  'stale',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/context/shared-payload.ts:418:  if (structuralContext.status === 'stale') {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/context/shared-payload.ts:422:      freshnessAuthority: 'stale',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/context/shared-payload.ts:593:  graphState: 'ready' | 'stale' | 'empty' | 'missing',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/context/shared-payload.ts:595:  return graphState === 'ready' ? 'live' : 'stale';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/context/shared-payload.ts:599:  status: 'ready' | 'stale' | 'missing',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/context/shared-payload.ts:601:  return status === 'ready' ? 'live' : 'stale';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/context/shared-payload.ts:611:    return 'stale';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/context/shared-payload.ts:613:  return nowMs - cachedAtMs >= maxAgeMs ? 'stale' : 'cached';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/working-memory.ts:260:    const staleSessionIds = (db.prepare(\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/working-memory.ts:266:    for (const row of staleSessionIds) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/05--lifecycle/06-startup-pending-file-recovery.md:22:Recovery is automatic and requires no user intervention. If the pending file is stale (the DB row was never committed), it is logged and left for manual review rather than silently deleted.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/interference.vitest.ts:45:      last_accessed TEXT,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/tier-classifier.ts:264:    const timestamp = mem.lastAccess || mem.last_accessed || mem.lastReview || mem.last_review || mem.created_at;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/hydra-spec-pack-consistency.vitest.ts:34:const staleReferences = [\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/hydra-spec-pack-consistency.vitest.ts:96:    for (const reference of staleReferences) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/hydra-spec-pack-consistency.vitest.ts:100:        const stalePath = path.resolve(__dirname, '..', reference.replace(/^mcp_server\\\\//, ''));\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/hydra-spec-pack-consistency.vitest.ts:101:        expect(fs.existsSync(stalePath), `Stale reference should NOT exist: ${reference}`).toBe(false);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/cache/README.md:108:Write-driven invalidation is used for memory and spec document changes so search and ranking do not serve stale `documentType`/`specLevel` context.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/05--lifecycle/07-automatic-archival-subsystem.md:20:The archival sweep runs periodically after access tracker data (`access_count`, `last_accessed`) establishes dormancy signals, but the FSRS-based classifier is still the final gate for archival eligibility. Constitutional and critical-tier memories therefore remain protected because the classifier will not approve auto-archival for them. On unarchive, BM25 is restored from stored text fields, while vector re-embedding is explicitly deferred and logged for the next index scan (no immediate vector row recreation). The archival manager lazy-loads the tier classifier to avoid circular dependencies at import time.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/archival-manager.ts:378:      ORDER BY last_accessed ASC NULLS FIRST, access_count ASC\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts:148:        last_accessed TEXT,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts:691:        makeNewMemory({ content: 'Incoming content that should not be stale-merged' }),\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:76:    mocks.ensureFreshFilesMock.mockReturnValue({ fresh: [], stale: [] });\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:80:      filePath: '/tmp/test-root/stale.ts',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:101:      const levels: GraphFreshness[] = ['fresh', 'stale', 'empty'];\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:119:        freshness: 'stale',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:123:        reason: 'stale files',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:150:      expect(result.freshness).toBe('stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:157:    it('reports stale work without indexing when read paths disable inline indexing', async () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:159:      mocks.getTrackedFilesMock.mockReturnValue(['/tmp/test-root/stale.ts']);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:160:      mocks.ensureFreshFilesMock.mockReturnValue({ fresh: [], stale: ['/tmp/test-root/stale.ts'] });\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:166:      expect(result.freshness).toBe('stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:168:      expect(result.files).toEqual(['/tmp/test-root/stale.ts']);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:173:    it('performs selective inline reindex for small stale sets when allowed', async () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:175:      mocks.getTrackedFilesMock.mockReturnValue(['/tmp/test-root/stale.ts']);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:176:      mocks.ensureFreshFilesMock.mockReturnValue({ fresh: [], stale: ['/tmp/test-root/stale.ts'] });\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:185:      expect(result.freshness).toBe('stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:187:      expect(result.files).toEqual(['/tmp/test-root/stale.ts']);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:192:    it('allows selective inline reindex after git HEAD changes when the stale set is small', async () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:197:      mocks.getTrackedFilesMock.mockReturnValue(['/tmp/test-root/stale.ts']);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:198:      mocks.ensureFreshFilesMock.mockReturnValue({ fresh: [], stale: ['/tmp/test-root/stale.ts'] });\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:207:      expect(result.freshness).toBe('stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:209:      expect(result.files).toEqual(['/tmp/test-root/stale.ts']);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:222:      mocks.ensureFreshFilesMock.mockReturnValue({ fresh: ['/tmp/test-root/fresh.ts'], stale: [] });\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:231:      expect(result.freshness).toBe('stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:240:      const staleFiles = Array.from({ length: 51 }, (_, index) => `/tmp/test-root/stale-${index}.ts`);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:242:      mocks.getTrackedFilesMock.mockReturnValue(staleFiles);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:243:      mocks.ensureFreshFilesMock.mockReturnValue({ fresh: [], stale: staleFiles });\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:252:      expect(result.freshness).toBe('stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:264:      expect(['fresh', 'stale', 'empty']).toContain(freshness);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1915:// M5 fix: Return stale cache immediately and refresh asynchronously to avoid\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1958:          // Non-fatal: stale cache remains usable\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1967:  // Cold start — synchronous build required (no stale data to return)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/README.md:500:// Activate memory (increment access_count, update last_accessed)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/ops/file-watcher.ts:241:  // M1 fix: AbortController per file path for cancellation of stale reindex\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:22:export type GraphFreshness = 'fresh' | 'stale' | 'empty';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:44:/** Maximum stale files before we switch from selective to full reindex */\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:100:  staleFiles: string[];\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:109:    return { freshness: 'empty', action: 'full_scan', staleFiles: [], deletedFiles: [], reason: 'graph is empty (0 nodes)' };\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:123:    return { freshness: 'empty', action: 'full_scan', staleFiles: [], deletedFiles: [], reason: 'no tracked files in code_files table' };\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:127:  const { stale } = ensureFreshFiles(existingFiles);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:128:  if (stale.length === 0) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:131:        freshness: 'stale',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:133:        staleFiles: [],\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:143:        freshness: 'stale',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:145:        staleFiles: [],\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:151:    return { freshness: 'fresh', action: 'none', staleFiles: [], deletedFiles: [], reason: 'all tracked files are up-to-date' };\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:154:  // Too many stale files => full scan is more efficient\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:155:  if (stale.length > SELECTIVE_REINDEX_THRESHOLD) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:157:      freshness: 'stale',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:159:      staleFiles: stale,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:163:        `${stale.length} stale files exceed selective threshold (${SELECTIVE_REINDEX_THRESHOLD})`,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:170:    freshness: 'stale',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:172:    staleFiles: stale,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:176:      `${stale.length} file(s) have newer mtime than indexed_at`,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:266:      ...(state.action === 'selective_reindex' ? { files: state.staleFiles } : {}),\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:301:    // selective_reindex: only re-parse stale files\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:302:    if (state.action === 'selective_reindex' && state.staleFiles.length > 0) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:304:      // F048: Convert absolute stale file paths to rootDir-relative globs\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:305:      config.includeGlobs = state.staleFiles.map(f => relative(rootDir, f));\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:314:        files: state.staleFiles,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:326:      files: state.staleFiles,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/attention-decay.ts:147:          last_accessed = ?,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/attention-decay.ts:198:          last_accessed = ?\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/attention-decay.ts:309:      ORDER BY last_accessed DESC, importance_weight DESC\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/06--analysis/01-causal-edge-creation-memorycausallink.md:22:Edge bounds are enforced at insert time. Auto-generated edges (those with `created_by='auto'`) are rejected when a node already has 20 edges (`MAX_EDGES_PER_NODE`) and clamped to a maximum strength of 0.5 (`MAX_AUTO_STRENGTH`). Every strength modification is logged to a `weight_history` table recording old strength, new strength, who changed it, when and why. The `created_by` and `last_accessed` fields on each edge track provenance and usage patterns.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/README.md:47:- `spec/` - 12 lifecycle scripts (`create.sh`, `upgrade-level.sh`, `check-placeholders.sh`, `validate.sh`, `progressive-validate.sh`, `test-validation.sh`, `check-completion.sh`, `calculate-completeness.sh`, `recommend-level.sh`, `archive.sh`, `check-template-staleness.sh`, `quality-audit.sh`)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/co-activation.ts:96:/** Clear the getRelatedMemories cache (called on init to avoid stale data across DB reloads). */\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/co-activation.ts:154:  clearRelatedCache(); // Evict stale entries when a new DB connection is set\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-types.ts:55:  last_accessed?: number;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-types.ts:86:  last_accessed?: number;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/db-state.vitest.ts:68:  it('expires stale scan lease and allows a fresh reservation', async () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/db-state.vitest.ts:71:    const staleStartedAt = Date.now() - 300000;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/db-state.vitest.ts:72:    db.prepare('INSERT INTO config (key, value) VALUES (?, ?)').run('scan_started_at', String(staleStartedAt));\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:46:      last_accessed INTEGER DEFAULT 0,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:538:  it('adds stale indexed rows to toDelete even when missing from scan input', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:546:    const stalePath = '/tmp/stale-only-in-db-' + Date.now() + '.md';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:547:    insertRow(db, { file_path: stalePath, file_mtime_ms: 1700000000000, embedding_status: 'success' });\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:550:    expect(result.toDelete).toContain(stalePath);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:557:  symlinkIt('does not mark alias rows as stale when canonical path is still present in scan', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:590:    const stalePath = '/tmp/stale-id-test-' + Date.now() + '.md';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:591:    const staleId = insertRow(db, { file_path: stalePath, file_mtime_ms: 1700000000000, embedding_status: 'success' });\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:597:    const ids = mod.listIndexedRecordIdsForDeletedPaths([stalePath, liveFile]);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:598:    expect(ids).toContain(staleId);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-context.ts:36:    freshness: { lastScanAt: string | null; staleness: 'fresh' | 'recent' | 'stale' | 'unknown' };\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-context.ts:163:function computeFreshness(): { lastScanAt: string | null; staleness: 'fresh' | 'recent' | 'stale' | 'unknown' } {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-context.ts:168:    if (!lastScanAt) return { lastScanAt: null, staleness: 'unknown' };\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-context.ts:171:    const staleness = ageMs < 300_000 ? 'fresh' : ageMs < 3_600_000 ? 'recent' : 'stale';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-context.ts:172:    return { lastScanAt, staleness };\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-context.ts:174:    return { lastScanAt: null, staleness: 'unknown' };\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/scoring/confidence-tracker.ts:176:    // From callers and allowing downstream side-effects to proceed on stale data.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/search-flags.ts:188: * staleness detection, edge bounds enforcement.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-helpers.vitest.ts:160:      last_accessed TEXT,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/19--feature-flag-reference/01-1-search-pipeline-features-speckit.md:51:| `SPECKIT_CONSOLIDATION` | `true` | boolean | `lib/search/search-flags.ts` | Enables the N3-lite consolidation engine which runs after every successful save. Scans for contradictions (>0.85 cosine similarity with negation conflicts), applies Hebbian strengthening (+0.05/cycle, 30-day decay), detects stale edges (>90 days unfetched) and enforces 20 edges per node. Runs weekly. |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/19--feature-flag-reference/01-1-search-pipeline-features-speckit.md:59:| `SPECKIT_DYNAMIC_INIT` | `true` | boolean | `context-server.ts` | **IMPLEMENTED (Sprint 019).** P1-6: Dynamic server instructions at MCP initialization. `buildServerInstructions()` generates a memory-system overview (total memories, spec folder count, channels, stale count) and injects via `server.setInstructions()`. Instructions are computed once at startup and not refreshed during session (CHK-076). Reuses existing `memory_stats` handler data. |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/startup-brief.ts:31:  graphState: 'ready' | 'stale' | 'empty' | 'missing';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/startup-brief.ts:107:  } else if (args.graphState === 'stale' && args.graphSummary) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/startup-brief.ts:109:      'stale',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/startup-brief.ts:156:    if (freshness === 'stale') {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/startup-brief.ts:157:      lines.push('Freshness: stale — first structural read may trigger bounded inline refresh or recommend code_graph_scan.');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/startup-brief.ts:168:      graphState: freshness === 'stale' ? 'stale' : 'ready',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/templates/context_template.md:308:| Stale Context | Information seems outdated | Check `last_accessed_epoch` vs current time |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/templates/context_template.md:472:last_accessed_epoch: {{LAST_ACCESSED_EPOCH}}\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/graph-search-fn.ts:629: * to ensure stale scores are not served.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/causal-boost.vitest.ts:19:      last_accessed TEXT\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/scoring/composite-scoring.ts:272: * Parse last_accessed value that may be:\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/scoring/composite-scoring.ts:392:  // Never fall back to last_accessed or updated_at — those conflate\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/scoring/composite-scoring.ts:668:  const popularityScore = calculatePopularityScore(row.access_count || 0, parseLastAccessed(row.last_accessed), row.created_at || null);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/scoring/composite-scoring.ts:752:        popularity: calculatePopularityScore(row.access_count || 0, parseLastAccessed(row.last_accessed), row.created_at || null),\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/scoring/composite-scoring.ts:832:  const popularity = calculatePopularityScore(row.access_count || 0, parseLastAccessed(row.last_accessed), row.created_at || null);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/compact-merger.ts:27:  staleness: 'fresh' | 'recent' | 'stale' | 'unknown';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/compact-merger.ts:223:        { source: 'constitutional', lastUpdated: null, staleness: 'unknown' },\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/compact-merger.ts:224:        { source: 'codeGraph', lastUpdated: null, staleness: 'unknown' },\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/compact-merger.ts:225:        { source: 'cocoIndex', lastUpdated: null, staleness: 'unknown' },\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/compact-merger.ts:226:        { source: 'triggered', lastUpdated: null, staleness: 'unknown' },\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/checkpoint-completeness.vitest.ts:307:    INSERT INTO causal_edges (id, source_id, target_id, relation, strength, evidence, created_by, last_accessed)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/intent-classifier.ts:527:    const dateStr = r.created_at as string | undefined || r.last_accessed as string | undefined || r.last_review as string | undefined;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ops-hardening.ts:7:export type GraphFreshness = 'fresh' | 'stale' | 'empty' | 'error';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ops-hardening.ts:8:export type StructuralReadiness = 'ready' | 'stale' | 'missing';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ops-hardening.ts:56:  if (graphFreshness === 'stale') {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ops-hardening.ts:57:    return 'stale';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ops-hardening.ts:69:    : canonical === 'stale'\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ops-hardening.ts:74:    : canonical === 'stale'\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-db.ts:360:/** Batch stale check for a set of file paths */\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-db.ts:361:export function ensureFreshFiles(filePaths: string[]): { stale: string[]; fresh: string[] } {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-db.ts:364:    return { stale: [], fresh: [] };\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-db.ts:376:  const stale: string[] = [];\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-db.ts:383:      stale.push(filePath);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-db.ts:389:  return { stale, fresh };\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-aliases.ts:383:          last_accessed = ?\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/19--feature-flag-reference/02-2-session-and-cache.md:26:| `STALE_CLEANUP_INTERVAL_MS` | `3600000` | number | `lib/session/session-manager.ts` | Interval in milliseconds between stale session cleanup sweeps. Default is 1 hour (3,600,000 ms). Stale sessions are those whose last activity exceeds `STALE_SESSION_THRESHOLD_MS`. |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/19--feature-flag-reference/02-2-session-and-cache.md:27:| `STALE_SESSION_THRESHOLD_MS` | `86400000` | number | `lib/session/session-manager.ts` | Age in milliseconds at which a session is considered stale and eligible for cleanup. Default is 24 hours (86,400,000 ms). |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:207:  it('removes stale index records even when discovery finds zero files', async () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:227:      staleDeleted: 1,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:228:      staleDeleteFailed: 0,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:229:      operation: 'stale-delete',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:234:    expect(envelope.data.staleDeleted).toBe(1);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:235:    expect(envelope.data.staleDeleteFailed).toBe(0);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:238:  it('consumes incremental toDelete and removes stale indexed records', async () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:261:      staleDeleted: 2,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:262:      staleDeleteFailed: 0,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:266:    expect(envelope.data.staleDeleted).toBe(2);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:267:    expect(envelope.data.staleDeleteFailed).toBe(0);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:270:  it('tracks stale delete failures without aborting scan', async () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:291:    expect(envelope.data.staleDeleted).toBe(1);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:292:    expect(envelope.data.staleDeleteFailed).toBe(1);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:296:      staleDeleted: 1,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:297:      staleDeleteFailed: 1,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:301:  it('defers stale deletion when replacement indexing fails in the same scan', async () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:307:      toDelete: ['/tmp/stale.md'],\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:326:    expect(envelope.data.staleDeleted).toBe(0);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:327:    expect(envelope.data.staleDeleteFailed).toBe(0);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:331:      'Deferred stale index cleanup because one or more replacement files failed to index'\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:619:            last_accessed TEXT,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:946:        database.exec('ALTER TABLE causal_edges ADD COLUMN last_accessed TEXT');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:947:        logger.info('Migration v18: Added last_accessed column to causal_edges');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:950:          console.warn('[VectorIndex] Migration v18 warning (last_accessed):', get_error_message(e));\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1813:  if (!column_names.includes('last_accessed')) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1815:      database.exec(`ALTER TABLE memory_index ADD COLUMN last_accessed INTEGER DEFAULT 0`);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1816:      console.warn('[vector-index] Migration: Added last_accessed column');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1821:      logDuplicateColumnMigrationSkip('last_accessed', error);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2047:    database.exec(`CREATE INDEX IF NOT EXISTS idx_last_accessed ON memory_index(last_accessed DESC)`);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2048:    logger.info('Created idx_last_accessed index');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2052:      index: 'idx_last_accessed',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2320:      last_accessed INTEGER DEFAULT 0,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2466:    CREATE INDEX IF NOT EXISTS idx_last_accessed ON memory_index(last_accessed DESC);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/spec-folder-hierarchy.ts:34:// Don't share a stale cache.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/graph-signals.vitest.ts:45:      last_accessed TEXT\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/graph-signals.vitest.ts:288:      // Cache returns stale values — should be identical\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/graph-signals.vitest.ts:322:      // Cache returns stale values — identical to first call\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/graph-signals.vitest.ts:671:      // Without clearing, cache returns stale value\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/graph-signals.vitest.ts:672:      const stale = computeMomentumScores(db, [1]);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/graph-signals.vitest.ts:673:      expect(stale.get(1)).toBe(momentum1);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/rules/check-phase-links.sh:35:    # TODO: Parse Predecessor/Successor metadata table rows instead of grepping for phase name presence. Current approach may pass with swapped, stale, or duplicated adjacency metadata. See review finding F-035.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:519:// The old global singleton would return stale statements from a prior DB connection\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/folder-discovery.ts:232:        // Also check description.json mtime so aggregate cache staleness\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/folder-discovery.ts:244:        // Ignore unreadable spec.md entries during staleness probing.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/folder-discovery.ts:491:      // Repair stale/corrupt on-disk descriptions during discovery when a file exists.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/folder-discovery.ts:540: * F-39: Batch repair stale description.json files.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/folder-discovery.ts:783: * Check whether a per-folder description.json is stale.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/folder-discovery.ts:785: * Missing description.json = stale.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/folder-discovery.ts:880: * Check whether a description cache is stale by comparing its\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/folder-discovery.ts:910: * disk, checks staleness, regenerates if needed, saves, and returns it.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:6:# against the current template version. Reports stale folders.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:9:#   check-template-staleness.sh [--json] [--auto-upgrade] [--root <path>]\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:13:#   1 - stale folders found\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:42:check-template-staleness.sh — Detect spec folders with outdated template versions\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:44:Usage: check-template-staleness.sh [--json] [--auto-upgrade] [--root <path>]\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:48:  --auto-upgrade   Apply safe auto-fixes to stale folders (update version comment)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:124:    local current_count=0 stale_count=0 none_count=0 missing_count=0\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:125:    local stale_folders=()\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:154:            \\\"none\\\") ((none_count++)) || true; stale_folders+=(\\\"$folder_name ($version)\\\") ;;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:156:            *) ((stale_count++)) || true; stale_folders+=(\\\"$folder_name ($version)\\\")\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:179:        local stale_json=\\\"[\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:181:        for s in \\\"${stale_folders[@]+\\\"${stale_folders[@]}\\\"}\\\"; do\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:182:            $first && first=false || stale_json+=\\\",\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:183:            stale_json+=\\\"\\\\\\\"$s\\\\\\\"\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:185:        stale_json+=\\\"]\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:198:{\\\"current_version\\\":\\\"$current_version\\\",\\\"total\\\":$total,\\\"current\\\":$current_count,\\\"stale\\\":$stale_count,\\\"no_version\\\":$none_count,\\\"missing_spec\\\":$missing_count,\\\"versions\\\":$versions_json,\\\"stale_folders\\\":$stale_json}\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:220:        if [[ ${#stale_folders[@]} -gt 0 ]]; then\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:222:            for s in \\\"${stale_folders[@]}\\\"; do\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:234:    [[ $stale_count -gt 0 || $none_count -gt 0 ]] && exit 1\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-mutations.ts:111:  // Evict any stale projection row that maps a *different* logical_key to the\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/shared-memory-handlers.vitest.ts:167:  it('treats stale create conflicts as updates and bootstraps only one owner', async () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/14--pipeline-architecture/11-pipeline-and-mutation-hardening.md:45:- **Parent BM25 rollback guard (T332):** parent BM25 mutation now waits until at least one chunk has indexed successfully and, for safe-swap updates, until finalization completes. All-chunks-failed rollback therefore preserves the old parent BM25 document instead of replacing it with an empty or stale summary.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:307:| `folder-discovery.ts`      | -      | TypeScript | Spec folder description discovery: per-folder `description.json` CRUD, centralized cache aggregation, staleness detection, `slugifyFolderName()` helper, keyword-overlap relevance scoring (PI-B3) |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:725:`memory_index_scan` now runs the broader post-mutation invalidation hook behavior whenever a scan indexes, updates, or stale-deletes rows.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/local-reranker.ts:105:  // Discard stale promise if the model path changed since the last load\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/11--scoring-and-calibration/11-scoring-and-ranking-corrections.md:22:**C2: Citation fallback chain:** `composite-scoring.ts` fell back through `last_accessed` then `updated_at` when no citation data existed, conflating recency with citation authority. The fallback chain was removed. The function returns 0 when no citation data exists.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/entity-linker.ts:456:    // Data integrity: clean stale auto-entities before re-extraction on update\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/entity-linker.ts:458:    // stale entity rows from polluting cross-document linking decisions.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/README.md:42:- `archive.sh` - archive completed or stale specs\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:840:    it('keeps stale pending files in place when the db probe reports no committed row', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:841:      const rootDir = makeTempDir('txn-stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:843:      const { originalPath, pendingPath } = createPendingFile(rootDir, 'specs/023/memory/stale.md', '# pending stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:857:      const stale = createPendingFile(rootDir, 'specs/023/memory/stale.md', '# stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:859:      expect(findPendingFiles(rootDir).sort()).toEqual([committed.pendingPath, stale.pendingPath].sort());\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:861:      const results = recoverAllPendingFiles(rootDir, (originalPath) => path.basename(originalPath) !== 'stale.md');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:865:      expect(byPath.get(stale.pendingPath)?.recovered).toBe(false);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:866:      expect(byPath.get(stale.pendingPath)?.error).toContain('Stale pending file');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:868:      expect(fs.existsSync(stale.pendingPath)).toBe(true);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:905:  it('stores file mtimes and reports stale files via mtime checks', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:928:      stale: [],\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:937:      stale: [trackedFile],\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:979:  it('cleanupOrphans removes stale nodes/edges', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:342:After every successful save, a consolidation cycle hook fires when `SPECKIT_CONSOLIDATION` is enabled (default ON). The N3-lite consolidation engine scans for contradictions (memory pairs above 0.85 cosine similarity with negation keyword conflicts), runs Hebbian strengthening on recently accessed edges (+0.05 per cycle with a 30-day decay), detects stale edges (unfetched for 90+ days) and enforces edge bounds (maximum 20 per node). The cycle runs on a weekly cadence.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:348:Successful insertions now clear the search cache immediately instead of waiting for delete-time invalidation or TTL expiry. `index_memory()` calls `clear_search_cache()` after the transactional insert, active-projection update and optional `vec_memories` write succeed, so a brand-new memory becomes visible to repeated `memory_search` calls right away. The fix closes a stale-results gap where the save path could report success while cached searches still replayed a pre-insert snapshot.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:370:By default, if embedding regeneration fails (API timeout, provider outage), the entire update rolls back with no changes applied. Nothing happens. With `allowPartialUpdate` enabled, the metadata changes persist and the embedding is marked as pending for later re-indexing by the next `memory_index_scan`. That mode is useful when you need to fix metadata urgently and can tolerate a temporarily stale embedding.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:769:Recovery is automatic and requires no user intervention. If the pending file is stale (the DB row was never committed), it is logged and left for manual review rather than silently deleted.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:787:The archival sweep runs periodically and respects tier-based protection: constitutional and critical-tier memories are never auto-archived. Access tracker data (`access_count`, `last_accessed`) drives the dormancy decision. On unarchive, BM25 is restored from stored text fields, while vector re-embedding is explicitly deferred and logged for the next index scan (no immediate vector row recreation). The archival manager lazy-loads the tier classifier to avoid circular dependencies at import time.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:809:Edge bounds are enforced at insert time. Auto-generated edges (those with `created_by='auto'`) are rejected when a node already has 20 edges (`MAX_EDGES_PER_NODE`) and clamped to a maximum strength of 0.5 (`MAX_AUTO_STRENGTH`). Every strength modification is logged to a `weight_history` table recording old strength, new strength, who changed it, when and why. The `created_by` and `last_accessed` fields on each edge track provenance and usage patterns.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:1561:Every causal edge now carries `created_by` and `last_accessed` metadata fields tracking who created the edge and when it was last used. All strength modifications are logged to a `weight_history` table recording old strength, new strength, the actor (`changed_by`), timestamp and reason.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:1565:This audit infrastructure supports the N3-lite consolidation engine: Hebbian strengthening, staleness detection and edge bounds enforcement all rely on accurate weight history and provenance tracking.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:2015:**C2: Citation fallback chain:** `composite-scoring.ts` fell back through `last_accessed` then `updated_at` when no citation data existed, conflating recency with citation authority. The fallback chain was removed. The function returns 0 when no citation data exists.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:2095:When you ask the same question twice within a short time, the system should not redo all the expensive work. This feature remembers recent results for up to 60 seconds so repeat requests get instant answers from the cache. When you save, update or delete a memory, the cache for affected searches is cleared automatically so you never see stale results.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:2117:The access tracker (`lib/storage/access-tracker.ts`) implements batched access counting with a soft-accumulator pattern. Each retrieval hit increments an in-memory accumulator by 0.1. When the accumulator exceeds the 0.5 threshold, a database write flushes the accumulated count to the `access_count` column in `memory_index` and updates `last_accessed`. This batching reduces write amplification from high-frequency search operations.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:2514:is missing or stale (spec.md modified after description.json).\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:2538:discovery, fresh per-folder files win, stale or corrupt existing files are\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:3135:The legacy V1 pipeline was the root cause of 3 of 4 P0 bugs: an inverted `STATE_PRIORITY` map, divergent scoring order in post-search weighting and a mismatched deep-query variant cap. Since V2 was already the default, the legacy handler path in `memory-search.ts` was removed and the 4-stage orchestrator became the only runtime path. Stage helpers with familiar names now live in stage modules (`stage1-candidate-gen.ts`, `stage2-fusion.ts`, `stage3-rerank.ts`, `stage4-filter.ts`) rather than the old monolithic V1 branch. The `isPipelineV2Enabled()` function now always returns `true` with a deprecation comment, and stale legacy-handler imports were removed.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:3218:**IMPLEMENTED (Sprint 019).** Startup in `context-server.ts` uses `server.setInstructions()` to inject a dynamic memory-system overview (total memories, spec folder count, channels, stale count) into the MCP instruction payload. Reuses existing `memory_stats` logic. Gated by `SPECKIT_DYNAMIC_INIT` (default `true`).\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:3262:When another process changes the database while the server is running, the server needs to notice and reconnect. This feature watches for a signal file that says \\\"the database changed\\\" and automatically refreshes the connection. Without it, the server would keep using stale data until someone manually restarted it.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:3432:Over time, stored memories can contradict each other or grow stale. This feature runs periodic housekeeping to spot conflicts, strengthen connections that get used often and flag relationships that have not been touched in months. Think of it as a librarian who regularly walks the shelves to catch duplicate entries and retire outdated references.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:3843:When you delete or rename a file on your computer, the search index needs to clean up the old entry so it does not show stale results. This feature handles that cleanup automatically. Without it, you could search and find references to files that no longer exist, like a phone book that still lists people who have moved away.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:4425:| `SPECKIT_CONSOLIDATION` | `true` | boolean | `lib/search/search-flags.ts` | Enables the N3-lite consolidation engine which runs after every successful save. Scans for contradictions (>0.85 cosine similarity with negation conflicts), applies Hebbian strengthening (+0.05/cycle, 30-day decay), detects stale edges (>90 days unfetched) and enforces 20 edges per node. Runs weekly. |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:4433:| `SPECKIT_DYNAMIC_INIT` | `true` | boolean | `context-server.ts` | **IMPLEMENTED (Sprint 019).** P1-6: Dynamic server instructions at MCP initialization. `buildServerInstructions()` generates a memory-system overview (total memories, spec folder count, channels, stale count) and injects via `server.setInstructions()`. Instructions are computed once at startup and not refreshed during session (CHK-076). Reuses existing `memory_stats` handler data. |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:4532:| `STALE_CLEANUP_INTERVAL_MS` | `3600000` | number | `lib/session/session-manager.ts` | Interval in milliseconds between stale session cleanup sweeps. Default is 1 hour (3,600,000 ms). Stale sessions are those whose last activity exceeds `STALE_SESSION_THRESHOLD_MS`. |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:4533:| `STALE_SESSION_THRESHOLD_MS` | `86400000` | number | `lib/session/session-manager.ts` | Age in milliseconds at which a session is considered stale and eligible for cleanup. Default is 24 hours (86,400,000 ms). |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/rules/check-spec-doc-integrity.sh:99:                issues+=(\\\"$filename has stale Spec Folder metadata: $spec_folder_value\\\")\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/quality-audit.sh:138:               # --fix: re-run staleness auto-upgrade on failing folders\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/quality-audit.sh:140:                   local staleness_script=\\\"$SCRIPT_DIR/check-template-staleness.sh\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/quality-audit.sh:141:                   if [[ -f \\\"$staleness_script\\\" ]]; then\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/quality-audit.sh:142:                       bash \\\"$staleness_script\\\" --auto-upgrade --root \\\"$folder\\\" 2>/dev/null || true\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/archive.sh:197:    # Clean up any stale temp directories from previous failed runs\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/14--pipeline-architecture/17-cross-process-db-hot-rebinding.md:12:When another process changes the database while the server is running, the server needs to notice and reconnect. This feature watches for a signal file that says \\\"the database changed\\\" and automatically refreshes the connection. Without it, the server would keep using stale data until someone manually restarted it.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage3-rerank.ts:420:        // the reranked value instead of stale Stage 2 values.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/migration/F-MIG-001-junk-residual.md:3:description: \\\"Fixture with stale residual triggers plus useful short anchors.\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/types.ts:26:  last_accessed?: number;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/types.ts:93:  last_accessed?: number;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/11--scoring-and-calibration/16-access-driven-popularity-scoring.md:18:The access tracker (`lib/storage/access-tracker.ts`) implements batched access counting with a soft-accumulator pattern. Each retrieval hit increments an in-memory accumulator by 0.1. When the accumulator exceeds the 0.5 threshold, a database write flushes the accumulated count to the `access_count` column in `memory_index` and updates `last_accessed`. This batching reduces write amplification from high-frequency search operations.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-schema-migration-refinements.vitest.ts:61:    const staleSpecFolder = 'current';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-schema-migration-refinements.vitest.ts:80:      staleSpecFolder,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-schema-migration-refinements.vitest.ts:99:    `).run('history-stale-folder', 101, staleSpecFolder, 'before', 'after', 'UPDATE', 'system');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-schema-migration-refinements.vitest.ts:100:    database.prepare('INSERT INTO session_state (session_id, spec_folder) VALUES (?, ?)').run('session-1', staleSpecFolder);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-schema-migration-refinements.vitest.ts:116:      { id: 'history-stale-folder', spec_folder: canonicalSpecFolder },\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage2-fusion.ts:575:          last_accessed = ?\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage2-fusion.ts:988:      // so rrfScore/intentAdjustedScore are not stale for subsequent steps.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/session-bootstrap.vitest.ts:71:  it('adds a structural hint when the bootstrap contract is stale', async () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/session-bootstrap.vitest.ts:73:      status: 'stale',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/session-bootstrap.vitest.ts:74:      summary: 'Code graph is stale',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/session-bootstrap.vitest.ts:82:    expect(parsed.data.structuralContext.status).toBe('stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/session-bootstrap.vitest.ts:84:      structuralContext: expect.objectContaining({ status: 'stale' }),\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/session-bootstrap.vitest.ts:86:    expect(parsed.data.payloadContract.provenance.trustState).toBe('stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/session-bootstrap.vitest.ts:87:    expect(parsed.data.graphOps.readiness.canonical).toBe('stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1094:export function get_usage_stats(options: UsageStatsOptions = {}): Array<{ id: number; title: string | null; spec_folder: string; file_path: string; access_count: number; last_accessed: number | null; confidence: number | null; created_at: string }> {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1101:  const valid_sort_fields = ['access_count', 'last_accessed', 'confidence'];\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1109:           last_accessed, confidence, created_at\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1120:    last_accessed: number | null;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1158:      last_accessed,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1167:      OR (last_accessed IS NULL AND created_at < ?)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1169:      last_accessed ASC NULLS FIRST,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1192:      typeof row.last_accessed === 'number' ? new Date(row.last_accessed).toISOString() : null\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1213:      lastAccessedAt: row.last_accessed,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1274:    lastAccessedAt: memory.last_accessed,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1279:      typeof memory.last_accessed === 'number' ? new Date(memory.last_accessed).toISOString() : null\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/11--scoring-and-calibration/15-tool-level-ttl-cache.md:12:When you ask the same question twice within a short time, the system should not redo all the expensive work. This feature remembers recent results for up to 60 seconds so repeat requests get instant answers from the cache. When you save, update or delete a memory, the cache for affected searches is cleared automatically so you never see stale results.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/query-flow-tracker.vitest.ts:82:  it('evicts stale queries after the 10 minute TTL', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/10--graph-signal-activation/04-weight-history-audit-tracking.md:3:description: \\\"Describes the `created_by`/`last_accessed` metadata on causal edges, the `weight_history` audit table and the edge bounds enforcement that caps auto-generated edges at 20 per node and 0.5 max strength.\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/10--graph-signal-activation/04-weight-history-audit-tracking.md:10:Describes the `created_by`/`last_accessed` metadata on causal edges, the `weight_history` audit table and the edge bounds enforcement that caps auto-generated edges at 20 per node and 0.5 max strength.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/10--graph-signal-activation/04-weight-history-audit-tracking.md:18:Every causal edge now carries `created_by` and `last_accessed` metadata fields tracking who created the edge and when it was last used. All strength modifications are logged to a `weight_history` table recording old strength, new strength, the actor (`changed_by`), timestamp and reason.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/10--graph-signal-activation/04-weight-history-audit-tracking.md:22:This audit infrastructure supports the N3-lite consolidation engine: Hebbian strengthening, staleness detection and edge bounds enforcement all rely on accurate weight history and provenance tracking.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/tests/test-folder-detector-functional.js:295:    `).run('099-stale-folder', 'T-stale', 'preflight');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/18-session-resume-tool.md:12:The session_resume handler performs three sub-calls: (1) `memory_context` with `mode=resume` and `profile=resume` to recover session state, (2) code graph database query for node/edge/file counts and last scan timestamp, and (3) CocoIndex binary availability check via filesystem probe. It also appends the shared structural ready/stale/missing contract from `session-snapshot.ts`, so callers can tell when a deeper refresh is needed. Results are merged into a `SessionResumeResult` with `memory`, `codeGraph`, `cocoIndex`, optional `structuralContext`, and `hints` fields. Failures in any sub-call are captured as error entries with recovery hints rather than failing the entire call. For the canonical first-call recovery step, use `session_bootstrap`; `session_resume` remains the detailed merged surface.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/17-session-health-tool.md:3:description: \\\"MCP tool (session_health) that reports session readiness with ok/warning/stale status, code graph freshness, priming status, and quality score.\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/17-session-health-tool.md:10:MCP tool (session_health) that reports session readiness with ok/warning/stale status, code graph freshness, priming status, and quality score.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/17-session-health-tool.md:12:The session_health handler computes session status based on three time thresholds: ok (last tool call within 15 minutes), warning (within 60 minutes), stale (beyond 60 minutes or session older than 24 hours). It returns structured details including sessionAgeMs, lastToolCallAgoMs, graphFreshness (fresh/stale/empty/error), specFolder, primingStatus, and a QualityScore with 4 weighted factors (recency, recovery, graphFreshness, continuity). Actionable hints guide the user toward recovery actions. The session_health tool call is excluded from recordToolCall() to prevent idle timer reset — health checks no longer artificially extend session freshness.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/code-graph-ops-hardening.vitest.ts:11:    expect(normalizeStructuralReadiness('stale')).toBe('stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/code-graph-ops-hardening.vitest.ts:18:      graphFreshness: 'stale',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/code-graph-ops-hardening.vitest.ts:22:    expect(contract.readiness.canonical).toBe('stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/full-spec-doc-indexing.vitest.ts:869:        last_accessed: 0,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/full-spec-doc-indexing.vitest.ts:912:        last_accessed: 0,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/15-code-graph-auto-trigger.md:12:The ensure-ready module checks graph state (fresh/stale/empty) by comparing the current git HEAD against the last indexed HEAD and scanning for stale files. When the graph is empty, a full scan is triggered. When files are stale but below the selective reindex threshold (50 files), only changed files are reindexed. Above the threshold, a full rescan is performed. A 10-second timeout prevents blocking on large codebases. Shared by code_graph_context, code_graph_query, and code_graph_status handlers.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/15-code-graph-auto-trigger.md:28:| `mcp_server/lib/code-graph/ensure-ready.ts` | Lib | Auto-trigger with git HEAD comparison and staleness detection |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/hook-state.vitest.ts:190:      const projectCwd = join(tmpdir(), `speckit-stale-state-${Date.now()}`);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/hook-state.vitest.ts:196:        const staleSessionId = 'stale-session';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/hook-state.vitest.ts:197:        const staleState: HookState = {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/hook-state.vitest.ts:198:          claudeSessionId: staleSessionId,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/hook-state.vitest.ts:199:          speckitSessionId: 'sk-stale',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/hook-state.vitest.ts:200:          lastSpecFolder: 'specs/stale',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/hook-state.vitest.ts:208:        saveState(staleSessionId, staleState);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/hook-state.vitest.ts:210:        const stalePath = getStatePath(staleSessionId);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/hook-state.vitest.ts:211:        const staleTime = new Date(Date.now() - 26 * 60 * 60 * 1000);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/hook-state.vitest.ts:212:        utimesSync(stalePath, staleTime, staleTime);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/hook-state.vitest.ts:215:          scope: { specFolder: 'specs/stale', claudeSessionId: staleSessionId },\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/hook-state.vitest.ts:217:        try { rmSync(stalePath); } catch { /* ok */ }\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:453:      const content = 'Existing same-path row with stale trigger phrases.';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:483:      const content = 'Existing same-path row with stale trigger phrases.';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/22-context-preservation-metrics.md:12:The context-metrics module maintains lightweight in-memory state for the current session: tool call count, memory recovery calls, code graph queries, spec folder transitions, and priming status. It computes a QualityScore (0.0-1.0) with 4 weighted factors: recency (time since last tool call, decays over time), recovery (1.0 if memory recovered this session), graphFreshness (1.0 fresh, 0.5 stale, 0.0 empty), and continuity (1.0 if spec folder stable, lower on transitions). Quality levels map to healthy (score >= 0.7), degraded (>= 0.4), or critical (< 0.4). No database persistence; state resets on server restart.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/14--pipeline-architecture/14-dynamic-server-instructions-at-mcp-initialization.md:3:description: \\\"Dynamic server instructions inject a memory-system overview (total memories, spec folder count, channels, stale count) into the MCP instruction payload at startup.\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/14--pipeline-architecture/14-dynamic-server-instructions-at-mcp-initialization.md:10:Dynamic server instructions inject a memory-system overview (total memories, spec folder count, channels, stale count) into the MCP instruction payload at startup.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/14--pipeline-architecture/14-dynamic-server-instructions-at-mcp-initialization.md:18:**IMPLEMENTED (Sprint 019).** Startup in `context-server.ts` uses `server.setInstructions()` to inject a dynamic memory-system overview (total memories, spec folder count, channels, stale count) into the MCP instruction payload. Reuses existing `memory_stats` logic. Gated by `SPECKIT_DYNAMIC_INIT` (default `true`).\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/14--pipeline-architecture/14-dynamic-server-instructions-at-mcp-initialization.md:29:| `mcp_server/handlers/memory-crud-stats.ts` | Handler | `memory_stats` logic reused to compute total memories, spec folder count, channels, stale count |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/10--graph-signal-activation/17-temporal-edges.md:10:`valid_at`/`invalid_at` columns on `causal_edges` enable time-bounded graph traversal, with `invalidateEdge()` marking outdated edges and `getValidEdges()` filtering to currently valid ones. This ensures that graph walks and causal boosts only consider edges that are temporally current, preventing stale or superseded relationships from influencing search ranking.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog_in_simple_terms.md:128:Another fix makes fresh saves show up reliably in repeat searches. After a successful insert, the search cache is cleared right away, so asking the same question again does not replay stale results that were computed before the new memory existed.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog_in_simple_terms.md:520:When you ask the same question twice within a short time, the system should not redo all the expensive work. This feature remembers recent results for up to 60 seconds so repeat requests get instant answers from the cache. When you save, update or delete a memory, the cache for affected searches is cleared automatically so you never see stale results.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog_in_simple_terms.md:772:When another process changes the database while the server is running, the server needs to notice and reconnect. This feature watches for a signal file that says \\\"the database changed\\\" and automatically refreshes the connection. Without it, the server would keep using stale data until someone manually restarted it.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog_in_simple_terms.md:812:Over time, stored memories can contradict each other or grow stale. This feature runs periodic housekeeping to spot conflicts, strengthen connections that get used often and flag relationships that have not been touched in months. Think of it as a librarian who regularly walks the shelves to catch duplicate entries and retire outdated references.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog_in_simple_terms.md:872:When source code files are deleted or renamed, their compiled output files should be removed too. But sometimes the old output files get left behind like ghosts. This tool checks that every compiled file has a matching source file and flags any orphans so they can be cleaned up, preventing stale code from lingering in the build output.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog_in_simple_terms.md:896:When you delete or rename a file on your computer, the search index needs to clean up the old entry so it does not show stale results. This feature handles that cleanup automatically. Without it, you could search and find references to files that no longer exist, like a phone book that still lists people who have moved away.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/01-category-overview.md:18:Implemented across spec 024-compact-code-graph phases 001-028. The shipped surface now includes hook scripts, code graph modules, MCP tools, budget allocator, tree-sitter parser with regex fallback, query-intent routing, auto-trigger, session health/resume/bootstrap tools, the structural ready/stale/missing contract, Gemini hooks, and startup-brief follow-ons.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/01-category-overview.md:34:| `mcp_server/lib/code-graph/ensure-ready.ts` | Lib | Auto-trigger with git HEAD staleness detection |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/01-category-overview.md:38:| `mcp_server/lib/session/session-snapshot.ts` | Lib | Shared ready/stale/missing structural context contract |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/archival-manager.vitest.ts:35:  last_accessed?: number;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/archival-manager.vitest.ts:76:      last_accessed INTEGER DEFAULT 0,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/archival-manager.vitest.ts:105:    INSERT INTO memory_index (spec_folder, file_path, title, content_text, importance_tier, created_at, last_accessed, access_count, confidence, is_pinned, stability, half_life_days)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/archival-manager.vitest.ts:115:    data.last_accessed || 0,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-integration.vitest.ts:271:    it('T644: last_accessed column exists', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-integration.vitest.ts:272:      expect(VECTOR_INDEX_SCHEMA_SOURCE).toContain('last_accessed INTEGER DEFAULT 0');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-integration.vitest.ts:296:    it('T650: last_accessed stores epoch timestamp', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-integration.vitest.ts:298:      expect(ACCESS_TRACKER_SOURCE).toContain('last_accessed = ?');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-integration.vitest.ts:303:    it('updates stability, review_count, access_count, and last_accessed together', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/memory-search-integration.vitest.ts:307:      expect(STAGE2_SOURCE).toContain('last_accessed = ?');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/02--mutation/01-memory-indexing-memorysave.md:41:After every successful save, a consolidation cycle hook fires when `SPECKIT_CONSOLIDATION` is enabled (default ON). The N3-lite consolidation engine scans for contradictions (memory pairs above 0.85 cosine similarity with negation keyword conflicts), runs Hebbian strengthening on recently accessed edges (+0.05 per cycle with a 30-day decay), detects stale edges (unfetched for 90+ days) and enforces edge bounds (maximum 20 per node). The cycle runs on a weekly cadence.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/02--mutation/01-memory-indexing-memorysave.md:47:Successful insertions now clear the search cache immediately instead of waiting for delete-time invalidation or TTL expiry. `index_memory()` calls `clear_search_cache()` after the transactional insert, active-projection update and optional `vec_memories` write succeed, so a brand-new memory becomes visible to repeated `memory_search` calls right away. The fix closes a stale-results gap where the save path could report success while cached searches still replayed a pre-insert snapshot.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/five-factor-scoring.vitest.ts:198:  it('T033-07: No last_accessed fallback — uncited memory scores 0', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/five-factor-scoring.vitest.ts:200:    const score = calculateCitationScore({ last_accessed: Date.now() });\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/04--maintenance/01-workspace-scanning-and-indexing-memoryindexscan.md:24:In incremental mode (the default), the scanner categorizes every discovered file into one of four buckets: to-index (new files), to-update (changed mtime or content hash), to-skip (unchanged mtime and matching content hash) and to-delete (files that disappeared from disk). The content-hash secondary check catches timestamp-preserving rewrites that would otherwise look unchanged from mtime alone. Batch processing with configurable `BATCH_SIZE` handles large workspaces, but oversized requests are clamped to the hard runtime maximum with a warning instead of exploding fan-out. Scan throttling now uses an atomic lease instead of a check-then-set cooldown gate: `acquireIndexScanLease()` reads `last_index_scan` and `scan_started_at` in one transaction, expires stale leases left behind by crashed scans, reserves a fresh run by writing `scan_started_at`, rejects overlapping fresh scans with `reason: 'lease_active'`, and still enforces `INDEX_SCAN_COOLDOWN` after completed runs with `reason: 'cooldown'`. The handler returns an E429 response with the computed wait time whenever either guard rejects the request.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/04--maintenance/01-workspace-scanning-and-indexing-memoryindexscan.md:26:Completion is a separate step. `completeIndexScanLease()` runs after the scan response is assembled, converts the active `scan_started_at` lease into `last_index_scan`, and clears the active lease row. That keeps the cooldown clock tied to completed scans instead of request start time while still protecting the database from concurrent scans and stale crash leftovers.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/04--maintenance/01-workspace-scanning-and-indexing-memoryindexscan.md:45:| `mcp_server/core/db-state.ts` | Atomic lease persistence for `scan_started_at` and `last_index_scan`, including stale-lease expiry and completion handoff |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/04--maintenance/01-workspace-scanning-and-indexing-memoryindexscan.md:67:| `mcp_server/tests/db-state.vitest.ts` | Atomic lease acquisition, stale-lease expiry, and completion handoff validation |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/02--mutation/11-shared-memory-end-to-end-architecture.md:88:| `mcp_server/tests/shared-memory-handlers.vitest.ts` | Admin identity resolution, owner bootstrap, stale concurrent-create handling, membership mutation, and README bootstrap |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/cognitive-gaps.vitest.ts:35:      last_accessed INTEGER DEFAULT 0,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-DUP-005b-frontmatter-mirror.json:9:    \\\"stale metadata trigger\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/16--tooling-and-scripts/08-watcher-delete-rename-cleanup.md:3:description: \\\"Watcher delete/rename cleanup purges stale index entries when memory files are deleted or renamed on disk.\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/16--tooling-and-scripts/08-watcher-delete-rename-cleanup.md:10:Watcher delete/rename cleanup purges stale index entries when memory files are deleted or renamed on disk.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/16--tooling-and-scripts/08-watcher-delete-rename-cleanup.md:12:When you delete or rename a file on your computer, the search index needs to clean up the old entry so it does not show stale results. This feature handles that cleanup automatically. Without it, you could search and find references to files that no longer exist, like a phone book that still lists people who have moved away.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/tool-cache.vitest.ts:421:    it('should not reuse or repopulate stale in-flight results after invalidation', async () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/tool-cache.vitest.ts:448:      resolveFirst?.('stale-result');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/tool-cache.vitest.ts:449:      expect(await first).toBe('stale-result');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/tool-cache.vitest.ts:587:    it('should drop stale in-flight work across shutdown boundaries', async () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/tool-cache.vitest.ts:607:      resolveFirst?.('stale-after-shutdown');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/tool-cache.vitest.ts:608:      expect(await first).toBe('stale-after-shutdown');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/02--mutation/02-memory-metadata-update-memoryupdate.md:22:By default, if embedding regeneration fails (API timeout, provider outage), the entire update rolls back with no changes applied. Nothing happens. With `allowPartialUpdate` enabled, the metadata changes persist and the embedding is marked as pending for later re-indexing by the next `memory_index_scan`. That mode is useful when you need to fix metadata urgently and can tolerate a temporarily stale embedding.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/15--retrieval-enhancements/04-lightweight-consolidation.md:3:description: \\\"Lightweight consolidation is invoked after every save, but contradiction scanning, Hebbian edge strengthening, staleness detection and edge bounds enforcement execute on a weekly cadence.\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/15--retrieval-enhancements/04-lightweight-consolidation.md:10:Lightweight consolidation is invoked after every save, but contradiction scanning, Hebbian edge strengthening, staleness detection and edge bounds enforcement execute on a weekly cadence.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/15--retrieval-enhancements/04-lightweight-consolidation.md:12:Over time, stored memories can contradict each other or grow stale. This feature runs periodic housekeeping to spot conflicts, strengthen connections that get used often and flag relationships that have not been touched in months. Think of it as a librarian who regularly walks the shelves to catch duplicate entries and retire outdated references.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/12--query-intelligence/09-index-time-query-surrogates.md:24:At query time, Stage 1 batch-loads stored surrogates from SQLite and matches them against the incoming query using token overlap. A match requires a minimum overlap ratio of `MIN_MATCH_THRESHOLD = 0.15`. The runtime matcher `matchSurrogates()` returns `{ score, matchedSurrogates }` for one document; the exported `SurrogateMatchResult` interface is stale because it still includes `memoryId`, but memory IDs actually come from the surrounding candidate rows in Stage 1. Stage 1 applies the returned match score as a capped additive boost to existing candidates.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/deferred-features-integration.vitest.ts:70:      last_accessed TEXT\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/16--tooling-and-scripts/29-setup-native-module-health-and-mcp-installation.md:28:4. Before installation, the installer clears a stale Hugging Face cache under the server package and removes `better-sqlite3` plus `sqlite-vec` from the server `node_modules` tree to avoid native-module load failures. It then runs `npm install` from the Spec Kit root, attempts `npm run build`, and falls back to `npx tsc --build --noCheck --force` if the standard build fails.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/mpab-quality-gate-integration.vitest.ts:391:            last_accessed TEXT,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/integration-causal-graph.vitest.ts:68:      last_accessed TEXT,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/safety.vitest.ts:110:          last_accessed INTEGER DEFAULT 0,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/safety.vitest.ts:209:    it('T106-Categorize: File with stale mtime re-categorized as toUpdate', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/references/structure/folder_routing.md:33:- **Reliability**: No stale state issues\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-CHECK-DUP5-trigger.json:9:    \\\"dup5 stale metadata\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/session-resume.vitest.ts:91:  it('reports stale graph status in the startup payload when freshness detection says stale', async () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/session-resume.vitest.ts:92:    vi.mocked(getGraphFreshness).mockReturnValueOnce('stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/session-resume.vitest.ts:97:    expect(parsed.data.codeGraph.status).toBe('stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/session-resume.vitest.ts:98:    expect(parsed.data.payloadContract.summary).toContain('graph=stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/session-resume.vitest.ts:100:      .toContain('status=stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/13--memory-quality-and-indexing/21-assistive-reconsolidation.md:29:The companion core reconsolidation merge path now validates predecessor freshness before any append-only merge completes. `executeMerge()` snapshots the predecessor row's `content_hash` and `updated_at`, reloads the row inside the transaction after the embedding await, and aborts with `predecessor_changed` or `predecessor_gone` if the predecessor changed, was deleted, or was archived mid-flight. Assistive reconsolidation still remains non-destructive at its own layer, but adjacent merge handling is now protected from stale predecessor state.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/13--memory-quality-and-indexing/06-reconsolidation-on-save.md:22:**T302 stale-merge guard:** `executeMerge()` now snapshots the predecessor row before awaiting merged-embedding generation, then reloads that predecessor inside the transaction and compares both `content_hash` and `updated_at`. If the predecessor was edited by another writer during the async embedding wait, the merge aborts with complement-style status `predecessor_changed`. If the predecessor was deleted or archived before commit, the merge aborts with `predecessor_gone`. This prevents stale append-only merges against an out-of-date predecessor.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-save.vitest.ts:1786:      const staleParsed = {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-save.vitest.ts:1789:        contentHash: 'stale-hash',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-save.vitest.ts:1790:        triggerPhrases: ['stale-trigger'],\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-save.vitest.ts:1804:        parsedOverride: staleParsed,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/13--memory-quality-and-indexing/04-spec-folder-description-discovery.md:31:is missing or stale (spec.md modified after description.json).\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/13--memory-quality-and-indexing/04-spec-folder-description-discovery.md:55:discovery, fresh per-folder files win, stale or corrupt existing files are\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/13--memory-quality-and-indexing/04-spec-folder-description-discovery.md:78:| `mcp_server/lib/search/folder-discovery.ts` | Lib/Parsing | Spec folder auto-discovery, description extraction, stale/fallback preference, auto-repair, per-folder CRUD, and `stripYamlFrontmatter()` reuse from the parsing layer |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/13--memory-quality-and-indexing/04-spec-folder-description-discovery.md:89:| `mcp_server/tests/folder-discovery.vitest.ts` | PerFolderDescription schema, generation, required-field/array validation, path-containment hardening, `slugifyFolderName`, CRUD/staleness, and CRLF frontmatter stripping |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/13--memory-quality-and-indexing/04-spec-folder-description-discovery.md:90:| `mcp_server/tests/folder-discovery-integration.vitest.ts` | Mixed-mode aggregation, fresh-vs-stale preference, corrupt/missing fallback, cache staleness, regeneration behavior, and performance checks |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery.vitest.ts:1086:    tmpDir4 = fs.mkdtempSync(path.join(os.tmpdir(), 'speckit-stale-'));\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/adaptive-ranking.vitest.ts:77:      last_accessed INTEGER,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/18--ux-hooks/13-end-to-end-success-envelope-verification.md:29:| `mcp_server/hooks/response-hints.ts` | Hook | Hint append + token-count resync on finalized envelope |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/13--memory-quality-and-indexing/25-indexing-runtime-bootstrap-api.md:14:The module is mostly orchestration glue, but the glue matters. `initializeIndexingRuntime()` wires the vector database, checkpoint storage, access tracking, and hybrid-search state into the shared db-state singleton before any scan work runs. `warmEmbeddingModel()` is intentionally separate, so callers can choose whether to pay the embedding startup cost ahead of time or let the first embedding request do that work. `runMemoryIndexScan()` then hands control to the full indexing handler, which means this API is small on the surface while still activating the real incremental-scan, deduplication, stale-delete, and response-envelope behavior deeper in the stack.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/13--memory-quality-and-indexing/25-indexing-runtime-bootstrap-api.md:22:`runMemoryIndexScan(args)` is a thin delegate to `handleMemoryIndexScan(args)`, so the real runtime behavior comes from the handler pipeline. The handler logs the active embedding profile when available, checks for external database updates through `checkDatabaseUpdated()`, enforces the persisted `INDEX_SCAN_COOLDOWN`, collects memory files plus optional constitutional and spec-document files, deduplicates them by canonical path, and in incremental mode categorizes files into index, update, skip, and stale-delete buckets. It batch-processes remaining files through `indexMemoryFile()`, updates stored mtimes only after successful indexing outcomes, optionally creates causal chains for changed spec documents, runs post-mutation invalidation hooks, records the last scan time, and returns standardized MCP success or error envelopes. Spec documents remain part of that scan by default, and the handler passes them through `memory_save` in warn-only quality mode rather than bypassing indexing.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/n3lite-consolidation.vitest.ts:2:// Covers: contradiction scan, Hebbian strengthening, staleness\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/n3lite-consolidation.vitest.ts:62:      last_accessed TEXT,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/n3lite-consolidation.vitest.ts:302:    db.prepare(\\\"UPDATE causal_edges SET last_accessed = datetime('now') WHERE id = ?\\\").run(edgeId);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/n3lite-consolidation.vitest.ts:318:    db.prepare(\\\"UPDATE causal_edges SET last_accessed = datetime('now') WHERE id = ?\\\").run(edgeId);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/n3lite-consolidation.vitest.ts:332:    db.prepare(\\\"UPDATE causal_edges SET last_accessed = datetime('now') WHERE id = ?\\\").run(edgeId);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/n3lite-consolidation.vitest.ts:346:    // Set last_accessed to 31 days ago\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/n3lite-consolidation.vitest.ts:347:    db.prepare(\\\"UPDATE causal_edges SET last_accessed = datetime('now', '-31 days') WHERE id = ?\\\").run(edgeId);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/n3lite-consolidation.vitest.ts:362:    db.prepare(\\\"UPDATE causal_edges SET last_accessed = datetime('now') WHERE id = ?\\\").run(edgeId);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/n3lite-consolidation.vitest.ts:376:      INSERT INTO causal_edges (source_id, target_id, relation, strength, created_by, last_accessed)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/n3lite-consolidation.vitest.ts:397:    // Set extracted_at to 91 days ago (no last_accessed)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/n3lite-consolidation.vitest.ts:400:    const stale = detectStaleEdges(db);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/n3lite-consolidation.vitest.ts:401:    expect(stale.length).toBeGreaterThanOrEqual(1);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/n3lite-consolidation.vitest.ts:404:  it('T-STALE-02: recently accessed edges are not stale', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/n3lite-consolidation.vitest.ts:409:    db.prepare(\\\"UPDATE causal_edges SET last_accessed = datetime('now') WHERE source_id = '1'\\\").run();\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/n3lite-consolidation.vitest.ts:411:    const stale = detectStaleEdges(db);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/n3lite-consolidation.vitest.ts:412:    expect(stale).toHaveLength(0);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/n3lite-consolidation.vitest.ts:487:    expect(result).toHaveProperty('stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/n3lite-consolidation.vitest.ts:499:    expect(result.stale.flagged).toBe(0);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/structural-contract.vitest.ts:68:  it('returns stale status when graph scan is old', async () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/structural-contract.vitest.ts:75:      getGraphFreshness: vi.fn(() => 'stale'),\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/structural-contract.vitest.ts:82:    expect(contract.status).toBe('stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/structural-contract.vitest.ts:83:    expect(contract.summary).toContain('stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/structural-contract.vitest.ts:87:    expect(contract.provenance?.trustState).toBe('stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/structural-contract.vitest.ts:110:    expect(contract.provenance?.trustState).toBe('stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/migration/F-MIG-001-junk-residual.md:3:description: \\\"Fixture with stale residual triggers plus useful short anchors.\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/phase2-integration.vitest.ts:41:        last_accessed TEXT\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/18--ux-hooks/17-retrieval-session-state.md:29:Canonical flag behavior is default ON (graduated). Set `SPECKIT_SESSION_RETRIEVAL_STATE_V1=false` to disable. Any older `session-state.ts` header text that says \\\"default OFF\\\" is stale and does not reflect the live runtime gate.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/setup/install.sh:71:    # Clear stale HuggingFace model cache to prevent version mismatches\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/setup/install.sh:74:        log_info \\\"Clearing stale HuggingFace model cache...\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/setup/install.sh:79:    log_info \\\"Removing stale native modules...\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/file-watcher.vitest.ts:546:      for (const stalePath of paths.slice(0, -1)) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/file-watcher.vitest.ts:547:        expect(indexedPaths.has(stalePath)).toBe(false);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/references/debugging/troubleshooting.md:414:| **Stale Context** | Information seems outdated | Check `last_accessed_epoch` vs current time |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/references/debugging/troubleshooting.md:447:memory_list({ specFolder: \\\"###-feature\\\", sortBy: \\\"last_accessed\\\" })\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/references/debugging/troubleshooting.md:449:// Look for last_accessed_epoch in results\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/degree-computation.vitest.ts:37:      last_accessed TEXT,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/causal-edges.vitest.ts:79:        last_accessed TEXT,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/causal-edges.vitest.ts:900:    it('T001: touchEdgeAccess updates last_accessed timestamp on read', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/causal-edges.vitest.ts:903:      // Before read, last_accessed should be null\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/causal-edges.vitest.ts:904:      const before = (testDb.prepare('SELECT last_accessed FROM causal_edges WHERE id = ?').get(edgeId) as { last_accessed: string | null });\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/causal-edges.vitest.ts:905:      expect(before.last_accessed).toBeNull();\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/causal-edges.vitest.ts:910:      const after = (testDb.prepare('SELECT last_accessed FROM causal_edges WHERE id = ?').get(edgeId) as { last_accessed: string | null });\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/causal-edges.vitest.ts:911:      expect(after.last_accessed).not.toBeNull();\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/causal-edges.vitest.ts:950:        if (sql.includes(\\\"UPDATE causal_edges SET last_accessed = datetime('now') WHERE id = ?\\\")) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/references/config/environment_variables.md:248:| `SPECKIT_CONSOLIDATION` | ON | S4 | Consolidation engine: contradiction scan, Hebbian strengthening, staleness detection |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/edge-density.vitest.ts:32:      last_accessed TEXT\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/evals/check-source-dist-alignment.ts:11://   2026-03-07. No matching source remains, so the stale dist\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/evals/check-source-dist-alignment.ts:16://   mcp_server/lib/eval/memory-state-baseline.ts, so the stale\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/evals/check-source-dist-alignment.ts:181:    console.error('\\\\nRemove stale dist outputs, restore missing source files, or add a time-bounded allowlist entry.');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/unit-normalization-roundtrip.vitest.ts:36:        last_accessed: null,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/causal-edges-unit.vitest.ts:38:    // Create causal_edges table matching production schema (+created_by, +last_accessed)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/causal-edges-unit.vitest.ts:51:        last_accessed TEXT,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/references/memory/epistemic_vectors.md:301:3. Did something behave unexpectedly? (knowledge staleness signal)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-DUP-005b-frontmatter-mirror.json:9:    \\\"stale metadata trigger\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/references/memory/memory_system.md:113:| L3: Discovery | `session_health()` | Report session readiness, graph freshness, and priming status | Detect stale session context before continuing |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/entity-linker.vitest.ts:74:      last_accessed TEXT,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/memory/migrate-trigger-phrase-residual.ts:7:// canonicalization rules for stale residual cleanup.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/shared-payload-certainty.vitest.ts:96:      getGraphFreshness: vi.fn(() => 'stale'),\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-CHECK-DUP5-trigger.json:9:    \\\"dup5 stale metadata\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/checkpoints-storage.vitest.ts:89:      last_accessed TEXT,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/checkpoints-storage.vitest.ts:549:    it('T503-13: scoped merge restore replaces stale in-folder edges without touching unrelated ones', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/access-tracker-extended.vitest.ts:21:  last_accessed: string | null;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/access-tracker-extended.vitest.ts:41:      last_accessed TEXT DEFAULT NULL,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/access-tracker-extended.vitest.ts:84:      const row = requireTestDb().prepare('SELECT access_count, last_accessed FROM memory_index WHERE id = 1').get() as AccessRow;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/access-tracker-extended.vitest.ts:87:      expect(row.last_accessed).not.toBeNull();\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/access-tracker-extended.vitest.ts:415:      const staleTimestamp = new Date(Date.now() - (3650 * DAY_MS)).toISOString();\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/access-tracker-extended.vitest.ts:416:      const noDecay = folderScoring.computeRecencyScore(staleTimestamp, 'normal', 0);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/access-tracker-extended.vitest.ts:417:      const fullDecay = folderScoring.computeRecencyScore(staleTimestamp, 'normal', 1.0);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/README.md:105:- `handler-memory-index-cooldown.vitest.ts` - scan cooldown, stale-delete behavior, and partial-failure handling.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:676:    index.addDocument('5', 'stale document that should be removed');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/constitutional/gate-enforcement.md:87:**RATIONALE:** Handoff messages may be stale or from a different branch. Always cross-check against memory.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/core/file-writer.ts:24:    .replace(/^(created_at|created_at_epoch|last_accessed_epoch|expires_at_epoch):.*$/gm, '$1: <normalized>')\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/structural-trust-axis.vitest.ts:20:    expect([...FRESHNESS_AUTHORITY_VALUES]).toEqual(['live', 'cached', 'stale', 'unknown']);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/corrections.vitest.ts:58:      last_accessed TEXT\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/memory/README.md:40:- `cleanup-orphaned-vectors.ts` - remove stale vector rows not linked to active memories\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/ARCHITECTURE.md:226:2. **Remove**: Delete wrapper files, update docs/runbooks, remove stale references\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:651:    it('increments access_count and updates last_accessed', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:660:      expect(after?.last_accessed).toBeGreaterThan(0);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1237:        triggerPhrases: ['cache invalidation', 'stale cache'],\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1246:        triggerPhrases: ['cache invalidation', 'stale cache'],\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-impl.vitest.ts:1262:        triggerPhrases: ['cache invalidation', 'stale cache'],\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/access-tracker.vitest.ts:35:        last_accessed INTEGER DEFAULT NULL,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/05--lifecycle/018-checkpoint-deletion-checkpoint-delete.md:19:- Prompt: `Delete stale checkpoint by name. Capture the evidence needed to prove Removed checkpoint absent from list. Return a concise user-facing pass/fail verdict with the main reason.`\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/05--lifecycle/018-checkpoint-deletion-checkpoint-delete.md:29:| EX-018 | Checkpoint deletion (checkpoint_delete) | Old snapshot cleanup | `Delete stale checkpoint by name. Capture the evidence needed to prove Removed checkpoint absent from list. Return a concise user-facing pass/fail verdict with the main reason.` | `checkpoint_list(specFolder:\\\"<sandbox-spec>\\\")` -> `checkpoint_delete(name:\\\"<checkpoint-name>\\\",confirmName:\\\"<checkpoint-name>\\\")` -> `checkpoint_list(specFolder:\\\"<sandbox-spec>\\\")` | Removed checkpoint absent from list | Before/after list outputs | PASS if checkpoint removed from sandbox list | Validate name, `confirmName`, and sandbox scope; retry |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/core/workflow.ts:399:    // Best-effort stale lock cleanup.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:278:  it('T046-10: detects staleness in nested phase subfolders', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:294:  it('T046-10a: detects staleness in 5-level nested spec paths', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:486:  it('T046-13: regenerates when cache is stale', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:490:    // Pre-generate a stale cache\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:491:    const staleCache: DescriptionCache = {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:494:      folders: [{ specFolder: 'old', description: 'Stale', keywords: ['stale'], lastUpdated: new Date('2020-01-01').toISOString() }],\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:497:    saveDescriptionCache(staleCache, cachePath);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:502:    // Should have regenerated — no longer contains the stale \\\"old\\\" folder\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:629:  it('T046-23: falls back to spec.md when description.json is stale', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:633:    // Create a stale description.json (written before spec.md)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:635:    const staleDesc: PerFolderDescription = {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:638:      keywords: ['stale'],\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:646:    fs.writeFileSync(descPath, JSON.stringify(staleDesc));\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:647:    // Set description.json mtime to past to ensure staleness\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:661:  it('T046-24: mixed mode aggregation with fresh and stale descriptions', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:690:describe('F12: mixed-mode aggregation with corrupt/missing/stale combinations', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:701:  it('includes all folders and falls back to spec.md for stale/corrupt/missing description.json', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:704:    const staleDir = createSpecFolder(tmpDir, '002-stale-json', '# Stale Spec Title');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:721:    const staleDescription: PerFolderDescription = {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:722:      specFolder: '002-stale-json',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:724:      keywords: ['stale'],\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:727:      folderSlug: 'stale-json',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:732:    savePerFolderDescription(staleDescription, staleDir);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:733:    const staleDescPath = path.join(staleDir, 'description.json');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:735:    fs.utimesSync(staleDescPath, pastTime, pastTime);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:743:    const stale = cache.folders.find(f => f.specFolder === '002-stale-json');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:748:    expect(stale).toBeDefined();\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:753:    expect(stale!.description).toBe('Stale Spec Title');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:758:  it('repairs stale and corrupt description.json files during discovery when the file already exists', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:760:    const staleDir = createSpecFolder(tmpDir, '005-stale-repair', '# Stale Repair Title');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:763:    const staleDescription: PerFolderDescription = {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:764:      specFolder: '005-stale-repair',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:765:      description: 'Old stale text',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:766:      keywords: ['stale'],\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:769:      folderSlug: 'stale-repair',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:774:    savePerFolderDescription(staleDescription, staleDir);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:775:    const staleDescPath = path.join(staleDir, 'description.json');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:777:    fs.utimesSync(staleDescPath, pastTime, pastTime);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:782:    expect(cache.folders.find((folder) => folder.specFolder === '005-stale-repair')!.description).toBe('Stale Repair Title');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:785:    const repairedStale = loadPerFolderDescription(staleDir);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:819:describe('CHK-024: description.json mtime staleness', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:824:  it('T046-25: editing description.json makes aggregate cache stale', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:842:  it('T046-25b: editing spec.md makes per-folder description stale and regeneration picks up changes', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:844:    const folderDir = createSpecFolder(td, '001-stale-test', '# Original Title');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:856:    // Per-folder description should now be stale\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:1017:  it('stale folder — repairs written', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:1019:    const specDir = createSpecFolder(tmpDir, '001-stale', '# Stale Repair Target');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:1026:    // Make spec.md newer than description.json to create staleness\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:1030:    // Verify it is stale before repair\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/folder-discovery-integration.vitest.ts:1052:    // Make both stale\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/05--lifecycle/134-startup-pending-file-recovery-lifecycle-coverage.md:3:description: \\\"This scenario validates Startup pending-file recovery lifecycle coverage for `134`. It focuses on Verify startup recovery scans allowed roots and preserves stale pending files for manual review.\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/05--lifecycle/134-startup-pending-file-recovery-lifecycle-coverage.md:10:This scenario validates Startup pending-file recovery lifecycle coverage for `134`. It focuses on Verify startup recovery scans allowed roots and preserves stale pending files for manual review.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/05--lifecycle/134-startup-pending-file-recovery-lifecycle-coverage.md:18:- Objective: Verify startup recovery scans allowed roots and preserves stale pending files for manual review\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/05--lifecycle/134-startup-pending-file-recovery-lifecycle-coverage.md:19:- Prompt: `Validate startup pending-file recovery behavior across committed and stale files. Capture the evidence needed to prove Committed pending file recovers to original path; stale pending file remains with explicit stale classification; startup scan covers configured/allowed roots without scanning unrelated workspace trees. Return a concise user-facing pass/fail verdict with the main reason.`\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/05--lifecycle/134-startup-pending-file-recovery-lifecycle-coverage.md:20:- Expected signals: Committed pending file recovers to original path; stale pending file remains with explicit stale classification; startup scan covers configured/allowed roots without scanning unrelated workspace trees\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/05--lifecycle/134-startup-pending-file-recovery-lifecycle-coverage.md:21:- Pass/fail: PASS if committed/stale behavior diverges correctly and startup scan root set includes expected allowed locations\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/05--lifecycle/134-startup-pending-file-recovery-lifecycle-coverage.md:29:| 134 | Startup pending-file recovery lifecycle coverage | Verify startup recovery scans allowed roots and preserves stale pending files for manual review | `Validate startup pending-file recovery behavior across committed and stale files. Capture the evidence needed to prove Committed pending file recovers to original path; stale pending file remains with explicit stale classification; startup scan covers configured/allowed roots without scanning unrelated workspace trees. Return a concise user-facing pass/fail verdict with the main reason.` | 1) Create a pending file where DB row is committed, then run startup recovery (`recoverAllPendingFiles` path) 2) Verify committed pending file is renamed to original path 3) Create a stale pending file with no DB row 4) Verify stale pending file is not renamed and is reported for manual review 5) Verify scan roots include configured memory base roots plus `.opencode/specs` and constitutional locations | Committed pending file recovers to original path; stale pending file remains with explicit stale classification; startup scan covers configured/allowed roots without scanning unrelated workspace trees | Recovery output + filesystem checks + startup scan log evidence | PASS if committed/stale behavior diverges correctly and startup scan root set includes expected allowed locations | Inspect `context-server.ts` recovery root derivation and `transaction-manager.ts` stale pending detection |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/transaction-manager-recovery.vitest.ts:104:  it('T007-R3: marks pending file as stale when isCommittedInDb returns false', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/transaction-manager-recovery.vitest.ts:117:  it('T007-R4: does not delete stale pending file', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/transaction-manager-recovery.vitest.ts:213:  it('T007-R6: recoverAllPendingFiles returns mixed committed and stale results correctly', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/transaction-manager-recovery.vitest.ts:216:    const stale = createPendingFile(dir, 'specs/memory/stale.md', 'S');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/transaction-manager-recovery.vitest.ts:219:    const results = recoverAllPendingFiles(dir, (dbPath) => path.basename(dbPath) !== 'stale.md');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/transaction-manager-recovery.vitest.ts:225:    expect(byPendingPath.get(stale.pendingPath)?.recovered).toBe(false);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/transaction-manager-recovery.vitest.ts:226:    expect(byPendingPath.get(stale.pendingPath)?.error).toContain('Stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/transaction-manager-recovery.vitest.ts:232:    expect(fs.existsSync(stale.originalPath)).toBe(false);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/transaction-manager-recovery.vitest.ts:233:    expect(fs.existsSync(stale.pendingPath)).toBe(true);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/code-graph-context-handler.vitest.ts:43:        freshness: { lastScanAt: null, staleness: 'unknown' },\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/pipeline-architecture-remediation.vitest.ts:51:      content: 'stale content',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:1372:      expect(instructions).toContain('Warning: 12 stale memories detected. Consider running memory_index_scan.')\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2280:      staleCount: number\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2303:      const staleWarning = stats.staleCount > 10\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2304:        ? ` Warning: ${stats.staleCount} stale memories detected. Consider running memory_index_scan.`\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2309:        `Active memories: ${stats.activeCount}. Stale memories: ${stats.staleCount}.`,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2312:        staleWarning.trim(),\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2322:        staleCount: 0,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2345:      // No stale warning for zero stale\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2349:    // T69: Stale threshold boundary — 10 stale = no warning, 11 stale = warning\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2350:    it('T69: stale warning appears only when staleCount > 10', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2355:        staleCount: 10,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2367:        staleCount: 11,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2370:      expect(aboveBoundary).toContain('Warning: 11 stale memories detected')\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2376:        staleCount: 50,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2379:      expect(wellAbove).toContain('Warning: 50 stale memories detected')\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2388:        staleCount: 5,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2404:    // Structural verification: stale threshold is 10 in source\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2405:    it('T70c: stale threshold is 10 in source', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2406:      expect(sourceCode).toMatch(/stats\\\\.staleCount\\\\s*>\\\\s*10/)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2424:      expect(fnBody).toMatch(/stats\\\\.staleCount/)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2431:    it('T101: stale threshold boundary — warning only when staleCount > 10', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2438:      // Must use strict > 10 (not >= 10), so 10 stale = no warning, 11 = warning\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2439:      expect(fnBody).toMatch(/stats\\\\.staleCount\\\\s*>\\\\s*10/)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2441:      expect(fnBody).not.toMatch(/stats\\\\.staleCount\\\\s*>=\\\\s*10/)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2442:      // Warning text must include \\\"stale memories detected\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/context-server.vitest.ts:2443:      expect(fnBody).toMatch(/stale memories detected/)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/feature-eval-scoring-calibration.vitest.ts:108:  // T041-03: LRU eviction removes stale entries, keeps fresh ones\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/feature-eval-scoring-calibration.vitest.ts:109:  it('T041-03: time-based eviction removes stale entries, preserves fresh', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/feature-eval-scoring-calibration.vitest.ts:112:    const staleHash = computeContentHash('stale entry');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/feature-eval-scoring-calibration.vitest.ts:115:    storeEmbedding(db, staleHash, model, makeEmbeddingBuffer(dims, 1), dims);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/feature-eval-scoring-calibration.vitest.ts:118:    // Backdate stale entry to 15 days ago\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/feature-eval-scoring-calibration.vitest.ts:121:    ).run(staleHash);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/feature-eval-scoring-calibration.vitest.ts:128:    expect(lookupEmbedding(db, staleHash, model, dims)).toBeNull();\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-template.test.ts:403:    expect(rewrite.content).not.toContain('  - \\\"stale metadata trigger\\\"');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/memory/migrate-trigger-phrase-residual.ts:7:// canonicalization rules for stale residual cleanup.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/tests/session-cached-consumer.vitest.ts.test.ts:209:  it('matches the frozen corpus outcomes for stale, scope mismatch, fidelity failure, and valid reuse', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/tests/session-cached-consumer.vitest.ts.test.ts:212:        name: 'stale',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/tests/session-cached-consumer.vitest.ts.test.ts:217:        expected: { status: 'rejected', category: 'freshness', reason: 'stale_summary' },\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/tests/session-cached-consumer.vitest.ts.test.ts:354:        name: 'stale',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/tests/coverage-graph-signals.vitest.ts:131:      graph.nodes.set('stale', { id: 'stale' });\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/tests/coverage-graph-signals.vitest.ts:132:      const momentum = signalsModule.computeMomentum(graph, 'stale', 300000);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/setup/install.sh:71:    # Clear stale HuggingFace model cache to prevent version mismatches\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/setup/install.sh:74:        log_info \\\"Clearing stale HuggingFace model cache...\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/setup/install.sh:79:    log_info \\\"Removing stale native modules...\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/tests/progressive-validation.vitest.js:21://   T-PB2-12  --level 2 runs detect + auto-fix only\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/manual_testing_playbook.md:512:Prompt: `Delete stale checkpoint by name. Capture the evidence needed to prove Removed checkpoint absent from list. Return a concise user-facing pass/fail verdict with the main reason.`\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/manual_testing_playbook.md:1316:Prompt: `Validate PI-B3 folder description discovery. Capture the evidence needed to prove description.json exists after create.sh; stale detection triggers on spec.md edit; per-folder files preferred over spec.md fallback; mixed-mode aggregation works; invalid JSON or schema-invalid description.json files are ignored, spec.md fallback is used, and existing files are repaired in place; missing description.json falls back cleanly without implicit backfill; out-of-base or prefix-bypass paths are rejected by realpath containment checks; YAML frontmatter is stripped before description extraction, including CRLF-heavy frontmatter cases; memory_context uses folder routing; regeneration leaves valid JSON on disk with no leftover temp files. Return a concise user-facing pass/fail verdict with the main reason.`\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/manual_testing_playbook.md:1318:description.json exists after create.sh; stale detection triggers on spec.md edit; per-folder files preferred over spec.md fallback; mixed-mode aggregation works; invalid JSON or schema-invalid description.json files are ignored, spec.md fallback is used, and existing files are repaired in place; missing description.json falls back cleanly without implicit backfill; out-of-base or prefix-bypass paths are rejected by realpath containment checks; YAML frontmatter is stripped before description extraction, including CRLF-heavy frontmatter cases; memory_context uses folder routing; regeneration leaves valid JSON on disk with no leftover temp files\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/manual_testing_playbook.md:1540:Prompt: `Run lightweight consolidation cycle (N3-lite). Capture the evidence needed to prove Consolidation cycle completes; contradiction detection, hebbian strengthening, and staleness decay all produce output; no runtime errors in logs. Return a concise user-facing pass/fail verdict with the main reason.`\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/manual_testing_playbook.md:1542:Consolidation cycle completes; contradiction detection, hebbian strengthening, and staleness decay all produce output; no runtime errors in logs\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/manual_testing_playbook.md:1870:Prompt: `Validate graph and cognitive memory fixes. Capture the evidence needed to prove Self-loops prevented; depth clamps enforced; cache invalidation triggers on mutation; no stale cognitive data returned. Return a concise user-facing pass/fail verdict with the main reason.`\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/manual_testing_playbook.md:1872:Self-loops prevented; depth clamps enforced; cache invalidation triggers on mutation; no stale cognitive data returned\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/manual_testing_playbook.md:2305:Prompt: `Validate cross-process DB hot rebinding via marker file. Capture the evidence needed to prove Server detects DB_UPDATED_FILE marker; DB reinitializes without restart; stats reflect post-mutation state (no stale data); health reports healthy after rebind. Return a concise user-facing pass/fail verdict with the main reason.`\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/manual_testing_playbook.md:2307:Server detects DB_UPDATED_FILE marker; DB reinitializes without restart; stats reflect post-mutation state (no stale data); health reports healthy after rebind\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/manual_testing_playbook.md:2612:Verify startup recovery scans allowed roots and preserves stale pending files for manual review.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/manual_testing_playbook.md:2615:Prompt: `Validate startup pending-file recovery behavior across committed and stale files. Capture the evidence needed to prove Committed pending file recovers to original path; stale pending file remains with explicit stale classification; startup scan covers configured/allowed roots without scanning unrelated workspace trees. Return a concise user-facing pass/fail verdict with the main reason.`\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/manual_testing_playbook.md:2617:Committed pending file recovers to original path; stale pending file remains with explicit stale classification; startup scan covers configured/allowed roots without scanning unrelated workspace trees\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/manual_testing_playbook.md:2756:Verify `setInstructions()` is called at MCP startup with memory count, spec folder count, channel list, and stale warning.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/manual_testing_playbook.md:2759:Prompt: `Validate dynamic server instructions at MCP initialization. Capture the evidence needed to prove Startup instructions include memory system overview with counts and channels; stale warning appears only above threshold; disabled flag yields empty instructions. Return a concise user-facing pass/fail verdict with the main reason.`\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/manual_testing_playbook.md:2761:Startup instructions include memory system overview with counts and channels; stale warning appears only above threshold; disabled flag yields empty instructions\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/manual_testing_playbook.md:3745:| 262 | Context Preservation | Session health ok/warning/stale status | [262](22--context-preservation-and-code-graph/262-session-health.md) | [22--context-preservation-and-code-graph/17-session-health-tool.md](../feature_catalog/22--context-preservation-and-code-graph/17-session-health-tool.md) |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/memory/README.md:40:- `cleanup-orphaned-vectors.ts` - remove stale vector rows not linked to active memories\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/19--feature-flag-reference/224-filter-config-contract.md:29:| 224 | Filter Config Contract | Confirm the content-filter loader honors file-backed pipeline settings, stage order, thresholds, and deep-merge fallback behavior | `Validate the filter config contract for filters.jsonc using a disposable fixture. Prove that the pipeline can be disabled cleanly, the configured stage order and threshold values drive filtering behavior when enabled, and malformed or partial config falls back to code defaults without breaking the filter pipeline.` | 1) Copy `config/filters.jsonc` into a disposable sandbox, keep `pipeline.enabled: true`, and set distinctive values for `pipeline.stages`, `noise.minContentLength`, `dedupe.similarityThreshold`, and `quality.warnThreshold`. 2) Run the content-filter pipeline against a fixed prompt list containing short noise entries, exact duplicates, near-duplicates, and low-quality content, then capture which items are removed and in what order. 3) Change the sandbox config to `pipeline.enabled: false`, rerun the same prompt list, and confirm the original prompts are returned unchanged. 4) Re-enable the pipeline but provide only a partial nested override, rerun the fixture, and confirm unspecified defaults such as the remaining stages or quality factors are preserved through deep merge. 5) Replace the sandbox file with malformed JSONC, rerun the fixture, and confirm the loader logs a warning while the filter still runs with built-in defaults. | `pipeline.enabled: false` returns the original prompt list unchanged; enabled runs respect the configured `noise`, `dedupe`, and `quality` stages in the declared order; configured thresholds such as `similarityThreshold` and `warnThreshold` affect filtering decisions; partial overrides preserve unspecified nested defaults; malformed JSONC logs a warning and falls back to built-in defaults | sandbox copies of `filters.jsonc`, captured before or after prompt lists for each run, warning logs from malformed config, and a short note showing which thresholds or stages changed behavior | PASS if filters.jsonc actively controls the filter pipeline while deep-merge fallback keeps the pipeline operational when fields are omitted or the file is malformed | Inspect `scripts/lib/content-filter.ts` loader and merge logic, verify the fixture prompt list actually exercises noise plus dedupe plus quality branches, and confirm the malformed-config run did not silently reuse stale in-memory config from a prior execution |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:2062:      pass('T-032a: scripts retry-manager module removed', 'No stale scripts/lib retry-manager output');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/tests/workflow-e2e.vitest.ts:421:    const dataFile = writeInputFile(harness, 'stale-lock.json', createExplicitJsonInput());\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/tests/workflow-e2e.vitest.ts:425:    const staleAt = new Date(Date.now() - 10_000);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/tests/workflow-e2e.vitest.ts:426:    fs.utimesSync(WORKFLOW_LOCK_DIR, staleAt, staleAt);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/16--tooling-and-scripts/207-watcher-delete-rename-cleanup.md:3:description: \\\"This scenario validates watcher delete/rename cleanup for `207`. It focuses on confirming stale index entries are purged on delete and rename.\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/16--tooling-and-scripts/207-watcher-delete-rename-cleanup.md:10:This scenario validates watcher delete/rename cleanup for `207`. It focuses on confirming stale index entries are purged on delete and rename.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/16--tooling-and-scripts/207-watcher-delete-rename-cleanup.md:16:Operators run the watcher runtime coverage and confirm deleted files are purged from the index, renames clean up old paths and create fresh entries, and debounce handling prevents stale rename bursts from leaving orphaned results.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/16--tooling-and-scripts/207-watcher-delete-rename-cleanup.md:18:- Objective: Confirm delete and rename cleanup remove stale index state\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/16--tooling-and-scripts/207-watcher-delete-rename-cleanup.md:20:- Expected signals: unlink events call removeFn for deleted markdown files; rename removes the old path and indexes the new path; the default 2-second debounce window collapses rapid rename/change bursts to one stable reindex; burst renames keep only the final path indexed; concurrent renames remove all stale paths and keep all renamed paths indexed\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/16--tooling-and-scripts/207-watcher-delete-rename-cleanup.md:21:- Pass/fail: PASS if stale paths are removed, renamed paths are reindexed, and no orphaned entries remain after delete, rename, burst-rename, or concurrent-rename flows\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/16--tooling-and-scripts/207-watcher-delete-rename-cleanup.md:29:| 207 | Watcher delete/rename cleanup | Confirm delete and rename cleanup remove stale index state | `Validate watcher delete/rename cleanup. Capture the evidence needed to prove unlink events call removeFn for deleted markdown files; rename is handled as old-path cleanup plus new-path indexing; the default 2-second debounce window collapses rapid rename/change bursts into a single stable reindex; and burst or concurrent renames leave only the final live paths indexed. Return a concise user-facing pass/fail verdict with the main reason.` | 1) run the file-watcher Vitest suite and capture the delete/unlink scenario where removeFn is called for a deleted markdown file 2) capture the rename lifecycle scenario showing unlink on the old path and add on the new path 3) capture the default-window debounce scenario proving rapid changes within the 2-second window coalesce to one reindex 4) capture the burst-rename scenario showing only the final path remains indexed 5) capture the concurrent-rename scenario showing every stale path is removed and every renamed path is indexed | unlink events call removeFn for deleted markdown files; rename removes the old path and indexes the new path; the default 2-second debounce window collapses rapid rename/change bursts to one stable reindex; burst renames keep only the final path indexed; concurrent renames remove all stale paths and keep all renamed paths indexed | Vitest output for delete/unlink, rename lifecycle, default debounce, burst rename, and concurrent rename cases + any logged indexed-path snapshots used to prove stale entries were removed | PASS if stale paths are removed, renamed paths are reindexed, and no orphaned entries remain after delete, rename, burst-rename, or concurrent-rename flows | Inspect `mcp_server/lib/ops/file-watcher.ts` debounce scheduling, unlink handling, and `removeFn` wiring if stale entries persist or rename paths duplicate |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/core/file-writer.ts:24:    .replace(/^(created_at|created_at_epoch|last_accessed_epoch|expires_at_epoch):.*$/gm, '$1: <normalized>')\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/14--pipeline-architecture/146-dynamic-server-instructions-p1-6.md:3:description: \\\"This scenario validates Dynamic server instructions (P1-6) for `146`. It focuses on Verify `setInstructions()` is called at MCP startup with memory count, spec folder count, channel list, and stale warning.\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/14--pipeline-architecture/146-dynamic-server-instructions-p1-6.md:10:This scenario validates Dynamic server instructions (P1-6) for `146`. It focuses on Verify `setInstructions()` is called at MCP startup with memory count, spec folder count, channel list, and stale warning.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/14--pipeline-architecture/146-dynamic-server-instructions-p1-6.md:18:- Objective: Verify `setInstructions()` is called at MCP startup with memory count, spec folder count, channel list, and stale warning\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/14--pipeline-architecture/146-dynamic-server-instructions-p1-6.md:19:- Prompt: `Validate dynamic server instructions at MCP initialization. Capture the evidence needed to prove Startup instructions include memory system overview with counts and channels; stale warning appears only above threshold; disabled flag yields empty instructions. Return a concise user-facing pass/fail verdict with the main reason.`\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/14--pipeline-architecture/146-dynamic-server-instructions-p1-6.md:20:- Expected signals: Startup instructions include memory system overview with counts and channels; stale warning appears only above threshold; disabled flag yields empty instructions\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/14--pipeline-architecture/146-dynamic-server-instructions-p1-6.md:29:| 146 | Dynamic server instructions (P1-6) | Verify `setInstructions()` is called at MCP startup with memory count, spec folder count, channel list, and stale warning | `Validate dynamic server instructions at MCP initialization. Capture the evidence needed to prove Startup instructions include memory system overview with counts and channels; stale warning appears only above threshold; disabled flag yields empty instructions. Return a concise user-facing pass/fail verdict with the main reason.` | 1) Start the MCP server and capture startup logs 2) Verify `setInstructions()` was called with a non-empty instructions string 3) Verify instructions include: memory count, spec folder count, available channels, and active feature flags 4) If 11+ stale memories exist, verify a stale warning is included 5) Restart with `SPECKIT_DYNAMIC_INIT=false` and verify `setInstructions()` receives an empty string | Startup instructions include memory system overview with counts and channels; stale warning appears only above threshold; disabled flag yields empty instructions | Server startup log + instructions content snapshot + flag toggle comparison | PASS if enabled mode emits overview with counts/channels and disabled mode yields empty string | Inspect `context-server.ts` `buildServerInstructions`, `startup-checks.ts`, and `SPECKIT_DYNAMIC_INIT` flag handling |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/16--tooling-and-scripts/183-runtime-lineage-naming-parity.md:22:- Prompt: `Audit runtime agent naming parity. Capture the evidence needed to prove base (.opencode/agents/) matches Claude and Gemini, Codex traces lineage to base after extension normalization, deep-research is the active name, and stale research naming is absent. Return a concise pass/fail verdict with the main reason.`\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/16--tooling-and-scripts/183-runtime-lineage-naming-parity.md:32:- Pass: normalized basenames match and no stale naming.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:2062:      pass('T-032a: scripts retry-manager module removed', 'No stale scripts/lib retry-manager output');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/14--pipeline-architecture/204-embedding-retry-orchestrator.md:29:| 204 | Embedding retry orchestrator | Verify failed embeddings fall back to pending lexical-only storage and are later repaired by the background retry manager with retry/backoff tracking | \\\"Validate the embedding retry orchestrator. Capture the evidence needed to prove a save or index operation can persist a memory with `embedding_status='pending'` when the provider is unavailable; the retry manager later picks up pending items in batch; cache dedup avoids redundant embedding calls where possible; retry counts/backoff state advance on repeated failures; and a successful retry refreshes the stored vector/index state. Return a concise user-facing pass/fail verdict with the main reason.\\\" | 1) Simulate embedding-provider unavailability during `memory_save` or `memory_index_scan` 2) Confirm the memory is still saved and marked pending without vectors, with lexical-only fallback intact 3) Restore provider availability and run or wait for the retry manager batch job 4) Confirm pending items are retried, retry counters/backoff metadata update appropriately, and cache reuse is visible when content was embedded before 5) Verify successful retry clears the pending state and refreshes vector/index rows for the affected memory | Provider outage yields saved memory with pending embedding status and lexical-only fallback; retry manager scans and processes pending items; embedding cache participates in deduplication; retry count/progressive backoff state changes across failures; successful retry updates memory index and vector storage | Save/index transcript during outage + pending status evidence + retry-manager run output + cache/retry stats + final vector/index state after recovery | PASS if pending memories remain searchable lexically during outage and are later upgraded with vectors by retry orchestration; FAIL if failed embeddings are dropped, pending items are never retried, or success does not refresh index/vector state | Inspect retry-manager batch selection and backoff logic; verify embedding cache reuse; check pending-status persistence during fallback; confirm retry success path clears stale vector rows and writes refreshed embeddings |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/core/workflow.ts:399:    // Best-effort stale lock cleanup.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/tests/progressive-validation.vitest.js:21://   T-PB2-12  --level 2 runs detect + auto-fix only\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/tests/workflow-e2e.vitest.ts:421:    const dataFile = writeInputFile(harness, 'stale-lock.json', createExplicitJsonInput());\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/tests/workflow-e2e.vitest.ts:425:    const staleAt = new Date(Date.now() - 10_000);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/tests/workflow-e2e.vitest.ts:426:    fs.utimesSync(WORKFLOW_LOCK_DIR, staleAt, staleAt);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/14--pipeline-architecture/112-cross-process-db-hot-rebinding.md:19:- Prompt: `Validate cross-process DB hot rebinding via marker file. Capture the evidence needed to prove Server detects DB_UPDATED_FILE marker; DB reinitializes without restart; stats reflect post-mutation state (no stale data); health reports healthy after rebind. Return a concise user-facing pass/fail verdict with the main reason.`\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/14--pipeline-architecture/112-cross-process-db-hot-rebinding.md:20:- Expected signals: Server detects DB_UPDATED_FILE marker; DB reinitializes without restart; stats reflect post-mutation state (no stale data); health reports healthy after rebind\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/14--pipeline-architecture/112-cross-process-db-hot-rebinding.md:21:- Pass/fail: PASS if server detects marker file, reinitializes DB, returns current (non-stale) data, and health is healthy\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/14--pipeline-architecture/112-cross-process-db-hot-rebinding.md:29:| 112 | Cross-process DB hot rebinding | Confirm marker-file triggers DB reinitialization | `Validate cross-process DB hot rebinding via marker file. Capture the evidence needed to prove Server detects DB_UPDATED_FILE marker; DB reinitializes without restart; stats reflect post-mutation state (no stale data); health reports healthy after rebind. Return a concise user-facing pass/fail verdict with the main reason.` | 1) start MCP server 2) create a test memory via MCP: `memory_save(filePath)` and note its title 3) from a separate terminal, run `node cli.js bulk-delete --tier scratch --folder specs/test-sandbox` (non-dry-run — this mutates the DB and writes the `DB_UPDATED_FILE` marker) 4) immediately call `memory_stats()` via MCP → verify server detects marker and reinitializes DB 5) verify no stale data from pre-rebind state 6) run `memory_health()` → verify healthy status post-rebind | Server detects DB_UPDATED_FILE marker; DB reinitializes without restart; stats reflect post-mutation state (no stale data); health reports healthy after rebind | memory_stats output post-rebind + memory_health output + marker file detection evidence | PASS if server detects marker file, reinitializes DB, returns current (non-stale) data, and health is healthy | Inspect DB_UPDATED_FILE marker path and detection logic; verify DB reinitialization clears caches; check for stale connection handles |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/tests/coverage-graph-signals.vitest.ts:131:      graph.nodes.set('stale', { id: 'stale' });\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/tests/coverage-graph-signals.vitest.ts:132:      const momentum = signalsModule.computeMomentum(graph, 'stale', 300000);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/evals/check-source-dist-alignment.ts:11://   2026-03-07. No matching source remains, so the stale dist\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/evals/check-source-dist-alignment.ts:16://   mcp_server/lib/eval/memory-state-baseline.ts, so the stale\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/evals/check-source-dist-alignment.ts:181:    console.error('\\\\nRemove stale dist outputs, restore missing source files, or add a time-bounded allowlist entry.');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/16--tooling-and-scripts/151-module-map-accuracy.md:37:| 151 | MODULE_MAP.md accuracy | Verify 5 module entries match actual code | `Validate MODULE_MAP.md accuracy by spot-checking 5 modules (config, cognitive, search, storage, scoring). For each: verify listed key files exist, verify primary consumers are accurate via grep. Return a pass/fail verdict per module.` | 1) `cd .opencode/skills/system-spec-kit` 2) Read MODULE_MAP.md entries for config, cognitive, search, storage, scoring 3) For each module: `ls mcp_server/lib/{module}/` to verify key files exist 4) For each module: `grep -r \\\"from.*/{module}/\\\" mcp_server/ --include=\\\"*.ts\\\" -l` to verify consumers 5) Compare against MODULE_MAP.md listings | All 5 modules have accurate file lists and consumer mappings | ls output + grep output per module vs MODULE_MAP.md entries | PASS if all 5 sampled modules are accurate | Identify stale entry -> update MODULE_MAP.md -> re-verify |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-template.test.ts:403:    expect(rewrite.content).not.toContain('  - \\\"stale metadata trigger\\\"');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/14--pipeline-architecture/218-mcp-server-public-api-barrel.md:29:| 218 | MCP Server Public API Barrel | Verify the top-level barrel re-exports the approved runtime, helper, and metadata surfaces from one stable import boundary | `Validate the MCP server public API barrel. Capture the evidence needed to prove external consumers can import approved evaluation, indexing, search, provider, storage, helper, and rollout-metadata surfaces from \\\\`mcp_server/api\\\\` without deep-linking into internal \\\\`lib/\\\\`, \\\\`core/\\\\`, or \\\\`handlers/\\\\` modules, and that the README reinforces this contract. Return a concise user-facing pass/fail verdict with the main reason.` | 1) Inspect `mcp_server/api/index.ts` and capture the top-level export groups and promoted helper surfaces 2) Cross-check those exports against `api/eval.ts`, `api/indexing.ts`, `api/search.ts`, `api/providers.ts`, and `api/storage.ts` plus the curated internal helper modules named in the catalog 3) Inspect `mcp_server/api/README.md` and confirm consumer guidance points to `api/` as the supported boundary 4) Run a barrel import smoke test or equivalent script check that accesses representative symbols from each export family through `mcp_server/api` only | `mcp_server/api/index.ts` re-exports the documented evaluation, indexing, search, provider, storage, helper, and metadata symbols; `mcp_server/api/README.md` names `api/` as the approved public surface; consumers can rely on one stable top-level barrel | Barrel export capture + README policy snippet + cross-check notes against sub-barrels and curated helper sources + import smoke-test transcript or equivalent proof | PASS if the barrel centralizes the approved public import contract and the docs steer consumers to `api/`; FAIL if required exports are missing, helper surfaces require internal imports, or the docs contradict the barrel policy | Inspect `mcp_server/api/index.ts` for stale or missing re-exports -> verify renamed helper symbols still match the barrel contract -> check `mcp_server/api/README.md` for outdated consumer guidance -> confirm callers are not forced back to internal paths for metadata or rollout helpers |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/tests/session-cached-consumer.vitest.ts.test.ts:209:  it('matches the frozen corpus outcomes for stale, scope mismatch, fidelity failure, and valid reuse', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/tests/session-cached-consumer.vitest.ts.test.ts:212:        name: 'stale',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/tests/session-cached-consumer.vitest.ts.test.ts:217:        expected: { status: 'rejected', category: 'freshness', reason: 'stale_summary' },\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/tests/session-cached-consumer.vitest.ts.test.ts:354:        name: 'stale',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/04--maintenance/014-workspace-scanning-and-indexing-memory-index-scan.md:19:- Prompt: `Run the incremental scan flow and the targeted atomic lease checks for memory_index_scan. Capture the evidence needed to prove scan summary and updated index state, that spec documents remain indexed in warn-only quality mode, and that scan leases reserve scan_started_at atomically, reject overlapping fresh scans, expire stale crashed-scan leases, and only move to last_index_scan on completion. Return a concise user-facing pass/fail verdict with the main reason.`\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/04--maintenance/014-workspace-scanning-and-indexing-memory-index-scan.md:20:- Expected signals: Scan summary, updated index state, spec-doc warn-only indexing behavior, atomic lease reservation, rejection wait time, stale-lease expiry, and completion handoff to `last_index_scan`\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/04--maintenance/014-workspace-scanning-and-indexing-memory-index-scan.md:32:| EX-014 | Workspace scanning and indexing (memory_index_scan) | Stale crashed-scan leases expire and allow a fresh reservation | `Run the stale-lease expiry validation. Capture the evidence needed to prove an expired scan_started_at lease is cleared and replaced by a fresh reservation so crashed scans do not block future indexing forever. Return a concise user-facing pass/fail verdict with the main reason.` | `cd .opencode/skills/system-spec-kit/mcp_server` -> `npm test -- --run tests/db-state.vitest.ts -t \\\"expires stale scan lease and allows a fresh reservation\\\"` | Expired `scan_started_at` is removed and the new reservation succeeds | Targeted test transcript showing stale-lease expiry and fresh reservation | PASS if the targeted test passes and the refreshed lease uses the current reservation timestamp | Inspect `core/db-state.ts` `clearStaleScanLease()` and `SPECKIT_INDEX_SCAN_LEASE_EXPIRY_MS` handling if expired leases keep blocking scans |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/13--memory-quality-and-indexing/042-spec-folder-description-discovery-pi-b3.md:19:- Prompt: `Validate PI-B3 folder description discovery. Capture the evidence needed to prove description.json exists after create.sh; stale detection triggers on spec.md edit; per-folder files preferred over spec.md fallback; mixed-mode aggregation works; invalid JSON or schema-invalid description.json files are ignored, spec.md fallback is used, and existing files are repaired in place; missing description.json falls back cleanly without implicit backfill; out-of-base or prefix-bypass paths are rejected by realpath containment checks; YAML frontmatter is stripped before description extraction, including CRLF-heavy frontmatter cases; memory_context uses folder routing; regeneration leaves valid JSON on disk with no leftover temp files. Return a concise user-facing pass/fail verdict with the main reason.`\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/13--memory-quality-and-indexing/042-spec-folder-description-discovery-pi-b3.md:20:- Expected signals: description.json exists after create.sh; stale detection triggers on spec.md edit; per-folder files preferred over spec.md fallback; mixed-mode aggregation works; invalid JSON or schema-invalid description.json files are ignored, spec.md fallback is used, and existing files are repaired in place; missing description.json falls back cleanly without implicit backfill; out-of-base or prefix-bypass paths are rejected by realpath containment checks; YAML frontmatter is stripped before description extraction, including CRLF-heavy frontmatter cases; memory_context uses folder routing; regeneration leaves valid JSON on disk with no leftover temp files\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/13--memory-quality-and-indexing/042-spec-folder-description-discovery-pi-b3.md:21:- Pass/fail: PASS: description.json created, stale detection works, per-folder preferred, mixed aggregation correct, no crash on corrupt description.json, invalid metadata repaired on regeneration, missing files fall back without implicit writes, traversal attempts rejected, frontmatter stripping works for CRLF-heavy files, folder routing active, and regenerated files are valid JSON with no leftover temp files; FAIL: Any of the scenario checks fails\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/13--memory-quality-and-indexing/042-spec-folder-description-discovery-pi-b3.md:29:| 042 | Spec folder description discovery (PI-B3) | Confirm per-folder + aggregated routing | `Validate PI-B3 folder description discovery. Capture the evidence needed to prove description.json exists after create.sh; stale detection triggers on spec.md edit; per-folder files preferred over spec.md fallback; mixed-mode aggregation works; invalid JSON or schema-invalid description.json files are ignored, spec.md fallback is used, and existing files are repaired in place; missing description.json falls back cleanly without implicit backfill; out-of-base or prefix-bypass paths are rejected by realpath containment checks; YAML frontmatter is stripped before description extraction, including CRLF-heavy frontmatter cases; memory_context uses folder routing; regeneration leaves valid JSON on disk with no leftover temp files. Return a concise user-facing pass/fail verdict with the main reason.` | 1) Create spec folder via create.sh → verify description.json exists 2) Edit spec.md → verify isPerFolderDescriptionStale detects change 3) Run generateFolderDescriptions → verify per-folder files preferred over spec.md 4) Mixed mode: some folders with/without description.json → verify aggregation 5) Corrupt description.json with invalid JSON and schema-invalid field types → run generateFolderDescriptions() and verify spec.md fallback plus repaired description.json 6) Verify missing description.json falls back to spec.md without forcing a write 7) Attempt generation against an out-of-base or prefix-bypass path → verify rejection and no file written 8) Use spec.md with large YAML frontmatter and CRLF-heavy line endings → verify extracted description comes from post-frontmatter content 9) Run memory_context query → verify short-circuit folder routing | description.json exists after create.sh; stale detection triggers on spec.md edit; per-folder files preferred over spec.md fallback; mixed-mode aggregation works; invalid JSON or schema-invalid description.json files are ignored, spec.md fallback is used, and existing files are repaired in place; missing description.json falls back cleanly without implicit backfill; out-of-base or prefix-bypass paths are rejected by realpath containment checks; YAML frontmatter is stripped before description extraction, including CRLF-heavy frontmatter cases; memory_context uses folder routing; regeneration leaves valid JSON on disk with no leftover temp files | description.json content + stale detection output + folder routing trace in memory_context + recovery evidence for corrupt/schema-invalid description.json files + missing-file fallback evidence + rejection evidence for traversal attempts + proof of valid regenerated JSON with no leftover temp files | PASS: description.json created, stale detection works, per-folder preferred, mixed aggregation correct, no crash on corrupt description.json, invalid metadata repaired on regeneration, missing files fall back without implicit writes, traversal attempts rejected, frontmatter stripping works for CRLF-heavy files, folder routing active, and regenerated files are valid JSON with no leftover temp files; FAIL: Any of the scenario checks fails | Verify create.sh generates description.json → Check stale detection mtime comparison → Inspect generateFolderDescriptions preference logic and repair path → Confirm missing-file fallback does not backfill unexpectedly → Verify realpath containment rejects traversal/prefix-bypass paths → Confirm frontmatter stripping happens before description extraction → Verify memory_context folder routing |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/13--memory-quality-and-indexing/044-reconsolidation-on-save-tm-06.md:10:This scenario validates Reconsolidation-on-save (TM-06) for `044`. It focuses on confirming merge/deprecate thresholds plus the stale-predecessor and BM25-repair safety paths.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/13--memory-quality-and-indexing/044-reconsolidation-on-save-tm-06.md:18:- Objective: Confirm merge/deprecate thresholds plus stale-merge abort and BM25 repair-flag persistence\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/13--memory-quality-and-indexing/044-reconsolidation-on-save-tm-06.md:19:- Prompt: `Validate reconsolidation-on-save (TM-06). Capture the evidence needed to prove Similarity >=0.88 triggers merge; 0.75-0.88 triggers supersede/deprecate; below 0.75 saves independently; stale predecessor changes abort merge with predecessor_changed or predecessor_gone; and failed post-commit BM25 repair persists bm25_repair_needed=1 on the merged row. Return a concise user-facing pass/fail verdict with the main reason.`\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/13--memory-quality-and-indexing/044-reconsolidation-on-save-tm-06.md:20:- Expected signals: Similarity >=0.88 triggers merge; 0.75-0.88 triggers supersede/deprecate; below 0.75 saves independently; stale predecessor changes abort merge instead of archiving/inserting; BM25 repair failure leaves merged lineage committed and sets `bm25_repair_needed=1`\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/13--memory-quality-and-indexing/044-reconsolidation-on-save-tm-06.md:21:- Pass/fail: PASS: Threshold behavior is correct, stale predecessor writes return `predecessor_changed` or `predecessor_gone` without destructive merge side effects, and failed BM25 repair persists `bm25_repair_needed=1`; FAIL: Wrong threshold action, stale merge still commits, or BM25 repair debt is not recorded\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/13--memory-quality-and-indexing/044-reconsolidation-on-save-tm-06.md:30:| 044 | Reconsolidation-on-save (TM-06) | Abort stale merge when predecessor changes before commit | `Validate reconsolidation-on-save (TM-06) stale-predecessor protection. Reproduce a case where executeMerge() snapshots a predecessor, another writer updates that predecessor during embedding generation, and the merge path returns predecessor_changed or predecessor_gone instead of archiving/inserting a stale merged row. Capture the evidence needed to prove the original predecessor remains the only active row after the abort. Return a concise user-facing pass/fail verdict with the main reason.` | 1) Seed a merge-eligible predecessor with known `content_hash` and `updated_at` 2) start merge with async embedding generation 3) mutate, archive, or delete the predecessor before the transaction body resumes 4) verify complement-style abort with `predecessor_changed` or `predecessor_gone` 5) verify no merged row was inserted and predecessor lineage stayed intact 6) `npx vitest run .opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts -t \\\\\\\"Aborts merge when predecessor changes during embedding generation\\\\\\\"` | Merge returns `action: complement` with `status: predecessor_changed` or `status: predecessor_gone`; no stale merged row is inserted; predecessor row reflects only the concurrent writer change | Targeted vitest output plus `memory_index` row dump showing the predecessor remained active and no new merged row was created | PASS: Stale predecessor detection blocks the merge and preserves the current predecessor state; FAIL: Merge still archives/inserts despite predecessor mutation or deletion | Verify predecessor snapshot capture (`content_hash`, `updated_at`) → Check in-transaction reload → Inspect `hasPredecessorChanged()` branch → Confirm archive/delete handling |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/11--scoring-and-calibration/196-tool-level-ttl-cache.md:19:- Prompt: `Verify the tool-level TTL cache on a repeated expensive request. Run the same request twice within the active TTL window and confirm the second run is served from the per-tool cache using the same SHA-256 cache key. Then invalidate the relevant search path with a mutation or wait for TTL expiry and verify the next run recomputes instead of serving stale data. Capture hit, miss, eviction or invalidation evidence and return a concise user-facing pass/fail verdict with the main reason.`\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/11--scoring-and-calibration/196-tool-level-ttl-cache.md:20:- Expected signals: first run records a cache miss for the tool/input combination; second identical run records a cache hit for the same SHA-256 key; cache stats reflect hits, misses, and invalidations; a relevant mutation or TTL expiry forces recomputation instead of returning stale results\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/11--scoring-and-calibration/196-tool-level-ttl-cache.md:21:- Pass/fail: PASS: identical repeat work hits the cache within TTL and recomputes after targeted invalidation or TTL expiry; FAIL: repeat work misses unexpectedly, stale data survives mutation/expiry, or cache accounting contradicts observed behavior\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/11--scoring-and-calibration/196-tool-level-ttl-cache.md:29:| 196 | Tool-level TTL cache | Confirm per-tool cache hits, TTL expiry, and mutation-driven invalidation | `Verify the tool-level TTL cache on a repeated expensive request. Run the same request twice within the active TTL window and confirm the second run is served from the per-tool cache using the same SHA-256 cache key. Then invalidate the relevant search path with a mutation or wait for TTL expiry and verify the next run recomputes instead of serving stale data. Capture hit, miss, eviction or invalidation evidence and return a concise user-facing pass/fail verdict with the main reason.` | 1) Confirm current cache settings, including active TTL window 2) Run a repeatable expensive request such as the same `memory_search` twice with identical inputs 3) Inspect cache stats or trace output to confirm miss then hit on the same tool/input key 4) Perform a relevant mutation such as `memory_save`, `memory_update`, or `memory_delete`, or wait past TTL expiry 5) Re-run the same request and confirm recomputation plus invalidation or expiry accounting | First run is a miss; second identical run is a hit; cache key is stable for identical tool+input; stats show hit/miss/invalidation activity; post-mutation or post-expiry run recomputes instead of returning stale data | Terminal transcript, cache stats or logs, repeated request output, and post-mutation or post-expiry rerun evidence | PASS: second identical run is a cache hit and the next run after invalidation or expiry recomputes cleanly; FAIL: repeated request misses inside TTL, stale results survive invalidation, or stats contradict the observed behavior | Verify TTL config and max-entry settings -> Confirm identical tool/input payloads were used -> Inspect cache-key hashing and per-tool scoping -> Check mutation hook invalidation path -> Review expiry cleanup timing and oldest-entry eviction behavior |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/11--scoring-and-calibration/197-access-driven-popularity-scoring.md:19:- Prompt: `Verify access-driven popularity scoring with two comparable memories. Repeatedly retrieve one target memory enough times to push the in-memory access accumulator past the flush threshold, then confirm the persisted access count and last_accessed fields update while a comparable control memory does not. Re-run a ranking query and confirm the more frequently accessed memory receives a stronger popularity contribution. Capture accumulator, flush, ranking, and dormancy evidence and return a concise user-facing pass/fail verdict with the main reason.`\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/11--scoring-and-calibration/197-access-driven-popularity-scoring.md:20:- Expected signals: each retrieval increments the in-memory accumulator by 0.1; accumulated access flushes after the threshold is crossed; persisted `access_count` and `last_accessed` update for the hot memory; composite scoring reflects a popularity boost for the more frequently accessed memory; untouched control evidence remains comparatively colder for dormancy analysis\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/11--scoring-and-calibration/197-access-driven-popularity-scoring.md:29:| 197 | Access-driven popularity scoring | Confirm batched access accumulation, thresholded flushes, and popularity-driven ranking effects | `Verify access-driven popularity scoring with two comparable memories. Repeatedly retrieve one target memory enough times to push the in-memory access accumulator past the flush threshold, then confirm the persisted access count and last_accessed fields update while a comparable control memory does not. Re-run a ranking query and confirm the more frequently accessed memory receives a stronger popularity contribution. Capture accumulator, flush, ranking, and dormancy evidence and return a concise user-facing pass/fail verdict with the main reason.` | 1) Prepare or identify two comparable memories that match the same retrieval query 2) Run the shared query once to establish a baseline ranking 3) Retrieve the target memory repeatedly until the accumulator crosses the flush threshold 4) Inspect accumulator state and persisted `access_count` plus `last_accessed` for target vs control 5) Re-run the ranking query and compare popularity-sensitive ordering and dormancy signals | Accumulator rises in 0.1 steps; flush occurs after the threshold is crossed; persisted fields update for the target memory; composite scoring or ranking reflects a popularity boost; colder control memory remains relatively less active for dormancy purposes | Baseline and post-access query results, accumulator snapshots, persisted access metadata, and operator transcript | PASS: target retrievals batch correctly, persistence updates are visible, and the hot memory gains a measurable popularity advantage; FAIL: accumulator does not flush, persisted metadata does not change, or ranking stays indistinguishable from baseline without explanation | Verify repeated retrievals hit the same target memory -> Inspect accumulator threshold and flush path -> Check `access_count` and `last_accessed` persistence writes -> Review composite scoring popularity contribution -> Confirm dormancy logic is reading updated access data |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/13--memory-quality-and-indexing/165-assistive-reconsolidation-speckit-assistive-reconsolidation.md:20:- Expected signals: similarity >= 0.96 returns 'auto_merge' and archives the older row; 0.88 <= similarity < 0.96 returns 'review' with AssistiveRecommendation logged; similarity < 0.88 returns 'keep_separate'; review tier produces classification (supersede/complement/keep_separate) without destructive action; companion merge guard aborts stale merge attempts with `predecessor_changed` or `predecessor_gone`\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/13--memory-quality-and-indexing/165-assistive-reconsolidation-speckit-assistive-reconsolidation.md:21:- Pass/fail: PASS if auto-merge triggers at >= 0.96, recommendation logs for review tier, no destructive action occurs for borderline pairs, and predecessor-change detection blocks stale companion merges; FAIL if tier classification is wrong, review tier mutates state, or stale predecessor changes still commit a merge\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/13--memory-quality-and-indexing/165-assistive-reconsolidation-speckit-assistive-reconsolidation.md:30:| 165 | Assistive reconsolidation (SPECKIT_ASSISTIVE_RECONSOLIDATION) | Verify predecessor change detection in companion reconsolidation path | `Test SPECKIT_ASSISTIVE_RECONSOLIDATION=true with companion reconsolidation safety. Reproduce a merge-eligible predecessor that changes during async embedding generation and capture the evidence needed to prove the shared reconsolidation path returns predecessor_changed or predecessor_gone instead of stale-merging while assistive behavior remains non-destructive. Return a concise user-facing pass/fail verdict with the main reason.` | 1) Enable `SPECKIT_ASSISTIVE_RECONSOLIDATION=true` 2) seed a merge-eligible predecessor used by the companion reconsolidation module 3) begin async merge preparation 4) mutate, archive, or delete the predecessor before transaction re-read 5) verify `predecessor_changed` or `predecessor_gone` is surfaced and no stale merged row is inserted 6) `npx vitest run .opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts -t \\\\\\\"Aborts merge when predecessor changes during embedding generation\\\\\\\"` | Companion merge path aborts with `predecessor_changed` or `predecessor_gone`; no stale merged row is inserted; assistive layer remains recommendation/shadow-only rather than performing a destructive content merge | Targeted vitest output plus DB evidence showing no merged row was inserted after predecessor mutation | PASS if predecessor mutation blocks the companion merge and assistive behavior remains non-destructive; FAIL if stale merge still commits or assistive layer mutates state outside its documented bounds | Verify predecessor snapshot comparison (`content_hash`, `updated_at`) → Check shared reconsolidation guardrails → Confirm assistive bridge still limits itself to shadow-archive/recommend behavior |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/README.md:111:CocoIndex (semantic search) finds code by concept. Code Graph (structural) maps what connects to what. Startup and recovery surfaces now report freshness-aware graph state, structural read paths return a `readiness` block, and lightly stale graphs may repair inline with bounded `selective_reindex` while empty or broadly stale graphs stay on the explicit `code_graph_scan` path.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/README.md:540:| `check-template-staleness.sh` | Detect templates that need regeneration                                                        |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/README.md:932:**Common causes**: The embedding index is stale, or the query is too vague for intent classification.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/22--context-preservation-and-code-graph/257-working-set-compaction.md:32:  - FAIL: Scoring order incorrect (stale files rank above recent), eviction not triggered, serialization loses data, or merger output missing tracked files\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/10--graph-signal-activation/081-graph-and-cognitive-memory-fixes.md:19:- Prompt: `Validate graph and cognitive memory fixes. Capture the evidence needed to prove Self-loops prevented; depth clamps enforced; cache invalidation triggers on mutation; no stale cognitive data returned. Return a concise user-facing pass/fail verdict with the main reason.`\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/10--graph-signal-activation/081-graph-and-cognitive-memory-fixes.md:20:- Expected signals: Self-loops prevented; depth clamps enforced; cache invalidation triggers on mutation; no stale cognitive data returned\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/10--graph-signal-activation/081-graph-and-cognitive-memory-fixes.md:29:| 081 | Graph and cognitive memory fixes | Confirm graph/cognitive fix bundle | `Validate graph and cognitive memory fixes. Capture the evidence needed to prove Self-loops prevented; depth clamps enforced; cache invalidation triggers on mutation; no stale cognitive data returned. Return a concise user-facing pass/fail verdict with the main reason.` | 1) trigger self-loop/depth/cache scenarios 2) verify clamps/invalidations 3) capture results | Self-loops prevented; depth clamps enforced; cache invalidation triggers on mutation; no stale cognitive data returned | Self-loop attempt output + depth clamp evidence + cache invalidation trace | PASS if self-loops are blocked, depth stays within clamped bounds, and cache invalidates correctly on mutation | Inspect self-loop guard logic; verify depth clamp constants; check cache invalidation trigger points |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/15--retrieval-enhancements/058-lightweight-consolidation-n3-lite.md:19:- Prompt: `Run lightweight consolidation cycle (N3-lite). Capture the evidence needed to prove Consolidation cycle completes; contradiction detection, hebbian strengthening, and staleness decay all produce output; no runtime errors in logs. Return a concise user-facing pass/fail verdict with the main reason.`\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/15--retrieval-enhancements/058-lightweight-consolidation-n3-lite.md:20:- Expected signals: Consolidation cycle completes; contradiction detection, hebbian strengthening, and staleness decay all produce output; no runtime errors in logs\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/15--retrieval-enhancements/058-lightweight-consolidation-n3-lite.md:29:| 058 | Lightweight consolidation (N3-lite) | Confirm maintenance cycle behavior | `Run lightweight consolidation cycle (N3-lite). Capture the evidence needed to prove Consolidation cycle completes; contradiction detection, hebbian strengthening, and staleness decay all produce output; no runtime errors in logs. Return a concise user-facing pass/fail verdict with the main reason.` | 1) trigger cycle 2) inspect contradiction/hebbian/staleness outputs 3) verify logs | Consolidation cycle completes; contradiction detection, hebbian strengthening, and staleness decay all produce output; no runtime errors in logs | Consolidation cycle output + log entries for each sub-step (contradiction/hebbian/staleness) | PASS if all three consolidation sub-processes execute and produce expected outputs without errors | Check consolidation trigger mechanism; inspect individual sub-process logs; verify database state before and after cycle |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/22--context-preservation-and-code-graph/266-context-metrics.md:16:- **Objective**: Verify that the context-metrics module correctly tracks session events (tool_call, memory_recovery, code_graph_query, spec_folder_change) and computes QualityScore with 4 weighted factors. The recency factor must decay over time (1.0 for recent, lower as time passes). The recovery factor must be 1.0 after a memory_recovery event. The graphFreshness factor must reflect actual code graph state (1.0 fresh, 0.5 stale, 0.0 empty). The continuity factor must decrease on spec folder transitions. The composite score must map to quality levels: healthy (>= 0.7), degraded (>= 0.4), critical (< 0.4).\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/22--context-preservation-and-code-graph/263-session-resume.md:16:- **Objective**: Verify that session_resume performs its recovery sub-calls (memory_context resume, code graph status, CocoIndex availability), appends the shared structural ready/stale/missing contract, and merges everything into a single SessionResumeResult. Each sub-call failure must be captured as an error entry with recovery hints rather than failing the entire call. The response must include memory (resume context), codeGraph (status/ok/empty/error with counts), cocoIndex (available boolean with binary path), structuralContext (`status`, `summary`, `recommendedAction`, `sourceSurface`, plus freshness guidance), and hints array.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/22--context-preservation-and-code-graph/263-session-resume.md:21:- **Prompt**: `Validate 263 Session resume. Call session_resume and confirm: (1) memory field contains resume context from memory_context, (2) codeGraph field has status (ok/empty/error), nodeCount, edgeCount, fileCount, lastScan, (3) cocoIndex field has available boolean and binaryPath, (4) structuralContext reports ready/stale/missing correctly and includes summary, recommendedAction, and sourceSurface, and (5) hints array includes session_bootstrap guidance when structural context is degraded.`\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/22--context-preservation-and-code-graph/263-session-resume.md:26:  - structuralContext.status is one of `ready`, `stale`, `missing`\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/22--context-preservation-and-code-graph/263-session-resume.md:42:| 263d | Session resume tool | Structural readiness and recovery hinting | `Validate 263d structural context` | Call `session_resume({})` via MCP in both healthy and degraded graph states | structuralContext.status in [ready, stale, missing]; structuralContext.summary/recommendedAction/sourceSurface present; degraded states mention session_bootstrap in hints | session_resume response JSON structuralContext + hints | PASS if structural contract fields are surfaced and degraded states recommend session_bootstrap; FAIL if required contract fields are missing or recovery hint is wrong | Check buildStructuralBootstrapContract() and degraded hint injection in session-resume.ts |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/22--context-preservation-and-code-graph/262-session-health.md:2:title: \\\"262 -- Session health reports ok/warning/stale status\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/22--context-preservation-and-code-graph/262-session-health.md:6:# 262 -- Session health reports ok/warning/stale status\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/22--context-preservation-and-code-graph/262-session-health.md:16:- **Objective**: Verify that session_health correctly computes session status based on time thresholds: ok (last tool call within 15 minutes), warning (within 60 minutes), stale (beyond 60 minutes or session older than 24 hours). Response must include structured details (sessionAgeMs, lastToolCallAgoMs, graphFreshness, specFolder, primingStatus), a QualityScore with 4 factors (recency, recovery, graphFreshness, continuity), and actionable hints.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/22--context-preservation-and-code-graph/262-session-health.md:24:  - graphFreshness is one of: fresh, stale, empty, error\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/22--context-preservation-and-code-graph/262-session-health.md:38:| 262b | Session health tool | Detail fields and graph freshness | `Validate 262b detail fields` | Call `session_health({})` | sessionAgeMs > 0, lastToolCallAgoMs >= 0, graphFreshness in [fresh, stale, empty, error], primingStatus in [primed, not_primed] | Response fields and values | PASS if all detail fields present with valid values | Check getCodeGraphStatusSnapshot() and getSessionTimestamps() |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/22--context-preservation-and-code-graph/265-gemini-hooks.md:21:- **Prompt**: `Validate 265 Gemini hooks. Simulate a Gemini SessionStart event with source=startup. Confirm: (1) session-prime.ts reads JSON from stdin with session_id, (2) output is JSON with hookSpecificOutput.additionalContext containing session context, (3) compact-inject.ts performs one-shot injection on BeforeAgent, (4) shared.ts parseGeminiStdin correctly parses Gemini input format, (5) stale cache (>30 min) is rejected.`\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/22--context-preservation-and-code-graph/265-gemini-hooks.md:28:  - PASS: Session-prime delivers context on startup, compact-inject is one-shot, stdin parsing works, stale cache rejected\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/22--context-preservation-and-code-graph/265-gemini-hooks.md:29:  - FAIL: Invalid output format, additionalContext missing, compact-inject repeats, or stale cache accepted\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/22--context-preservation-and-code-graph/260-code-graph-auto-trigger.md:3:description: \\\"This scenario validates Code graph auto-trigger for 260. It focuses on verifying ensureCodeGraphReady() detects empty/stale graphs and auto-indexes.\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/22--context-preservation-and-code-graph/260-code-graph-auto-trigger.md:16:- **Objective**: Verify that ensureCodeGraphReady() correctly detects graph freshness state (fresh/stale/empty) and triggers the appropriate action (none/full_scan/selective_reindex). On an empty graph, a full scan must fire. When git HEAD has changed and files are stale, selective reindex must fire for changed files (up to 50). When more than 50 files are stale, a full rescan must trigger. The 10-second timeout must abort long-running indexing.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/22--context-preservation-and-code-graph/260-code-graph-auto-trigger.md:25:  - After file modification: action=selective_reindex with stale file listed\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/22--context-preservation-and-code-graph/260-code-graph-auto-trigger.md:28:  - PASS: Auto-trigger correctly detects all three states (empty/stale/fresh) and performs correct action\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/22--context-preservation-and-code-graph/260-code-graph-auto-trigger.md:29:  - FAIL: Missing auto-trigger on empty graph, stale files not detected, or timeout causes crash\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/21--implement-and-remove-deprecated-features/232-adaptive-fusion-flag-drift.md:3:description: \\\"This scenario validates Adaptive-fusion flag drift for `232`. It focuses on confirming live hybrid search always applies adaptive fusion while the install guide still documents a stale disable switch.\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/21--implement-and-remove-deprecated-features/232-adaptive-fusion-flag-drift.md:10:This scenario validates Adaptive-fusion flag drift for `232`. It focuses on confirming live hybrid search always applies adaptive fusion while the install guide still documents a stale disable switch.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/21--implement-and-remove-deprecated-features/232-adaptive-fusion-flag-drift.md:18:- Objective: Confirm live hybrid search always applies adaptive fusion while the install guide still documents a stale disable switch\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/21--implement-and-remove-deprecated-features/232-adaptive-fusion-flag-drift.md:21:- Pass/fail: PASS if the targeted checks prove adaptive fusion stays active in the live runtime path while the install guide still reflects stale flag-toggle guidance\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/21--implement-and-remove-deprecated-features/232-adaptive-fusion-flag-drift.md:29:| 232 | Adaptive-fusion flag drift | Confirm live hybrid search always applies adaptive fusion while the install guide still documents a stale disable switch | `Validate that live hybrid search still applies adaptive fusion regardless of the documented SPECKIT_ADAPTIVE_FUSION disable guidance, then compare that runtime behavior against the install guide text. Run the targeted checks, capture the implementation and documentation evidence, and return a concise pass/fail verdict with the main reason.` | 1) `cd .opencode/skills/system-spec-kit/mcp_server` 2) `npx vitest run tests/adaptive-fusion.vitest.ts tests/hybrid-search.vitest.ts` 3) `sed -n '985,1015p' lib/search/hybrid-search.ts` 4) `rg -n \\\"SPECKIT_ADAPTIVE_FUSION\\\" INSTALL_GUIDE.md` 5) `rg -n \\\"hybridAdaptiveFuse\\\" lib/search/hybrid-search.ts tests/adaptive-fusion.vitest.ts tests/hybrid-search.vitest.ts` | The targeted adaptive-fusion and hybrid-search tests pass, the live fusion path always calls `hybridAdaptiveFuse(...)` without a flag gate in `hybrid-search.ts`, and `INSTALL_GUIDE.md` still documents `SPECKIT_ADAPTIVE_FUSION` as an operator-facing disable switch | Vitest transcript plus the runtime-source excerpt and the install-guide lines that still advertise the stale flag behavior | PASS if the targeted checks prove adaptive fusion stays active in the live runtime path while the install guide still reflects stale flag-toggle guidance | Inspect `lib/search/hybrid-search.ts` and `INSTALL_GUIDE.md`; confirm the checked-in docs match the tested source tree and that no alternate fusion gate was introduced elsewhere in the pipeline |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/manual_testing_playbook/21--implement-and-remove-deprecated-features/230-shadow-scoring-retirement.md:29:| 230 | Shadow-scoring retirement | Confirm runtime shadow scoring and persistence stay retired while read-only comparison helpers remain usable | `Validate that shadow-scoring execution and persistence remain retired even when the legacy flag is set, while comparison and historical stats helpers stay safe to call. Run the targeted checks, capture the evidence that proves the runtime path is shut off, and return a concise pass/fail verdict with the main reason.` | 1) `cd .opencode/skills/system-spec-kit/mcp_server` 2) `npx vitest run tests/shadow-scoring.vitest.ts tests/mpab-quality-gate-integration.vitest.ts` 3) `sed -n '230,420p' lib/eval/shadow-scoring.ts` 4) `rg -n \\\"runShadowScoring|logShadowComparison|getShadowStats|compareShadowResults|SPECKIT_SHADOW_SCORING\\\" lib/eval/shadow-scoring.ts tests/shadow-scoring.vitest.ts tests/mpab-quality-gate-integration.vitest.ts` | The targeted shadow-scoring tests pass, `runShadowScoring()` returns `null`, `logShadowComparison()` returns `false`, `getShadowStats()` stays in the zero-case when no historical rows exist, and `compareShadowResults()` remains available as the live analysis surface | Vitest transcript plus the source excerpts showing the retired runtime/write paths and the retained comparison helpers | PASS if the targeted checks prove runtime execution and write paths are retired while comparison and historical read helpers remain intact | Inspect `lib/eval/shadow-scoring.ts`; confirm the test sandbox DB path is isolated; verify no environment leakage or stale eval DB state is affecting the results |\\n\", truncated_after_lines: None }, aggregated_output: StreamOutput { text: \"rg: /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/specs/system-spec-kit/scripts: No such file or directory (os error 2)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:118:// P4-12/P4-19: Incremental index (passed to db-state for stale handle refresh)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:175:    codeGraphStatus: 'fresh' | 'stale' | 'empty';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:194:  staleCount: number;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:379:// Safe for stdio (single client). TTL in query-flow-tracker bounds staleness.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:712:      return { totalMemories: 0, specFolderCount: 0, activeCount: 0, staleCount: 0 };\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:731:      staleCount: pending + failed + retry,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:734:    return { totalMemories: 0, specFolderCount: 0, activeCount: 0, staleCount: 0 };\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:751:  const staleWarning = stats.staleCount > 10\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:752:    ? ` Warning: ${stats.staleCount} stale memories detected. Consider running memory_index_scan.`\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:757:    `Active memories: ${stats.activeCount}. Stale memories: ${stats.staleCount}.`,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:761:    staleWarning.trim(),\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:787:  lines.push('- If \\\"stale\\\" or \\\"missing\\\": call session_bootstrap first to refresh structural context');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:798:    if (snap.graphFreshness === 'fresh' || snap.graphFreshness === 'stale') {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1191:    // P1 FIX: Wire isCommittedInDb callback so stale pending files are detected at startup.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1313:          staleDeleted: 0,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1314:          staleDeleteFailed: 0,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1481:  // Node version mismatch detection (non-blocking)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1561:  // Refresh their DB handles during reinitializeDatabase(), preventing stale refs.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1843:                    staleDeleted: 0,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/context-server.ts:1844:                    staleDeleteFailed: 0,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/ENV_REFERENCE.md:223:| `SPECKIT_ARCHIVAL` | `true` | boolean | Archival manager for aging out stale memories (90-day max age). Graduated ON. | `lib/cognitive/archival-manager.ts` |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/ENV_REFERENCE.md:227:| `SPECKIT_CONSOLIDATION` | `true` | boolean | Consolidation engine: contradiction scan, Hebbian strengthening, staleness detection (N3-lite). Graduated ON. | `lib/search/search-flags.ts` |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/save/post-insert.ts:103:      // Data integrity: clean stale auto-entities before re-extraction on update\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/save/response-builder.ts:453:        `-${consolidation.hebbian.decayed} decayed, ${consolidation.stale.flagged} stale flagged`\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/session-resume.ts:79:    | 'stale_summary'\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/session-resume.ts:94:  status: 'fresh' | 'stale' | 'empty' | 'error';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/session-resume.ts:287:      'stale_summary',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/session-resume.ts:473:  if (structuralContext.status === 'stale' || structuralContext.status === 'missing') {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/session-bootstrap.ts:115:  } else if (structuralContext.status === 'stale') {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/session-bootstrap.ts:122:  if (healthStatus === 'warning' || healthStatus === 'stale') {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/session-bootstrap.ts:196:  if (structuralContext.status === 'stale' || structuralContext.status === 'missing') {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/session-bootstrap.ts:317:      : structuralContext.status === 'stale'\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/session-bootstrap.ts:318:        ? 'stale'\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:632:  // Otherwise stale trigger/tool-cache entries persist until next non-chunked save.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/session-health.ts:33:type SessionStatus = 'ok' | 'warning' | 'stale';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/session-health.ts:38:  graphFreshness: 'fresh' | 'stale' | 'empty' | 'error';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/session-health.ts:92:        graphFreshness = 'stale';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/session-health.ts:110:    status = 'stale';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/session-health.ts:111:  } else if (graphFreshness === 'stale' || graphFreshness === 'empty' || lastToolCallAgoMs > FIFTEEN_MINUTES_MS) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/session-health.ts:122:  if (structuralContext.status === 'stale') {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/session-health.ts:123:    hints.push('Structural context is stale. Call session_bootstrap to refresh, or run code_graph_scan for a full rescan.');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/README.md:47:- `spec/` - 12 lifecycle scripts (`create.sh`, `upgrade-level.sh`, `check-placeholders.sh`, `validate.sh`, `progressive-validate.sh`, `test-validation.sh`, `check-completion.sh`, `calculate-completeness.sh`, `recommend-level.sh`, `archive.sh`, `check-template-staleness.sh`, `quality-audit.sh`)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:992:    // Data integrity: clean stale auto-entities before re-extraction on update\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:998:        console.error(`[memory-save] Cleaned stale auto-entities for superseded memory #${existing.id}`);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:1007:        console.error(`[memory-save] Cleaned stale auto-entities for PE-superseded memory #${peResult.supersededId}`);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/code-graph/query.ts:70:  if (readiness.freshness === 'stale') {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/code-graph/query.ts:74:      freshnessAuthority: 'stale',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/code-graph/query.ts:333:    // Non-blocking: continue with potentially stale data\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/README.md:70:- `memory-index.ts` and `mutation-hooks.ts` work together so index, update, and stale-delete flows clear trigger, constitutional, graph, co-activation, and degree caches.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/README.md:80:- Post-mutation invalidation clears `clearDegreeCache()` alongside trigger and constitutional caches so graph-derived retrieval signals cannot serve stale data after mutations.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/memory-surface.ts:46:      staleFiles: number;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/memory-surface.ts:68:  codeGraphStatus: 'fresh' | 'stale' | 'empty';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/memory-surface.ts:218:    const staleCount = (graphDb.getDb().prepare(`\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/memory-surface.ts:229:        staleFiles: staleCount,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/memory-surface.ts:317:    // stale cross-session entries from influencing auto-surface ordering.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/memory-surface.ts:445:      codeGraphStatus = 'stale';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/memory-surface.ts:456:  if (codeGraphStatus === 'stale' || codeGraphStatus === 'empty') {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:127:  last_accessed?: number;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:197:// Track stale session cleanup interval (runs hourly)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:198:let staleCleanupInterval: ReturnType<typeof setInterval> | null = null;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:234:  // Run stale session cleanup on startup and set up hourly interval\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:239:    console.warn(`[session-manager] Initial stale session cleanup failed: ${message}`);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:242:  if (staleCleanupInterval) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:243:    clearInterval(staleCleanupInterval);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:245:  staleCleanupInterval = setInterval(() => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:250:      console.warn(`[session-manager] Periodic stale session cleanup failed: ${message}`);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:253:  if (staleCleanupInterval && typeof staleCleanupInterval === 'object' && 'unref' in staleCleanupInterval) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:254:    staleCleanupInterval.unref();\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:758: * T302: Clean up stale sessions across all session-related tables.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:782:  // 1. Clean stale working_memory entries\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:795:  // 2. Clean stale session_sent_memories entries\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:1382:  if (staleCleanupInterval) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:1383:    clearInterval(staleCleanupInterval);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:1384:    staleCleanupInterval = null;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/claude/session-prime.ts:28:  graphState: 'ready' | 'stale' | 'empty' | 'missing';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/claude/session-prime.ts:58:    hookLog('warn', 'session-prime', `Rejecting stale compact cache for session ${sessionId} (cached at ${cachedAt})`);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/claude/session-prime.ts:166:  if (startupBrief?.graphState === 'stale') {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/claude/session-prime.ts:169:      content: 'Code graph freshness is stale. The first structural read may refresh inline when safe; run `code_graph_scan` for broader stale states.',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/code-graph/context.ts:104:      // Non-blocking: continue with potentially stale data\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/handler-utils.ts:6:// GROWTH POLICY (T033):\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-snapshot.ts:25:  graphFreshness: 'fresh' | 'stale' | 'empty' | 'error';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-snapshot.ts:39:  status: 'ready' | 'stale' | 'missing';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-snapshot.ts:218:  } else if (graphFreshness === 'stale') {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-snapshot.ts:219:    status = 'stale';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-snapshot.ts:240:  } else if (status === 'stale') {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-snapshot.ts:243:      summary = `Code graph: ${stats.totalFiles} files, ${stats.totalNodes} nodes (stale — structural reads may refresh inline or recommend code_graph_scan)`;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-snapshot.ts:245:      summary = 'Code graph data is stale — structural context may be outdated';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-snapshot.ts:254:  } else if (status === 'stale') {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-snapshot.ts:255:    recommendedAction = 'Use a structural read to trigger bounded inline refresh when safe, or run code_graph_scan for broader stale states.';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/session-snapshot.ts:273:      lastUpdated: status === 'ready' || status === 'stale'\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/context-metrics.ts:34:    graphFreshness: number; // 1.0 fresh, 0.5 stale, 0.0 empty\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/context-metrics.ts:84:// Matches the session-snapshot graph staleness threshold.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/context-metrics.ts:178:/** Compute graph freshness: 1.0 fresh, 0.5 stale, 0.0 empty/error. */\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/context-metrics.ts:217:  //   recency (0.35)       — Highest weight because stale sessions are the primary\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/session/context-metrics.ts:228:  //   graphFreshness (0.20) — A stale code graph means structural queries return\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/SHARED_MEMORY_DATABASE.md:138:Your shared space contains outdated guidance after a breaking change. Flip the kill switch to block all reads immediately while you update the content. Once the corrections are in place, turn it back off. Nobody acts on stale information during the gap.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/claude/session-stop.ts:23:/** Default max age (ms) for stale state cleanup in --finalize mode */\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/claude/session-stop.ts:324:  // --finalize mode: manual cleanup of stale session states\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/claude/session-stop.ts:327:    hookLog('info', 'session-stop', `Finalize: cleaned ${removed} stale state file(s) older than 24h`);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/tests/test-folder-detector-functional.js:295:    `).run('099-stale-folder', 'T-stale', 'preflight');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/SKILL.md:613:- Preflight parses are revalidated inside the write lock when file contents change, and duplicate short-circuits verify stored content before trusting a stale hash hit.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/SKILL.md:614:- Delete and replacement paths now treat vector cleanup and projection replacement as integrity-critical instead of best-effort, so stale vector/projection rows do not silently survive successful writes.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/SKILL.md:782:**Read-path freshness:** Startup and bootstrap surfaces report graph freshness without mutating the index. Bounded inline refresh happens on structural read paths when stale sets are small; otherwise callers receive `readiness` guidance to run `code_graph_scan`.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/shared/mcp_server/database/README.md:36:**`.db-updated` file:** Contains a Unix timestamp (milliseconds) recording the last database modification. Used by the indexer to detect stale data.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/database/README.md:73:- Structural reads (`code_graph_query`, `code_graph_context`) can perform bounded inline selective refresh against `code-graph.sqlite` when the stale set is small enough.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/database/README.md:74:- Empty or broadly stale structural states still require explicit `code_graph_scan` to rebuild the graph database.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-hierarchy.vitest.ts:505:// 9. Cache behavior (invalidations + TTL stale detection)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-hierarchy.vitest.ts:536:  it('detects stale cache after TTL expiry and rebuilds hierarchy', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-hierarchy.vitest.ts:551:    const staleRefreshedTree = buildHierarchyTree(db);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-hierarchy.vitest.ts:552:    expect(staleRefreshedTree).not.toBe(initialTree);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/spec-folder-hierarchy.vitest.ts:553:    expect(staleRefreshedTree.nodeMap.has('003-foo/140-after-ttl')).toBe(true);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/gemini/session-prime.ts:30:  graphState: 'ready' | 'stale' | 'empty' | 'missing';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/gemini/session-prime.ts:59:    hookLog('warn', 'gemini:session-prime', `Rejecting stale compact cache (cached at ${cachedAt})`);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/gemini/session-prime.ts:132:  if (startupBrief?.graphState === 'stale') {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/gemini/session-prime.ts:135:      content: 'Code graph freshness is stale. The first structural read may refresh inline when safe; run `code_graph_scan` for broader stale states.',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/gemini/session-stop.ts:21:/** Default max age for stale state cleanup in --finalize mode */\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/gemini/session-stop.ts:80:  // --finalize mode: manual cleanup of stale session states\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/gemini/session-stop.ts:83:    hookLog('info', 'gemini:session-stop', `Finalize: cleaned ${removed} stale state file(s) older than 24h`);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:58:  'last_accessed',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:134:      last_accessed INTEGER DEFAULT 0,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:180:    CREATE INDEX IF NOT EXISTS idx_last_accessed ON memory_index(last_accessed DESC);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/hooks/gemini/compact-inject.ts:48:    hookLog('warn', 'gemini:compact-inject', `Rejecting stale compact cache (cached at ${cachedAt})`);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/access-tracker.ts:159:          last_accessed = ?\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tool-schemas.ts:734:  description: '[L3:Discovery] Check session readiness: priming status, code graph freshness, time since last tool call. Call periodically during long sessions to check for context drift. Returns ok/warning/stale with actionable hints. No arguments required.',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tool-schemas.ts:770:      structuralContext: { type: 'object', description: 'Structural bootstrap contract (status, summary, recommendedAction); omitted when code graph is unavailable', properties: { status: { type: 'string', enum: ['ready', 'stale', 'missing'] }, summary: { type: 'string' }, recommendedAction: { type: 'string' } } },\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:5:// Strengthening, staleness detection, edge bounds enforcement.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:55:  stale: { flagged: number };\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:346:        SELECT id, strength, last_accessed, created_by FROM causal_edges\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:347:        WHERE last_accessed IS NOT NULL\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:348:          AND last_accessed > datetime('now', '-7 days')\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:369:      const staleDecayEdges = (database.prepare(`\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:370:        SELECT id, strength, last_accessed, created_by FROM causal_edges\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:371:        WHERE (last_accessed IS NULL AND extracted_at < datetime('now', '-' || ? || ' days'))\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:372:           OR (last_accessed IS NOT NULL AND last_accessed < datetime('now', '-' || ? || ' days'))\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:375:      for (const edge of staleDecayEdges) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:396: * Detect stale edges (not accessed in 90+ days).\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:447:  const staleEdges = detectStaleEdges(database);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:471:    stale: { flagged: staleEdges.length },\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/INSTALL_GUIDE.md:106:- Server starts but search returns empty or stale results\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/INSTALL_GUIDE.md:125:- startup and resume surfaces report freshness-aware graph status (`fresh`, `stale`, `empty`, `error`)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/INSTALL_GUIDE.md:126:- `code_graph_query` and `code_graph_context` may repair small stale deltas inline\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/INSTALL_GUIDE.md:127:- empty or broadly stale graphs still require explicit `code_graph_scan`\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/INSTALL_GUIDE.md:449:- if the graph is only lightly stale, the read path may refresh inline before returning results\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/INSTALL_GUIDE.md:786:| `Cannot find module '@spec-kit/shared/...'` | Workspace dependency state is incomplete or stale | Run `npm install && npm run build` from the skill root |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/INSTALL_GUIDE.md:791:| `code_graph_query` reports `full_scan` or `inline full scan skipped for read path` | The graph is empty or too stale for bounded read-path repair | Run `code_graph_scan`, then retry the structural read |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/INSTALL_GUIDE.md:792:| Startup or resume shows graph `stale` | Freshness-aware startup detected drift before a structural read ran | Run a structural read to allow bounded inline repair, or run `code_graph_scan` for broader stale states |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/INSTALL_GUIDE.md:793:| Database appears stale after restore | Client still uses old MCP process with in-memory state | Fully restart OpenCode or Claude Code |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:96:  staleDeleted: number;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:97:  staleDeleteFailed: number;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:252:    const staleRecordIds = incrementalIndex.listIndexedRecordIdsForDeletedPaths(paths);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:256:    for (const staleRecordId of staleRecordIds) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:258:        const staleSnapshot = vectorIndex.getDb()?.prepare(\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:260:        ).get(staleRecordId) as { spec_folder?: string | null; file_path?: string | null } | undefined;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:262:        if (vectorIndex.deleteMemory(staleRecordId)) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:267:              staleRecordId,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:269:              staleSnapshot?.file_path ?? null,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:272:              staleSnapshot?.spec_folder ?? null,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:297:    let staleDeleted = 0;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:298:    let staleDeleteFailed = 0;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:302:      const staleDeleteResult = deleteStaleIndexedRecords(categorized.toDelete);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:303:      staleDeleted = staleDeleteResult.deleted;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:304:      staleDeleteFailed = staleDeleteResult.failed;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:305:      if (staleDeleted > 0) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:306:        runScanInvalidationHooks({ staleDeleted, staleDeleteFailed, operation: 'stale-delete' });\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:321:        staleDeleted,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:322:        staleDeleteFailed,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:325:        ...(staleDeleted > 0 ? [`Removed ${staleDeleted} stale index record(s) for deleted files`] : []),\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:342:    staleDeleted: 0,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:343:    staleDeleteFailed: 0,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:498:      const staleDeleteResult = deleteStaleIndexedRecords(filesToDelete);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:499:      results.staleDeleted = staleDeleteResult.deleted;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:500:      results.staleDeleteFailed = staleDeleteResult.failed;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:502:      console.warn('[memory-index-scan] Deferring stale cleanup because one or more replacement files failed to index');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:576:  if (results.indexed > 0 || results.updated > 0 || results.staleDeleted > 0) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:580:      staleDeleted: results.staleDeleted,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:581:      staleDeleteFailed: results.staleDeleteFailed,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:588:  const summary = `Scan complete: ${results.indexed} indexed, ${results.updated} updated, ${results.unchanged} unchanged, ${results.staleDeleted} deleted, ${results.failed} failed`;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:594:  if (filesToDelete.length > 0 && results.failed > 0 && results.staleDeleted === 0 && results.staleDeleteFailed === 0) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:595:    hints.push('Deferred stale index cleanup because one or more replacement files failed to index');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:597:  if (results.staleDeleted > 0) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:598:    hints.push(`Removed ${results.staleDeleted} stale index record(s) for deleted files`);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:600:  if (results.staleDeleteFailed > 0) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index.ts:601:    hints.push(`${results.staleDeleteFailed} stale index record(s) could not be removed`);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/graph-search-fn.vitest.ts:61:      last_accessed TEXT,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/graph-search-fn.vitest.ts:309:      const stale = computeDegreeScores(db, [1]).get('1');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/graph-search-fn.vitest.ts:310:      expect(stale).toBe(before);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/graph-search-fn.vitest.ts:335:      expect(refreshed).not.toBe(stale);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1330:    'last_accessed',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/README.md:258:**Tool-level TTL cache** remembers recent results for 60 seconds. When you save, update or delete a memory, the cache for affected searches clears automatically. You never see stale results.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/README.md:543:**Read-path readiness:** `ensureCodeGraphReady()` runs automatically inside `code_graph_query` and `code_graph_context`. It checks graph freshness, returns a `readiness` block, and performs bounded inline selective reindex only when the stale set is small enough to repair safely on the read path. Empty graphs, large stale sets, and other full-scan cases remain explicit `code_graph_scan` work.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/README.md:601:Resume session with combined memory, code graph and CocoIndex status in a single call. Use when you want the detailed merged resume payload directly. The response carries freshness-aware code-graph status (`fresh`, `stale`, `empty`, `error`) instead of count-only health. For the canonical first-call recovery path on session start or after `/clear`, prefer `session_bootstrap`.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/README.md:765:Run a health check. This is the diagnostic tool for when search quality degrades or something feels off. It checks for stale indexes, divergent aliases, broken embeddings and other issues. It can also attempt automatic repairs.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/README.md:779:Check session readiness: priming status, code graph freshness and time since last tool call. Returns `ok`, `warning` or `stale` with actionable hints. Call periodically during long sessions to detect context drift.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/README.md:1062:Query structural code relationships: `outline` (file symbols), `calls_from` and `calls_to` (call graph), `imports_from` and `imports_to` (dependency graph). Use this instead of Grep for structural queries. Supports multi-hop BFS traversal. Responses include a `readiness` block, and the handler may perform bounded inline selective reindex before answering when the graph is only lightly stale.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/README.md:1077:Get LLM-oriented compact graph neighborhoods. Accepts CocoIndex search results as seeds for structural expansion. Modes: `neighborhood` (1-hop calls plus imports), `outline` (file symbols), `impact` (reverse callers). Responses include a `readiness` block, and the handler may perform bounded inline selective reindex before answering when the graph is only lightly stale.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/README.md:1537:| Repair an empty or broadly stale code graph | `code_graph_scan` | Use when readiness reports `full_scan` or the graph is missing |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/README.md:1643:| BM25 index stale | Set `ENABLE_BM25=false` to fall back to FTS5 |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/README.md:30:- Incremental indexing metadata and stale-record discovery.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/README.md:49:| `consolidation.ts` | N3-lite contradiction, Hebbian, and stale-edge maintenance |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/README.md:52:| `incremental-index.ts` | Stored metadata lookup, content-hash-aware reindex decisions, and stale path discovery |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/entity-extractor.vitest.ts:546:    `).run('stale entry', '[\\\"stale\\\"]', 'technology', 99);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:6:# against the current template version. Reports stale folders.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:9:#   check-template-staleness.sh [--json] [--auto-upgrade] [--root <path>]\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:13:#   1 - stale folders found\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:42:check-template-staleness.sh — Detect spec folders with outdated template versions\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:44:Usage: check-template-staleness.sh [--json] [--auto-upgrade] [--root <path>]\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:48:  --auto-upgrade   Apply safe auto-fixes to stale folders (update version comment)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:124:    local current_count=0 stale_count=0 none_count=0 missing_count=0\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:125:    local stale_folders=()\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:154:            \\\"none\\\") ((none_count++)) || true; stale_folders+=(\\\"$folder_name ($version)\\\") ;;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:156:            *) ((stale_count++)) || true; stale_folders+=(\\\"$folder_name ($version)\\\")\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:179:        local stale_json=\\\"[\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:181:        for s in \\\"${stale_folders[@]+\\\"${stale_folders[@]}\\\"}\\\"; do\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:182:            $first && first=false || stale_json+=\\\",\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:183:            stale_json+=\\\"\\\\\\\"$s\\\\\\\"\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:185:        stale_json+=\\\"]\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:198:{\\\"current_version\\\":\\\"$current_version\\\",\\\"total\\\":$total,\\\"current\\\":$current_count,\\\"stale\\\":$stale_count,\\\"no_version\\\":$none_count,\\\"missing_spec\\\":$missing_count,\\\"versions\\\":$versions_json,\\\"stale_folders\\\":$stale_json}\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:220:        if [[ ${#stale_folders[@]} -gt 0 ]]; then\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:222:            for s in \\\"${stale_folders[@]}\\\"; do\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:234:    [[ $stale_count -gt 0 || $none_count -gt 0 ]] && exit 1\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/shared/trigger-extractor.ts:201:  'pending', 'stale', 'cached', 'expired', 'deprecated', 'legacy',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/shared/trigger-extractor.ts:234:    /\\\\b(simulation|placeholder|fallback|mock|stub|fake|debug|verbose|silent|readonly|disabled|enabled|pending|stale|cached|expired|deprecated|legacy)\\\\s+(mode|data|value|state|behavior|response|output|result|content)\\\\b/gi,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/shared/trigger-extractor.ts:235:    /\\\\b(mode|data|value|state|behavior|response|output|result|content)\\\\s+(simulation|placeholder|fallback|mock|stub|fake|debug|verbose|silent|readonly|disabled|enabled|pending|stale|cached|expired|deprecated|legacy)\\\\b/gi,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:407:  // Evict any stale projection row that maps a *different* logical_key to the\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/unit-normalization.vitest.ts:30:    last_accessed: 1706800000,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/shared/normalization.ts:49:  last_accessed: number;       // Unix timestamp (integer)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/shared/normalization.ts:144:    lastAccessed: row.last_accessed,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/shared/normalization.ts:189:  if (memory.lastAccessed !== undefined) row.last_accessed = memory.lastAccessed;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/shared/normalization.ts:234:  if (row.last_accessed !== undefined) mem.lastAccessed = row.last_accessed;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:78:/** Result when a merge candidate becomes stale before commit */\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/graph/README.md:142:| `memory_index` | usage-tracking.ts, community-detection.ts | access_count column, stale assignment cleanup |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:75:  last_accessed: string | null;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:854:    \\\"UPDATE causal_edges SET last_accessed = datetime('now') WHERE id = ?\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:863:      WHERE (last_accessed IS NULL AND extracted_at < datetime('now', '-' || ? || ' days'))\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:864:         OR (last_accessed IS NOT NULL AND last_accessed < datetime('now', '-' || ? || ' days'))\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:865:      ORDER BY COALESCE(last_accessed, extracted_at) ASC\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/rules/check-phase-links.sh:35:    # TODO: Parse Predecessor/Successor metadata table rows instead of grepping for phase name presence. Current approach may pass with swapped, stale, or duplicated adjacency metadata. See review finding F-035.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:262:  // Include stale indexed paths that are no longer discovered on disk.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:265:  const staleIndexedPaths = listStaleIndexedPaths(filePaths);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:266:  if (staleIndexedPaths.length > 0) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:268:    for (const stalePath of staleIndexedPaths) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:269:      const staleKey = getCanonicalPathKey(stalePath);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:270:      if (!seenDeleteKeys.has(staleKey)) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:271:        result.toDelete.push(stalePath);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:272:        seenDeleteKeys.add(staleKey);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:284:  const stalePaths = new Set<string>();\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:318:        stalePaths.add(row.file_path);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:326:  return Array.from(stalePaths);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/README.md:42:- `archive.sh` - archive completed or stale specs\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/typed-traversal.vitest.ts:27:      last_accessed TEXT\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/shared/embeddings/providers/hf-local.ts:191:        // Detect native module version mismatch (onnxruntime-node, sharp)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/startup-brief.vitest.ts:98:    expect(brief.sharedPayload?.provenance.trustState).toBe('stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/startup-brief.vitest.ts:101:  it('reports stale graph state when freshness detection says stale even with graph counts present', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/startup-brief.vitest.ts:102:    vi.mocked(getGraphFreshness).mockReturnValueOnce('stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/startup-brief.vitest.ts:106:    expect(brief.graphState).toBe('stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/startup-brief.vitest.ts:107:    expect(brief.graphOutline).toContain('Freshness: stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/startup-brief.vitest.ts:108:    expect(brief.startupSurface).toContain('- Code Graph: stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/startup-brief.vitest.ts:111:    expect(brief.sharedPayload?.provenance.trustState).toBe('stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/quality-audit.sh:138:               # --fix: re-run staleness auto-upgrade on failing folders\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/quality-audit.sh:140:                   local staleness_script=\\\"$SCRIPT_DIR/check-template-staleness.sh\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/quality-audit.sh:141:                   if [[ -f \\\"$staleness_script\\\" ]]; then\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/quality-audit.sh:142:                       bash \\\"$staleness_script\\\" --auto-upgrade --root \\\"$folder\\\" 2>/dev/null || true\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/archive.sh:197:    # Clean up any stale temp directories from previous failed runs\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/contracts/README.md:180:| `freshnessAuthority` | `live`, `cached`, `stale`, `unknown` | Whether the structural signal is current and authoritative |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/eval/data/ground-truth.json:415:      \\\"query\\\": \\\"the memory_search tool returns stale results after index rebuild\\\",\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/eval/data/ground-truth.json:420:      \\\"expectedResultDescription\\\": \\\"Should surface incremental-index.ts, retry-manager.ts, and any spec memories about stale cache behavior after indexing operations.\\\",\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/feedback/query-flow-tracker.ts:171:  // Evict stale entries\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/eval/warm-start-variant-runner.ts:37:  freshness: 'fresh' | 'stale';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/rules/check-spec-doc-integrity.sh:99:                issues+=(\\\"$filename has stale Spec Folder metadata: $spec_folder_value\\\")\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/causal-fixes.vitest.ts:34:        last_accessed TEXT,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-extended.vitest.ts:124:        last_accessed TEXT,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-extended.vitest.ts:628:          'stale-hash',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/response/profile-formatters.ts:268:    blockers.push(`${archivedOrCold.length} result(s) are cold/archived — may be stale`);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/context/shared-payload.ts:17:  | 'stale'\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/context/shared-payload.ts:61:  'stale',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/context/shared-payload.ts:418:  if (structuralContext.status === 'stale') {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/context/shared-payload.ts:422:      freshnessAuthority: 'stale',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/context/shared-payload.ts:593:  graphState: 'ready' | 'stale' | 'empty' | 'missing',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/context/shared-payload.ts:595:  return graphState === 'ready' ? 'live' : 'stale';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/context/shared-payload.ts:599:  status: 'ready' | 'stale' | 'missing',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/context/shared-payload.ts:601:  return status === 'ready' ? 'live' : 'stale';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/context/shared-payload.ts:611:    return 'stale';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/context/shared-payload.ts:613:  return nowMs - cachedAtMs >= maxAgeMs ? 'stale' : 'cached';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/working-memory.ts:260:    const staleSessionIds = (db.prepare(\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/working-memory.ts:266:    for (const row of staleSessionIds) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/05--lifecycle/06-startup-pending-file-recovery.md:22:Recovery is automatic and requires no user intervention. If the pending file is stale (the DB row was never committed), it is logged and left for manual review rather than silently deleted.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/interference.vitest.ts:45:      last_accessed TEXT,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/tier-classifier.ts:264:    const timestamp = mem.lastAccess || mem.last_accessed || mem.lastReview || mem.last_review || mem.created_at;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/hydra-spec-pack-consistency.vitest.ts:34:const staleReferences = [\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/hydra-spec-pack-consistency.vitest.ts:96:    for (const reference of staleReferences) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/hydra-spec-pack-consistency.vitest.ts:100:        const stalePath = path.resolve(__dirname, '..', reference.replace(/^mcp_server\\\\//, ''));\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/hydra-spec-pack-consistency.vitest.ts:101:        expect(fs.existsSync(stalePath), `Stale reference should NOT exist: ${reference}`).toBe(false);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/cache/README.md:108:Write-driven invalidation is used for memory and spec document changes so search and ranking do not serve stale `documentType`/`specLevel` context.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/05--lifecycle/07-automatic-archival-subsystem.md:20:The archival sweep runs periodically after access tracker data (`access_count`, `last_accessed`) establishes dormancy signals, but the FSRS-based classifier is still the final gate for archival eligibility. Constitutional and critical-tier memories therefore remain protected because the classifier will not approve auto-archival for them. On unarchive, BM25 is restored from stored text fields, while vector re-embedding is explicitly deferred and logged for the next index scan (no immediate vector row recreation). The archival manager lazy-loads the tier classifier to avoid circular dependencies at import time.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/archival-manager.ts:378:      ORDER BY last_accessed ASC NULLS FIRST, access_count ASC\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts:148:        last_accessed TEXT,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts:691:        makeNewMemory({ content: 'Incoming content that should not be stale-merged' }),\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:76:    mocks.ensureFreshFilesMock.mockReturnValue({ fresh: [], stale: [] });\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:80:      filePath: '/tmp/test-root/stale.ts',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:101:      const levels: GraphFreshness[] = ['fresh', 'stale', 'empty'];\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:119:        freshness: 'stale',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:123:        reason: 'stale files',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:150:      expect(result.freshness).toBe('stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:157:    it('reports stale work without indexing when read paths disable inline indexing', async () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:159:      mocks.getTrackedFilesMock.mockReturnValue(['/tmp/test-root/stale.ts']);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:160:      mocks.ensureFreshFilesMock.mockReturnValue({ fresh: [], stale: ['/tmp/test-root/stale.ts'] });\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:166:      expect(result.freshness).toBe('stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:168:      expect(result.files).toEqual(['/tmp/test-root/stale.ts']);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:173:    it('performs selective inline reindex for small stale sets when allowed', async () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:175:      mocks.getTrackedFilesMock.mockReturnValue(['/tmp/test-root/stale.ts']);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:176:      mocks.ensureFreshFilesMock.mockReturnValue({ fresh: [], stale: ['/tmp/test-root/stale.ts'] });\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:185:      expect(result.freshness).toBe('stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:187:      expect(result.files).toEqual(['/tmp/test-root/stale.ts']);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:192:    it('allows selective inline reindex after git HEAD changes when the stale set is small', async () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:197:      mocks.getTrackedFilesMock.mockReturnValue(['/tmp/test-root/stale.ts']);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:198:      mocks.ensureFreshFilesMock.mockReturnValue({ fresh: [], stale: ['/tmp/test-root/stale.ts'] });\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:207:      expect(result.freshness).toBe('stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:209:      expect(result.files).toEqual(['/tmp/test-root/stale.ts']);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:222:      mocks.ensureFreshFilesMock.mockReturnValue({ fresh: ['/tmp/test-root/fresh.ts'], stale: [] });\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:231:      expect(result.freshness).toBe('stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:240:      const staleFiles = Array.from({ length: 51 }, (_, index) => `/tmp/test-root/stale-${index}.ts`);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:242:      mocks.getTrackedFilesMock.mockReturnValue(staleFiles);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:243:      mocks.ensureFreshFilesMock.mockReturnValue({ fresh: [], stale: staleFiles });\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:252:      expect(result.freshness).toBe('stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/ensure-ready.vitest.ts:264:      expect(['fresh', 'stale', 'empty']).toContain(freshness);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1915:// M5 fix: Return stale cache immediately and refresh asynchronously to avoid\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1958:          // Non-fatal: stale cache remains usable\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/hybrid-search.ts:1967:  // Cold start — synchronous build required (no stale data to return)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/README.md:500:// Activate memory (increment access_count, update last_accessed)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/ops/file-watcher.ts:241:  // M1 fix: AbortController per file path for cancellation of stale reindex\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:22:export type GraphFreshness = 'fresh' | 'stale' | 'empty';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:44:/** Maximum stale files before we switch from selective to full reindex */\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:100:  staleFiles: string[];\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:109:    return { freshness: 'empty', action: 'full_scan', staleFiles: [], deletedFiles: [], reason: 'graph is empty (0 nodes)' };\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:123:    return { freshness: 'empty', action: 'full_scan', staleFiles: [], deletedFiles: [], reason: 'no tracked files in code_files table' };\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:127:  const { stale } = ensureFreshFiles(existingFiles);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:128:  if (stale.length === 0) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:131:        freshness: 'stale',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:133:        staleFiles: [],\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:143:        freshness: 'stale',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:145:        staleFiles: [],\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:151:    return { freshness: 'fresh', action: 'none', staleFiles: [], deletedFiles: [], reason: 'all tracked files are up-to-date' };\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:154:  // Too many stale files => full scan is more efficient\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:155:  if (stale.length > SELECTIVE_REINDEX_THRESHOLD) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:157:      freshness: 'stale',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:159:      staleFiles: stale,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:163:        `${stale.length} stale files exceed selective threshold (${SELECTIVE_REINDEX_THRESHOLD})`,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:170:    freshness: 'stale',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:172:    staleFiles: stale,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:176:      `${stale.length} file(s) have newer mtime than indexed_at`,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:266:      ...(state.action === 'selective_reindex' ? { files: state.staleFiles } : {}),\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:301:    // selective_reindex: only re-parse stale files\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:302:    if (state.action === 'selective_reindex' && state.staleFiles.length > 0) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:304:      // F048: Convert absolute stale file paths to rootDir-relative globs\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:305:      config.includeGlobs = state.staleFiles.map(f => relative(rootDir, f));\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:314:        files: state.staleFiles,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ensure-ready.ts:326:      files: state.staleFiles,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/attention-decay.ts:147:          last_accessed = ?,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/attention-decay.ts:198:          last_accessed = ?\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/attention-decay.ts:309:      ORDER BY last_accessed DESC, importance_weight DESC\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/06--analysis/01-causal-edge-creation-memorycausallink.md:22:Edge bounds are enforced at insert time. Auto-generated edges (those with `created_by='auto'`) are rejected when a node already has 20 edges (`MAX_EDGES_PER_NODE`) and clamped to a maximum strength of 0.5 (`MAX_AUTO_STRENGTH`). Every strength modification is logged to a `weight_history` table recording old strength, new strength, who changed it, when and why. The `created_by` and `last_accessed` fields on each edge track provenance and usage patterns.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/README.md:47:- `spec/` - 12 lifecycle scripts (`create.sh`, `upgrade-level.sh`, `check-placeholders.sh`, `validate.sh`, `progressive-validate.sh`, `test-validation.sh`, `check-completion.sh`, `calculate-completeness.sh`, `recommend-level.sh`, `archive.sh`, `check-template-staleness.sh`, `quality-audit.sh`)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/co-activation.ts:96:/** Clear the getRelatedMemories cache (called on init to avoid stale data across DB reloads). */\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/cognitive/co-activation.ts:154:  clearRelatedCache(); // Evict stale entries when a new DB connection is set\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-types.ts:55:  last_accessed?: number;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-types.ts:86:  last_accessed?: number;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/db-state.vitest.ts:68:  it('expires stale scan lease and allows a fresh reservation', async () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/db-state.vitest.ts:71:    const staleStartedAt = Date.now() - 300000;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/db-state.vitest.ts:72:    db.prepare('INSERT INTO config (key, value) VALUES (?, ?)').run('scan_started_at', String(staleStartedAt));\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:46:      last_accessed INTEGER DEFAULT 0,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:538:  it('adds stale indexed rows to toDelete even when missing from scan input', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:546:    const stalePath = '/tmp/stale-only-in-db-' + Date.now() + '.md';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:547:    insertRow(db, { file_path: stalePath, file_mtime_ms: 1700000000000, embedding_status: 'success' });\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:550:    expect(result.toDelete).toContain(stalePath);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:557:  symlinkIt('does not mark alias rows as stale when canonical path is still present in scan', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:590:    const stalePath = '/tmp/stale-id-test-' + Date.now() + '.md';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:591:    const staleId = insertRow(db, { file_path: stalePath, file_mtime_ms: 1700000000000, embedding_status: 'success' });\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:597:    const ids = mod.listIndexedRecordIdsForDeletedPaths([stalePath, liveFile]);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:598:    expect(ids).toContain(staleId);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-context.ts:36:    freshness: { lastScanAt: string | null; staleness: 'fresh' | 'recent' | 'stale' | 'unknown' };\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-context.ts:163:function computeFreshness(): { lastScanAt: string | null; staleness: 'fresh' | 'recent' | 'stale' | 'unknown' } {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-context.ts:168:    if (!lastScanAt) return { lastScanAt: null, staleness: 'unknown' };\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-context.ts:171:    const staleness = ageMs < 300_000 ? 'fresh' : ageMs < 3_600_000 ? 'recent' : 'stale';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-context.ts:172:    return { lastScanAt, staleness };\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-context.ts:174:    return { lastScanAt: null, staleness: 'unknown' };\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/scoring/confidence-tracker.ts:176:    // From callers and allowing downstream side-effects to proceed on stale data.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/search-flags.ts:188: * staleness detection, edge bounds enforcement.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-helpers.vitest.ts:160:      last_accessed TEXT,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/19--feature-flag-reference/01-1-search-pipeline-features-speckit.md:51:| `SPECKIT_CONSOLIDATION` | `true` | boolean | `lib/search/search-flags.ts` | Enables the N3-lite consolidation engine which runs after every successful save. Scans for contradictions (>0.85 cosine similarity with negation conflicts), applies Hebbian strengthening (+0.05/cycle, 30-day decay), detects stale edges (>90 days unfetched) and enforces 20 edges per node. Runs weekly. |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/19--feature-flag-reference/01-1-search-pipeline-features-speckit.md:59:| `SPECKIT_DYNAMIC_INIT` | `true` | boolean | `context-server.ts` | **IMPLEMENTED (Sprint 019).** P1-6: Dynamic server instructions at MCP initialization. `buildServerInstructions()` generates a memory-system overview (total memories, spec folder count, channels, stale count) and injects via `server.setInstructions()`. Instructions are computed once at startup and not refreshed during session (CHK-076). Reuses existing `memory_stats` handler data. |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/startup-brief.ts:31:  graphState: 'ready' | 'stale' | 'empty' | 'missing';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/startup-brief.ts:107:  } else if (args.graphState === 'stale' && args.graphSummary) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/startup-brief.ts:109:      'stale',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/startup-brief.ts:156:    if (freshness === 'stale') {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/startup-brief.ts:157:      lines.push('Freshness: stale — first structural read may trigger bounded inline refresh or recommend code_graph_scan.');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/startup-brief.ts:168:      graphState: freshness === 'stale' ? 'stale' : 'ready',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/templates/context_template.md:308:| Stale Context | Information seems outdated | Check `last_accessed_epoch` vs current time |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/templates/context_template.md:472:last_accessed_epoch: {{LAST_ACCESSED_EPOCH}}\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/graph-search-fn.ts:629: * to ensure stale scores are not served.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/causal-boost.vitest.ts:19:      last_accessed TEXT\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/scoring/composite-scoring.ts:272: * Parse last_accessed value that may be:\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/scoring/composite-scoring.ts:392:  // Never fall back to last_accessed or updated_at — those conflate\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/scoring/composite-scoring.ts:668:  const popularityScore = calculatePopularityScore(row.access_count || 0, parseLastAccessed(row.last_accessed), row.created_at || null);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/scoring/composite-scoring.ts:752:        popularity: calculatePopularityScore(row.access_count || 0, parseLastAccessed(row.last_accessed), row.created_at || null),\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/scoring/composite-scoring.ts:832:  const popularity = calculatePopularityScore(row.access_count || 0, parseLastAccessed(row.last_accessed), row.created_at || null);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/compact-merger.ts:27:  staleness: 'fresh' | 'recent' | 'stale' | 'unknown';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/compact-merger.ts:223:        { source: 'constitutional', lastUpdated: null, staleness: 'unknown' },\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/compact-merger.ts:224:        { source: 'codeGraph', lastUpdated: null, staleness: 'unknown' },\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/compact-merger.ts:225:        { source: 'cocoIndex', lastUpdated: null, staleness: 'unknown' },\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/compact-merger.ts:226:        { source: 'triggered', lastUpdated: null, staleness: 'unknown' },\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/checkpoint-completeness.vitest.ts:307:    INSERT INTO causal_edges (id, source_id, target_id, relation, strength, evidence, created_by, last_accessed)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/intent-classifier.ts:527:    const dateStr = r.created_at as string | undefined || r.last_accessed as string | undefined || r.last_review as string | undefined;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ops-hardening.ts:7:export type GraphFreshness = 'fresh' | 'stale' | 'empty' | 'error';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ops-hardening.ts:8:export type StructuralReadiness = 'ready' | 'stale' | 'missing';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ops-hardening.ts:56:  if (graphFreshness === 'stale') {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ops-hardening.ts:57:    return 'stale';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ops-hardening.ts:69:    : canonical === 'stale'\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/ops-hardening.ts:74:    : canonical === 'stale'\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-db.ts:360:/** Batch stale check for a set of file paths */\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-db.ts:361:export function ensureFreshFiles(filePaths: string[]): { stale: string[]; fresh: string[] } {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-db.ts:364:    return { stale: [], fresh: [] };\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-db.ts:376:  const stale: string[] = [];\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-db.ts:383:      stale.push(filePath);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-db.ts:389:  return { stale, fresh };\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-aliases.ts:383:          last_accessed = ?\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/19--feature-flag-reference/02-2-session-and-cache.md:26:| `STALE_CLEANUP_INTERVAL_MS` | `3600000` | number | `lib/session/session-manager.ts` | Interval in milliseconds between stale session cleanup sweeps. Default is 1 hour (3,600,000 ms). Stale sessions are those whose last activity exceeds `STALE_SESSION_THRESHOLD_MS`. |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/19--feature-flag-reference/02-2-session-and-cache.md:27:| `STALE_SESSION_THRESHOLD_MS` | `86400000` | number | `lib/session/session-manager.ts` | Age in milliseconds at which a session is considered stale and eligible for cleanup. Default is 24 hours (86,400,000 ms). |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:207:  it('removes stale index records even when discovery finds zero files', async () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:227:      staleDeleted: 1,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:228:      staleDeleteFailed: 0,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:229:      operation: 'stale-delete',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:234:    expect(envelope.data.staleDeleted).toBe(1);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:235:    expect(envelope.data.staleDeleteFailed).toBe(0);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:238:  it('consumes incremental toDelete and removes stale indexed records', async () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:261:      staleDeleted: 2,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:262:      staleDeleteFailed: 0,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:266:    expect(envelope.data.staleDeleted).toBe(2);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:267:    expect(envelope.data.staleDeleteFailed).toBe(0);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:270:  it('tracks stale delete failures without aborting scan', async () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:291:    expect(envelope.data.staleDeleted).toBe(1);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:292:    expect(envelope.data.staleDeleteFailed).toBe(1);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:296:      staleDeleted: 1,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:297:      staleDeleteFailed: 1,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:301:  it('defers stale deletion when replacement indexing fails in the same scan', async () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:307:      toDelete: ['/tmp/stale.md'],\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:326:    expect(envelope.data.staleDeleted).toBe(0);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:327:    expect(envelope.data.staleDeleteFailed).toBe(0);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index-cooldown.vitest.ts:331:      'Deferred stale index cleanup because one or more replacement files failed to index'\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:619:            last_accessed TEXT,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:946:        database.exec('ALTER TABLE causal_edges ADD COLUMN last_accessed TEXT');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:947:        logger.info('Migration v18: Added last_accessed column to causal_edges');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:950:          console.warn('[VectorIndex] Migration v18 warning (last_accessed):', get_error_message(e));\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1813:  if (!column_names.includes('last_accessed')) {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1815:      database.exec(`ALTER TABLE memory_index ADD COLUMN last_accessed INTEGER DEFAULT 0`);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1816:      console.warn('[vector-index] Migration: Added last_accessed column');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1821:      logDuplicateColumnMigrationSkip('last_accessed', error);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2047:    database.exec(`CREATE INDEX IF NOT EXISTS idx_last_accessed ON memory_index(last_accessed DESC)`);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2048:    logger.info('Created idx_last_accessed index');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2052:      index: 'idx_last_accessed',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2320:      last_accessed INTEGER DEFAULT 0,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2466:    CREATE INDEX IF NOT EXISTS idx_last_accessed ON memory_index(last_accessed DESC);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/spec-folder-hierarchy.ts:34:// Don't share a stale cache.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/graph-signals.vitest.ts:45:      last_accessed TEXT\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/graph-signals.vitest.ts:288:      // Cache returns stale values — should be identical\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/graph-signals.vitest.ts:322:      // Cache returns stale values — identical to first call\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/graph-signals.vitest.ts:671:      // Without clearing, cache returns stale value\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/graph-signals.vitest.ts:672:      const stale = computeMomentumScores(db, [1]);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/graph-signals.vitest.ts:673:      expect(stale.get(1)).toBe(momentum1);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/rules/check-phase-links.sh:35:    # TODO: Parse Predecessor/Successor metadata table rows instead of grepping for phase name presence. Current approach may pass with swapped, stale, or duplicated adjacency metadata. See review finding F-035.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts:519:// The old global singleton would return stale statements from a prior DB connection\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/folder-discovery.ts:232:        // Also check description.json mtime so aggregate cache staleness\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/folder-discovery.ts:244:        // Ignore unreadable spec.md entries during staleness probing.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/folder-discovery.ts:491:      // Repair stale/corrupt on-disk descriptions during discovery when a file exists.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/folder-discovery.ts:540: * F-39: Batch repair stale description.json files.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/folder-discovery.ts:783: * Check whether a per-folder description.json is stale.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/folder-discovery.ts:785: * Missing description.json = stale.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/folder-discovery.ts:880: * Check whether a description cache is stale by comparing its\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/folder-discovery.ts:910: * disk, checks staleness, regenerates if needed, saves, and returns it.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:6:# against the current template version. Reports stale folders.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:9:#   check-template-staleness.sh [--json] [--auto-upgrade] [--root <path>]\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:13:#   1 - stale folders found\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:42:check-template-staleness.sh — Detect spec folders with outdated template versions\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:44:Usage: check-template-staleness.sh [--json] [--auto-upgrade] [--root <path>]\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:48:  --auto-upgrade   Apply safe auto-fixes to stale folders (update version comment)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:124:    local current_count=0 stale_count=0 none_count=0 missing_count=0\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:125:    local stale_folders=()\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:154:            \\\"none\\\") ((none_count++)) || true; stale_folders+=(\\\"$folder_name ($version)\\\") ;;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:156:            *) ((stale_count++)) || true; stale_folders+=(\\\"$folder_name ($version)\\\")\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:179:        local stale_json=\\\"[\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:181:        for s in \\\"${stale_folders[@]+\\\"${stale_folders[@]}\\\"}\\\"; do\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:182:            $first && first=false || stale_json+=\\\",\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:183:            stale_json+=\\\"\\\\\\\"$s\\\\\\\"\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:185:        stale_json+=\\\"]\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:198:{\\\"current_version\\\":\\\"$current_version\\\",\\\"total\\\":$total,\\\"current\\\":$current_count,\\\"stale\\\":$stale_count,\\\"no_version\\\":$none_count,\\\"missing_spec\\\":$missing_count,\\\"versions\\\":$versions_json,\\\"stale_folders\\\":$stale_json}\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:220:        if [[ ${#stale_folders[@]} -gt 0 ]]; then\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:222:            for s in \\\"${stale_folders[@]}\\\"; do\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/check-template-staleness.sh:234:    [[ $stale_count -gt 0 || $none_count -gt 0 ]] && exit 1\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-mutations.ts:111:  // Evict any stale projection row that maps a *different* logical_key to the\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/shared-memory-handlers.vitest.ts:167:  it('treats stale create conflicts as updates and bootstraps only one owner', async () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/14--pipeline-architecture/11-pipeline-and-mutation-hardening.md:45:- **Parent BM25 rollback guard (T332):** parent BM25 mutation now waits until at least one chunk has indexed successfully and, for safe-swap updates, until finalization completes. All-chunks-failed rollback therefore preserves the old parent BM25 document instead of replacing it with an empty or stale summary.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:307:| `folder-discovery.ts`      | -      | TypeScript | Spec folder description discovery: per-folder `description.json` CRUD, centralized cache aggregation, staleness detection, `slugifyFolderName()` helper, keyword-overlap relevance scoring (PI-B3) |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/README.md:725:`memory_index_scan` now runs the broader post-mutation invalidation hook behavior whenever a scan indexes, updates, or stale-deletes rows.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/local-reranker.ts:105:  // Discard stale promise if the model path changed since the last load\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/11--scoring-and-calibration/11-scoring-and-ranking-corrections.md:22:**C2: Citation fallback chain:** `composite-scoring.ts` fell back through `last_accessed` then `updated_at` when no citation data existed, conflating recency with citation authority. The fallback chain was removed. The function returns 0 when no citation data exists.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/entity-linker.ts:456:    // Data integrity: clean stale auto-entities before re-extraction on update\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/entity-linker.ts:458:    // stale entity rows from polluting cross-document linking decisions.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/README.md:42:- `archive.sh` - archive completed or stale specs\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:840:    it('keeps stale pending files in place when the db probe reports no committed row', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:841:      const rootDir = makeTempDir('txn-stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:843:      const { originalPath, pendingPath } = createPendingFile(rootDir, 'specs/023/memory/stale.md', '# pending stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:857:      const stale = createPendingFile(rootDir, 'specs/023/memory/stale.md', '# stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:859:      expect(findPendingFiles(rootDir).sort()).toEqual([committed.pendingPath, stale.pendingPath].sort());\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:861:      const results = recoverAllPendingFiles(rootDir, (originalPath) => path.basename(originalPath) !== 'stale.md');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:865:      expect(byPath.get(stale.pendingPath)?.recovered).toBe(false);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:866:      expect(byPath.get(stale.pendingPath)?.error).toContain('Stale pending file');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:868:      expect(fs.existsSync(stale.pendingPath)).toBe(true);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:905:  it('stores file mtimes and reports stale files via mtime checks', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:928:      stale: [],\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:937:      stale: [trackedFile],\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/crash-recovery.vitest.ts:979:  it('cleanupOrphans removes stale nodes/edges', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:342:After every successful save, a consolidation cycle hook fires when `SPECKIT_CONSOLIDATION` is enabled (default ON). The N3-lite consolidation engine scans for contradictions (memory pairs above 0.85 cosine similarity with negation keyword conflicts), runs Hebbian strengthening on recently accessed edges (+0.05 per cycle with a 30-day decay), detects stale edges (unfetched for 90+ days) and enforces edge bounds (maximum 20 per node). The cycle runs on a weekly cadence.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:348:Successful insertions now clear the search cache immediately instead of waiting for delete-time invalidation or TTL expiry. `index_memory()` calls `clear_search_cache()` after the transactional insert, active-projection update and optional `vec_memories` write succeed, so a brand-new memory becomes visible to repeated `memory_search` calls right away. The fix closes a stale-results gap where the save path could report success while cached searches still replayed a pre-insert snapshot.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:370:By default, if embedding regeneration fails (API timeout, provider outage), the entire update rolls back with no changes applied. Nothing happens. With `allowPartialUpdate` enabled, the metadata changes persist and the embedding is marked as pending for later re-indexing by the next `memory_index_scan`. That mode is useful when you need to fix metadata urgently and can tolerate a temporarily stale embedding.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:769:Recovery is automatic and requires no user intervention. If the pending file is stale (the DB row was never committed), it is logged and left for manual review rather than silently deleted.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:787:The archival sweep runs periodically and respects tier-based protection: constitutional and critical-tier memories are never auto-archived. Access tracker data (`access_count`, `last_accessed`) drives the dormancy decision. On unarchive, BM25 is restored from stored text fields, while vector re-embedding is explicitly deferred and logged for the next index scan (no immediate vector row recreation). The archival manager lazy-loads the tier classifier to avoid circular dependencies at import time.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:809:Edge bounds are enforced at insert time. Auto-generated edges (those with `created_by='auto'`) are rejected when a node already has 20 edges (`MAX_EDGES_PER_NODE`) and clamped to a maximum strength of 0.5 (`MAX_AUTO_STRENGTH`). Every strength modification is logged to a `weight_history` table recording old strength, new strength, who changed it, when and why. The `created_by` and `last_accessed` fields on each edge track provenance and usage patterns.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:1561:Every causal edge now carries `created_by` and `last_accessed` metadata fields tracking who created the edge and when it was last used. All strength modifications are logged to a `weight_history` table recording old strength, new strength, the actor (`changed_by`), timestamp and reason.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:1565:This audit infrastructure supports the N3-lite consolidation engine: Hebbian strengthening, staleness detection and edge bounds enforcement all rely on accurate weight history and provenance tracking.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:2015:**C2: Citation fallback chain:** `composite-scoring.ts` fell back through `last_accessed` then `updated_at` when no citation data existed, conflating recency with citation authority. The fallback chain was removed. The function returns 0 when no citation data exists.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:2095:When you ask the same question twice within a short time, the system should not redo all the expensive work. This feature remembers recent results for up to 60 seconds so repeat requests get instant answers from the cache. When you save, update or delete a memory, the cache for affected searches is cleared automatically so you never see stale results.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:2117:The access tracker (`lib/storage/access-tracker.ts`) implements batched access counting with a soft-accumulator pattern. Each retrieval hit increments an in-memory accumulator by 0.1. When the accumulator exceeds the 0.5 threshold, a database write flushes the accumulated count to the `access_count` column in `memory_index` and updates `last_accessed`. This batching reduces write amplification from high-frequency search operations.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:2514:is missing or stale (spec.md modified after description.json).\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:2538:discovery, fresh per-folder files win, stale or corrupt existing files are\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:3135:The legacy V1 pipeline was the root cause of 3 of 4 P0 bugs: an inverted `STATE_PRIORITY` map, divergent scoring order in post-search weighting and a mismatched deep-query variant cap. Since V2 was already the default, the legacy handler path in `memory-search.ts` was removed and the 4-stage orchestrator became the only runtime path. Stage helpers with familiar names now live in stage modules (`stage1-candidate-gen.ts`, `stage2-fusion.ts`, `stage3-rerank.ts`, `stage4-filter.ts`) rather than the old monolithic V1 branch. The `isPipelineV2Enabled()` function now always returns `true` with a deprecation comment, and stale legacy-handler imports were removed.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:3218:**IMPLEMENTED (Sprint 019).** Startup in `context-server.ts` uses `server.setInstructions()` to inject a dynamic memory-system overview (total memories, spec folder count, channels, stale count) into the MCP instruction payload. Reuses existing `memory_stats` logic. Gated by `SPECKIT_DYNAMIC_INIT` (default `true`).\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:3262:When another process changes the database while the server is running, the server needs to notice and reconnect. This feature watches for a signal file that says \\\"the database changed\\\" and automatically refreshes the connection. Without it, the server would keep using stale data until someone manually restarted it.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:3432:Over time, stored memories can contradict each other or grow stale. This feature runs periodic housekeeping to spot conflicts, strengthen connections that get used often and flag relationships that have not been touched in months. Think of it as a librarian who regularly walks the shelves to catch duplicate entries and retire outdated references.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:3843:When you delete or rename a file on your computer, the search index needs to clean up the old entry so it does not show stale results. This feature handles that cleanup automatically. Without it, you could search and find references to files that no longer exist, like a phone book that still lists people who have moved away.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:4425:| `SPECKIT_CONSOLIDATION` | `true` | boolean | `lib/search/search-flags.ts` | Enables the N3-lite consolidation engine which runs after every successful save. Scans for contradictions (>0.85 cosine similarity with negation conflicts), applies Hebbian strengthening (+0.05/cycle, 30-day decay), detects stale edges (>90 days unfetched) and enforces 20 edges per node. Runs weekly. |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:4433:| `SPECKIT_DYNAMIC_INIT` | `true` | boolean | `context-server.ts` | **IMPLEMENTED (Sprint 019).** P1-6: Dynamic server instructions at MCP initialization. `buildServerInstructions()` generates a memory-system overview (total memories, spec folder count, channels, stale count) and injects via `server.setInstructions()`. Instructions are computed once at startup and not refreshed during session (CHK-076). Reuses existing `memory_stats` handler data. |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:4532:| `STALE_CLEANUP_INTERVAL_MS` | `3600000` | number | `lib/session/session-manager.ts` | Interval in milliseconds between stale session cleanup sweeps. Default is 1 hour (3,600,000 ms). Stale sessions are those whose last activity exceeds `STALE_SESSION_THRESHOLD_MS`. |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/feature_catalog.md:4533:| `STALE_SESSION_THRESHOLD_MS` | `86400000` | number | `lib/session/session-manager.ts` | Age in milliseconds at which a session is considered stale and eligible for cleanup. Default is 24 hours (86,400,000 ms). |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/rules/check-spec-doc-integrity.sh:99:                issues+=(\\\"$filename has stale Spec Folder metadata: $spec_folder_value\\\")\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/quality-audit.sh:138:               # --fix: re-run staleness auto-upgrade on failing folders\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/quality-audit.sh:140:                   local staleness_script=\\\"$SCRIPT_DIR/check-template-staleness.sh\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/quality-audit.sh:141:                   if [[ -f \\\"$staleness_script\\\" ]]; then\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/quality-audit.sh:142:                       bash \\\"$staleness_script\\\" --auto-upgrade --root \\\"$folder\\\" 2>/dev/null || true\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/spec/archive.sh:197:    # Clean up any stale temp directories from previous failed runs\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/14--pipeline-architecture/17-cross-process-db-hot-rebinding.md:12:When another process changes the database while the server is running, the server needs to notice and reconnect. This feature watches for a signal file that says \\\"the database changed\\\" and automatically refreshes the connection. Without it, the server would keep using stale data until someone manually restarted it.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage3-rerank.ts:420:        // the reranked value instead of stale Stage 2 values.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/migration/F-MIG-001-junk-residual.md:3:description: \\\"Fixture with stale residual triggers plus useful short anchors.\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/types.ts:26:  last_accessed?: number;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/types.ts:93:  last_accessed?: number;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/11--scoring-and-calibration/16-access-driven-popularity-scoring.md:18:The access tracker (`lib/storage/access-tracker.ts`) implements batched access counting with a soft-accumulator pattern. Each retrieval hit increments an in-memory accumulator by 0.1. When the accumulator exceeds the 0.5 threshold, a database write flushes the accumulated count to the `access_count` column in `memory_index` and updates `last_accessed`. This batching reduces write amplification from high-frequency search operations.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-schema-migration-refinements.vitest.ts:61:    const staleSpecFolder = 'current';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-schema-migration-refinements.vitest.ts:80:      staleSpecFolder,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-schema-migration-refinements.vitest.ts:99:    `).run('history-stale-folder', 101, staleSpecFolder, 'before', 'after', 'UPDATE', 'system');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-schema-migration-refinements.vitest.ts:100:    database.prepare('INSERT INTO session_state (session_id, spec_folder) VALUES (?, ?)').run('session-1', staleSpecFolder);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-schema-migration-refinements.vitest.ts:116:      { id: 'history-stale-folder', spec_folder: canonicalSpecFolder },\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage2-fusion.ts:575:          last_accessed = ?\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/stage2-fusion.ts:988:      // so rrfScore/intentAdjustedScore are not stale for subsequent steps.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/session-bootstrap.vitest.ts:71:  it('adds a structural hint when the bootstrap contract is stale', async () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/session-bootstrap.vitest.ts:73:      status: 'stale',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/session-bootstrap.vitest.ts:74:      summary: 'Code graph is stale',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/session-bootstrap.vitest.ts:82:    expect(parsed.data.structuralContext.status).toBe('stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/session-bootstrap.vitest.ts:84:      structuralContext: expect.objectContaining({ status: 'stale' }),\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/session-bootstrap.vitest.ts:86:    expect(parsed.data.payloadContract.provenance.trustState).toBe('stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/session-bootstrap.vitest.ts:87:    expect(parsed.data.graphOps.readiness.canonical).toBe('stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1094:export function get_usage_stats(options: UsageStatsOptions = {}): Array<{ id: number; title: string | null; spec_folder: string; file_path: string; access_count: number; last_accessed: number | null; confidence: number | null; created_at: string }> {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1101:  const valid_sort_fields = ['access_count', 'last_accessed', 'confidence'];\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1109:           last_accessed, confidence, created_at\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1120:    last_accessed: number | null;\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1158:      last_accessed,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1167:      OR (last_accessed IS NULL AND created_at < ?)\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1169:      last_accessed ASC NULLS FIRST,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1192:      typeof row.last_accessed === 'number' ? new Date(row.last_accessed).toISOString() : null\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1213:      lastAccessedAt: row.last_accessed,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1274:    lastAccessedAt: memory.last_accessed,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts:1279:      typeof memory.last_accessed === 'number' ? new Date(memory.last_accessed).toISOString() : null\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/11--scoring-and-calibration/15-tool-level-ttl-cache.md:12:When you ask the same question twice within a short time, the system should not redo all the expensive work. This feature remembers recent results for up to 60 seconds so repeat requests get instant answers from the cache. When you save, update or delete a memory, the cache for affected searches is cleared automatically so you never see stale results.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/query-flow-tracker.vitest.ts:82:  it('evicts stale queries after the 10 minute TTL', () => {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/10--graph-signal-activation/04-weight-history-audit-tracking.md:3:description: \\\"Describes the `created_by`/`last_accessed` metadata on causal edges, the `weight_history` audit table and the edge bounds enforcement that caps auto-generated edges at 20 per node and 0.5 max strength.\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/10--graph-signal-activation/04-weight-history-audit-tracking.md:10:Describes the `created_by`/`last_accessed` metadata on causal edges, the `weight_history` audit table and the edge bounds enforcement that caps auto-generated edges at 20 per node and 0.5 max strength.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/10--graph-signal-activation/04-weight-history-audit-tracking.md:18:Every causal edge now carries `created_by` and `last_accessed` metadata fields tracking who created the edge and when it was last used. All strength modifications are logged to a `weight_history` table recording old strength, new strength, the actor (`changed_by`), timestamp and reason.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/10--graph-signal-activation/04-weight-history-audit-tracking.md:22:This audit infrastructure supports the N3-lite consolidation engine: Hebbian strengthening, staleness detection and edge bounds enforcement all rely on accurate weight history and provenance tracking.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/scripts/tests/test-folder-detector-functional.js:295:    `).run('099-stale-folder', 'T-stale', 'preflight');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/18-session-resume-tool.md:12:The session_resume handler performs three sub-calls: (1) `memory_context` with `mode=resume` and `profile=resume` to recover session state, (2) code graph database query for node/edge/file counts and last scan timestamp, and (3) CocoIndex binary availability check via filesystem probe. It also appends the shared structural ready/stale/missing contract from `session-snapshot.ts`, so callers can tell when a deeper refresh is needed. Results are merged into a `SessionResumeResult` with `memory`, `codeGraph`, `cocoIndex`, optional `structuralContext`, and `hints` fields. Failures in any sub-call are captured as error entries with recovery hints rather than failing the entire call. For the canonical first-call recovery step, use `session_bootstrap`; `session_resume` remains the detailed merged surface.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/17-session-health-tool.md:3:description: \\\"MCP tool (session_health) that reports session readiness with ok/warning/stale status, code graph freshness, priming status, and quality score.\\\"\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/17-session-health-tool.md:10:MCP tool (session_health) that reports session readiness with ok/warning/stale status, code graph freshness, priming status, and quality score.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/17-session-health-tool.md:12:The session_health handler computes session status based on three time thresholds: ok (last tool call within 15 minutes), warning (within 60 minutes), stale (beyond 60 minutes or session older than 24 hours). It returns structured details including sessionAgeMs, lastToolCallAgoMs, graphFreshness (fresh/stale/empty/error), specFolder, primingStatus, and a QualityScore with 4 weighted factors (recency, recovery, graphFreshness, continuity). Actionable hints guide the user toward recovery actions. The session_health tool call is excluded from recordToolCall() to prevent idle timer reset — health checks no longer artificially extend session freshness.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/code-graph-ops-hardening.vitest.ts:11:    expect(normalizeStructuralReadiness('stale')).toBe('stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/code-graph-ops-hardening.vitest.ts:18:      graphFreshness: 'stale',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/code-graph-ops-hardening.vitest.ts:22:    expect(contract.readiness.canonical).toBe('stale');\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/full-spec-doc-indexing.vitest.ts:869:        last_accessed: 0,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/full-spec-doc-indexing.vitest.ts:912:        last_accessed: 0,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/15-code-graph-auto-trigger.md:12:The ensure-ready module checks graph state (fresh/stale/empty) by comparing the current git HEAD against the last indexed HEAD and scanning for stale files. When the graph is empty, a full scan is triggered. When files are stale but below the selective reindex threshold (50 files), only changed files are reindexed. Above the threshold, a full rescan is performed. A 10-second timeout prevents blocking on large codebases. Shared by code_graph_context, code_graph_query, and code_graph_status handlers.\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/15-code-graph-auto-trigger.md:28:| `mcp_server/lib/code-graph/ensure-ready.ts` | Lib | Auto-trigger with git HEAD comparison and staleness detection |\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/hook-state.vitest.ts:190:      const projectCwd = join(tmpdir(), `speckit-stale-state-${Date.now()}`);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/hook-state.vitest.ts:196:        const staleSessionId = 'stale-session';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/hook-state.vitest.ts:197:        const staleState: HookState = {\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/hook-state.vitest.ts:198:          claudeSessionId: staleSessionId,\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/hook-state.vitest.ts:199:          speckitSessionId: 'sk-stale',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/hook-state.vitest.ts:200:          lastSpecFolder: 'specs/stale',\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/hook-state.vitest.ts:208:        saveState(staleSessionId, staleState);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/hook-state.vitest.ts:210:        const stalePath = getStatePath(staleSessionId);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/hook-state.vitest.ts:211:        const staleTime = new Date(Date.now() - 26 * 60 * 60 * 1000);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/hook-state.vitest.ts:212:        utimesSync(stalePath, staleTime, staleTime);\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/hook-state.vitest.ts:215:          scope: { specFolder: 'specs/stale', claudeSessionId: staleSessionId },\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/hook-state.vitest.ts:217:        try { rmSync(stalePath); } catch { /* ok */ }\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:453:      const content = 'Existing same-path row with stale trigger phrases.';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:483:      const content = 'Existing same-path row with stale trigger phrases.';\\n/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/feature_catalog/22--context-preservation-and-code-graph/22-context-preservation-metrics.md:12:The context-metrics module mscripts/core/quality-scorer.ts:52:export type { QualityFlag, QualityDimensionScore, QualityInsufficiencySummary, QualityScoreResult } from '../types/session-types';\\n.opencode/skills/system-spec-kit/scripts/core/quality-scorer.ts:129:  triggerPhrases: 10,    // >= 4 trigger phrases extracted\\n.opencode/skills/system-spec-kit/scripts/core/quality-scorer.ts:130:  keyTopics: 5,          // >= 1 key topic present\\n.opencode/skills/system-spec-kit/scripts/core/quality-scorer.ts:142:  triggerPhrases: string[],\\n.opencode/skills/system-spec-kit/scripts/core/quality-scorer.ts:153:    triggerPhrases: 0,\\n.opencode/skills/system-spec-kit/scripts/core/quality-scorer.ts:162:  if (triggerPhrases.length >= 8) {\\n.opencode/skills/system-spec-kit/scripts/core/quality-scorer.ts:163:    breakdown.triggerPhrases = 20;\\n.opencode/skills/system-spec-kit/scripts/core/quality-scorer.ts:164:  } else if (triggerPhrases.length >= 4) {\\n.opencode/skills/system-spec-kit/scripts/core/quality-scorer.ts:165:    breakdown.triggerPhrases = 15;\\n.opencode/skills/system-spec-kit/scripts/core/quality-scorer.ts:166:  } else if (triggerPhrases.length > 0) {\\n.opencode/skills/system-spec-kit/scripts/core/quality-scorer.ts:167:    breakdown.triggerPhrases = 10;\\n.opencode/skills/system-spec-kit/scripts/core/quality-scorer.ts:169:    qualityFlags.add('missing_trigger_phrases');\\n.opencode/skills/system-spec-kit/scripts/core/quality-scorer.ts:170:    warnings.push('No trigger phrases extracted — memory will not surface via trigger matching');\\n.opencode/skills/system-spec-kit/scripts/core/quality-scorer.ts:173:  // 2. Key topics (0-15 points)\\n.opencode/skills/system-spec-kit/scripts/core/quality-scorer.ts:181:    qualityFlags.add('missing_key_topics');\\n.opencode/skills/system-spec-kit/scripts/core/quality-scorer.ts:182:    warnings.push('No key topics extracted — memory searchability reduced');\\n.opencode/skills/system-spec-kit/scripts/core/quality-scorer.ts:186:  // This rewards memory files that remain self-explanatory in future sessions.\\n.opencode/skills/system-spec-kit/scripts/core/quality-scorer.ts:249:    qualityFlags.add('duplicate_observations');\\n.opencode/skills/system-spec-kit/scripts/core/quality-scorer.ts:251:    warnings.push('No observations captured — memory lacks concrete session evidence');\\n.opencode/skills/system-spec-kit/scripts/core/quality-scorer.ts:262:      qualityFlags.add('duplicate_observations');\\n.opencode/skills/system-spec-kit/scripts/core/quality-scorer.ts:263:      warnings.push(`High observation duplication: ${titles.length - uniqueTitles.size} duplicate titles`);\\n.opencode/skills/system-spec-kit/scripts/core/quality-scorer.ts:266:      qualityFlags.add('duplicate_observations');\\n.opencode/skills/system-spec-kit/scripts/core/quality-scorer.ts:278:    hasTriggers: breakdown.triggerPhrases >= JSON_FLOOR_THRESHOLDS.triggerPhrases,\\n.opencode/skills/system-spec-kit/scripts/core/quality-scorer.ts:331:    { id: 'trigger_phrases', score01: breakdown.triggerPhrases / 20, score100: breakdown.triggerPhrases, maxScore100: 20, passed: triggerPhrases.length > 0 },\\n.opencode/skills/system-spec-kit/scripts/core/quality-scorer.ts:332:    { id: 'key_topics', score01: breakdown.keyTopics / 15, score100: breakdown.keyTopics, maxScore100: 15, passed: keyTopics.length > 0 },\\n.opencode/skills/system-spec-kit/scripts/memory/migrate-historical-json-mode-memories.ts:12:import { sanitizeTriggerPhrase } from '../lib/trigger-phrase-sanitizer';\\n.opencode/skills/system-spec-kit/scripts/memory/migrate-historical-json-mode-memories.ts:77:  triggers: string[];\\n.opencode/skills/system-spec-kit/scripts/memory/migrate-historical-json-mode-memories.ts:485:  const triggers = parseFrontmatterArray(content, 'trigger_phrases');\\n.opencode/skills/system-spec-kit/scripts/memory/migrate-historical-json-mode-memories.ts:493:    triggers,\\n.opencode/skills/system-spec-kit/scripts/memory/migrate-historical-json-mode-memories.ts:530:  if (parsed.triggers.some((phrase) => sanitizeTriggerPhrase(phrase).reason === 'path_fragment')) {\\n.opencode/skills/system-spec-kit/scripts/memory/migrate-historical-json-mode-memories.ts:531:    signals.push('path_fragment_trigger');\\n.opencode/skills/system-spec-kit/scripts/memory/migrate-historical-json-mode-memories.ts:551:function detectD3(triggers: string[]): boolean {\\n.opencode/skills/system-spec-kit/scripts/memory/migrate-historical-json-mode-memories.ts:552:  return triggers.some((phrase) => {\\n.opencode/skills/system-spec-kit/scripts/memory/migrate-historical-json-mode-memories.ts:571:function detectD6(triggers: string[]): boolean {\\n.opencode/skills/system-spec-kit/scripts/memory/migrate-historical-json-mode-memories.ts:573:  for (const trigger of triggers) {\\n.opencode/skills/system-spec-kit/scripts/memory/migrate-historical-json-mode-memories.ts:574:    const normalized = trigger.trim().toLowerCase();\\n.opencode/skills/system-spec-kit/scripts/memory/migrate-historical-json-mode-memories.ts:618:  if (detectD3(parsed.triggers)) {\\n.opencode/skills/system-spec-kit/scripts/memory/migrate-historical-json-mode-memories.ts:627:  if (detectD6(parsed.triggers)) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/orchestrator.ts:12:// Input:  PipelineConfig (query, embedding, limits, flags, intent, session)\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/orchestrator.ts:101:        sessionBoostApplied: 'failed' as SignalStatus,\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/pipeline/orchestrator.ts:102:        causalBoostApplied: 'failed' as SignalStatus,\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/folder-discovery.ts:344: * - Deduplicates\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/folder-discovery.ts:347: * @returns Deduplicated array of significant lowercase keywords.\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/folder-discovery.ts:707:    // Validate ALL PerFolderDescription fields — type mismatch triggers spec.md fallback.\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/folder-discovery.ts:723:      return null; // Structurally invalid — triggers spec.md fallback\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/bm25-index.ts:4:// Feature catalog: BM25 trigger phrase re-index gate\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/bm25-index.ts:5:import type Database from 'better-sqlite3';\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/bm25-index.ts:31:  trigger_phrases?: string | string[] | null;\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/bm25-index.ts:51: * These weights are consumed by the FTS5 path in sqlite-fts.ts,\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/bm25-index.ts:55: * trigger_phrases:  5.0 — curated keywords next most important\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/bm25-index.ts:63:  trigger_phrases: BM25_FTS5_WEIGHTS[1],\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/bm25-index.ts:119:  // Only deduplicate doubled consonants when a suffix was actually removed.\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/bm25-index.ts:124:  // Are identical consonants and deduplicate.\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/bm25-index.ts:181:function normalizeTriggerPhrasesForBM25(triggerPhrases: string | string[] | null | undefined): string {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/bm25-index.ts:182:  if (Array.isArray(triggerPhrases)) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/bm25-index.ts:183:    return triggerPhrases\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/bm25-index.ts:188:  if (typeof triggerPhrases !== 'string') {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/bm25-index.ts:192:  const trimmed = triggerPhrases.trim();\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/bm25-index.ts:222:  const triggerPhrases = normalizeTriggerPhrasesForBM25(row.trigger_phrases);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/bm25-index.ts:223:  if (triggerPhrases) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/bm25-index.ts:224:    textParts.push(triggerPhrases);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/bm25-index.ts:380:        `SELECT id, title, content_text, trigger_phrases, file_path\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/bm25-index.ts:381:         FROM memory_index\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/bm25-index.ts:388:        trigger_phrases: string | null;\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/bm25-index.ts:430:         FROM memory_index\\n.opencode/skills/system-spec-kit/scripts/tests/test-export-contracts.js:112:  // Deduplicate noisy duplicates from multiple export forms\\n.opencode/skills/system-spec-kit/scripts/tests/test-export-contracts.js:167:  { file: 'causal-graph.ts', minHandleFuncs: 3 },\\n.opencode/skills/system-spec-kit/scripts/tests/test-export-contracts.js:174:  { file: 'memory-triggers.ts', minHandleFuncs: 1 },\\n.opencode/skills/system-spec-kit/scripts/tests/test-export-contracts.js:175:  { file: 'session-learning.ts', minHandleFuncs: 3 },\\n.opencode/skills/system-spec-kit/scripts/tests/test-export-contracts.js:331:    // Deduplicate\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/llm-reformulation.ts:24:import { fts5Bm25Search } from './sqlite-fts.js';\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/llm-reformulation.ts:110:    const rawResults = fts5Bm25Search(db, query, { limit });\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/llm-reformulation.ts:389: * Deduplicated fanout: combines the original query with the LLM-produced\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/llm-reformulation.ts:394: * @param queries - Array of query strings to deduplicate.\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/llm-reformulation.ts:395: * @returns Deduplicated array, original first.\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:7:import Database from 'better-sqlite3';\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:51:const REQUIRED_TABLES: readonly string[] = ['memory_index', 'schema_version'];\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:53:  memory_index: [\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:74:  'session_id',\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:122:  ON memory_index(\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:129:    session_id,\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:137:  ON memory_index(spec_folder, canonical_file_path, id DESC)\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:143:    \\\"SELECT 1 AS present FROM sqlite_master WHERE type='table' AND name = ?\\\"\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:151:    \\\"SELECT 1 AS present FROM sqlite_master WHERE type='index' AND name = ?\\\"\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:165:    \\\"SELECT sql FROM sqlite_master WHERE type='table' AND name = ?\\\"\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:217:  const tableSql = getTableSql(database, 'memory_index');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:247:    CREATE TABLE IF NOT EXISTS memory_conflicts (\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:262:      FOREIGN KEY (existing_memory_id) REFERENCES memory_index(id) ON DELETE SET NULL\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:409:// Added causal_edges table for Causal Memory Graph (REQ-012, T043-T047)\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:419:// V18: the rollout — weight_history table + causal_edges provenance + encoding_intent column\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:422:// V21: Add learned_triggers column (R11 learned feedback)\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:424:// V23: One-time spec_folder re-canonicalization + session_state migration\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:425:// V24: Add trigger-cache source and temporal contiguity indexes\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:458:        database.exec('ALTER TABLE memory_index ADD COLUMN related_memories TEXT');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:461:        if (!get_error_message(e).includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:470:        { name: 'stability', sql: 'ALTER TABLE memory_index ADD COLUMN stability REAL DEFAULT 1.0' },\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:471:        { name: 'difficulty', sql: 'ALTER TABLE memory_index ADD COLUMN difficulty REAL DEFAULT 5.0' },\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:472:        { name: 'last_review', sql: 'ALTER TABLE memory_index ADD COLUMN last_review TEXT' },\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:473:        { name: 'review_count', sql: 'ALTER TABLE memory_index ADD COLUMN review_count INTEGER DEFAULT 0' }\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:481:          if (!get_error_message(e).includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:495:        'CREATE INDEX IF NOT EXISTS idx_stability ON memory_index(stability DESC)',\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:501:        'CREATE INDEX IF NOT EXISTS idx_last_review ON memory_index(last_review)',\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:507:        'CREATE INDEX IF NOT EXISTS idx_fsrs_retrieval ON memory_index(stability, difficulty, last_review)',\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:516:          ALTER TABLE memory_index ADD COLUMN memory_type TEXT DEFAULT 'declarative'\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:524:        if (!get_error_message(e).includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:530:        database.exec('ALTER TABLE memory_index ADD COLUMN half_life_days REAL');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:533:        if (!get_error_message(e).includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:540:          ALTER TABLE memory_index ADD COLUMN type_inference_source TEXT DEFAULT 'default'\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:547:        if (!get_error_message(e).includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:553:        database.exec('CREATE INDEX IF NOT EXISTS idx_memory_type ON memory_index(memory_type)');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:554:        database.exec('CREATE INDEX IF NOT EXISTS idx_memory_type_decay ON memory_index(memory_type, half_life_days)');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:565:        database.exec('ALTER TABLE memory_index ADD COLUMN file_mtime_ms INTEGER');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:568:        if (!get_error_message(e).includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:574:        database.exec('CREATE INDEX IF NOT EXISTS idx_file_mtime ON memory_index(file_mtime_ms)');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:585:          ON memory_index(embedding_status)\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:596:          ON memory_index(spec_folder, embedding_status, importance_tier)\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:605:      // V7 -> v8: Create causal_edges table for Causal Memory Graph (REQ-012, T043-T047)\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:608:          CREATE TABLE IF NOT EXISTS causal_edges (\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:623:        logger.info('Migration v8: Created causal_edges table');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:626:          console.warn('[VectorIndex] Migration v8 warning (causal_edges):', get_error_message(e));\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:631:        database.exec('CREATE INDEX IF NOT EXISTS idx_causal_source ON causal_edges(source_id)');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:632:        database.exec('CREATE INDEX IF NOT EXISTS idx_causal_target ON causal_edges(target_id)');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:633:        database.exec('CREATE INDEX IF NOT EXISTS idx_causal_relation ON causal_edges(relation)');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:634:        database.exec('CREATE INDEX IF NOT EXISTS idx_causal_strength ON causal_edges(strength DESC)');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:635:        logger.info('Migration v8: Created causal_edges indexes');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:644:          CREATE TABLE IF NOT EXISTS memory_corrections (\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:660:            FOREIGN KEY (original_memory_id) REFERENCES memory_index(id) ON DELETE CASCADE,\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:661:            FOREIGN KEY (correction_memory_id) REFERENCES memory_index(id) ON DELETE SET NULL\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:693:        database.exec(\\\"ALTER TABLE memory_index ADD COLUMN document_type TEXT DEFAULT 'memory'\\\");\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:696:        if (!get_error_message(e).includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:702:        database.exec('ALTER TABLE memory_index ADD COLUMN spec_level INTEGER');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:705:        if (!get_error_message(e).includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:713:        'CREATE INDEX IF NOT EXISTS idx_document_type ON memory_index(document_type)',\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:719:        'CREATE INDEX IF NOT EXISTS idx_doc_type_folder ON memory_index(document_type, spec_folder)',\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:726:          UPDATE memory_index SET document_type = 'constitutional'\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:738:        database.exec('ALTER TABLE memory_index ADD COLUMN content_text TEXT');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:741:        if (!get_error_message(e).includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:753:          CREATE VIRTUAL TABLE memory_fts USING fts5(\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:754:            title, trigger_phrases, file_path, content_text,\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:755:            content='memory_index', content_rowid='id'\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:760:          CREATE TRIGGER memory_fts_insert AFTER INSERT ON memory_index BEGIN\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:761:            INSERT INTO memory_fts(rowid, title, trigger_phrases, file_path, content_text)\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:762:            VALUES (new.id, new.title, new.trigger_phrases, new.file_path, new.content_text);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:766:          CREATE TRIGGER memory_fts_update AFTER UPDATE ON memory_index BEGIN\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:767:            INSERT INTO memory_fts(memory_fts, rowid, title, trigger_phrases, file_path, content_text)\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:768:            VALUES ('delete', old.id, old.title, old.trigger_phrases, old.file_path, old.content_text);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:769:            INSERT INTO memory_fts(rowid, title, trigger_phrases, file_path, content_text)\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:770:            VALUES (new.id, new.title, new.trigger_phrases, new.file_path, new.content_text);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:774:          CREATE TRIGGER memory_fts_delete AFTER DELETE ON memory_index BEGIN\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:775:            INSERT INTO memory_fts(memory_fts, rowid, title, trigger_phrases, file_path, content_text)\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:776:            VALUES ('delete', old.id, old.title, old.trigger_phrases, old.file_path, old.content_text);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:786:          'SELECT id, file_path FROM memory_index WHERE content_text IS NULL'\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:792:          'UPDATE memory_index SET content_text = ? WHERE id = ?'\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:834:        database.exec('ALTER TABLE memory_index ADD COLUMN quality_score REAL DEFAULT 0');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:837:        if (!get_error_message(e).includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:843:        database.exec('ALTER TABLE memory_index ADD COLUMN quality_flags TEXT');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:846:        if (!get_error_message(e).includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:854:        'CREATE INDEX IF NOT EXISTS idx_quality_score ON memory_index(quality_score)',\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:862:        database.exec('ALTER TABLE memory_index ADD COLUMN parent_id INTEGER REFERENCES memory_index(id) ON DELETE CASCADE');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:865:        if (!get_error_message(e).includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:871:        database.exec('ALTER TABLE memory_index ADD COLUMN chunk_index INTEGER');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:874:        if (!get_error_message(e).includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:880:        database.exec('ALTER TABLE memory_index ADD COLUMN chunk_label TEXT');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:883:        if (!get_error_message(e).includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:889:        database.exec('CREATE INDEX IF NOT EXISTS idx_parent_id ON memory_index(parent_id)');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:890:        database.exec('CREATE INDEX IF NOT EXISTS idx_parent_chunk ON memory_index(parent_id, chunk_index)');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:899:        database.exec('ALTER TABLE memory_index ADD COLUMN interference_score REAL DEFAULT 0');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:902:        if (!get_error_message(e).includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:908:        database.exec('CREATE INDEX IF NOT EXISTS idx_interference_score ON memory_index(interference_score)');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:918:          CREATE TABLE IF NOT EXISTS weight_history (\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:920:            edge_id INTEGER NOT NULL REFERENCES causal_edges(id) ON DELETE CASCADE,\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:938:        database.exec(\\\"ALTER TABLE causal_edges ADD COLUMN created_by TEXT DEFAULT 'manual'\\\");\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:939:        logger.info('Migration v18: Added created_by column to causal_edges');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:941:        if (!get_error_message(e).includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:946:        database.exec('ALTER TABLE causal_edges ADD COLUMN last_accessed TEXT');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:947:        logger.info('Migration v18: Added last_accessed column to causal_edges');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:949:        if (!get_error_message(e).includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:955:        database.exec(\\\"ALTER TABLE memory_index ADD COLUMN encoding_intent TEXT DEFAULT 'document'\\\");\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:956:        database.exec('CREATE INDEX IF NOT EXISTS idx_encoding_intent ON memory_index(encoding_intent)');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:957:        logger.info('Migration v18: Added encoding_intent column to memory_index (R16)');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:959:        if (!get_error_message(e).includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:968:          CREATE TABLE IF NOT EXISTS degree_snapshots (\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:987:          CREATE TABLE IF NOT EXISTS community_assignments (\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1007:          CREATE TABLE IF NOT EXISTS memory_summaries (\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1027:          CREATE TABLE IF NOT EXISTS memory_entities (\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1049:          CREATE TABLE IF NOT EXISTS entity_catalog (\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1068:  // V20 -> v21: Add learned_triggers column (R11 learned feedback)\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1071:      database.exec(\\\"ALTER TABLE memory_index ADD COLUMN learned_triggers TEXT DEFAULT '[]'\\\");\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1072:      logger.info('Migration v21: Added learned_triggers column (R11)');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1074:      if (!get_error_message(e).includes('duplicate column') && !get_error_message(e).includes('already exists')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1075:        console.warn('[VectorIndex] Migration v21 warning (learned_triggers):', get_error_message(e));\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1094:      SELECT id, file_path, spec_folder FROM memory_index\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1118:        'UPDATE memory_index SET spec_folder = ? WHERE id = ? AND spec_folder = ?'\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1126:    // P1-3 fix: Migrate session_state.spec_folder using old→new mapping\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1134:      'idx_trigger_cache_source',\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1135:      `CREATE INDEX IF NOT EXISTS idx_trigger_cache_source\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1136:       ON memory_index(embedding_status, id)\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1138:         AND trigger_phrases IS NOT NULL\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1139:         AND trigger_phrases != '[]'\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1140:         AND trigger_phrases != ''`,\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1146:      'CREATE INDEX IF NOT EXISTS idx_spec_folder_created_at ON memory_index(spec_folder, created_at DESC)',\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1149:    logger.info('Migration v24: Created trigger-cache source and temporal contiguity indexes');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1156:      UPDATE memory_index SET context_type = 'planning' WHERE context_type = 'decision'\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1159:      UPDATE memory_index SET context_type = 'general' WHERE context_type = 'discovery'\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1166:      `SELECT COUNT(*) as cnt FROM pragma_table_info('memory_index') WHERE name = 'context_type'`\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1172:        `SELECT sql FROM sqlite_master WHERE type='table' AND name='memory_index'`\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1178:        const columns = database.prepare(`PRAGMA table_info(memory_index)`).all() as Array<{ name: string }>;\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1183:          `SELECT sql FROM sqlite_master WHERE type='index' AND tbl_name='memory_index' AND sql IS NOT NULL`\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1187:        database.exec(`ALTER TABLE memory_index RENAME TO memory_index_v24_backup`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1189:        // Get the CREATE TABLE statement and replace the CHECK constraint\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1206:        database.exec(`INSERT INTO memory_index SELECT ${columnNames} FROM memory_index_v24_backup`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1207:        database.exec(`DROP TABLE memory_index_v24_backup`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1218:        logger.info('Migration v25: Rebuilt memory_index with strict CHECK(context_type) — canonical types only');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1251:    CREATE TABLE IF NOT EXISTS schema_version (\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1293:    CREATE TABLE IF NOT EXISTS memory_lineage (\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1311:    \\\"SELECT sql FROM sqlite_master WHERE type='table' AND name='memory_lineage'\\\"\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1316:      CREATE TABLE memory_lineage (\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1357:    CREATE TABLE IF NOT EXISTS active_memory_projection (\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1366:    \\\"SELECT sql FROM sqlite_master WHERE type='table' AND name='active_memory_projection'\\\"\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1371:      CREATE TABLE active_memory_projection (\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1407:  if (!hasTable(database, 'memory_index')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1411:  const columnNames = getTableColumns(database, 'memory_index');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1414:    { name: 'tenant_id', sql: 'ALTER TABLE memory_index ADD COLUMN tenant_id TEXT' },\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1415:    { name: 'user_id', sql: 'ALTER TABLE memory_index ADD COLUMN user_id TEXT' },\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1416:    { name: 'agent_id', sql: 'ALTER TABLE memory_index ADD COLUMN agent_id TEXT' },\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1417:    { name: 'shared_space_id', sql: 'ALTER TABLE memory_index ADD COLUMN shared_space_id TEXT' },\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1418:    { name: 'provenance_source', sql: 'ALTER TABLE memory_index ADD COLUMN provenance_source TEXT' },\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1419:    { name: 'provenance_actor', sql: 'ALTER TABLE memory_index ADD COLUMN provenance_actor TEXT' },\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1420:    { name: 'governed_at', sql: 'ALTER TABLE memory_index ADD COLUMN governed_at TEXT' },\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1421:    { name: 'retention_policy', sql: \\\"ALTER TABLE memory_index ADD COLUMN retention_policy TEXT DEFAULT 'keep'\\\" },\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1422:    { name: 'delete_after', sql: 'ALTER TABLE memory_index ADD COLUMN delete_after TEXT' },\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1423:    { name: 'governance_metadata', sql: 'ALTER TABLE memory_index ADD COLUMN governance_metadata TEXT' },\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1440:    CREATE TABLE IF NOT EXISTS governance_audit (\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1449:      session_id TEXT,\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1461:      ON governance_audit(tenant_id, user_id, agent_id, session_id, shared_space_id);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1464:  if (hasTable(database, 'memory_index')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1467:        ON memory_index(tenant_id, user_id, agent_id, session_id, shared_space_id);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1469:        ON memory_index(delete_after);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1478:    CREATE TABLE IF NOT EXISTS shared_spaces (\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1492:    CREATE TABLE IF NOT EXISTS shared_space_members (\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1504:    CREATE TABLE IF NOT EXISTS shared_space_conflicts (\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1539:    if (hasTable(database, 'memory_index')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1540:      const existingColumns = new Set(getTableColumns(database, 'memory_index'));\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1543:        missingColumns.memory_index = absentColumns;\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1546:        constraintMismatches.push('memory_index.importance_tier CHECK constraint is missing constitutional support');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1549:      missingColumns.memory_index = [...REQUIRED_MEMORY_INDEX_COLUMNS];\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1601:      missingColumns: { memory_index: [...REQUIRED_MEMORY_INDEX_COLUMNS] },\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1682:  const columns = database.prepare(`PRAGMA table_info(memory_index)`).all() as Array<{ name: string }>;\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1687:      database.exec(`ALTER TABLE memory_index ADD COLUMN confidence REAL DEFAULT 0.5`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1690:      if (!get_error_message(error).includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1699:      database.exec(`ALTER TABLE memory_index ADD COLUMN validation_count INTEGER DEFAULT 0`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1702:      if (!get_error_message(error).includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1711:      database.exec(`ALTER TABLE memory_index ADD COLUMN importance_tier TEXT DEFAULT 'normal'`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1714:      if (!get_error_message(error).includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1720:      database.exec(`CREATE INDEX IF NOT EXISTS idx_importance_tier ON memory_index(importance_tier)`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1731:      database.exec(`ALTER TABLE memory_index ADD COLUMN context_type TEXT DEFAULT 'general'`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1734:      if (!get_error_message(error).includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1743:      database.exec(`ALTER TABLE memory_index ADD COLUMN content_hash TEXT`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1746:      if (!get_error_message(error).includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1755:      database.exec(`ALTER TABLE memory_index ADD COLUMN channel TEXT DEFAULT 'default'`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1758:      if (!get_error_message(error).includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1765:  if (!column_names.includes('session_id')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1767:      database.exec(`ALTER TABLE memory_index ADD COLUMN session_id TEXT`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1768:      console.warn('[vector-index] Migration: Added session_id column');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1770:      if (!get_error_message(error).includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1773:      logDuplicateColumnMigrationSkip('session_id', error);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1779:      database.exec(`ALTER TABLE memory_index ADD COLUMN base_importance REAL DEFAULT 0.5`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1782:      if (!get_error_message(error).includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1791:      database.exec(`ALTER TABLE memory_index ADD COLUMN decay_half_life_days REAL DEFAULT 90.0`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1794:      if (!get_error_message(error).includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1803:      database.exec(`ALTER TABLE memory_index ADD COLUMN is_pinned INTEGER DEFAULT 0`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1806:      if (!get_error_message(error).includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1815:      database.exec(`ALTER TABLE memory_index ADD COLUMN last_accessed INTEGER DEFAULT 0`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1818:      if (!get_error_message(error).includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1827:      database.exec(`ALTER TABLE memory_index ADD COLUMN expires_at DATETIME`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1830:      if (!get_error_message(error).includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1839:      database.exec(`ALTER TABLE memory_index ADD COLUMN related_memories TEXT`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1842:      if (!get_error_message(error).includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1851:      database.exec(`ALTER TABLE memory_index ADD COLUMN stability REAL DEFAULT 1.0`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1854:      if (!get_error_message(error).includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1863:      database.exec(`ALTER TABLE memory_index ADD COLUMN difficulty REAL DEFAULT 5.0`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1866:      if (!get_error_message(error).includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1875:      database.exec(`ALTER TABLE memory_index ADD COLUMN last_review TEXT`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1878:      if (!get_error_message(error).includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1887:      database.exec(`ALTER TABLE memory_index ADD COLUMN review_count INTEGER DEFAULT 0`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1890:      if (!get_error_message(error).includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1904:  const columns = database.prepare('PRAGMA table_info(memory_index)').all() as Array<{ name: string }>;\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1909:      database.exec('ALTER TABLE memory_index ADD COLUMN canonical_file_path TEXT');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1912:      if (!get_error_message(error).includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1920:    database.exec('CREATE INDEX IF NOT EXISTS idx_canonical_file_path ON memory_index(canonical_file_path)');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1921:    database.exec('CREATE INDEX IF NOT EXISTS idx_spec_canonical_path ON memory_index(spec_folder, canonical_file_path)');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1934:    FROM memory_index\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1943:    UPDATE memory_index\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1974:  const tableSql = getTableSql(database, 'memory_index');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1982:      SELECT COUNT(*) as count FROM memory_index\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1988:        ? `Legacy memory_index importance_tier constraint is missing constitutional support and blocks ${constitutionalCount} constitutional memories`\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1989:        : 'Legacy memory_index importance_tier constraint is missing constitutional support and requires a table rebuild before startup can continue'\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2002:    database.exec(`CREATE INDEX IF NOT EXISTS idx_file_path ON memory_index(file_path)`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2013:    database.exec('CREATE INDEX IF NOT EXISTS idx_canonical_file_path ON memory_index(canonical_file_path)');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2014:    database.exec('CREATE INDEX IF NOT EXISTS idx_spec_canonical_path ON memory_index(spec_folder, canonical_file_path)');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2030:    database.exec(`CREATE INDEX IF NOT EXISTS idx_content_hash ON memory_index(content_hash)`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2047:    database.exec(`CREATE INDEX IF NOT EXISTS idx_last_accessed ON memory_index(last_accessed DESC)`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2058:    database.exec(`CREATE INDEX IF NOT EXISTS idx_importance_tier ON memory_index(importance_tier)`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2070:      CREATE INDEX IF NOT EXISTS idx_trigger_cache_source\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2071:      ON memory_index(embedding_status, id)\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2073:        AND trigger_phrases IS NOT NULL\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2074:        AND trigger_phrases != '[]'\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2075:        AND trigger_phrases != ''\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2077:    logger.info('Created idx_trigger_cache_source index');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2079:    console.warn('[vector-index] Failed to create idx_trigger_cache_source', {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2081:      index: 'idx_trigger_cache_source',\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2087:    database.exec('CREATE INDEX IF NOT EXISTS idx_spec_folder_created_at ON memory_index(spec_folder, created_at DESC)');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2109: * Ensure companion tables exist alongside memory_index.\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2113:    CREATE TABLE IF NOT EXISTS memory_history (\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2127:    \\\"SELECT sql FROM sqlite_master WHERE type='table' AND name='memory_history'\\\"\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2132:      CREATE TABLE memory_history (\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2148:    CREATE TABLE IF NOT EXISTS checkpoints (\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2172: * Migrate session_state.spec_folder values using the old→new mapping\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2173: * produced by the memory_index re-canonicalization in migration v23.\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2179:  if (!hasTable(database, 'session_state')) return;\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2190:    'UPDATE session_state SET spec_folder = ? WHERE session_id = ? AND spec_folder = ?'\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2193:  const sessionRows = database.prepare(\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2194:    `SELECT session_id, spec_folder FROM session_state WHERE spec_folder IS NOT NULL`\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2195:  ).all() as Array<{ session_id: string; spec_folder: string }>;\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2198:  for (const row of sessionRows) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2202:      updateStmt.run(canonical, row.session_id, row.spec_folder);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2205:      logger.warn(`Migration v23: Ambiguous session_state mapping for \\\"${row.spec_folder}\\\". Skipping.`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2210:    logger.info(`Migration v23: Updated spec_folder for ${updated} session_state rows`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2266:  options: { sqlite_vec_available: boolean; get_embedding_dim: () => number }\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2268:  const { sqlite_vec_available, get_embedding_dim } = options;\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2271:    SELECT name FROM sqlite_master\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2272:    WHERE type='table' AND name='memory_index'\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2297:  // Create memory_index table (metadata only)\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2299:    CREATE TABLE memory_index (\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2306:      trigger_phrases TEXT,\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2325:      session_id TEXT,\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2351:      parent_id INTEGER REFERENCES memory_index(id) ON DELETE CASCADE,\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2355:      learned_triggers TEXT DEFAULT '[]',\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2361:  // Create vec_memories virtual table (only if sqlite-vec is available)\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2362:  if (sqlite_vec_available) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2370:      CREATE TABLE IF NOT EXISTS vec_metadata (\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2384:    CREATE VIRTUAL TABLE IF NOT EXISTS memory_fts USING fts5(\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2385:      title, trigger_phrases, file_path, content_text,\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2386:      content='memory_index', content_rowid='id'\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2390:  // Create FTS5 sync triggers (includes content_text)\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2392:    CREATE TRIGGER IF NOT EXISTS memory_fts_insert AFTER INSERT ON memory_index BEGIN\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2393:      INSERT INTO memory_fts(rowid, title, trigger_phrases, file_path, content_text)\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2394:      VALUES (new.id, new.title, new.trigger_phrases, new.file_path, new.content_text);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2399:    CREATE TRIGGER IF NOT EXISTS memory_fts_update AFTER UPDATE ON memory_index BEGIN\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2400:      INSERT INTO memory_fts(memory_fts, rowid, title, trigger_phrases, file_path, content_text)\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2401:      VALUES ('delete', old.id, old.title, old.trigger_phrases, old.file_path, old.content_text);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2402:      INSERT INTO memory_fts(rowid, title, trigger_phrases, file_path, content_text)\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2403:      VALUES (new.id, new.title, new.trigger_phrases, new.file_path, new.content_text);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2408:    CREATE TRIGGER IF NOT EXISTS memory_fts_delete AFTER DELETE ON memory_index BEGIN\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2409:      INSERT INTO memory_fts(memory_fts, rowid, title, trigger_phrases, file_path, content_text)\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2410:      VALUES ('delete', old.id, old.title, old.trigger_phrases, old.file_path, old.content_text);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2423:  // Create memory_index-specific indexes (not IF NOT EXISTS because this is a fresh DB)\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2425:    CREATE INDEX idx_spec_folder ON memory_index(spec_folder);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2426:    CREATE INDEX idx_created_at ON memory_index(created_at);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2427:    CREATE INDEX idx_importance ON memory_index(importance_weight DESC);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2428:    CREATE INDEX idx_embedding_status ON memory_index(embedding_status);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2429:    CREATE INDEX idx_retry_eligible ON memory_index(embedding_status, retry_count, last_retry_at)\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2433:    CREATE INDEX IF NOT EXISTS idx_importance_tier ON memory_index(importance_tier);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2434:    CREATE INDEX IF NOT EXISTS idx_access_importance ON memory_index(access_count DESC, importance_weight DESC);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2435:    CREATE INDEX IF NOT EXISTS idx_memories_scope ON memory_index(spec_folder, session_id, context_type);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2436:    CREATE INDEX IF NOT EXISTS idx_memories_governed_scope ON memory_index(tenant_id, user_id, agent_id, session_id, shared_space_id);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2437:    CREATE INDEX IF NOT EXISTS idx_channel ON memory_index(channel);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2438:    CREATE INDEX IF NOT EXISTS idx_spec_folder_created_at ON memory_index(spec_folder, created_at DESC);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2439:    CREATE INDEX IF NOT EXISTS idx_trigger_cache_source\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2440:      ON memory_index(embedding_status, id)\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2442:        AND trigger_phrases IS NOT NULL\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2443:        AND trigger_phrases != '[]'\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2444:        AND trigger_phrases != '';\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2448:    CREATE INDEX IF NOT EXISTS idx_file_path ON memory_index(file_path);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2449:    CREATE INDEX IF NOT EXISTS idx_canonical_file_path ON memory_index(canonical_file_path);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2450:    CREATE INDEX IF NOT EXISTS idx_spec_canonical_path ON memory_index(spec_folder, canonical_file_path);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2451:    CREATE INDEX IF NOT EXISTS idx_save_parent_canonical_path ON memory_index(spec_folder, canonical_file_path, id DESC)\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2453:    CREATE INDEX IF NOT EXISTS idx_content_hash ON memory_index(content_hash);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2454:    CREATE INDEX IF NOT EXISTS idx_save_parent_content_hash_scope ON memory_index(\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2461:      session_id,\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2466:    CREATE INDEX IF NOT EXISTS idx_last_accessed ON memory_index(last_accessed DESC);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2467:    CREATE INDEX IF NOT EXISTS idx_file_mtime ON memory_index(file_mtime_ms);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2468:    CREATE INDEX IF NOT EXISTS idx_document_type ON memory_index(document_type);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2469:    CREATE INDEX IF NOT EXISTS idx_doc_type_folder ON memory_index(document_type, spec_folder);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2470:    CREATE INDEX IF NOT EXISTS idx_quality_score ON memory_index(quality_score);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2474:    CREATE INDEX IF NOT EXISTS idx_stability ON memory_index(stability DESC);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2475:    CREATE INDEX IF NOT EXISTS idx_last_review ON memory_index(last_review);\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2476:    CREATE INDEX IF NOT EXISTS idx_fsrs_retrieval ON memory_index(stability, difficulty, last_review);\\n.opencode/skills/system-spec-kit/mcp_server/lib/chunking/README.md:4:trigger_phrases:\\n.opencode/skills/system-spec-kit/mcp_server/lib/chunking/README.md:113:| `CHUNKING_THRESHOLD` | 50,000 chars | Minimum file size to trigger chunking |\\n.opencode/skills/system-spec-kit/scripts/tests/overview-boundary-safe-truncation.vitest.ts:8:import { collectSessionData } from '../extractors/collect-session-data';\\n.opencode/skills/system-spec-kit/scripts/tests/overview-boundary-safe-truncation.vitest.ts:11:const COLLECT_SESSION_DATA_PATH = path.join(TEST_DIR, '..', 'extractors', 'collect-session-data.ts');\\n.opencode/skills/system-spec-kit/scripts/tests/overview-boundary-safe-truncation.vitest.ts:14:  it('keeps moderately long authored session summaries intact instead of forcing an ellipsis', async () => {\\n.opencode/skills/system-spec-kit/scripts/tests/overview-boundary-safe-truncation.vitest.ts:15:    const sessionSummary = 'Shipped the 014 code graph upgrades runtime lane across detector provenance, blast-radius correctness, hot-file breadcrumbs, edge evidence, and a frozen regression floor. The runtime adds a DetectorProvenance taxonomy to shared-payload, enforces blast-radius depth-cap at BFS traversal time with explicit multi-file unionMode, emits advisory hotFileBreadcrumb entries with low-authority wording, carries edgeEvidenceClass and numericConfidence additively on existing owner payloads without replacing the StructuralTrust envelope, and locks the provenance plus depth expectations behind a scripts-side frozen fixture floor. Strict packet validation passes.';\\n.opencode/skills/system-spec-kit/scripts/tests/overview-boundary-safe-truncation.vitest.ts:16:    const sessionData = await collectSessionData({\\n.opencode/skills/system-spec-kit/scripts/tests/overview-boundary-safe-truncation.vitest.ts:18:      sessionSummary,\\n.opencode/skills/system-spec-kit/scripts/tests/overview-boundary-safe-truncation.vitest.ts:22:    expect(sessionSummary.length).toBeGreaterThan(500);\\n.opencode/skills/system-spec-kit/scripts/tests/overview-boundary-safe-truncation.vitest.ts:23:    expect(sessionSummary.length).toBeLessThan(800);\\n.opencode/skills/system-spec-kit/scripts/tests/overview-boundary-safe-truncation.vitest.ts:24:    expect(sessionData.SUMMARY).toBe(sessionSummary);\\n.opencode/skills/system-spec-kit/scripts/tests/overview-boundary-safe-truncation.vitest.ts:25:    expect(sessionData.SUMMARY.endsWith('…')).toBe(false);\\n.opencode/skills/system-spec-kit/scripts/tests/overview-boundary-safe-truncation.vitest.ts:26:    expect(sessionData.SUMMARY.endsWith('.')).toBe(true);\\n.opencode/skills/system-spec-kit/scripts/tests/overview-boundary-safe-truncation.vitest.ts:31:    const sessionData = await collectSessionData({\\n.opencode/skills/system-spec-kit/scripts/tests/overview-boundary-safe-truncation.vitest.ts:33:      sessionSummary: longSummary,\\n.opencode/skills/system-spec-kit/scripts/tests/overview-boundary-safe-truncation.vitest.ts:37:    const summary = sessionData.SUMMARY;\\n.opencode/skills/system-spec-kit/scripts/tests/overview-boundary-safe-truncation.vitest.ts:42:    expect(source).toContain('renderOverviewSummary(data.sessionSummary, truncateOnWordBoundary(data.sessionSummary, 500))');\\n.opencode/skills/system-spec-kit/scripts/tests/overview-boundary-safe-truncation.vitest.ts:51:    const sessionSummary = 'Shipped the 014 code graph upgrades runtime lane across detector provenance, blast-radius correctness, hot-file breadcrumbs, edge evidence, and a frozen regression floor. The runtime adds a DetectorProvenance taxonomy to shared-payload, enforces blast-radius depth-cap at BFS traversal time with explicit multi-file unionMode, emits advisory hotFileBreadcrumb entries with low-authority wording, carries edgeEvidenceClass and numericConfidence additively on existing owner payloads without replacing the StructuralTrust envelope, and locks the provenance plus depth expectations behind a scripts-side frozen fixture floor. Strict packet validation passes.';\\n.opencode/skills/system-spec-kit/scripts/tests/overview-boundary-safe-truncation.vitest.ts:59:${sessionSummary}\\n.opencode/skills/system-spec-kit/scripts/tests/overview-boundary-safe-truncation.vitest.ts:74:        sessionSummary,\\n.opencode/skills/system-spec-kit/scripts/memory/README.md:4:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/memory/README.md:38:- `generate-context.ts` - generate memory output from spec folder or JSON input with content-aware candidate selection\\n.opencode/skills/system-spec-kit/scripts/memory/README.md:41:- `validate-memory-quality.ts` - validates post-render memory quality against scoring thresholds before indexing/reporting; includes post-save quality gates (structure, semantic sufficiency, duplicate detection), heuristic calibration, and trigger sanitization\\n.opencode/skills/system-spec-kit/scripts/memory/README.md:59:node .opencode/skills/system-spec-kit/scripts/dist/memory/generate-context.js /tmp/save-context-data.json specs/<###-spec-name>\\n.opencode/skills/system-spec-kit/scripts/memory/README.md:67:node .opencode/skills/system-spec-kit/scripts/dist/memory/generate-context.js --json '{\\\"sessionSummary\\\":\\\"...\\\",\\\"specFolder\\\":\\\"...\\\"}' specs/NNN-name\\n.opencode/skills/system-spec-kit/scripts/memory/README.md:94:- Uses content-aware candidate selection so task/session evidence beats generic folder fallback when valid.\\n.opencode/skills/system-spec-kit/scripts/memory/README.md:97:- Runs post-render memory quality validation so contaminated headings or fallback-decision leaks are caught after template population. The post-save quality pipeline includes 3-layer gates (structure, semantic sufficiency, duplicate detection), heuristic calibration for scoring thresholds, and trigger sanitization to prevent noisy or over-broad trigger phrases from persisting in the index.\\n.opencode/skills/system-spec-kit/scripts/memory/README.md:98:- Retroactive title refresh for existing memories: run `memory_index_scan({ force: true })` after parser/template updates.\\n.opencode/skills/system-spec-kit/scripts/memory/README.md:109:- `trigger_phrases`\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/result-explainability.ts:35:  | 'session_boosted'\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/result-explainability.ts:36:  | 'causal_boosted'\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/result-explainability.ts:113:    const causalDelta = typeof graphContrib.causalDelta === 'number' ? graphContrib.causalDelta : 0;\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/result-explainability.ts:118:    if (causalDelta > 0) signals.push('causal_boosted');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/result-explainability.ts:125:  const sessionBoost = typeof row.sessionBoost === 'number' ? row.sessionBoost : 0;\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/result-explainability.ts:126:  if (sessionBoost > 0) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/result-explainability.ts:127:    signals.push('session_boosted');\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/result-explainability.ts:137:  // Feedback boost (learned trigger weight)\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/result-explainability.ts:207:    if (signal === 'session_boosted') return 'session attention';\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/result-explainability.ts:208:    if (signal === 'causal_boosted') return 'causal graph';\\n.opencode/skills/system-spec-kit/mcp_server/lib/search/result-explainability.ts:211:    if (signal === 'feedback_boosted') return 'learned trigger';\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-validation/missing-child-docs/plan.md:4:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/core/memory-metadata.ts:4:// Memory classification, session dedup, causal links, and evidence\\n.opencode/skills/system-spec-kit/scripts/core/memory-metadata.ts:10:import type { CollectedDataFull } from '../extractors/collect-session-data';\\n.opencode/skills/system-spec-kit/scripts/core/memory-metadata.ts:12:import type { FileChange } from '../types/session-types';\\n.opencode/skills/system-spec-kit/scripts/core/memory-metadata.ts:44:  sessionId: string;\\n.opencode/skills/system-spec-kit/scripts/core/memory-metadata.ts:131:  sessionData: { CONTEXT_TYPE: string; IMPORTANCE_TIER: string },\\n.opencode/skills/system-spec-kit/scripts/core/memory-metadata.ts:135:  const fallbackType = inferMemoryType(sessionData.CONTEXT_TYPE, sessionData.IMPORTANCE_TIER);\\n.opencode/skills/system-spec-kit/scripts/core/memory-metadata.ts:172:      importanceMultiplier(sessionData.IMPORTANCE_TIER),\\n.opencode/skills/system-spec-kit/scripts/core/memory-metadata.ts:181:  sessionData: { SESSION_ID: string; SUMMARY: string },\\n.opencode/skills/system-spec-kit/scripts/core/memory-metadata.ts:184:  const rawDedup = readNamedObject(collectedData, 'session_dedup', 'sessionDedup');\\n.opencode/skills/system-spec-kit/scripts/core/memory-metadata.ts:207:    .update(`${sessionData.SESSION_ID}\\\\n${memoryTitle}\\\\n${sessionData.SUMMARY}`)\\n.opencode/skills/system-spec-kit/scripts/core/memory-metadata.ts:236:  const snakeCaseLinks = readNamedObject(collectedData, 'causal_links');\\n.opencode/skills/system-spec-kit/scripts/core/memory-metadata.ts:237:  const camelCaseLinks = readNamedObject(collectedData, 'causalLinks');\\n.opencode/skills/system-spec-kit/scripts/core/memory-metadata.ts:297:    const sessionId = parseStructuredValue(frontmatter, ['session_id'])\\n.opencode/skills/system-spec-kit/scripts/core/memory-metadata.ts:298:      || parseStructuredValue(content, ['session_id']);\\n.opencode/skills/system-spec-kit/scripts/core/memory-metadata.ts:299:    if (!sessionId) {\\n.opencode/skills/system-spec-kit/scripts/core/memory-metadata.ts:307:      sessionId,\\n.opencode/skills/system-spec-kit/scripts/core/memory-metadata.ts:319:  currentSession: { sessionId: string; contextType: string },\\n.opencode/skills/system-spec-kit/scripts/core/memory-metadata.ts:330:    .filter((entry): entry is ExistingMemoryHeader => entry !== null && entry.sessionId !== currentSession.sessionId)\\n.opencode/skills/system-spec-kit/scripts/core/memory-metadata.ts:354:    DERIVED_FROM: merge(existing.DERIVED_FROM, [latest.sessionId]),\\n.opencode/skills/system-spec-kit/scripts/core/memory-metadata.ts:356:      ? merge(existing.SUPERSEDES, [latest.sessionId])\\n.opencode/skills/system-spec-kit/scripts/core/memory-metadata.ts:392:  triggerPhrases: string[];\\n.opencode/skills/system-spec-kit/scripts/core/memory-metadata.ts:404:    triggerPhrases,\\n.opencode/skills/system-spec-kit/scripts/core/memory-metadata.ts:423:    triggerPhrases,\\n.opencode/skills/system-spec-kit/scripts/scripts-registry.json:8:      \\\"name\\\": \\\"generate-context\\\",\\n.opencode/skills/system-spec-kit/scripts/scripts-registry.json:9:      \\\"path\\\": \\\"scripts/dist/memory/generate-context.js\\\",\\n.opencode/skills/system-spec-kit/scripts/scripts-registry.json:12:      \\\"trigger\\\": [\\\"save context\\\", \\\"save memory\\\", \\\"/memory:save\\\"],\\n.opencode/skills/system-spec-kit/scripts/scripts-registry.json:29:      \\\"trigger\\\": [\\\"reindex embeddings\\\", \\\"force reindex\\\", \\\"memory index rebuild\\\"],\\n.opencode/skills/system-spec-kit/scripts/scripts-registry.json:46:      \\\"trigger\\\": [\\\"validate spec\\\", \\\"check spec\\\"],\\n.opencode/skills/system-spec-kit/scripts/scripts-registry.json:63:      \\\"trigger\\\": [\\\"check completion\\\", \\\"verify complete\\\", \\\"claiming done\\\"],\\n.opencode/skills/system-spec-kit/scripts/scripts-registry.json:80:      \\\"trigger\\\": [\\\"upgrade level\\\", \\\"level upgrade\\\", \\\"promote spec level\\\"],\\n.opencode/skills/system-spec-kit/scripts/scripts-registry.json:97:      \\\"trigger\\\": [\\\"check prerequisites\\\", \\\"verify files\\\"],\\n.opencode/skills/system-spec-kit/scripts/scripts-registry.json:113:      \\\"trigger\\\": [\\\"calculate progress\\\", \\\"completeness\\\"],\\n.opencode/skills/system-spec-kit/scripts/scripts-registry.json:130:      \\\"trigger\\\": [\\\"test validation\\\", \\\"run tests\\\"],\\n.opencode/skills/system-spec-kit/scripts/scripts-registry.json:146:      \\\"trigger\\\": [\\\"create spec\\\", \\\"new spec folder\\\", \\\"Option B\\\"],\\n.opencode/skills/system-spec-kit/scripts/scripts-registry.json:163:      \\\"trigger\\\": [\\\"nested changelog\\\", \\\"packet changelog\\\", \\\"phase changelog\\\", \\\"spec changelog\\\"],\\n.opencode/skills/system-spec-kit/scripts/scripts-registry.json:180:      \\\"trigger\\\": [\\\"recommend level\\\", \\\"what level\\\"],\\n.opencode/skills/system-spec-kit/scripts/scripts-registry.json:196:      \\\"trigger\\\": [\\\"archive spec\\\", \\\"move to archive\\\"],\\n.opencode/skills/system-spec-kit/scripts/scripts-registry.json:213:      \\\"trigger\\\": [],\\n.opencode/skills/system-spec-kit/scripts/scripts-registry.json:228:      \\\"trigger\\\": [\\\"cleanup vectors\\\", \\\"database cleanup\\\"],\\n.opencode/skills/system-spec-kit/scripts/scripts-registry.json:235:      \\\"dependencies\\\": [\\\"better-sqlite3\\\", \\\"sqlite-vec\\\"]\\n.opencode/skills/system-spec-kit/scripts/scripts-registry.json:242:      \\\"trigger\\\": [\\\"test embeddings\\\", \\\"verify provider\\\"],\\n.opencode/skills/system-spec-kit/scripts/scripts-registry.json:414:        \\\"name\\\": \\\"trigger-extractor\\\",\\n.opencode/skills/system-spec-kit/scripts/scripts-registry.json:415:        \\\"path\\\": \\\"scripts/dist/lib/trigger-extractor.js\\\",\\n.opencode/skills/system-spec-kit/scripts/scripts-registry.json:416:        \\\"description\\\": \\\"Re-exports from ../../shared/trigger-extractor\\\"\\n.opencode/skills/system-spec-kit/scripts/scripts-registry.json:458:      \\\"memory\\\": [\\\"generate-context\\\", \\\"cleanup-orphaned-vectors\\\", \\\"test-embeddings-factory\\\"],\\n.opencode/skills/system-spec-kit/scripts/tests/memory-template-contract.vitest.ts:5:function buildValidMemory(overrides: { triggerBlock?: string; bodyTail?: string } = {}): string {\\n.opencode/skills/system-spec-kit/scripts/tests/memory-template-contract.vitest.ts:10:    overrides.triggerBlock ?? [\\n.opencode/skills/system-spec-kit/scripts/tests/memory-template-contract.vitest.ts:11:      'trigger_phrases:',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-template-contract.vitest.ts:27:    '<!-- ANCHOR:continue-session -->',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-template-contract.vitest.ts:32:    '<!-- /ANCHOR:continue-session -->',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-template-contract.vitest.ts:69:    'session_id: \\\"test-session\\\"',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-template-contract.vitest.ts:94:  it('rejects malformed trigger_phrases frontmatter shapes', () => {\\n.opencode/skills/system-spec-kit/scripts/tests/memory-template-contract.vitest.ts:96:      buildValidMemory({ triggerBlock: 'trigger_phrases: \\\"session summary\\\"' })\\n.opencode/skills/system-spec-kit/scripts/tests/memory-template-contract.vitest.ts:100:    expect(result.violations.some((violation) => violation.code === 'invalid_trigger_phrases')).toBe(true);\\n.opencode/skills/system-spec-kit/scripts/tests/memory-template-contract.vitest.ts:114:          '- [CONTINUE SESSION](#continue-session)',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-template-contract.vitest.ts:162:          && violation.message.includes('duplicate or orphaned closing ANCHOR comments')\\n.opencode/skills/system-spec-kit/scripts/tests/memory-template-contract.vitest.ts:215:      expect(result.missingAnchors).not.toContain('session-history');\\n.opencode/skills/system-spec-kit/scripts/evals/map-ground-truth-ids.ts:12:import Database from 'better-sqlite3';\\n.opencode/skills/system-spec-kit/scripts/evals/map-ground-truth-ids.ts:31:const DB_PATH = path.join(DB_DIR, 'context-index.sqlite');\\n.opencode/skills/system-spec-kit/scripts/evals/map-ground-truth-ids.ts:180:  const fts5Query1 = buildFTS5Query(queryTerms);\\n.opencode/skills/system-spec-kit/scripts/evals/map-ground-truth-ids.ts:181:  if (fts5Query1) {\\n.opencode/skills/system-spec-kit/scripts/evals/map-ground-truth-ids.ts:187:        JOIN memory_index m ON m.id = f.rowid\\n.opencode/skills/system-spec-kit/scripts/evals/map-ground-truth-ids.ts:192:      `).all(fts5Query1) as CandidateRow[];\\n.opencode/skills/system-spec-kit/scripts/evals/map-ground-truth-ids.ts:203:          matchStrategy: 'fts5_query',\\n.opencode/skills/system-spec-kit/scripts/evals/map-ground-truth-ids.ts:215:  const fts5Query2 = buildFTS5Query(descTerms);\\n.opencode/skills/system-spec-kit/scripts/evals/map-ground-truth-ids.ts:216:  if (fts5Query2) {\\n.opencode/skills/system-spec-kit/scripts/evals/map-ground-truth-ids.ts:222:        JOIN memory_index m ON m.id = f.rowid\\n.opencode/skills/system-spec-kit/scripts/evals/map-ground-truth-ids.ts:227:      `).all(fts5Query2) as CandidateRow[];\\n.opencode/skills/system-spec-kit/scripts/evals/map-ground-truth-ids.ts:239:          matchStrategy: 'fts5_description',\\n.opencode/skills/system-spec-kit/scripts/evals/map-ground-truth-ids.ts:255:        FROM memory_index\\n.opencode/skills/system-spec-kit/scripts/evals/map-ground-truth-ids.ts:299:  if (desc.includes('libsql') || desc.includes('sqlite-to-libsql')) {\\n.opencode/skills/system-spec-kit/scripts/evals/map-ground-truth-ids.ts:300:    specFolderPatterns.push('%140-sqlite-to-libsql%');\\n.opencode/skills/system-spec-kit/scripts/evals/map-ground-truth-ids.ts:313:        FROM memory_index\\n.opencode/skills/system-spec-kit/scripts/evals/map-ground-truth-ids.ts:441:  const totalMemories = (db.prepare('SELECT COUNT(*) as cnt FROM memory_index WHERE parent_id IS NULL').get() as CountRow | undefined)?.cnt ?? 0;\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-validation/missing-child-docs/tasks.md:4:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/evals/run-phase2-closure-metrics.mjs:31:  for (let sessionIndex = 0; sessionIndex < SESSION_COUNT; sessionIndex += 1) {\\n.opencode/skills/system-spec-kit/scripts/evals/run-phase2-closure-metrics.mjs:32:    const sessionId = `session-${String(sessionIndex + 1).padStart(2, '0')}`;\\n.opencode/skills/system-spec-kit/scripts/evals/run-phase2-closure-metrics.mjs:33:    const hasIntentionalReadMiss = sessionIndex % 10 === 0; // 5 misses\\n.opencode/skills/system-spec-kit/scripts/evals/run-phase2-closure-metrics.mjs:34:    const hasIntentionalGrepMiss = sessionIndex % 7 === 0; // 8 misses\\n.opencode/skills/system-spec-kit/scripts/evals/run-phase2-closure-metrics.mjs:36:    const sessionEvents = [\\n.opencode/skills/system-spec-kit/scripts/evals/run-phase2-closure-metrics.mjs:38:        sessionId,\\n.opencode/skills/system-spec-kit/scripts/evals/run-phase2-closure-metrics.mjs:41:          ? `Read /tmp/${sessionId}-notes.md`\\n.opencode/skills/system-spec-kit/scripts/evals/run-phase2-closure-metrics.mjs:42:          : `Read /tmp/${sessionId}-spec.md`,\\n.opencode/skills/system-spec-kit/scripts/evals/run-phase2-closure-metrics.mjs:46:        sessionId,\\n.opencode/skills/system-spec-kit/scripts/evals/run-phase2-closure-metrics.mjs:49:          ? `warning: ${sessionId} edge case`\\n.opencode/skills/system-spec-kit/scripts/evals/run-phase2-closure-metrics.mjs:50:          : `error: ${sessionId} build failed`,\\n.opencode/skills/system-spec-kit/scripts/evals/run-phase2-closure-metrics.mjs:54:        sessionId,\\n.opencode/skills/system-spec-kit/scripts/evals/run-phase2-closure-metrics.mjs:56:        content: sessionIndex % 3 === 0\\n.opencode/skills/system-spec-kit/scripts/evals/run-phase2-closure-metrics.mjs:57:          ? `git commit -m \\\"${sessionId} checkpoint\\\"`\\n.opencode/skills/system-spec-kit/scripts/evals/run-phase2-closure-metrics.mjs:58:          : `npm run test:${sessionId}`,\\n.opencode/skills/system-spec-kit/scripts/evals/run-phase2-closure-metrics.mjs:59:        expectedExtract: sessionIndex % 3 === 0,\\n.opencode/skills/system-spec-kit/scripts/evals/run-phase2-closure-metrics.mjs:61:      { sessionId, tool: 'Edit', content: `edit ${sessionId} handler`, expectedExtract: false },\\n.opencode/skills/system-spec-kit/scripts/evals/run-phase2-closure-metrics.mjs:62:      { sessionId, tool: 'Read', content: `Read /tmp/${sessionId}-README.md`, expectedExtract: false },\\n.opencode/skills/system-spec-kit/scripts/evals/run-phase2-closure-metrics.mjs:63:      { sessionId, tool: 'Grep', content: `match_count=${sessionIndex}`, expectedExtract: false },\\n.opencode/skills/system-spec-kit/scripts/evals/run-phase2-closure-metrics.mjs:64:      { sessionId, tool: 'Bash', content: `echo ${sessionId} smoke`, expectedExtract: false },\\n.opencode/skills/system-spec-kit/scripts/evals/run-phase2-closure-metrics.mjs:65:      { sessionId, tool: 'Write', content: `write ${sessionId} scratch`, expectedExtract: false },\\n.opencode/skills/system-spec-kit/scripts/evals/run-phase2-closure-metrics.mjs:68:    events.push(...sessionEvents.slice(0, EVENTS_PER_SESSION));\\n.opencode/skills/system-spec-kit/scripts/evals/run-phase2-closure-metrics.mjs:97:      missesBySession.add(event.sessionId);\\n.opencode/skills/system-spec-kit/scripts/evals/run-phase2-closure-metrics.mjs:113:    sessionsWithMisses: missesBySession.size,\\n.opencode/skills/system-spec-kit/scripts/evals/run-phase2-closure-metrics.mjs:119:  const automatedManualSaves = extractionMetrics.sessionsWithMisses;\\n.opencode/skills/system-spec-kit/scripts/evals/run-phase2-closure-metrics.mjs:192:    '- Baseline assumes one manual save per session for continuity-critical context.',\\n.opencode/skills/system-spec-kit/scripts/evals/run-phase2-closure-metrics.mjs:193:    '- Automated run requires manual save only for sessions with extraction misses.',\\n.opencode/skills/system-spec-kit/scripts/evals/run-phase2-closure-metrics.mjs:228:    sessions: SESSION_COUNT,\\n.opencode/skills/system-spec-kit/scripts/core/frontmatter-editor.ts:4:// Frontmatter injection and trigger phrase rendering utilities.\\n.opencode/skills/system-spec-kit/scripts/core/frontmatter-editor.ts:9:import { sanitizeTriggerPhrases } from '../lib/trigger-phrase-sanitizer';\\n.opencode/skills/system-spec-kit/scripts/core/frontmatter-editor.ts:10:import type { FileChange } from '../types/session-types';\\n.opencode/skills/system-spec-kit/scripts/core/frontmatter-editor.ts:12:// CG-04: Domain-specific stopwords — duplicated from workflow.ts to avoid circular imports\\n.opencode/skills/system-spec-kit/scripts/core/frontmatter-editor.ts:19:  'based', 'features', 'perfect', 'session', 'capturing', 'pipeline',\\n.opencode/skills/system-spec-kit/scripts/core/frontmatter-editor.ts:96:export function renderTriggerPhrasesYaml(triggerPhrases: string[]): string {\\n.opencode/skills/system-spec-kit/scripts/core/frontmatter-editor.ts:97:  if (!Array.isArray(triggerPhrases) || triggerPhrases.length === 0) {\\n.opencode/skills/system-spec-kit/scripts/core/frontmatter-editor.ts:98:    return 'trigger_phrases: []';\\n.opencode/skills/system-spec-kit/scripts/core/frontmatter-editor.ts:101:  const escapedPhrases = triggerPhrases.map((phrase) => {\\n.opencode/skills/system-spec-kit/scripts/core/frontmatter-editor.ts:106:  return ['trigger_phrases:', ...escapedPhrases].join('\\\\n');\\n.opencode/skills/system-spec-kit/scripts/core/frontmatter-editor.ts:146:  const topicFromFolder = normalizeSpecSegment(path.basename(specFolderName));\\n.opencode/skills/system-spec-kit/scripts/core/frontmatter-editor.ts:147:  const folderTokens = topicFromFolder\\n.opencode/skills/system-spec-kit/scripts/core/frontmatter-editor.ts:162:    const compoundFallback = sanitizeTriggerPhrases([leafFolderAnchor || topicFromFolder], { source: 'extracted' })[0];\\n.opencode/skills/system-spec-kit/scripts/core/frontmatter-editor.ts:163:    return [combined[0], compoundFallback && compoundFallback !== combined[0] ? compoundFallback : 'session'];\\n.opencode/skills/system-spec-kit/scripts/core/frontmatter-editor.ts:166:  return ['session', 'context'];\\n.opencode/skills/system-spec-kit/scripts/core/frontmatter-editor.ts:174:  const topicFromFolder = normalizeSpecSegment(path.basename(specFolderName));\\n.opencode/skills/system-spec-kit/scripts/core/frontmatter-editor.ts:175:  const folderTokens = topicFromFolder\\n.opencode/skills/system-spec-kit/scripts/core/frontmatter-editor.ts:186:  return combined.length > 0 ? [combined[0]] : ['session'];\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:10:import type Database from 'better-sqlite3';\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:44:  'trigger_phrases',\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:60:  'session_id',\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:101:    .prepare('PRAGMA table_info(memory_index)')\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:107:      throw new Error(`Cannot downgrade: required v16 column \\\"${col}\\\" not found on memory_index`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:114:    CREATE TABLE memory_index (\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:120:      trigger_phrases TEXT,\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:136:      session_id TEXT,\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:167:    CREATE INDEX IF NOT EXISTS idx_spec_folder ON memory_index(spec_folder);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:168:    CREATE INDEX IF NOT EXISTS idx_created_at ON memory_index(created_at);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:169:    CREATE INDEX IF NOT EXISTS idx_importance ON memory_index(importance_weight DESC);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:170:    CREATE INDEX IF NOT EXISTS idx_embedding_status ON memory_index(embedding_status);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:171:    CREATE INDEX IF NOT EXISTS idx_retry_eligible ON memory_index(embedding_status, retry_count, last_retry_at);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:173:    CREATE INDEX IF NOT EXISTS idx_importance_tier ON memory_index(importance_tier);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:174:    CREATE INDEX IF NOT EXISTS idx_access_importance ON memory_index(access_count DESC, importance_weight DESC);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:175:    CREATE INDEX IF NOT EXISTS idx_memories_scope ON memory_index(spec_folder, session_id, context_type);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:176:    CREATE INDEX IF NOT EXISTS idx_channel ON memory_index(channel);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:178:    CREATE INDEX IF NOT EXISTS idx_file_path ON memory_index(file_path);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:179:    CREATE INDEX IF NOT EXISTS idx_content_hash ON memory_index(content_hash);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:180:    CREATE INDEX IF NOT EXISTS idx_last_accessed ON memory_index(last_accessed DESC);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:181:    CREATE INDEX IF NOT EXISTS idx_file_mtime ON memory_index(file_mtime_ms);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:182:    CREATE INDEX IF NOT EXISTS idx_document_type ON memory_index(document_type);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:183:    CREATE INDEX IF NOT EXISTS idx_doc_type_folder ON memory_index(document_type, spec_folder);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:184:    CREATE INDEX IF NOT EXISTS idx_quality_score ON memory_index(quality_score);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:186:    CREATE INDEX IF NOT EXISTS idx_stability ON memory_index(stability DESC);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:187:    CREATE INDEX IF NOT EXISTS idx_last_review ON memory_index(last_review);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:188:    CREATE INDEX IF NOT EXISTS idx_fsrs_retrieval ON memory_index(stability, difficulty, last_review);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:190:    CREATE INDEX IF NOT EXISTS idx_memory_type ON memory_index(memory_type);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:191:    CREATE INDEX IF NOT EXISTS idx_memory_type_decay ON memory_index(memory_type, half_life_days);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:194:      ON memory_index(embedding_status)\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:198:      ON memory_index(spec_folder, embedding_status)\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:205:    CREATE VIRTUAL TABLE IF NOT EXISTS memory_fts USING fts5(\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:206:      title, trigger_phrases, file_path, content_text,\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:207:      content='memory_index', content_rowid='id'\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:212:    CREATE TRIGGER IF NOT EXISTS memory_fts_insert AFTER INSERT ON memory_index BEGIN\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:213:      INSERT INTO memory_fts(rowid, title, trigger_phrases, file_path, content_text)\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:214:      VALUES (new.id, new.title, new.trigger_phrases, new.file_path, new.content_text);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:219:    CREATE TRIGGER IF NOT EXISTS memory_fts_update AFTER UPDATE ON memory_index BEGIN\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:220:      INSERT INTO memory_fts(memory_fts, rowid, title, trigger_phrases, file_path, content_text)\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:221:      VALUES ('delete', old.id, old.title, old.trigger_phrases, old.file_path, old.content_text);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:222:      INSERT INTO memory_fts(rowid, title, trigger_phrases, file_path, content_text)\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:223:      VALUES (new.id, new.title, new.trigger_phrases, new.file_path, new.content_text);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:228:    CREATE TRIGGER IF NOT EXISTS memory_fts_delete AFTER DELETE ON memory_index BEGIN\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:229:      INSERT INTO memory_fts(memory_fts, rowid, title, trigger_phrases, file_path, content_text)\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:230:      VALUES ('delete', old.id, old.title, old.trigger_phrases, old.file_path, old.content_text);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:278:      database.exec(`ALTER TABLE memory_index RENAME TO memory_index_v16_backup`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:284:        INSERT INTO memory_index (${columnsCsv})\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:286:        FROM memory_index_v16_backup\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:290:      database.exec(`DROP TABLE memory_index_v16_backup`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:306:  const row = database.prepare('SELECT COUNT(*) as count FROM memory_index').get() as { count: number };\\n.opencode/skills/system-spec-kit/scripts/tests/content-filter-parity.vitest.ts:71:    expect(pipeline.deduplicate([\\n.opencode/skills/system-spec-kit/scripts/evals/run-performance-benchmarks.ts:16:import Database from 'better-sqlite3';\\n.opencode/skills/system-spec-kit/scripts/evals/run-performance-benchmarks.ts:18:  sessionBoost,\\n.opencode/skills/system-spec-kit/scripts/evals/run-performance-benchmarks.ts:19:  causalBoost,\\n.opencode/skills/system-spec-kit/scripts/evals/run-performance-benchmarks.ts:49:  sessionBoost: LatencyStats;\\n.opencode/skills/system-spec-kit/scripts/evals/run-performance-benchmarks.ts:50:  causalBoost: LatencyStats;\\n.opencode/skills/system-spec-kit/scripts/evals/run-performance-benchmarks.ts:143:    CREATE TABLE memory_index (\\n.opencode/skills/system-spec-kit/scripts/evals/run-performance-benchmarks.ts:149:      trigger_phrases TEXT,\\n.opencode/skills/system-spec-kit/scripts/evals/run-performance-benchmarks.ts:153:    CREATE TABLE working_memory (\\n.opencode/skills/system-spec-kit/scripts/evals/run-performance-benchmarks.ts:155:      session_id TEXT NOT NULL,\\n.opencode/skills/system-spec-kit/scripts/evals/run-performance-benchmarks.ts:167:      UNIQUE(session_id, memory_id)\\n.opencode/skills/system-spec-kit/scripts/evals/run-performance-benchmarks.ts:170:    CREATE TABLE causal_edges (\\n.opencode/skills/system-spec-kit/scripts/evals/run-performance-benchmarks.ts:182:    INSERT INTO memory_index (id, spec_folder, file_path, title, importance_tier, trigger_phrases)\\n.opencode/skills/system-spec-kit/scripts/evals/run-performance-benchmarks.ts:191:    INSERT INTO working_memory (session_id, memory_id, attention_score, event_counter, mention_count, focus_count, last_focused)\\n.opencode/skills/system-spec-kit/scripts/evals/run-performance-benchmarks.ts:197:    wmInsert.run('bench-session', id, Math.min(0.95, score));\\n.opencode/skills/system-spec-kit/scripts/evals/run-performance-benchmarks.ts:201:    INSERT INTO causal_edges (source_id, target_id, relation, strength, evidence)\\n.opencode/skills/system-spec-kit/scripts/evals/run-performance-benchmarks.ts:230:    sessionBoost.applySessionBoost(input, 'bench-session');\\n.opencode/skills/system-spec-kit/scripts/evals/run-performance-benchmarks.ts:241:    causalBoost.applyCausalBoost(input);\\n.opencode/skills/system-spec-kit/scripts/evals/run-performance-benchmarks.ts:301:    const withSession = sessionBoost.applySessionBoost(baseline, 'bench-session').results;\\n.opencode/skills/system-spec-kit/scripts/evals/run-performance-benchmarks.ts:302:    causalBoost.applyCausalBoost(withSession);\\n.opencode/skills/system-spec-kit/scripts/evals/run-performance-benchmarks.ts:327:    const withSession = sessionBoost.applySessionBoost(input, 'bench-session').results;\\n.opencode/skills/system-spec-kit/scripts/evals/run-performance-benchmarks.ts:328:    causalBoost.applyCausalBoost(withSession);\\n.opencode/skills/system-spec-kit/scripts/evals/run-performance-benchmarks.ts:359:    `- NFR-P01 (session boost p95): < ${report.thresholds.nfrP01SessionBoostP95Ms}ms`,\\n.opencode/skills/system-spec-kit/scripts/evals/run-performance-benchmarks.ts:360:    `- NFR-P02 (causal traversal p95): < ${report.thresholds.nfrP02CausalTraversalP95Ms}ms`,\\n.opencode/skills/system-spec-kit/scripts/evals/run-performance-benchmarks.ts:365:    `- Session boost p95: ${report.sessionBoost.p95Ms.toFixed(3)}ms`,\\n.opencode/skills/system-spec-kit/scripts/evals/run-performance-benchmarks.ts:366:    `- Causal traversal p95: ${report.causalBoost.p95Ms.toFixed(3)}ms`,\\n.opencode/skills/system-spec-kit/scripts/evals/run-performance-benchmarks.ts:415:  sessionBoost.init(db);\\n.opencode/skills/system-spec-kit/scripts/evals/run-performance-benchmarks.ts:416:  causalBoost.init(db);\\n.opencode/skills/system-spec-kit/scripts/evals/run-performance-benchmarks.ts:419:    const sessionBoostStats = measureSessionBoostLatency();\\n.opencode/skills/system-spec-kit/scripts/evals/run-performance-benchmarks.ts:420:    const causalBoostStats = measureCausalBoostLatency();\\n.opencode/skills/system-spec-kit/scripts/evals/run-performance-benchmarks.ts:426:      chk110: sessionBoostStats.p95Ms < NFR_P01_P95_MS ? 'PASS' as const : 'FAIL' as const,\\n.opencode/skills/system-spec-kit/scripts/evals/run-performance-benchmarks.ts:427:      chk111: causalBoostStats.p95Ms < NFR_P02_P95_MS ? 'PASS' as const : 'FAIL' as const,\\n.opencode/skills/system-spec-kit/scripts/evals/run-performance-benchmarks.ts:454:      sessionBoost: sessionBoostStats,\\n.opencode/skills/system-spec-kit/scripts/evals/run-performance-benchmarks.ts:455:      causalBoost: causalBoostStats,\\n.opencode/skills/system-spec-kit/scripts/evals/run-performance-benchmarks.ts:466:    console.log(`session_boost_p95_ms=${sessionBoostStats.p95Ms.toFixed(3)}`);\\n.opencode/skills/system-spec-kit/scripts/evals/run-performance-benchmarks.ts:467:    console.log(`causal_boost_p95_ms=${causalBoostStats.p95Ms.toFixed(3)}`);\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-migration.test.ts:13:} from '../memory/migrate-trigger-phrase-residual';\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-migration.test.ts:24:  const triggerSection = detection.sections.find((section) => section.key === 'trigger_phrases');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-migration.test.ts:25:  const triggerValue = triggerSection ? parseSectionValue(triggerSection) : undefined;\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-migration.test.ts:26:  return Array.isArray(triggerValue)\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-migration.test.ts:27:    ? triggerValue.filter((value): value is string => typeof value === 'string')\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-migration.test.ts:48:    if (match[1] === 'trigger_phrases') {\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-migration.test.ts:101:describe('Phase 6 PR-13 trigger residual migration', () => {\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-migration.test.ts:102:  it('flags junk residuals in dry-run mode, preserves useful anchors, and rewrites only trigger_phrases in apply mode', async () => {\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-migration.test.ts:135:      expect.objectContaining({ phrase: 'trigger phrase migration', reason: 'title_overlap' }),\\n.opencode/skills/system-spec-kit/scripts/tests/memory-sufficiency.vitest.ts:13:        'Implemented a shared insufficiency gate across workflow and memory_save so thin saves fail explicitly.',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-sufficiency.vitest.ts:17:        '- Rationale: the prior path could index generic sessions that matched workspace identity but not the real task.',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-sufficiency.vitest.ts:19:      triggerPhrases: ['perfect session capturing', 'memory sufficiency', 'memory save', 'alignment block'],\\n.opencode/skills/system-spec-kit/scripts/tests/memory-sufficiency.vitest.ts:38:        'Rerun the memory_save dry-run coverage after wiring the new rejection payload.',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-sufficiency.vitest.ts:56:        'Please save context for perfect session capturing.',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-sufficiency.vitest.ts:58:      triggerPhrases: ['perfect session capturing'],\\n.opencode/skills/system-spec-kit/scripts/tests/memory-sufficiency.vitest.ts:62:          learning: 'Please save context for perfect session capturing.',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-sufficiency.vitest.ts:80:        'This rendered file contains a long scaffolded summary block, several headings, and anchored metadata, but no real files, observations, decisions, or outcomes from the session.',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-sufficiency.vitest.ts:85:      triggerPhrases: ['perfect session capturing', 'recovery hints'],\\n.opencode/skills/system-spec-kit/scripts/tests/memory-sufficiency.vitest.ts:96:      title: 'Development session',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-sufficiency.vitest.ts:98:        '# Development session',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-sufficiency.vitest.ts:101:        'Implemented the shared insufficiency gate in both generate-context and memory_save, then wired the rejection payload so dry-run reports reasons and evidence counts before any write occurs.',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-sufficiency.vitest.ts:106:      triggerPhrases: ['memory_save', 'dry run', 'insufficient context', 'generate-context'],\\n.opencode/skills/system-spec-kit/scripts/tests/memory-sufficiency.vitest.ts:135:        { path: 'scripts/core/workflow.ts', description: 'Modified during session', specRelevant: true },\\n.opencode/skills/system-spec-kit/scripts/tests/memory-sufficiency.vitest.ts:138:      triggerPhrases: ['perfect session capturing', 'workflow'],\\n.opencode/skills/system-spec-kit/scripts/tests/memory-sufficiency.vitest.ts:152:        '### Tool: bash memory_save dry run',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-sufficiency.vitest.ts:155:      triggerPhrases: ['memory_save', 'dry run', 'insufficient context', 'evidence counts'],\\n.opencode/skills/system-spec-kit/scripts/tests/memory-sufficiency.vitest.ts:158:          title: 'Tool: bash memory_save dry run',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-sufficiency.vitest.ts:159:          narrative: 'Executed memory_save with dryRun=true and confirmed the insufficiency payload is explicit and non-mutating.',\\n.opencode/skills/system-spec-kit/scripts/evals/run-bm25-baseline.ts:10:// Live production context-index.sqlite and record results in the\\n.opencode/skills/system-spec-kit/scripts/evals/run-bm25-baseline.ts:22:import Database from 'better-sqlite3';\\n.opencode/skills/system-spec-kit/scripts/evals/run-bm25-baseline.ts:27:  fts5Bm25Search, isFts5Available,\\n.opencode/skills/system-spec-kit/scripts/evals/run-bm25-baseline.ts:36:const PROD_DB_PATH = path.join(DB_DIR, 'context-index.sqlite');\\n.opencode/skills/system-spec-kit/scripts/evals/run-bm25-baseline.ts:85:    'SELECT COUNT(*) as c FROM memory_index'\\n.opencode/skills/system-spec-kit/scripts/evals/run-bm25-baseline.ts:101:  //    Wraps fts5Bm25Search() to match the BM25SearchFn signature:\\n.opencode/skills/system-spec-kit/scripts/evals/run-bm25-baseline.ts:104:    const ftsResults = fts5Bm25Search(prodDb, query, { limit });\\n.opencode/skills/system-spec-kit/scripts/core/workflow-path-utils.ts:11:import type { FileChange } from '../types/session-types';\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/access-tracker.ts:6:import type Database from 'better-sqlite3';\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/access-tracker.ts:157:      UPDATE memory_index\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:16:  createBoard: (opts: { sessionId: string; generation?: number; loopType: string; target?: string }) => any;\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:32:  createSegmentState: (id: string, config: { sessionId: string; generation?: number; waveId?: string; loopType?: string; files?: string[]; domains?: string[] }) => any;\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:51:      const b = board.createBoard({ sessionId: 'sess-1', loopType: 'review', target: 'my-repo' });\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:53:      expect(b.sessionId).toBe('sess-1');\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:60:    it('throws for missing sessionId', () => {\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:65:      expect(board.createBoard({ sessionId: 's', loopType: 'invalid' } as any)).toBeNull();\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:71:      const b = board.createBoard({ sessionId: 's1', loopType: 'review' });\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:80:    it('deduplicates identical findings', () => {\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:81:      const b = board.createBoard({ sessionId: 's1', loopType: 'review' });\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:91:      const b = board.createBoard({ sessionId: 's1', loopType: 'review' });\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:104:      const b = board.createBoard({ sessionId: 's1', loopType: 'review' });\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:121:      const b = board.createBoard({ sessionId: 's1', generation: 2, loopType: 'review' });\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:127:      expect(record.sessionId).toBe('s1');\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:136:      const b = board.createBoard({ sessionId: 's1', loopType: 'review' });\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:145:      const b = board.createBoard({ sessionId: 's1', loopType: 'review' });\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:152:      const b = board.createBoard({ sessionId: 's1', loopType: 'review' });\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:179:      expect(segState.MERGE_KEYS).toEqual(['sessionId', 'generation', 'segment', 'wave', 'findingId']);\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:185:      const s = segState.createSegmentState('seg-1', { sessionId: 'sess-1', files: ['a.ts'] });\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:187:      expect(s.sessionId).toBe('sess-1');\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:194:      expect(segState.createSegmentState('', { sessionId: 's' })).toBeNull();\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:197:    it('throws for missing sessionId', () => {\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:204:      const state = segState.createSegmentState('seg-1', { sessionId: 's1', generation: 2, waveId: 'w1' });\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:206:      expect(record.sessionId).toBe('s1');\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:216:      const state = segState.createSegmentState('seg-1', { sessionId: 's1' });\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:219:      expect(state.jsonlRecords[0].sessionId).toBe('s1');\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:226:      const s1 = segState.createSegmentState('seg-1', { sessionId: 's1' });\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:229:      const s2 = segState.createSegmentState('seg-2', { sessionId: 's1' });\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:237:    it('deduplicates findings with same ID', () => {\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:238:      const s1 = segState.createSegmentState('seg-1', { sessionId: 's1' });\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:241:      const s2 = segState.createSegmentState('seg-2', { sessionId: 's1' });\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:250:      const s1 = segState.createSegmentState('seg-1', { sessionId: 's1' });\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:253:      const s2 = segState.createSegmentState('seg-2', { sessionId: 's1' });\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:262:      const s1 = segState.createSegmentState('seg-2', { sessionId: 's1', generation: 1 });\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:265:      const s2 = segState.createSegmentState('seg-1', { sessionId: 's1', generation: 1 });\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:282:      const state = segState.createSegmentState('seg-1', { sessionId: 's1' });\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:294:        '{\\\"sessionId\\\":\\\"s1\\\",\\\"generation\\\":1,\\\"segment\\\":\\\"seg-1\\\",\\\"wave\\\":\\\"w1\\\",\\\"findingId\\\":\\\"f1\\\",\\\"valid\\\":true}',\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:296:        '{\\\"sessionId\\\":\\\"s1\\\",\\\"generation\\\":1,\\\"segment\\\":\\\"seg-1\\\",\\\"wave\\\":\\\"w1\\\",\\\"findingId\\\":\\\"f2\\\",\\\"also\\\":\\\"valid\\\"}',\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:308:        sessionId: 's1', generation: 1, segment: 'seg-1', wave: 'w1', findingId: 'f1',\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-merge.vitest.ts:315:      const result = segState.validateMergeKeys({ sessionId: 's1' });\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-validation/missing-child-docs/001-design/spec.md:4:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/evals/run-ablation.ts:14://   SPECKIT_ABLATION=true npx tsx scripts/evals/run-ablation.ts [--channels vector,bm25,fts5] [--verbose]\\n.opencode/skills/system-spec-kit/scripts/evals/run-ablation.ts:47:const PROD_DB_PATH = path.join(DB_DIR, 'context-index.sqlite');\\n.opencode/skills/system-spec-kit/scripts/evals/run-ablation.ts:53:// Parse --channels flag (e.g., --channels vector,bm25,fts5)\\n.opencode/skills/system-spec-kit/scripts/evals/run-ablation.ts:111:    'SELECT COUNT(*) as c FROM memory_index'\\n.opencode/skills/system-spec-kit/scripts/evals/run-ablation.ts:144:      triggerPhrases: channelFlags.useTrigger ? undefined : [],\\n.opencode/skills/system-spec-kit/scripts/tests/validate-memory-quality.vitest.ts:9:spec_folder: \\\"022-hybrid-rag-fusion/009-perfect-session-capturing\\\"\\n.opencode/skills/system-spec-kit/scripts/tests/validate-memory-quality.vitest.ts:10:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/validate-memory-quality.vitest.ts:28:spec_folder: \\\"022-hybrid-rag-fusion/009-perfect-session-capturing\\\"\\n.opencode/skills/system-spec-kit/scripts/tests/validate-memory-quality.vitest.ts:29:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/validate-memory-quality.vitest.ts:48:title: \\\"Implementation session for phase 009\\\"\\n.opencode/skills/system-spec-kit/scripts/tests/validate-memory-quality.vitest.ts:50:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/validate-memory-quality.vitest.ts:56:# Implementation session\\n.opencode/skills/system-spec-kit/scripts/tests/validate-memory-quality.vitest.ts:64:      filePath: '/project/specs/system-spec-kit/009-reindex-validator/memory/session.md',\\n.opencode/skills/system-spec-kit/scripts/tests/validate-memory-quality.vitest.ts:73:      filePath: '/project/specs/009-reindex-validator/memory/session.md',\\n.opencode/skills/system-spec-kit/scripts/tests/validate-memory-quality.vitest.ts:80:  it('V12 skip: memory directory files bypass topical coherence', () => {\\n.opencode/skills/system-spec-kit/scripts/tests/validate-memory-quality.vitest.ts:84:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/validate-memory-quality.vitest.ts:92:Detailed notes about graduating feature flags with different terminology than parent spec trigger phrases.\\n.opencode/skills/system-spec-kit/scripts/tests/validate-memory-quality.vitest.ts:93:The topical coherence check should be skipped for memory directory files.\\n.opencode/skills/system-spec-kit/scripts/tests/validate-memory-quality.vitest.ts:103:  it('V12 skip: spec doc files bypass topical coherence', () => {\\n.opencode/skills/system-spec-kit/scripts/tests/validate-memory-quality.vitest.ts:107:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/validate-memory-quality.vitest.ts:131:    expect(v12?.name).toBe('topical-coherence-mismatch');\\n.opencode/skills/system-spec-kit/scripts/evals/README.md:4:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/memory-pipeline-regressions.vitest.ts:5:import { extractTriggerPhrases as extractSharedTriggerPhrases } from '@spec-kit/shared/trigger-extractor';\\n.opencode/skills/system-spec-kit/scripts/tests/memory-pipeline-regressions.vitest.ts:50:  it('filters generic single-word trigger phrases while preserving meaningful phrases', () => {\\n.opencode/skills/system-spec-kit/scripts/tests/memory-pipeline-regressions.vitest.ts:52:      'Manual testing per spec phase validated deterministic trigger extraction for embeddings provider selection and memory title truncation.',\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:7:import type Database from 'better-sqlite3';\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:19:} from './causal-edges.js';\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:20:import type { CausalEdge } from './causal-edges.js';\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:94:    // Query high-similarity pairs from vec_memories using sqlite-vec\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:114:      \\\"SELECT name FROM sqlite_master WHERE type='table' AND name='vec_memories'\\\"\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:123: * Vector-based contradiction scan using sqlite-vec cosine similarity.\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:133:    FROM memory_index m\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:195:    FROM memory_index\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:286: * (via causal edges) to surface the full context for resolution.\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:297:    // Expand cluster via causal edges (1-hop neighbors)\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:301:          SELECT CAST(target_id AS INTEGER) as neighbor_id FROM causal_edges WHERE source_id = ?\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:303:          SELECT CAST(source_id AS INTEGER) as neighbor_id FROM causal_edges WHERE target_id = ?\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:346:        SELECT id, strength, last_accessed, created_by FROM causal_edges\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:370:        SELECT id, strength, last_accessed, created_by FROM causal_edges\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:454:        SELECT source_id AS node_id FROM causal_edges\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:456:        SELECT target_id AS node_id FROM causal_edges\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/consolidation.ts:493:      CREATE TABLE IF NOT EXISTS consolidation_state (\\n.opencode/skills/system-spec-kit/scripts/core/subfolder-utils.ts:46:  // Deduplicate aliased roots upfront to avoid duplicate traversal\\n.opencode/skills/system-spec-kit/scripts/core/subfolder-utils.ts:108:    // Deduplicate aliased results (belt-and-suspenders with root dedup)\\n.opencode/skills/system-spec-kit/scripts/core/subfolder-utils.ts:137:  // Deduplicate aliased roots upfront to avoid duplicate traversal\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-validation/missing-child-docs/001-design/tasks.md:4:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-planner.vitest.ts:51:function makeDomains(count: number, opts: { diverse?: boolean } = {}): Array<{ domain: string; authority: number; cluster: string; topics: string[] }> {\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-planner.vitest.ts:60:      topics: [`topic-${i % 4}`],\\n.opencode/skills/system-spec-kit/scripts/tests/test-memory-quality-lane.js:24:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/test-memory-quality-lane.js:46:  const v4 = validator.validateMemoryQualityContent(validContent + '\\\\nNo specific decisions were made during this session.\\\\n');\\n.opencode/skills/system-spec-kit/scripts/tests/test-memory-quality-lane.js:50:  assert(v5.failedRules.includes('V5'), 'V5 should fail empty trigger_phrases with >=5 tools');\\n.opencode/skills/system-spec-kit/scripts/tests/test-memory-quality-lane.js:54:      'trigger_phrases:\\\\n  - \\\"memory\\\"\\\\n  - \\\"quality\\\"',\\n.opencode/skills/system-spec-kit/scripts/tests/test-memory-quality-lane.js:55:      'trigger_phrases: [\\\"memory\\\", \\\"quality\\\"]'\\n.opencode/skills/system-spec-kit/scripts/tests/test-memory-quality-lane.js:58:  assert(inlineTriggerPhrases.valid === true, 'inline trigger_phrases list should count as populated');\\n.opencode/skills/system-spec-kit/scripts/tests/test-memory-quality-lane.js:83:      { narrative: 'Selected a fallback strategy for sparse trigger phrases.' },\\n.opencode/skills/system-spec-kit/scripts/tests/test-memory-quality-lane.js:258:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/test-memory-quality-lane.js:270:  // V11 should fail on error-dominated trigger phrases\\n.opencode/skills/system-spec-kit/scripts/tests/test-memory-quality-lane.js:275:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/test-memory-quality-lane.js:288:  assert(v11Triggers.failedRules.includes('V11'), 'V11 should fail when >50% trigger phrases contain error vocabulary');\\n.opencode/skills/system-spec-kit/scripts/tests/test-memory-quality-lane.js:295:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/test-memory-quality-lane.js:370:trigger_phrases:\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/post-insert-metadata.ts:7:import type Database from 'better-sqlite3';\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/post-insert-metadata.ts:15: * Keys align to the guarded `memory_index` columns below.\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/post-insert-metadata.ts:39:  session_id?: string;\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/post-insert-metadata.ts:60:  'session_id',\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/post-insert-metadata.ts:70: * Build and execute a dynamic `UPDATE memory_index SET ... WHERE id = ?`\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/post-insert-metadata.ts:106:    UPDATE memory_index\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:12:import { buildProjectStateSnapshot } from '../extractors/session-extractor';\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:50:          userInput: 'Perfect session capturing hardening for stateless mode',\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:51:          assistantResponse: 'Improved perfect session capturing alignment and enrichment safeguards.',\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:57:      sessionTitle: 'Perfect Session Capturing',\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:58:      sessionId: 'session-test',\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:60:    }, 'system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing');\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:71:          userInput: 'Perfect session capturing hardening for stateless mode',\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:72:          assistantResponse: 'Improved perfect session capturing alignment and enrichment safeguards.',\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:83:      sessionTitle: 'Perfect Session Capturing',\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:84:      sessionId: 'session-test',\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:86:    }, 'system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing');\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:89:    expect(transformed.userPrompts[0]?.prompt).toContain('Perfect session capturing');\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:105:      sessionTitle: 'Foreign Spec Session',\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:106:      sessionId: 'foreign-session',\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:108:    }, 'system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing');\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:119:          userInput: 'Perfect session capturing hardening for stateless mode',\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:120:          assistantResponse: 'Validated the stateless alignment guard for perfect session capturing.',\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:132:          output: 'Confirmed scripts/core/workflow.ts still blocks mis-scoped 009-perfect-session-capturing saves.',\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:136:      sessionTitle: 'Codex stateless evidence preservation',\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:137:      sessionId: 'codex-evidence',\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:139:    }, 'system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing', 'codex-cli-capture');\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:169:            command: \\\"node .opencode/skills/system-spec-kit/scripts/dist/memory/generate-context.js .opencode/specs/00--anobel.com/036-hero-contact-success\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:175:      sessionTitle: 'Generic infrastructure session',\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:176:      sessionId: 'generic-infra',\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:178:    }, 'system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing');\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:185:  it('extracts trigger phrases from merged specs that embed a second frontmatter block', async () => {\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:198:        'trigger_phrases:',\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:220:    expect(extracted.triggerPhrases).toEqual(expect.arrayContaining(['stateless mode', 'improve stateless']));\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:229:      id: '009-perfect-session-capturing',\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:239:        'trigger_phrases:',\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:240:        '  - \\\"perfect session capturing\\\"',\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:351:    const specFolderPath = path.join(repoRoot, '.opencode', 'specs', 'system-spec-kit', '022-hybrid-rag-fusion', '009-perfect-session-capturing');\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:503:    const targetSpecFolder = path.join(repoRoot, '.opencode', 'specs', 'system-spec-kit', '022-hybrid-rag-fusion', '009-perfect-session-capturing');\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:523:        FILE_PATH: '.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/note-2.md',\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:526:        FILE_PATH: '.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/note-6.md',\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:531:        FILE_PATH: '.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/note-1.md',\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:538:    const targetSpecFolder = path.join(repoRoot, '.opencode', 'specs', 'system-spec-kit', '022-hybrid-rag-fusion', '009-perfect-session-capturing');\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:558:        FILE_PATH: '.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/spec.md',\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:564:        files: ['.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/spec.md'],\\n.opencode/skills/system-spec-kit/scripts/tests/session-enrichment.vitest.ts:569:        FILE_PATH: '.opencode/specs/system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing-archive/notes.md',\\n.opencode/skills/system-spec-kit/scripts/tests/test-phase-system.js:170:    assertEqual(phaseMapCount, 1, 'create.sh parent mode: phase-map section not duplicated');\\n.opencode/skills/system-spec-kit/scripts/core/README.md:4:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/core/README.md:26:The `core/` directory contains orchestration modules used by `dist/memory/generate-context.js`.\\n.opencode/skills/system-spec-kit/scripts/core/README.md:38:- `frontmatter-editor.ts` - frontmatter metadata injection and trigger phrase YAML rendering\\n.opencode/skills/system-spec-kit/scripts/core/README.md:40:- `memory-metadata.ts` - memory classification, session dedup, causal links, and evidence snapshot assembly\\n.opencode/skills/system-spec-kit/scripts/core/README.md:46:- `topic-extractor.ts` - derive topic signals from folder/content inputs\\n.opencode/skills/system-spec-kit/scripts/core/file-writer.ts:23:    .replace(/^session_id:\\\\s*\\\".*\\\"$/gm, 'session_id: \\\"<normalized>\\\"')\\n.opencode/skills/system-spec-kit/scripts/core/file-writer.ts:95:// RC-6: Return duplicate filename instead of throwing, so callers can skip\\n.opencode/skills/system-spec-kit/scripts/core/file-writer.ts:96:// Idempotently. Previously, throw-on-duplicate was treated as a batch error\\n.opencode/skills/system-spec-kit/scripts/core/file-writer.ts:97:// That triggered rollback, causing 5 separate runs to create 5 files.\\n.opencode/skills/system-spec-kit/scripts/core/file-writer.ts:120:        return existing; // duplicate found — return the matching filename\\n.opencode/skills/system-spec-kit/scripts/core/file-writer.ts:141:    // RC-6: Skip duplicate files idempotently instead of crashing the batch\\n.opencode/skills/system-spec-kit/scripts/core/file-writer.ts:142:    const duplicateOf = await checkForDuplicateContent(contextDir, content, filename);\\n.opencode/skills/system-spec-kit/scripts/core/file-writer.ts:143:    if (duplicateOf) {\\n.opencode/skills/system-spec-kit/scripts/core/file-writer.ts:144:      console.warn(`   Skipping ${filename}: duplicate of existing ${duplicateOf}`);\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:16:import Database from 'better-sqlite3';\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:32:import { buildSessionActivitySignal } from '../lib/session-activity-signal';\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:79:  sessionActivityBoost: number;\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:80:  sessionActivitySignalCount: number;\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:102:  sessionActivityBoost?: number;\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:103:  sessionActivitySignalCount?: number;\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:344:    return { lowConfidence: true, reason: 'no candidates resolved from session learning rows' };\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:470:    const sessionActivity = buildSessionActivitySignal(collectedData, candidate.relativePath);\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:475:      sessionActivityBoost: sessionActivity.confidenceBoost,\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:476:      sessionActivitySignalCount:\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:477:        sessionActivity.toolCallPaths.length\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:478:        + sessionActivity.gitChangedFiles.length\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:479:        + sessionActivity.transcriptMentions.length,\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:516:  if (a.sessionActivityBoost !== b.sessionActivityBoost) {\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:517:    return b.sessionActivityBoost - a.sessionActivityBoost;\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:520:  if (a.sessionActivitySignalCount !== b.sessionActivitySignalCount) {\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:521:    return b.sessionActivitySignalCount - a.sessionActivitySignalCount;\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:528:  return [...pickPreferredCandidates(candidates.filter((candidate) => candidate.sessionActivityBoost > 0))]\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:534:    return { lowConfidence: true, reason: 'no session activity matched candidate folders' };\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:538:    return { lowConfidence: false, reason: 'single session-activity candidate' };\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:544:    top.sessionActivityBoost === second.sessionActivityBoost\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:545:    && top.sessionActivitySignalCount === second.sessionActivitySignalCount\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:547:    return { lowConfidence: true, reason: 'top session-activity candidates tie on boost and signal count' };\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:550:  return { lowConfidence: false, reason: 'clear session-activity winner' };\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:560:  if (a.sessionActivityBoost !== b.sessionActivityBoost) {\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:561:    return b.sessionActivityBoost - a.sessionActivityBoost;\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:600:  const sameActivity = top.sessionActivityBoost === second.sessionActivityBoost;\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:719:      console.warn(`Skipping session_learning spec_folder outside specs roots: ${resolvedSpecFolder}`);\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:786:    // Fix F6 — validate session-learning paths against approved roots.\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:791:          `[folder-detector] Skipping session-learning row with unapproved absolute spec_folder: ${resolvedAbsoluteSpecFolder}`\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:839:  console.log(`   [Priority 2.5] Low-confidence session match: ${reason}`);\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:844:  console.log(`   ${shortlist.length + 1}. Skip session-learning selection and continue\\\\n`);\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:874:      sessionActivityBoost: 0,\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:875:      sessionActivitySignalCount: 0,\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:1054:      sessionActivityBoost: input.sessionActivityBoost ?? 0,\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:1055:      sessionActivitySignalCount: input.sessionActivitySignalCount ?? 0,\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:1154:        // so alignment validator can extract topics from all path segments.\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:1249:      console.error('\\\\nUsage: node generate-context.js [spec-folder-name] OR node generate-context.js <data-file> [spec-folder]\\\\n');\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:1347:         FROM session_learning\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:1353:      const sessionCandidates = await buildSessionCandidates(rows, specsDirsForDetection);\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:1354:      const rankedSessionCandidates = rankSessionCandidates(sessionCandidates);\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:1374:            console.warn(`   [Priority 2.5] Low-confidence session match (${confidence.reason}); falling through.`);\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:1385:            `source=session_learning, recency=${selected.recencyIso}, reason=${confidence.reason}`\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:1479:    const sessionActivityCandidates = rankSessionActivityCandidates(await loadAutoDetectCandidates());\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:1480:    if (sessionActivityCandidates.length > 0) {\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:1481:      const confidence = assessSessionActivityConfidence(sessionActivityCandidates);\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:1482:      let selected: AutoDetectCandidate | null = sessionActivityCandidates[0];\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:1484:        console.warn(`   [Priority 3.5] Low-confidence session-activity match (${confidence.reason}); falling through.`);\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:1493:          `activity_boost=${selected.sessionActivityBoost.toFixed(2)}, signals=${selected.sessionActivitySignalCount}, reason=${confidence.reason}`,\\n.opencode/skills/system-spec-kit/scripts/spec-folder/folder-detector.ts:1555:    console.log('\\\\n   Conversation topic may not align with most recent spec folder');\\n.opencode/skills/system-spec-kit/scripts/core/config.ts:233:    maxObservations: 15, // Raised from 3 to 15 to prevent 96% data loss (010-perfect-session-capturing)\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:11:import type Database from 'better-sqlite3';\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:27:import { deleteEdgesForMemory } from './causal-edges.js';\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:67:    'memory_index',\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:70:    'working_memory',\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:71:    'causal_edges',\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:80:    'session_learning',\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:85:    'session_state',\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:86:    'session_sent_memories',\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:109:  'memory_index',\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:112:  'working_memory',\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:113:  'causal_edges',\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:122:  'session_learning',\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:127:  'session_state',\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:128:  'session_sent_memories',\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:206:  causalEdges?: Array<Record<string, unknown>>;\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:300:      \\\"SELECT name FROM sqlite_master WHERE type IN ('table','view') AND name = ?\\\"\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:311:  'memory_index', 'memory_fts', 'vec_memories', 'vec_metadata', 'causal_edges',\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:314:  // Working memory & session\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:315:  'working_memory', 'session_state', 'session_sent_memories', 'session_learning',\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:320:  'learned_feedback_audit', 'learned_trigger_scores', 'learned_trigger_feedback',\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:443:    || columns.has('session_id')\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:485:    ? database.prepare('SELECT * FROM memory_index WHERE spec_folder = ?').all(specFolder) as Array<Record<string, unknown>>\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:486:    : database.prepare('SELECT * FROM memory_index').all() as Array<Record<string, unknown>>;\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:596:  if (memoryIds.length === 0 || !tableExists(database, 'causal_edges')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:606:          SELECT * FROM causal_edges\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:614:          SELECT * FROM causal_edges\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:626:  if (memoryIds.length === 0 || !tableExists(database, 'causal_edges')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:660:  if (tableName === 'memory_index') {\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:663:        'SELECT * FROM memory_index WHERE spec_folder = ?'\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:665:      : database.prepare('SELECT * FROM memory_index').all() as Array<Record<string, unknown>>;\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:681:      JOIN memory_index m ON m.id = v.rowid\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:690:  if (tableName === 'causal_edges') {\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:694:    return hasScope ? [] : database.prepare('SELECT * FROM causal_edges').all() as Array<Record<string, unknown>>;\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:840:    tableSnapshots.memory_index = {\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:847:    tableSnapshots.working_memory = {\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:863:  if (Array.isArray(snapshot.causalEdges)) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:864:    tableSnapshots.causal_edges = {\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:865:      columns: Object.keys(snapshot.causalEdges[0] ?? {}),\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:866:      rows: snapshot.causalEdges,\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:940:  if (tableName === 'memory_index') {\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:942:      database.prepare(`DELETE FROM memory_index WHERE ${scopedClauses.join(' AND ')}`).run(...scopedParams);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:952:  if (tableName === 'causal_edges') {\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1107:      CREATE TABLE IF NOT EXISTS working_memory (\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1109:        session_id TEXT NOT NULL,\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1121:        UNIQUE(session_id, memory_id),\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1122:        FOREIGN KEY (memory_id) REFERENCES memory_index(id) ON DELETE SET NULL\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1126:    const wmColumns = (database.prepare('PRAGMA table_info(working_memory)').all() as Array<{ name: string }>)\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1129:      database.exec('ALTER TABLE working_memory ADD COLUMN event_counter INTEGER NOT NULL DEFAULT 0');\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1132:      database.exec('ALTER TABLE working_memory ADD COLUMN mention_count INTEGER NOT NULL DEFAULT 0');\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1135:      database.exec('ALTER TABLE working_memory ADD COLUMN source_tool TEXT');\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1138:      database.exec('ALTER TABLE working_memory ADD COLUMN source_call_id TEXT');\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1141:      database.exec('ALTER TABLE working_memory ADD COLUMN extraction_rule_id TEXT');\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1144:      database.exec('ALTER TABLE working_memory ADD COLUMN redaction_applied INTEGER NOT NULL DEFAULT 0');\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1193:  const hasMemoryParentId = tableHasColumn(database, 'memory_index', 'parent_id');\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1284:  if ((column === 'trigger_phrases' || column === 'quality_flags') && Array.isArray(value)) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1295:  const tableColumns = new Set(getTableColumns(database, 'memory_index'));\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1316:    'trigger_phrases',\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1332:    'session_id',\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1453:      const workingMemorySnapshot = tables.working_memory?.rows ?? [];\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1454:      const causalEdgesSnapshot = tables.causal_edges?.rows ?? [];\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1466:        causalEdges: causalEdgesSnapshot,\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1624:    const memorySnapshot = tableSnapshots.memory_index;\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1651:    const edgeIds = getEdgeIds(tableSnapshots.causal_edges?.rows ?? []);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1672:      result.errors.push('No compatible memory_index columns found for restore');\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1678:    // Merge mode: INSERT OR REPLACE triggers CASCADE DELETE on working_memory\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1679:    // Via the FOREIGN KEY (memory_id) REFERENCES memory_index(id) ON DELETE CASCADE.\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1683:          INSERT OR ${clearExisting ? 'REPLACE' : 'IGNORE'} INTO memory_index (${memoryRestoreColumns.join(', ')})\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1691:          UPDATE memory_index SET ${nonIdColumns.map(c => `${c} = ?`).join(', ')}\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1696:    // Ensure working_memory table schema is ready BEFORE the transaction.\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1697:    // DDL (CREATE TABLE, ALTER TABLE) causes SQLite to auto-commit, which would\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1699:    if (tableSnapshots.working_memory) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1749:          // P4-11 FIX: When clearExisting=false, check for duplicate logical key\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1754:                SELECT id FROM memory_index\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1785:                FROM memory_index\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1825:          // Apply the snapshot values without triggering CASCADE deletes.\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1844:        if (tableName === 'memory_index') {\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1873:          if (tableName === 'working_memory') {\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1883:      // Throw to trigger ROLLBACK — this undoes both the DELETEs and partial INSERTs,\\n.opencode/skills/system-spec-kit/scripts/tests/memory-indexer-weighting.vitest.ts:50:vi.mock('../lib/trigger-extractor', () => ({\\n.opencode/skills/system-spec-kit/scripts/tests/memory-indexer-weighting.vitest.ts:136:  it('falls back to manual trigger phrases when extraction throws', async () => {\\n.opencode/skills/system-spec-kit/scripts/tests/memory-indexer-weighting.vitest.ts:147:      'test-trigger-fallback.md',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-indexer-weighting.vitest.ts:155:      triggerPhrases: expect.arrayContaining(['manual phrase one', 'manual phrase two']),\\n.opencode/skills/system-spec-kit/scripts/core/topic-extractor.ts:8:// Extracts key topics from session data using weighted scoring and bigram analysis\\n.opencode/skills/system-spec-kit/scripts/core/topic-extractor.ts:12:/** Represents decision for topics. */\\n.opencode/skills/system-spec-kit/scripts/core/topic-extractor.ts:20:// NOTE: Similar to extractors/session-extractor.ts:extractKeyTopics but differs in:\\n.opencode/skills/system-spec-kit/scripts/core/topic-extractor.ts:21:// - Uses compound phrase extraction (bigrams) for more meaningful topics\\n.opencode/skills/system-spec-kit/scripts/core/topic-extractor.ts:22:// - Accepts `string` only (session-extractor accepts `string | undefined`)\\n.opencode/skills/system-spec-kit/scripts/core/topic-extractor.ts:23:// - Includes spec folder name tokens as high-priority topics\\n.opencode/skills/system-spec-kit/scripts/core/topic-extractor.ts:25:/** Extract key topics. */\\n.opencode/skills/system-spec-kit/scripts/core/topic-extractor.ts:34:  // contaminate topics with generic infrastructure words. Topics should come from\\n.opencode/skills/system-spec-kit/scripts/core/topic-extractor.ts:35:  // actual session content (summary, decisions).\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/README.md:4:trigger_phrases:\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/README.md:33:- Reconsolidation, consolidation, and causal-edge persistence helpers.\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/README.md:47:| `causal-edges.ts` | Insert, query, and manage causal edge records |\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/README.md:53:| `learned-triggers-schema.ts` | Migration helpers for the `learned_triggers` column and FTS isolation checks |\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/README.md:56:| `post-insert-metadata.ts` | Guarded dynamic post-insert metadata updates for `memory_index` rows |\\n.opencode/skills/system-spec-kit/scripts/core/find-predecessor-memory.ts:12:  'session',\\n.opencode/skills/system-spec-kit/scripts/core/find-predecessor-memory.ts:25:  sessionId?: string;\\n.opencode/skills/system-spec-kit/scripts/core/find-predecessor-memory.ts:27:  sessionSummary?: string;\\n.opencode/skills/system-spec-kit/scripts/core/find-predecessor-memory.ts:34:  causal_links?: Record<string, unknown>;\\n.opencode/skills/system-spec-kit/scripts/core/find-predecessor-memory.ts:35:  causalLinks?: Record<string, unknown>;\\n.opencode/skills/system-spec-kit/scripts/core/find-predecessor-memory.ts:39:  sessionId: string;\\n.opencode/skills/system-spec-kit/scripts/core/find-predecessor-memory.ts:72:  return readSupersedes(currentSession.causal_links).length > 0\\n.opencode/skills/system-spec-kit/scripts/core/find-predecessor-memory.ts:73:    || readSupersedes(currentSession.causalLinks).length > 0;\\n.opencode/skills/system-spec-kit/scripts/core/find-predecessor-memory.ts:104:    currentSession.sessionSummary,\\n.opencode/skills/system-spec-kit/scripts/core/find-predecessor-memory.ts:207:    const sessionId = parseFrontmatterValue(frontmatter, 'session_id');\\n.opencode/skills/system-spec-kit/scripts/core/find-predecessor-memory.ts:209:    if (sessionId.length === 0 || title.length === 0) {\\n.opencode/skills/system-spec-kit/scripts/core/find-predecessor-memory.ts:214:      sessionId,\\n.opencode/skills/system-spec-kit/scripts/core/find-predecessor-memory.ts:253: * across mixed-topic sibling folders. Auto-linking requires either an exact\\n.opencode/skills/system-spec-kit/scripts/core/find-predecessor-memory.ts:254: * source-session match, an explicit continuation marker, or >=50% title-family\\n.opencode/skills/system-spec-kit/scripts/core/find-predecessor-memory.ts:266:  const currentSessionId = typeof currentSession.sessionId === 'string' ? currentSession.sessionId.trim() : '';\\n.opencode/skills/system-spec-kit/scripts/core/find-predecessor-memory.ts:300:    if (candidateHeader.sessionId === currentSessionId) {\\n.opencode/skills/system-spec-kit/scripts/core/find-predecessor-memory.ts:314:      sourceMatch: sourceSessionId.length > 0 && candidateHeader.sessionId === sourceSessionId,\\n.opencode/skills/system-spec-kit/scripts/core/find-predecessor-memory.ts:315:      explicitMarkerMatch: hasExplicitContinuationMarker(currentSession, candidateHeader.sessionId),\\n.opencode/skills/system-spec-kit/scripts/core/find-predecessor-memory.ts:341:    if (comparison === 'tie' && candidate.sessionId !== bestCandidate.sessionId) {\\n.opencode/skills/system-spec-kit/scripts/core/find-predecessor-memory.ts:350:  return bestCandidate.sessionId;\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:6:// - collect-session-data.js (424 LOC) - P0\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:7:// - session-extractor.js (330 LOC) - P1\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:193:    narrative: 'Explored Redis vs Memcached for session caching. Next: implement Redis solution.',\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:245:    { decision: 'Redis for session cache', title: 'Caching Strategy' }\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:268:    const collectSessionData = require(path.join(EXTRACTORS_DIR, 'collect-session-data'));\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:444:    const sessionExtractor = require(path.join(EXTRACTORS_DIR, 'session-extractor'));\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:447:    assertType(sessionExtractor.generateSessionId, 'function', 'EXT-Session-001: generateSessionId exported');\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:448:    assertType(sessionExtractor.getChannel, 'function', 'EXT-Session-002: getChannel exported');\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:449:    assertType(sessionExtractor.detectContextType, 'function', 'EXT-Session-003: detectContextType exported');\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:450:    assertType(sessionExtractor.detectImportanceTier, 'function', 'EXT-Session-004: detectImportanceTier exported');\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:451:    assertType(sessionExtractor.detectProjectPhase, 'function', 'EXT-Session-005: detectProjectPhase exported');\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:452:    assertType(sessionExtractor.extractActiveFile, 'function', 'EXT-Session-006: extractActiveFile exported');\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:453:    assertType(sessionExtractor.extractNextAction, 'function', 'EXT-Session-007: extractNextAction exported');\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:454:    assertType(sessionExtractor.extractBlockers, 'function', 'EXT-Session-008: extractBlockers exported');\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:455:    assertType(sessionExtractor.buildFileProgress, 'function', 'EXT-Session-009: buildFileProgress exported');\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:456:    assertType(sessionExtractor.countToolsByType, 'function', 'EXT-Session-010: countToolsByType exported');\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:457:    assertType(sessionExtractor.calculateSessionDuration, 'function', 'EXT-Session-011: calculateSessionDuration exported');\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:458:    assertType(sessionExtractor.calculateExpiryEpoch, 'function', 'EXT-Session-012: calculateExpiryEpoch exported');\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:459:    assertType(sessionExtractor.extractKeyTopics, 'function', 'EXT-Session-013: extractKeyTopics exported');\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:460:    assertType(sessionExtractor.detectSessionCharacteristics, 'function', 'EXT-Session-014: detectSessionCharacteristics exported');\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:461:    assertType(sessionExtractor.buildProjectStateSnapshot, 'function', 'EXT-Session-015: buildProjectStateSnapshot exported');\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:464:    const { generateSessionId } = sessionExtractor;\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:465:    const sessionId = generateSessionId();\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:466:    assertMatch(sessionId, /^session-\\\\d+-[a-z0-9]+$/, 'EXT-Session-016: Session ID format correct');\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:468:    // Test unique session IDs\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:478:    const { getChannel } = sessionExtractor;\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:488:    const { detectContextType } = sessionExtractor;\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:496:    const { detectImportanceTier } = sessionExtractor;\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:503:    const { detectProjectPhase } = sessionExtractor;\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:510:    const { extractActiveFile } = sessionExtractor;\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:519:    const { extractNextAction } = sessionExtractor;\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:524:    const { extractBlockers } = sessionExtractor;\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:537:    const { buildFileProgress } = sessionExtractor;\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:543:    const { countToolsByType } = sessionExtractor;\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:550:    const { calculateSessionDuration } = sessionExtractor;\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:561:    const { calculateExpiryEpoch } = sessionExtractor;\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:573:    const { extractKeyTopics } = sessionExtractor;\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:574:    const topics = extractKeyTopics('Implemented OAuth authentication with JWT tokens');\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:575:    assertArray(topics, 'EXT-Session-047: extractKeyTopics returns array');\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:576:    if (topics.some(t => t.includes('oauth')) || topics.some(t => t.includes('authentication')) || topics.some(t => t.includes('tokens'))) {\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:577:      pass('EXT-Session-048: Relevant topics extracted', topics.slice(0, 3).join(', '));\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:579:      fail('EXT-Session-048: Relevant topics extracted', topics.join(', '));\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:583:    const topicsFiltered = extractKeyTopics('The quick fox jumps over the lazy dog');\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:585:    if (!topicsFiltered.includes('the')) {\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:586:      pass('EXT-Session-049: Stopwords filtered', `'the' filtered, remaining: ${topicsFiltered.slice(0, 3).join(', ')}`);\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:588:      fail('EXT-Session-049: Stopwords filtered', topicsFiltered.join(', '));\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:592:    const { detectSessionCharacteristics } = sessionExtractor;\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:600:    const { buildProjectStateSnapshot } = sessionExtractor;\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:764:        narrative: 'Observation duplicate of the authoritative manual decision.',\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:832:    assertEqual(dedupedFiles.length, 1, 'EXT-File-016: Duplicate files deduplicated');\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:841:    assertEqual(normalizedDedupedFiles.length, 1, 'EXT-File-016b: Normalized path-equivalent files deduplicated');\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:876:    const duplicateObs = [\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:881:    const uniqueAnchors = buildObservationsWithAnchors(duplicateObs, '007-test');\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:897:    const baseFiles = [{ FILE_PATH: 'src/auth.js', DESCRIPTION: 'Modified during session' }];\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:1070:    const topicFromFolder = extractMainTopic([], '007-oauth-auth');\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:1071:    if (topicFromFolder.includes('oauth') || topicFromFolder.includes('auth')) {\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:1072:      pass('EXT-Impl-011: Topic from folder name', topicFromFolder);\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:1074:      fail('EXT-Impl-011: Topic from folder name', topicFromFolder);\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:1077:    const topicFromObs = extractMainTopic(MOCK_OBSERVATIONS, null);\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:1078:    assertType(topicFromObs, 'string', 'EXT-Impl-012: Topic from observations is string');\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:1095:    assertEqual(dedupedBuilt.length, 1, 'EXT-Impl-016: Duplicate features deduplicated');\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:1189:    // Test with short session\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:1192:    assertArray(shortPhases, 'EXT-Diag-008: Short session returns array');\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:1245:    assertType(opencodeCapture.getSessionResponses, 'function', 'EXT-OC-002: get_session_responses exported');\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:1249:    assertType(opencodeCapture.getRecentSessions, 'function', 'EXT-OC-006: get_recent_sessions exported');\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:1250:    assertType(opencodeCapture.getCurrentSession, 'function', 'EXT-OC-007: get_current_session exported');\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:1251:    assertType(opencodeCapture.getSessionMessages, 'function', 'EXT-OC-008: get_session_messages exported');\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:1292:    // Test get_recent_sessions with invalid project ID\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:1294:    const sessions = await getRecentSessions('nonexistent-project-id', 10);\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:1295:    assertArray(sessions, 'EXT-OC-025: Invalid project returns empty array');\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:1296:    assertEqual(sessions.length, 0, 'EXT-OC-026: No sessions for invalid project');\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:1298:    // Test get_session_messages with invalid session ID\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:1300:    const messages = await getSessionMessages('nonexistent-session-id');\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:1301:    assertArray(messages, 'EXT-OC-027: Invalid session returns empty array');\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:1411:    const sessionExtractor = require(path.join(EXTRACTORS_DIR, 'session-extractor'));\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:1430:    // Test session extractor with edge cases\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:1431:    const { countToolsByType } = sessionExtractor;\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:1447:    const { extractKeyTopics } = sessionExtractor;\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:1448:    const topics1 = extractKeyTopics('');\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:1449:    assertArray(topics1, 'ERR-009: Empty string returns array');\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:1451:    const topics2 = extractKeyTopics(null);\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:1452:    assertArray(topics2, 'ERR-010: Null summary returns array');\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:1455:    const { calculateSessionDuration } = sessionExtractor;\\n.opencode/skills/system-spec-kit/scripts/tests/test-extractors-loaders.js:1514:    // Test session characteristics detection\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:7:import type Database from 'better-sqlite3';\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:13:import { get_embedding_dim, refresh_interference_scores_for_folder, sqlite_vec_available } from '../search/vector-index-store.js';\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:37:  session_id?: string | null;\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:138:  duplicateActiveLogicalKeys: string[];\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:176:  const row = database.prepare('SELECT * FROM memory_index WHERE id = ?').get(memoryId) as MemoryIndexRow | undefined;\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:178:    throw new Error(`Memory ${memoryId} not found in memory_index`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:212:    ['session', normalizeScopeValue(row.session_id)],\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:431:    UPDATE memory_index\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:453:    ? (sqlite_vec_available() ? 'success' : 'pending')\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:457:    INSERT INTO memory_index (\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:462:      trigger_phrases,\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:482:    JSON.stringify(parsed.triggerPhrases),\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:512:  if (embedding && sqlite_vec_available()) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:529:        trigger_phrases: parsed.triggerPhrases,\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:538:    recordHistory(memoryId, 'ADD', null, parsed.title ?? filePath, params.actor ?? 'mcp:memory_save');\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:816:      actor: params.actor ?? 'mcp:memory_save',\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:997:  const duplicateActiveLogicalKeys: string[] = [];\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:1014:  const duplicateActive = database.prepare(`\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:1022:  for (const issue of duplicateActive) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:1023:    duplicateActiveLogicalKeys.push(issue.logical_key);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:1054:    duplicateActiveLogicalKeys,\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:1076:    FROM memory_index\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:24:import { sanitizeTriggerPhrase, type TriggerPhraseSanitizeReason } from '../lib/trigger-phrase-sanitizer';\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:84:    sessionSummary?: string;\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:129:  'session summary',\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:132:  'development session',\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:133:  'session in progress',\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:135:  'implementation session',\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:362:  return extractYamlListEntries(extractMemoryMetadataYaml(content), 'trigger_phrases');\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:419:function buildD3Counts(triggerPhrases: string[]): Record<D3Reason, number> {\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:420:  return triggerPhrases.reduce<Record<D3Reason, number>>((counts, phrase) => {\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:437:function buildManualTriggerKeySet(triggerPhrases: string[] | undefined): Set<string> {\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:439:    (Array.isArray(triggerPhrases) ? triggerPhrases : [])\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:447:  triggerPhrases: string[],\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:450:  return triggerPhrases.reduce<Record<D3Reason, number>>((counts, phrase) => {\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:550:    structuredLog('warn', 'memory_save_review_violation', {\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:568:      structuredLog('warn', 'memory_save_git_provenance_degraded', {\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:577:      structuredLog('warn', 'memory_save_template_contract_violation', {\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:625:    const savedTriggers = parseFrontmatterArray(fileContent, 'trigger_phrases');\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:632:    const metadataHasTriggerPhrases = /(^|\\\\n)trigger_phrases:\\\\s*/m.test(memoryMetadataYaml);\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:639:    const payloadSummary = (collectedData.sessionSummary || '').trim();\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:659:        message: `\\\"${savedTitle}\\\" — should reflect sessionSummary`,\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:673:          field: 'trigger_phrases',\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:687:          field: 'trigger_phrases',\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:689:          fix: `Add to trigger_phrases: ${JSON.stringify(missingPhrases.slice(0, 5))}`,\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:758:    const duplicatedDecisionPropositions = Array.from(normalizedOutcomePropositions).filter((proposition) => (\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:763:    if (duplicatedDecisionPropositions.length > 0) {\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:768:        message: `decision proposition is repeated across outcomes, title, and rationale: ${JSON.stringify(duplicatedDecisionPropositions.slice(0, 3))}`,\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:769:        fix: 'Deduplicate repeated decision propositions across Key Outcomes, decision titles, and fallback rationale',\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:781:        message: `completed-session closure guidance is repeated across ${closureSignals.length} surfaces`,\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:782:        fix: 'Keep completed-session closure guidance on the canonical Next Action surface only',\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:807:    const normalizedSavedTriggers = Array.from(new Set(savedTriggers.map((trigger) => trigger.trim().toLowerCase()).filter(Boolean))).sort();\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:808:    const normalizedMetadataTriggers = Array.from(new Set(metadataTriggers.map((trigger) => trigger.trim().toLowerCase()).filter(Boolean))).sort();\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:813:        field: 'trigger_phrases',\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:814:        message: `frontmatter trigger_phrases ${JSON.stringify(normalizedSavedTriggers)} drift from MEMORY METADATA ${JSON.stringify(normalizedMetadataTriggers)}`,\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:815:        fix: 'Render MEMORY METADATA trigger_phrases from the same resolved frontmatter trigger list',\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:846:        'session focused on implementing and testing features',\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:847:        'development session',\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:857:          fix: `Replace with sessionSummary: \\\"${payloadSummary.substring(0, 100)}\\\"`,\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:885:          fix: 'Re-render the OVERVIEW from the full session summary using the boundary-safe truncation helper',\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:901:    // CHECK-D3: trigger phrase sanitization.\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:912:        field: 'trigger_phrases',\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:913:        message: `trigger_phrases contains unsanitized junk (${details})`,\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:914:        fix: 'Run trigger phrases through the Phase 3 sanitizer before render and persist only the kept phrases',\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:934:        field: 'causal_links.supersedes',\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:935:        message: `continuation signal matched \\\"${continuationPattern}\\\" but causal_links.supersedes is empty`,\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:936:        fix: 'Populate causal_links.supersedes when a continuation save has a valid predecessor',\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:940:    // CHECK-D6: duplicate trigger phrases.\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:943:      const duplicates = new Set<string>();\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:948:          duplicates.add(normalized);\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:954:      if (duplicates.size > 0) {\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:958:          field: 'trigger_phrases',\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:959:          message: `duplicate trigger phrases detected: ${JSON.stringify(Array.from(duplicates))}`,\\n.opencode/skills/system-spec-kit/scripts/core/post-save-review.ts:960:          fix: 'Deduplicate trigger_phrases before the saved frontmatter is rendered',\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:23:import { extractKeyTopics } from './topic-extractor';\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:24:import type { DecisionForTopics } from './topic-extractor';\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:36:} from '../lib/trigger-phrase-sanitizer';\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:37:import { shouldAutoSave, collectSessionData } from '../extractors/collect-session-data';\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:38:import type { CollectedDataFull } from '../extractors/collect-session-data';\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:68:import { extractTriggerPhrases } from '../lib/trigger-extractor';\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:84:import type { FileChange, SessionData } from '../types/session-types';\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:303:  /** Path to a JSON file containing pre-collected session data. */\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:311:  /** Custom async function to collect live session data from the environment. */\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:319:  /** Optional session ID forwarded from CLI --session-id flag. */\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:320:  sessionId?: string;\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:351:    /** Whether the data originated from a simulation rather than a live session. */\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:527:      // Merge FILES (deduplicate by path, prefer existing descriptions)\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:537:      // Merge trigger phrases\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:538:      if (specContext.triggerPhrases.length > 0) {\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:541:          ...specContext.triggerPhrases,\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:554:      if (specContext.summary && (!enriched.SUMMARY || enriched.SUMMARY === 'Development session')) {\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:575:      // Merge FILES (deduplicate by path)\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:603:    // Synthetic observations provide file coverage but do not influence session narrative\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:654:      // Rec 1: Normalize JSON-derived preloaded data so sessionSummary → userPrompts,\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:659:      // preserving preloadedData's non-normalized fields (e.g., _source, _sessionId).\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:672:        causalLinks: n.causalLinks ?? preloadedData.causalLinks,\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:673:        causal_links: n.causal_links ?? preloadedData.causal_links,\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:697:    // Step 1.5: Captured-session alignment check\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:698:    // When no JSON data file was provided, data comes from the active OpenCode session.\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:700:    // Cross-spec contamination (e.g., session working on spec A saved to spec B).\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:711:        const alignMsg = `ALIGNMENT_WARNING: Captured-session content matched the workspace but not the target spec folder \\\"${activeSpecFolderArg}\\\". ` +\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:731:            `The active session appears to be working on a different task (alignment keywords: [${alignmentTargets.keywordTargets.join(', ')}], ` +\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:849:      // Phase 002 T010: Clean _JSON_SESSION_SUMMARY (raw sessionSummary title candidate)\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:920:    // Step 3.5: Enrich captured-session data with spec folder and git context\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:932:      log('Step 3.5: Enriching captured-session data...');\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1013:    const sessionDataFn = collectSessionDataFn || collectSessionData;\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1014:    if (!sessionDataFn) {\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1016:        'Missing session data collector function.\\\\n' +\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1018:        '  - If using generate-context.js, ensure extractors/collect-session-data.js exports collectSessionData'\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1066:    const [sessionData, conversations, decisions, diagrams, workflowData] = await Promise.all([\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1068:      log('   Collecting session data...');\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1069:      const result = await sessionDataFn(narrativeCollectedData, specFolderName, options.sessionId);\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1118:  // Patch TOOL_COUNT for enriched captured-session saves so V7 does not flag\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1121:  let patchedToolCount = Number.isFinite(sessionData.TOOL_COUNT) ? sessionData.TOOL_COUNT : 0;\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1160:  log(`   Content quality: ${filterStats.qualityScore}/100 (${filterStats.noiseFiltered} noise, ${filterStats.duplicatesRemoved} duplicates filtered from ${filterStats.totalProcessed} items)`);\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1175:    sessionData.FILES || [],\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1206:  const specFolderBasename: string = path.basename(sessionData.SPEC_FOLDER || specFolderName);\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1230:      sessionData._JSON_SESSION_SUMMARY || '',  // RC1: raw JSON sessionSummary as first candidate\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1231:      sessionData.QUICK_SUMMARY || '',\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1232:      sessionData.TITLE || '',\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1233:      sessionData.SUMMARY || '',\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1247:  const rawCtxFilename: string = `${sessionData.DATE}_${sessionData.TIME}__${contentSlug}.md`;\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1251:  const keyTopicsInitial: string[] = extractKeyTopics(sessionData.SUMMARY, decisions.DECISIONS, specFolderName);\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1254:    ?? buildMemoryTitle(preferredMemoryTask, specFolderName, sessionData.DATE, contentSlug);\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1255:  // Keep dashboard titles stable across duplicate-save retries so content dedup\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1260:      summary: sessionData.SUMMARY,\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1264:  // Pre-extract trigger phrases for template embedding AND later indexing\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1267:    // Build enriched text for trigger extraction from semantic session content only.\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1268:    const triggerSourceParts: string[] = [];\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1269:    if (sessionData.SUMMARY && sessionData.SUMMARY.length > 20) {\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1270:      triggerSourceParts.push(sessionData.SUMMARY);\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1273:      if (d.TITLE) triggerSourceParts.push(d.TITLE);\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1274:      if (d.RATIONALE) triggerSourceParts.push(d.RATIONALE);\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1275:      if (d.CONTEXT) triggerSourceParts.push(d.CONTEXT);\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1276:      if (d.CHOSEN) triggerSourceParts.push(d.CHOSEN);\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1282:      if (f.DESCRIPTION && !f.DESCRIPTION.includes('pending')) triggerSourceParts.push(f.DESCRIPTION);\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1292:    const triggerSource = triggerSourceParts.join('\\\\n');\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1293:    const autoExtractedTriggers = extractTriggerPhrases(triggerSource);\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1299:    // RC2: Merge manual trigger phrases from JSON into frontmatter triggers.\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1354:    // CG-04: Domain-specific stopwords for single-word trigger phrases from folder names\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1361:      'based', 'features', 'perfect', 'session', 'capturing', 'pipeline',\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1397:    log(`   Pre-extracted ${preExtractedTriggers.length} trigger phrases`);\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1400:    warn(`   Warning: Pre-extraction of trigger phrases failed: ${errMsg}`);\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1404:  const memoryClassification = buildMemoryClassificationContext(collectedData, sessionData);\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1405:  const sessionDedup = buildSessionDedupContext(collectedData, sessionData, memoryTitle);\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1407:    collectedData.causal_links\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1408:    && typeof collectedData.causal_links === 'object'\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1409:    && !Array.isArray(collectedData.causal_links)\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1410:  ) ? { ...(collectedData.causal_links as Record<string, unknown>) } : null;\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1412:    collectedData.causalLinks\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1413:    && typeof collectedData.causalLinks === 'object'\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1414:    && !Array.isArray(collectedData.causalLinks)\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1415:  ) ? { ...(collectedData.causalLinks as Record<string, unknown>) } : null;\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1425:      summary: sessionData.SUMMARY,\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1426:      sessionId: sessionData.SESSION_ID,\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1428:      sourceSessionId: sessionData.SOURCE_SESSION_ID,\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1429:      causal_links: currentSnakeCaseCausalLinks ?? undefined,\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1430:      causalLinks: currentCamelCaseCausalLinks ?? undefined,\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1438:      collectedData.causal_links = nextCausalLinks;\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1439:      collectedData.causalLinks = nextCausalLinks;\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1443:    sessionId: sessionData.SESSION_ID,\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1444:    contextType: sessionData.CONTEXT_TYPE,\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1478:  collectedData.causal_links = {\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1486:  collectedData.causalLinks = collectedData.causal_links;\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1487:  const causalLinks = buildCausalLinksContext(collectedData);\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1488:  const effectiveDecisionCount = Math.max(sessionData.DECISION_COUNT, decisions.DECISIONS.length);\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1492:      ...sessionData,\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1496:      // Captured-session mode, because conversations object contains TOOL_COUNT: 0\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1497:      // Which overwrites the patched value from captured-session enrichment.\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1499:      // O1-4: Uses patchedToolCount (local variable) instead of mutated sessionData.\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1508:      CANONICAL_DOCS: sessionData.CANONICAL_DOCS || {},\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1509:      CANONICAL_SOURCE_ENTRIES: Array.isArray((sessionData.CANONICAL_DOCS as unknown as Record<string, unknown> | undefined)?.CANONICAL_SOURCE_ENTRIES)\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1510:        ? (sessionData.CANONICAL_DOCS as unknown as Record<string, unknown>).CANONICAL_SOURCE_ENTRIES as Array<Record<string, string>>\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1512:      DISTINGUISHING_EVIDENCE: sessionData.DISTINGUISHING_EVIDENCE || [],\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1515:      HAS_IMPLEMENTATION_GUIDE: sessionData.HAS_IMPLEMENTATION_GUIDE === true,\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1546:      ...sessionDedup,\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1547:      ...causalLinks,\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1573:        const topics = (exchanges as Array<Record<string, unknown>>)\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1575:          .map(ex => ex.topic || ex.userInput || 'exchange')\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1579:        return `${exchanges.length} exchanges${topics ? ` \\\\u2014 ${topics}` : ''}`;\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1583:      timestamp: `${sessionData.DATE} ${sessionData.TIME}`,\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1584:      messageCount: sessionData.MESSAGE_COUNT,\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1588:      autoTriggered: shouldAutoSave(sessionData.MESSAGE_COUNT),\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1607:        fileCount: sessionData.FILE_COUNT,\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1608:        capturedFileCount: sessionData.CAPTURED_FILE_COUNT,\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1609:        filesystemFileCount: sessionData.FILESYSTEM_FILE_COUNT,\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1610:        gitChangedFileCount: sessionData.GIT_CHANGED_FILE_COUNT,\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1613:        transcriptPath: sessionData.SOURCE_TRANSCRIPT_PATH,\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1614:        sessionId: sessionData.SOURCE_SESSION_ID,\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1615:        sessionCreated: sessionData.SOURCE_SESSION_CREATED,\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1616:        sessionUpdated: sessionData.SOURCE_SESSION_UPDATED,\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1625:  let duplicateExistingFilename: string | null = null;\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1631:        duplicateExistingFilename = rawCtxFilename;\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1642:      warn(`   Warning: Could not preflight duplicate check for ${rawCtxFilename}: ${errMsg}`);\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1678:    triggerPhrases: preExtractedTriggers,\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1680:    observations: sessionData.OBSERVATIONS || [],\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1682:    outcomes: sessionData.OUTCOMES || [],\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1683:    nextAction: sessionData.NEXT_ACTION,\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1684:    blockers: sessionData.BLOCKERS,\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1730:    const warningHeader = `> **Note:** This session had limited actionable content (input_completeness_score: ${filterStats.qualityScore}/100). ${filterStats.noiseFiltered} noise entries and ${filterStats.duplicatesRemoved} duplicates were filtered.\\\\n\\\\n`;\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1732:    log(`   Warning: Low quality session (${filterStats.qualityScore}/100) - warning header added`);\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1736:    const simWarning = `<!-- WARNING: This is simulated/placeholder content - NOT from a real session -->\\\\n\\\\n`;\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1774:      `This typically means the captured session data does not contain meaningful content for this spec folder. ` +\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1802:      warn(`QUALITY_GATE_WARN: Captured-session save continuing despite soft validation failures: ${qualityValidation.failedRules.join(', ')}`);\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1839:            warn(`   [PRE-SAVE OVERLAP] Memory content matches existing \\\"${existingFile}\\\" — possible duplicate save`);\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1854:  if (duplicateExistingFilename) {\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1855:    log(`   Skipping ${ctxFilename}: duplicate of existing ${duplicateExistingFilename}`);\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1861:  // Have been skipped as a duplicate). Guard downstream operations accordingly.\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1934:    log('   Context file was a duplicate — skipping description tracking');\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1951:  log(`  - Session duration: ${sessionData.DURATION}\\\\n`);\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1966:          sessionSummary: collectedData.sessionSummary || jsonSessionSummary,\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:1975:    structuredLog('info', 'memory_save_started', {\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:2001:      'memory_save_review_completed',\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:2015:      structuredLog('warn', 'memory_save_review_failure', {\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:2025:    // to preserve content-based duplicate detection at line 1259)\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:2062:  // RC-6 fix: Only index if the context file was actually written (not a duplicate skip)\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:2064:    log('   Skipping indexing — context file was a duplicate');\\n.opencode/skills/system-spec-kit/scripts/core/workflow.ts:2066:      'skipped_duplicate',\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:12:import { collectSessionData } from '../extractors/collect-session-data';\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:93:      sessionSummary: 'Completed runtime hardening.',\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:115:      spec_folder: '022-hybrid-rag-fusion/009-perfect-session-capturing',\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:116:      session_summary: 'Verified generated memory render quality in snake_case JSON mode.',\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:117:      trigger_phrases: ['perfect session capturing', 'render quality', 'trigger phrases'],\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:136:        specFolderArg: '022-hybrid-rag-fusion/009-perfect-session-capturing',\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:143:        'perfect session capturing',\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:145:        'trigger phrases',\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:220:      sessionTitle: 'Copilot parity capture',\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:221:      sessionId: 'copilot-parity',\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:326:      sessionSummary: 'Stabilized delegated memory save runtime behavior.',\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:348:    const sessionData = await collectSessionData(normalized, '022-hybrid-rag-fusion');\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:350:    expect(sessionData.SUMMARY).toBe('Stabilized delegated memory save runtime behavior.');\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:351:    expect(sessionData.NEXT_ACTION).toBe('Add regression coverage for explicit dataFile failures.');\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:385:    const sessionData = await collectSessionData(\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:390:    expect(sessionData.NEXT_ACTION).toBe('Promote the preserved structured next action.');\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:394:      next_steps: ['This should not duplicate the existing next-step facts.'],\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:406:      sessionSummary: 'Session with no next steps.',\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:417:      sessionSummary: 'Both fields present.',\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:432:      sessionSummary: 'Edge case: empty first step.',\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:446:      sessionSummary: 'Critical save should keep the caller-provided tier.',\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:450:    const sessionData = await collectSessionData(\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:455:    expect(sessionData.IMPORTANCE_TIER).toBe('critical');\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:456:    expect(sessionData.EXPIRES_AT_EPOCH).toBe(0);\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:462:      sessionSummary: 'Temporary save should retain the snake_case override.',\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:466:    const sessionData = await collectSessionData(\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:471:    expect(sessionData.IMPORTANCE_TIER).toBe('temporary');\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:472:    expect(sessionData.EXPIRES_AT_EPOCH).toBeGreaterThan(sessionData.CREATED_AT_EPOCH);\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:478:      sessionSummary: 'Architecture work should still auto-detect as critical.',\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:482:    const sessionData = await collectSessionData(\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:487:    expect(sessionData.IMPORTANCE_TIER).toBe('critical');\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:488:    expect(sessionData.EXPIRES_AT_EPOCH).toBe(0);\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:495:      specFolder: '022-hybrid-rag-fusion/009-perfect-session-capturing',\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:512:    const sessionData = await collectSessionData(\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:514:      '022-hybrid-rag-fusion/009-perfect-session-capturing',\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:517:    expect(sessionData.NEXT_ACTION).toBe('run smoke tests on staging');\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:523:      specFolder: '022-hybrid-rag-fusion/009-perfect-session-capturing',\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:540:    const sessionData = await collectSessionData(\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:542:      '022-hybrid-rag-fusion/009-perfect-session-capturing',\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:545:    expect(sessionData.NEXT_ACTION).toHaveLength(100);\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:555:      specFolder: '022-hybrid-rag-fusion/009-perfect-session-capturing',\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:585:    const sessionData = await collectSessionData(\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:587:      '022-hybrid-rag-fusion/009-perfect-session-capturing',\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:592:    expect(sessionData.NEXT_ACTION).toBe('Fix bug X');\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:597:      specFolder: '022-hybrid-rag-fusion/009-perfect-session-capturing',\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:615:    const sessionData = await collectSessionData(\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:617:      '022-hybrid-rag-fusion/009-perfect-session-capturing',\\n.opencode/skills/system-spec-kit/scripts/tests/runtime-memory-inputs.vitest.ts:622:    expect(sessionData.NEXT_ACTION).toBe('Deploy to staging');\\n.opencode/skills/system-spec-kit/scripts/tests/distinguishing-evidence-dedup.vitest.ts:3:import { buildDistinctiveEvidence } from '../extractors/collect-session-data';\\n.opencode/skills/system-spec-kit/scripts/tests/distinguishing-evidence-dedup.vitest.ts:6:  it('deduplicates repeated bullets and prefers file-line anchored evidence', () => {\\n.opencode/skills/system-spec-kit/scripts/tests/distinguishing-evidence-dedup.vitest.ts:18:        'scripts/extractors/collect-session-data.ts:1200 canonical docs now render from relative links.',\\n.opencode/skills/system-spec-kit/scripts/tests/distinguishing-evidence-dedup.vitest.ts:24:      'scripts/extractors/collect-session-data.ts:1200 canonical docs now render from relative links.',\\n.opencode/skills/system-spec-kit/scripts/core/memory-indexer.ts:19:import { extractTriggerPhrases } from '../lib/trigger-extractor';\\n.opencode/skills/system-spec-kit/scripts/core/memory-indexer.ts:20:import type { CollectedDataFull } from '../extractors/collect-session-data';\\n.opencode/skills/system-spec-kit/scripts/core/memory-indexer.ts:26:  | 'skipped_duplicate'\\n.opencode/skills/system-spec-kit/scripts/core/memory-indexer.ts:104:  let triggerPhrases: string[] = [];\\n.opencode/skills/system-spec-kit/scripts/core/memory-indexer.ts:106:    // Start with pre-extracted triggers (from enriched sources), fall back to content extraction\\n.opencode/skills/system-spec-kit/scripts/core/memory-indexer.ts:108:      triggerPhrases = [...preExtractedTriggers];\\n.opencode/skills/system-spec-kit/scripts/core/memory-indexer.ts:109:      console.log(`   Using ${triggerPhrases.length} pre-extracted trigger phrases`);\\n.opencode/skills/system-spec-kit/scripts/core/memory-indexer.ts:111:      triggerPhrases = extractTriggerPhrases(content);\\n.opencode/skills/system-spec-kit/scripts/core/memory-indexer.ts:112:      console.log(`   Extracted ${triggerPhrases.length} trigger phrases from content`);\\n.opencode/skills/system-spec-kit/scripts/core/memory-indexer.ts:118:      const existingLower = new Set(triggerPhrases.map((p) => p.toLowerCase()));\\n.opencode/skills/system-spec-kit/scripts/core/memory-indexer.ts:121:          triggerPhrases.push(phrase);\\n.opencode/skills/system-spec-kit/scripts/core/memory-indexer.ts:124:      console.log(`   Total: ${triggerPhrases.length} trigger phrases (${manualPhrases.length} manual)`);\\n.opencode/skills/system-spec-kit/scripts/core/memory-indexer.ts:126:  } catch (triggerError: unknown) {\\n.opencode/skills/system-spec-kit/scripts/core/memory-indexer.ts:127:    const errMsg = triggerError instanceof Error ? triggerError.message : String(triggerError);\\n.opencode/skills/system-spec-kit/scripts/core/memory-indexer.ts:134:      triggerPhrases = collectedData._manualTriggerPhrases;\\n.opencode/skills/system-spec-kit/scripts/core/memory-indexer.ts:135:      console.log(`   Using ${triggerPhrases.length} manual trigger phrases`);\\n.opencode/skills/system-spec-kit/scripts/core/memory-indexer.ts:167:      triggerPhrases: triggerPhrases,\\n.opencode/skills/system-spec-kit/scripts/spec-folder/README.md:4:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/spec-folder/README.md:41:| **Alignment Validation**    | Calculate alignment scores between conversation topics and spec folder names        |\\n.opencode/skills/system-spec-kit/scripts/spec-folder/README.md:45:| **CLI Authority**           | Respect explicit CLI spec-folder targets without rerouting to session-learning picks |\\n.opencode/skills/system-spec-kit/scripts/spec-folder/README.md:123:const topics = extractConversationTopics({\\n.opencode/skills/system-spec-kit/scripts/spec-folder/README.md:173:| `alignment-validator.ts` | Validates alignment between conversation topics and folder names. Calculates scores |\\n.opencode/skills/system-spec-kit/scripts/spec-folder/README.md:199:node scripts/dist/memory/generate-context.js /tmp/save-context-data.json specs/<###-feature-name>/\\n.opencode/skills/system-spec-kit/scripts/spec-folder/README.md:201:node scripts/dist/memory/generate-context.js /tmp/save-context-data.json .opencode/specs/<###-feature-name>/\\n.opencode/skills/system-spec-kit/scripts/spec-folder/README.md:208:**Cause**: Conversation topics don't match folder name keywords\\n.opencode/skills/system-spec-kit/scripts/spec-folder/README.md:213:node scripts/dist/memory/generate-context.js /tmp/context.json specs/<###-feature-name>/\\n.opencode/skills/system-spec-kit/scripts/spec-folder/README.md:216:node scripts/dist/memory/generate-context.js 003-parent/001-child\\n.opencode/skills/system-spec-kit/scripts/spec-folder/README.md:219:node scripts/dist/memory/generate-context.js .opencode/specs/system-spec-kit/022-hybrid-rag-fusion/012-code-audit-per-feature-catalog/021-remediation-revalidation\\n.opencode/skills/system-spec-kit/scripts/spec-folder/README.md:260:# Test with actual generate-context script (which uses these utilities)\\n.opencode/skills/system-spec-kit/scripts/spec-folder/README.md:261:node scripts/dist/memory/generate-context.js --help\\n.opencode/skills/system-spec-kit/scripts/spec-folder/README.md:276:| [scripts/memory/generate-context.ts](../memory/generate-context.ts)                        | Main memory save script that uses these utilities |\\n.opencode/skills/system-spec-kit/scripts/tests/memory-save-title-description-override.vitest.ts:67:    const { main } = await import('../memory/generate-context');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-save-title-description-override.vitest.ts:72:        sessionSummary: 'Patched the structured memory-save schema so explicit authored metadata wins.',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-save-title-description-override.vitest.ts:75:        triggerPhrases: ['authored metadata override', 'structured json save'],\\n.opencode/skills/system-spec-kit/scripts/tests/memory-save-title-description-override.vitest.ts:109:    const { main } = await import('../memory/generate-context');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-save-title-description-override.vitest.ts:114:        sessionSummary: 'Implemented a fallback save path for the title builder when explicit title is absent.',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-save-title-description-override.vitest.ts:116:        triggerPhrases: ['title fallback verification'],\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:8:// - similarity in [0.88, 1.0]: MERGE (duplicate — merge content, boost importance_weight)\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:9:// - similarity in [0.75, 0.88): CONFLICT (supersede prior memory via causal 'supersedes' edge)\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:16:import type Database from 'better-sqlite3';\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:18:import * as causalEdges from './causal-edges.js';\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:60:  triggerPhrases?: string[];\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:93:  causalEdgeId: number | null;\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:129:/** Threshold above which memories are merged (near-duplicates) */\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:223:    const memoryIndexColumns = getTableColumns(db, 'memory_index');\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:225:    const existingRow = db.prepare('SELECT * FROM memory_index WHERE id = ?').get(existingMemory.id) as Record<string, unknown> | undefined;\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:240:    // Better-sqlite3's synchronous transaction callback).\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:257:      const currentRow = db.prepare('SELECT * FROM memory_index WHERE id = ?').get(existingMemory.id) as Record<string, unknown> | undefined;\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:278:      const mergedTriggerPhrases = buildMergedTriggerPhrases(currentRow, newMemory.triggerPhrases);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:285:        trigger_phrases: mergedTriggerPhrases,\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:291:        UPDATE memory_index\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:303:        trigger_phrases: mergedTriggerPhrases,\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:320:        INSERT INTO memory_index (${insertColumns.join(', ')})\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:346:      // Create supersedes causal edge\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:348:        INSERT OR IGNORE INTO causal_edges (source_id, target_id, relation, strength, extracted_at)\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:465: * - Create a 'supersedes' causal edge from new -> existing\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:482:    // Add causal 'supersedes' edge only when caller provides a distinct new ID.\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:495:          UPDATE memory_index\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:508:        edgeId = causalEdges.insertEdge(\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:526:          UPDATE memory_index\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:547:      causalEdgeId: edgeId,\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:632:    // Caller owns canonical create flow (prevents duplicate writes).\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:773:    db.exec('ALTER TABLE memory_index ADD COLUMN bm25_repair_needed INTEGER DEFAULT 0');\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:777:    if (message.toLowerCase().includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:797:      UPDATE memory_index\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:854:  triggerPhrases?: string[],\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:856:  if (Array.isArray(triggerPhrases)) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:857:    return JSON.stringify(triggerPhrases);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:859:  const existingValue = existingRow.trigger_phrases;\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:922:    session_id: existingRow.session_id,\\n.opencode/skills/system-spec-kit/scripts/core/title-builder.ts:57:  const fallback = readableFolder.length > 0 ? `${readableFolder} session ${_date}` : `Session ${_date}`;\\n.opencode/skills/system-spec-kit/scripts/core/tree-thinning.ts:24:  /** Memory-specific thinning trigger threshold */\\n.opencode/skills/system-spec-kit/scripts/core/tree-thinning.ts:186:      // Memory thinning trigger: merge into parent\\n.opencode/skills/system-spec-kit/scripts/tests/validation-rule-metadata.vitest.ts:57:  it('blocks indexing but allows write for V12 topical mismatch', () => {\\n.opencode/skills/system-spec-kit/scripts/tests/validation-rule-metadata.vitest.ts:73:  it('triggers V12 when memory content has zero overlap with spec trigger_phrases', () => {\\n.opencode/skills/system-spec-kit/scripts/tests/validation-rule-metadata.vitest.ts:74:    // Build a memory file whose content has no overlap with the spec's trigger_phrases.\\n.opencode/skills/system-spec-kit/scripts/tests/validation-rule-metadata.vitest.ts:75:    // V12 requires a spec_folder that points to a spec.md with trigger_phrases, and then\\n.opencode/skills/system-spec-kit/scripts/tests/validation-rule-metadata.vitest.ts:86:      'trigger_phrases: []',\\n.opencode/skills/system-spec-kit/scripts/tests/validation-rule-metadata.vitest.ts:91:      'This memory discusses something entirely off-topic with no spec alignment.',\\n.opencode/skills/system-spec-kit/scripts/tests/validation-rule-metadata.vitest.ts:96:    // V12 passes when no spec.md is found on disk (no trigger_phrases to compare against).\\n.opencode/skills/system-spec-kit/scripts/tests/validation-rule-metadata.vitest.ts:97:    // The rule only fires when it can read a spec.md with trigger_phrases and finds zero overlap.\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-validation/no-children/spec.md:4:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/validate-memory-quality-v12-normalization.vitest.ts:25:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/validate-memory-quality-v12-normalization.vitest.ts:41:describe('V12 topical normalization', () => {\\n.opencode/skills/system-spec-kit/scripts/tests/validate-memory-quality-v12-normalization.vitest.ts:47:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/validate-memory-quality-v12-normalization.vitest.ts:55:It should satisfy the topical coherence gate even though the spec trigger phrases are prose.\\n.opencode/skills/system-spec-kit/scripts/tests/validate-memory-quality-v12-normalization.vitest.ts:66:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/validate-memory-quality-v12-normalization.vitest.ts:80:  it('fails when the memory body has zero overlap with the spec trigger phrases', async () => {\\n.opencode/skills/system-spec-kit/scripts/tests/validate-memory-quality-v12-normalization.vitest.ts:85:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/validate-memory-quality-v12-normalization.vitest.ts:105:trigger_phrases:\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:4:// Feature catalog: Causal edge creation (memory_causal_link)\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:6:import type Database from 'better-sqlite3';\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:35:  caused:       1.3,  // Strong causal link\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:36:  enabled:      1.1,  // Weak causal link\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:103:  edgeId?: number;          // T202: causal_edges.id for unlink workflow\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:146:    database.exec('CREATE INDEX IF NOT EXISTS idx_causal_source ON causal_edges(source_id)');\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:147:    database.exec('CREATE INDEX IF NOT EXISTS idx_causal_target ON causal_edges(target_id)');\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:168:    console.warn('[causal-edges] Database not initialized. Server may still be starting up.');\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:183:  // Fix #26 (FK check) deferred — test environments use synthetic IDs not in memory_index.\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:184:  // Implementing FK validation would require seeding memory_index in 20+ causal edge tests.\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:190:      console.warn(`[causal-edges] Edge bounds: node ${sourceId} has ${edgeCount} edges (max ${MAX_EDGES_PER_NODE}), rejecting auto edge`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:198:      console.warn('[causal-edges] insertEdge rejected non-finite strength');\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:218:        SELECT id, strength FROM causal_edges\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:223:        INSERT INTO causal_edges (source_id, target_id, relation, strength, evidence, created_by)\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:227:          evidence = COALESCE(excluded.evidence, causal_edges.evidence)\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:231:        SELECT id FROM causal_edges WHERE source_id = ? AND target_id = ? AND relation = ?\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:250:    console.warn(`[causal-edges] insertEdge error: ${msg}`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:296:    console.warn(`[causal-edges] insertEdgesBatch error: ${msg}`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:310:    const edgeColumns = (database.prepare('PRAGMA table_info(causal_edges)').all() as Array<{ name: string }>)\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:319:      INSERT OR IGNORE INTO causal_edges (${edgeColumns.join(', ')})\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:351:    console.warn(`[causal-edges] bulkInsertEdges error: ${msg}`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:373:      SELECT * FROM causal_edges\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:382:        console.warn(`[causal-edges] touchEdgeAccess failed for edge ${edge.id}: ${e instanceof Error ? e.message : String(e)}`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:388:    console.warn(`[causal-edges] getEdgesFrom error: ${msg}`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:398:      SELECT * FROM causal_edges\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:407:        console.warn(`[causal-edges] touchEdgeAccess failed for edge ${edge.id}: ${e instanceof Error ? e.message : String(e)}`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:413:    console.warn(`[causal-edges] getEdgesTo error: ${msg}`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:423:      SELECT * FROM causal_edges\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:432:    console.warn(`[causal-edges] getAllEdges error: ${msg}`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:521:        console.warn('[causal-edges] updateEdge rejected non-finite strength');\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:543:          'SELECT strength FROM causal_edges WHERE id = ?'\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:551:        `UPDATE causal_edges SET ${parts.join(', ')} WHERE id = ?`\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:573:    console.warn(`[causal-edges] updateEdge error: ${msg}`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:583:      'DELETE FROM causal_edges WHERE id = ?'\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:591:    console.warn(`[causal-edges] deleteEdge error: ${msg}`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:603:    DELETE FROM causal_edges\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:622:    const total = (db.prepare('SELECT COUNT(*) as count FROM causal_edges') as Database.Statement).get() as { count: number };\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:623:    const byRelation = (db.prepare('SELECT relation, COUNT(*) as count FROM causal_edges GROUP BY relation') as Database.Statement).all() as Array<{ relation: string; count: number }>;\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:624:    const avgStrength = (db.prepare('SELECT AVG(strength) as avg FROM causal_edges') as Database.Statement).get() as { avg: number | null };\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:625:    const sources = (db.prepare('SELECT COUNT(DISTINCT source_id) as count FROM causal_edges') as Database.Statement).get() as { count: number };\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:626:    const targets = (db.prepare('SELECT COUNT(DISTINCT target_id) as count FROM causal_edges') as Database.Statement).get() as { count: number };\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:642:    console.warn(`[causal-edges] getGraphStats error: ${msg}`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:652:      SELECT ce.* FROM causal_edges ce\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:653:      WHERE NOT EXISTS (SELECT 1 FROM memory_index m WHERE CAST(m.id AS TEXT) = ce.source_id)\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:654:        OR NOT EXISTS (SELECT 1 FROM memory_index m WHERE CAST(m.id AS TEXT) = ce.target_id)\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:658:    console.warn(`[causal-edges] findOrphanedEdges error: ${msg}`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:678:    console.warn(`[causal-edges] cleanupOrphanedEdges error: ${msg}`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:688: * Create causal relationship chain between spec folder documents.\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:692: * @param documentIds Map of document_type -> memory_index.id for documents in the same spec folder\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:763:    console.warn(`[causal-edges] getWeightHistory error: ${msg}`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:776:        'SELECT strength FROM causal_edges WHERE id = ?'\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:811:        'UPDATE causal_edges SET strength = ? WHERE id = ?'\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:827:    console.warn(`[causal-edges] rollbackWeights error: ${msg}`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:840:      SELECT COUNT(*) as count FROM causal_edges\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:846:    console.warn(`[causal-edges] countEdgesForNode error: ${msg}`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:854:    \\\"UPDATE causal_edges SET last_accessed = datetime('now') WHERE id = ?\\\"\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:862:      SELECT * FROM causal_edges\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/causal-edges.ts:869:    console.warn(`[causal-edges] getStaleEdges error: ${msg}`);\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:11:import type { SessionData } from '../types/session-types';\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:12:import { collectSessionData } from '../extractors/collect-session-data';\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:35:      triggerPhrases: 20,\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:67:    triggerPhrases: 4,\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:84:    MESSAGES: [{ TIMESTAMP: '2026-03-06T09:00:00Z', ROLE: 'User', CONTENT: 'Development session', TOOL_CALLS: [] }],\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:123:    String(data.TRIGGER_PHRASES_YAML ?? 'trigger_phrases: []'),\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:141:    '<!-- ANCHOR:continue-session -->',\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:156:    '<!-- ANCHOR:session-history -->',\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:170:    'session_id: \\\"test-session\\\"',\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:196:        userPrompts: [{ prompt: 'Development session', timestamp: '2026-03-06T09:00:00Z' }],\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:202:      userPrompts: [{ prompt: 'Development session', timestamp: '2026-03-06T09:01:00Z' }],\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:217:    task: 'Development session',\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:223:    triggerPhrases: [],\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:286:    SESSION_ID: 'session-test',\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:383:      triggerPhrases: 4,\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:402:      triggerPhrases: 20,\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:430:  'Development session',\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:436:  'Work session',\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:456:    expect(isContaminatedMemoryName('Epistemic state captured at session start for learning delta calculation.')).toBe(true);\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:463:    expect(shouldEnrichTaskFromSpecTitle('Development session', 'file', null)).toBe(false);\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:464:    expect(shouldEnrichTaskFromSpecTitle('Development session', 'opencode-capture', '/tmp/context.json')).toBe(false);\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:468:    expect(shouldEnrichTaskFromSpecTitle('Development session', 'opencode-capture', null)).toBe(true);\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:493:  const genericTask = 'Development session';\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:558:  it('prefers specific session semantics over folder fallback when task and spec title are unusable', () => {\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:560:      'Development session',\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:569:      'Development session',\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:579:      'Development session',\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:601:    triggerPhrases?: string[];\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:607:    const triggerLines = (overrides.triggerPhrases ?? ['memory audit', 'lint gate'])\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:635:      '- No significant gaps identified at session start',\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:649:      'trigger_phrases:',\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:650:      triggerLines,\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:670:  it('does not treat quoted template tokens in session content as V6 leakage', () => {\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:700:  it('fails when frontmatter trigger phrases reference a foreign spec id', () => {\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:702:      triggerPhrases: [\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:819:  it('passes V10 when capturedFileCount is 0 (no file references in session)', () => {\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:899:    const sessionData = await collectSessionData(collectedData, '022-hybrid-rag-fusion');\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:901:    expect(sessionData.TITLE).toBe('hybrid rag fusion');\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:902:    expect(sessionData.QUICK_SUMMARY).toBe('Direct save naming fix for hybrid RAG fusion collector path');\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:906:    const sessionData = await collectSessionData({\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:907:      SPEC_FOLDER: '009-perfect-session-capturing',\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:908:      userPrompts: [{ prompt: 'Validate session source counts', timestamp: '2026-03-16T08:00:00Z' }],\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:927:      _sourceTranscriptPath: '/tmp/.claude/projects/spec-kit/session-123.jsonl',\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:928:      _sourceSessionId: 'session-123',\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:931:    }, '009-perfect-session-capturing');\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:933:    expect(sessionData.CAPTURED_FILE_COUNT).toBe(1);\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:934:    expect(sessionData.FILESYSTEM_FILE_COUNT).toBe(2);\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:935:    expect(sessionData.GIT_CHANGED_FILE_COUNT).toBe(1);\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:936:    expect(sessionData.FILE_COUNT).toBe(2);\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:937:    expect(sessionData.SOURCE_TRANSCRIPT_PATH).toContain('session-123.jsonl');\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:938:    expect(sessionData.SOURCE_SESSION_ID).toBe('session-123');\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:960:      const sessionData = createSessionData(specFolderName || '022-hybrid-rag-fusion');\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:961:      sessionData.QUICK_SUMMARY = 'Hybrid RAG fusion recall regression audit';\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:962:      sessionData.TITLE = 'Hybrid RAG fusion recall regression audit';\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:963:      sessionData.SUMMARY = 'Hybrid RAG fusion recall regression audit for file-backed root save naming.';\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:964:      return sessionData;\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:969:      userPrompts: [{ prompt: 'Development session', timestamp: '2026-03-06T09:00:00Z' }],\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:990:    const specFolderPath = path.join(tempRoot, '009-perfect-session-capturing');\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1017:          userPrompts: [{ prompt: 'Perfect session capturing', timestamp: '2026-03-15T15:00:00Z' }],\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1019:        collectSessionDataFn: async (_collectedData, specFolderName) => createSessionData(specFolderName || '009-perfect-session-capturing'),\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1038:  it.skip('persists source provenance fields and excludes raw path noise from trigger extraction', async () => {\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1040:    const specFolderPath = path.join(tempRoot, '011-session-source-validation');\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1060:          userPrompts: [{ prompt: 'Validate Claude session source provenance', timestamp: '2026-03-16T12:00:00Z' }],\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1063:          ...createSessionData(specFolderName || '011-session-source-validation'),\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1064:          SUMMARY: 'Bound Claude transcript selection to expected session id and history timestamps.',\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1068:              DESCRIPTION: 'Bound Claude transcript selection to expected session id and history timestamps.',\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1072:              FILE_PATH: 'src/zorbiumsessionpath.ts',\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1083:          SOURCE_TRANSCRIPT_PATH: '/tmp/.claude/projects/spec-kit/session-abc.jsonl',\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1084:          SOURCE_SESSION_ID: 'session-abc',\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1092:      expect(rendered).toContain('_sourceTranscriptPath: \\\"/tmp/.claude/projects/spec-kit/session-abc.jsonl\\\"');\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1093:      expect(rendered).toContain('_sourceSessionId: \\\"session-abc\\\"');\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1096:      expect(rendered).not.toContain('zorbiumsessionpath');\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1106:    const specFolderPath = path.join(tempRoot, '009-perfect-session-capturing');\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1130:      userPrompts: [{ prompt: 'Perfect session capturing hardening', timestamp: '2026-03-06T09:01:00Z' }],\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1134:          narrative: 'Updated stateless alignment handling for perfect session capturing.',\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1151:        collectSessionDataFn: async (_collectedData, specFolderName) => createSessionData(specFolderName || '009-perfect-session-capturing'),\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1164:    const specFolderPath = path.join(tempRoot, '009-perfect-session-capturing');\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1212:        collectSessionDataFn: async (_collectedData, specFolderName) => createSessionData(specFolderName || '009-perfect-session-capturing'),\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1227:    const specFolderPath = path.join(tempRoot, '009-perfect-session-capturing');\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1253:        triggerPhrases: 1,\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1265:          userPrompts: [{ prompt: 'Perfect session capturing', timestamp: '2026-03-15T15:00:00Z' }],\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1267:        collectSessionDataFn: async (_collectedData, specFolderName) => createSessionData(specFolderName || '009-perfect-session-capturing'),\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1282:    const specFolderPath = path.join(tempRoot, '009-perfect-session-capturing');\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1321:          userPrompts: [{ prompt: 'Perfect session capturing', timestamp: '2026-03-15T15:00:00Z' }],\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1330:        collectSessionDataFn: async (_collectedData, specFolderName) => createSessionData(specFolderName || '009-perfect-session-capturing'),\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1343:    const specFolderPath = path.join(tempRoot, '009-perfect-session-capturing');\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1362:      'trigger_phrases:',\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1382:          userPrompts: [{ prompt: 'Perfect session capturing', timestamp: '2026-03-15T15:00:00Z' }],\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1391:        collectSessionDataFn: async (_collectedData, specFolderName) => createSessionData(specFolderName || '009-perfect-session-capturing'),\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1428:      userPrompts: [{ prompt: 'Development session', timestamp: '2026-03-06T09:01:00Z' }],\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1432:      const sessionData = createSessionData(specFolderName || '013-memory-search-bug-fixes');\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1433:      sessionData.QUICK_SUMMARY = 'Development session';\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1434:      sessionData.TITLE = 'Development session';\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1435:      sessionData.SUMMARY = 'Implementation and updates';\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1436:      return sessionData;\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1441:      userPrompts: [{ prompt: 'Development session', timestamp: '2026-03-06T09:00:00Z' }],\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1512:          userPrompts: [{ prompt: 'Development session', timestamp: '2026-03-06T09:00:00Z' }],\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1526:        userPrompts: [{ prompt: 'Development session', timestamp: '2026-03-06T09:01:00Z' }],\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1607:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1620:  it('V11 fails when trigger phrases are error-dominated', () => {\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1625:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/task-enrichment.vitest.ts:1646:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/spec-affinity.vitest.ts:28:    const specRoot = path.join(makeTempSpecRoot(), '010-perfect-session-capturing');\\n.opencode/skills/system-spec-kit/scripts/tests/spec-affinity.vitest.ts:32:      triggerPhrases: ['perfect session capturing', 'stateless capture quality'],\\n.opencode/skills/system-spec-kit/scripts/tests/spec-affinity.vitest.ts:39:        'trigger_phrases:',\\n.opencode/skills/system-spec-kit/scripts/tests/spec-affinity.vitest.ts:40:        '  - \\\"perfect session capturing\\\"',\\n.opencode/skills/system-spec-kit/scripts/tests/spec-affinity.vitest.ts:56:    expect(targets.specId).toBe('010-perfect-session-capturing');\\n.opencode/skills/system-spec-kit/scripts/tests/spec-affinity.vitest.ts:58:      '010 perfect session capturing',\\n.opencode/skills/system-spec-kit/scripts/tests/spec-affinity.vitest.ts:59:      'perfect session capturing',\\n.opencode/skills/system-spec-kit/scripts/tests/spec-affinity.vitest.ts:66:    const specRoot = path.join(makeTempSpecRoot(), '010-perfect-session-capturing');\\n.opencode/skills/system-spec-kit/scripts/tests/spec-affinity.vitest.ts:91:    const specRoot = path.join(makeTempSpecRoot(), '010-perfect-session-capturing');\\n.opencode/skills/system-spec-kit/scripts/tests/spec-affinity.vitest.ts:132:  it('filters single-word stopword trigger phrases from exact phrase anchors', () => {\\n.opencode/skills/system-spec-kit/scripts/tests/spec-affinity.vitest.ts:140:        'trigger_phrases:',\\n.opencode/skills/system-spec-kit/scripts/tests/spec-affinity.vitest.ts:167:        'trigger_phrases:',\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:11:import type Database from 'better-sqlite3';\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:79:    const columns = (db.prepare('PRAGMA table_info(memory_index)').all() as Array<{ name: string }>);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:120:          FROM memory_index\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:127:          FROM memory_index\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:205:          UPDATE memory_index\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:210:          UPDATE memory_index\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:290:          FROM memory_index\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:295:          FROM memory_index\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:351:            FROM memory_index\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:356:            FROM memory_index\\n.opencode/skills/system-spec-kit/scripts/tests/progressive-validation.vitest.ts:542:      // File with trailing spaces → triggers WHITESPACE fix\\n.opencode/skills/system-spec-kit/scripts/tests/progressive-validation.vitest.ts:587:      // File with trailing spaces → will trigger WHITESPACE fix\\n.opencode/skills/system-spec-kit/scripts/core/alignment-validator.ts:11:import type { FileChange } from '../types/session-types';\\n.opencode/skills/system-spec-kit/scripts/tests/memory-render-fixture.vitest.ts:10:import type { SessionData } from '../types/session-types';\\n.opencode/skills/system-spec-kit/scripts/tests/memory-render-fixture.vitest.ts:64:    SESSION_ID: 'session-render-fixture',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-render-fixture.vitest.ts:120:    CONTEXT_SUMMARY: 'This fixture exercises the real workflow render path with deterministic session data.',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-render-fixture.vitest.ts:199:            prompt: 'Development session',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-render-fixture.vitest.ts:232:      expect(result.contextFilename).not.toContain('development-session');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-render-fixture.vitest.ts:238:      expect(frontmatterTitle).not.toMatch(/to promote a memory|epistemic state captured at session start|table of contents/i);\\n.opencode/skills/system-spec-kit/scripts/tests/memory-render-fixture.vitest.ts:239:      expect(rendered).not.toMatch(/^#\\\\s*(To promote a memory|Epistemic state captured at session start|Table of Contents)\\\\b/im);\\n.opencode/skills/system-spec-kit/scripts/tests/memory-render-fixture.vitest.ts:241:      expect(frontmatter).toContain('trigger_phrases:');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-render-fixture.vitest.ts:244:      expect(frontmatter.match(/trigger_phrases:/g)?.length ?? 0).toBe(1);\\n.opencode/skills/system-spec-kit/scripts/tests/memory-render-fixture.vitest.ts:245:      expect(frontmatter).toMatch(/trigger_phrases:\\\\n  - \\\"/);\\n.opencode/skills/system-spec-kit/scripts/tests/memory-render-fixture.vitest.ts:247:      expect(frontmatter).not.toContain('session summary');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-render-fixture.vitest.ts:288:          userPrompts: [{ prompt: 'Development session', timestamp: '2026-03-06T09:25:00Z' }],\\n.opencode/skills/system-spec-kit/scripts/tests/memory-render-fixture.vitest.ts:293:              facts: ['Tool: Read File: scripts/core/workflow.ts Result: development session'],\\n.opencode/skills/system-spec-kit/scripts/tests/memory-render-fixture.vitest.ts:301:            TITLE: 'Development session',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-render-fixture.vitest.ts:315:      expect(result.contextFilename).not.toContain('development-session');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-render-fixture.vitest.ts:320:      expect(heading).not.toMatch(/development session|to promote a memory|constitutional tier|always surfaced/i);\\n.opencode/skills/system-spec-kit/scripts/tests/memory-render-fixture.vitest.ts:321:      expect(frontmatterTitle).not.toMatch(/development session|to promote a memory|constitutional tier|always surfaced/i);\\n.opencode/skills/system-spec-kit/scripts/tests/memory-render-fixture.vitest.ts:331:  it('renders session-source provenance and split file counts into frontmatter', async () => {\\n.opencode/skills/system-spec-kit/scripts/tests/memory-render-fixture.vitest.ts:338:      const specFolderPath = path.join(tempRoot, '011-session-source-validation');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-render-fixture.vitest.ts:355:          userPrompts: [{ prompt: 'Validate session source provenance', timestamp: '2026-03-16T12:00:00Z' }],\\n.opencode/skills/system-spec-kit/scripts/tests/memory-render-fixture.vitest.ts:358:          specFolderName || '011-session-source-validation',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-render-fixture.vitest.ts:360:            SOURCE_TRANSCRIPT_PATH: '/tmp/.claude/projects/spec-kit/session-xyz.jsonl',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-render-fixture.vitest.ts:361:            SOURCE_SESSION_ID: 'session-xyz',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-render-fixture.vitest.ts:376:      expect(frontmatter).toContain('_sourceTranscriptPath: \\\"/tmp/.claude/projects/spec-kit/session-xyz.jsonl\\\"');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-render-fixture.vitest.ts:377:      expect(frontmatter).toContain('_sourceSessionId: \\\"session-xyz\\\"');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-render-fixture.vitest.ts:390:  it('renders an empty trigger list when no trigger phrases are provided', async () => {\\n.opencode/skills/system-spec-kit/scripts/tests/memory-render-fixture.vitest.ts:402:        TRIGGER_PHRASES_YAML: 'trigger_phrases: []',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-render-fixture.vitest.ts:433:      expect(frontmatter).toContain('trigger_phrases: []');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-render-fixture.vitest.ts:435:      expect(frontmatter.match(/trigger_phrases:/g)?.length ?? 0).toBe(1);\\n.opencode/skills/system-spec-kit/scripts/tests/memory-render-fixture.vitest.ts:437:      expect(rendered).not.toContain('session summary');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-render-fixture.vitest.ts:480:                'Tool: read File: scripts/extractors/collect-session-data.ts Result: inspected quick summary derivation',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-render-fixture.vitest.ts:483:              files: ['scripts/extractors/collect-session-data.ts', 'scripts/tests/memory-render-fixture.vitest.ts'],\\n.opencode/skills/system-spec-kit/scripts/tests/memory-render-fixture.vitest.ts:508:  it.skip('escapes literal anchor examples from captured session text without breaking real anchors', async () => {\\n.opencode/skills/system-spec-kit/scripts/tests/memory-render-fixture.vitest.ts:515:      const specFolderPath = path.join(tempRoot, '010-perfect-session-capturing');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-render-fixture.vitest.ts:541:              narrative: 'Verified that literal anchor examples from the session render as escaped text instead of malformed real anchors.',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-render-fixture.vitest.ts:548:        collectSessionDataFn: async (_input, specFolderName) => createSessionData(specFolderName || '010-perfect-session-capturing'),\\n.opencode/skills/system-spec-kit/scripts/tests/memory-render-fixture.vitest.ts:656:  it('renders git provenance metadata into the session summary table and YAML block (M-007d)', async () => {\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-validation/no-children/plan.md:4:trigger_phrases:\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:5:// Schema migration for the learned_triggers column.\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:7:// ALTER TABLE memory_index ADD COLUMN learned_triggers TEXT DEFAULT '[]';\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:13:// Rollback: ALTER TABLE memory_index DROP COLUMN learned_triggers;\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:22: * A single learned trigger entry stored in the learned_triggers JSON array.\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:39:/** Column name for learned triggers (NOT in FTS5 index) */\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:40:export const LEARNED_TRIGGERS_COLUMN = 'learned_triggers';\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:42:/** Default value for the learned_triggers column */\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:50: * Add the learned_triggers column to memory_index if it does not already exist.\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:53: * CRITICAL: This column is stored on memory_index only. It is NOT added to\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:55: *   title, trigger_phrases, file_path, content_text\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:56: * learned_triggers is deliberately excluded to keep user-generated content\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:65:    const columns = db.prepare('PRAGMA table_info(memory_index)').all() as Array<{ name: string }>;\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:73:      `ALTER TABLE memory_index ADD COLUMN ${LEARNED_TRIGGERS_COLUMN} TEXT DEFAULT '${LEARNED_TRIGGERS_DEFAULT}'`\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:76:    console.warn('[learned-triggers-schema] Migration complete: learned_triggers column added');\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:80:    // SQLite may report \\\"duplicate column name\\\" if run concurrently\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:81:    if (msg.includes('duplicate column')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:84:    console.error(`[learned-triggers-schema] Migration failed: ${msg}`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:94: * CRITICAL test: Verify that learned_triggers is NOT present in the\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:99: *   title, trigger_phrases, file_path, content_text\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:101: * If learned_triggers appears in FTS5, it means user-generated feedback\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:105: * @returns true if isolation is verified (learned_triggers NOT in FTS5)\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:106: * @throws Error if learned_triggers IS found in FTS5 (critical violation)\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:112:      `SELECT sql FROM sqlite_master WHERE type='table' AND name='memory_fts'`\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:122:    // Check that learned_triggers does NOT appear in the FTS5 CREATE statement\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:123:    if (createSql.includes('learned_triggers')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:125:        'CRITICAL: learned_triggers found in FTS5 index (memory_fts). ' +\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:126:        'This violates data isolation requirements. Learned triggers must ' +\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:127:        'ONLY exist in the memory_index.learned_triggers column, never in FTS5.'\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:137:    console.error(`[learned-triggers-schema] FTS5 isolation check failed: ${msg}`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:147: * Drop the learned_triggers column from memory_index.\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:156:    const columns = db.prepare('PRAGMA table_info(memory_index)').all() as Array<{ name: string }>;\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:163:    db.exec(`ALTER TABLE memory_index DROP COLUMN ${LEARNED_TRIGGERS_COLUMN}`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:164:    console.warn('[learned-triggers-schema] Rollback complete: learned_triggers column removed');\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:168:    console.error(`[learned-triggers-schema] Rollback failed: ${msg}`);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:178: * Parse the learned_triggers JSON column value into typed entries.\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:181: * @returns Parsed array of learned trigger entries\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:203: * Serialize learned trigger entries to JSON for storage.\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/learned-triggers-schema.ts:205: * @param entries - Array of learned trigger entries\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase1.vitest.ts:11:const COLLECT_SESSION_DATA_PATH = path.join(TEST_DIR, '..', 'extractors', 'collect-session-data.ts');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase1.vitest.ts:16:  sessionSummary: string;\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase1.vitest.ts:26:    const result = truncateOnWordBoundary(fixture.sessionSummary, 500);\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase1.vitest.ts:28:    const nextChar = fixture.sessionSummary.charAt(keptText.length);\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase1.vitest.ts:31:    expect(fixture.sessionSummary.length).toBeGreaterThan(600);\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase1.vitest.ts:34:    expect(fixture.sessionSummary.startsWith(keptText)).toBe(true);\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase1.vitest.ts:36:    expect(collectSessionDataSource).toContain('truncateOnWordBoundary(data.sessionSummary, 500)');\\n.opencode/skills/system-spec-kit/scripts/tests/generate-context-cli-authority.vitest.ts:21:vi.mock('../extractors/collect-session-data', () => ({\\n.opencode/skills/system-spec-kit/scripts/tests/generate-context-cli-authority.vitest.ts:40:describe('generate-context CLI authority', () => {\\n.opencode/skills/system-spec-kit/scripts/tests/generate-context-cli-authority.vitest.ts:58:    process.argv = ['node', path.join('scripts', 'dist', 'memory', 'generate-context.js'), dataFile, explicitSpecFolder];\\n.opencode/skills/system-spec-kit/scripts/tests/generate-context-cli-authority.vitest.ts:60:    const { main } = await import('../memory/generate-context');\\n.opencode/skills/system-spec-kit/scripts/tests/generate-context-cli-authority.vitest.ts:76:  it('forwards explicit --session-id to workflow', async () => {\\n.opencode/skills/system-spec-kit/scripts/tests/generate-context-cli-authority.vitest.ts:79:    const sessionId = 'test-session-123';\\n.opencode/skills/system-spec-kit/scripts/tests/generate-context-cli-authority.vitest.ts:82:      path.join('scripts', 'dist', 'memory', 'generate-context.js'),\\n.opencode/skills/system-spec-kit/scripts/tests/generate-context-cli-authority.vitest.ts:83:      '--session-id',\\n.opencode/skills/system-spec-kit/scripts/tests/generate-context-cli-authority.vitest.ts:84:      sessionId,\\n.opencode/skills/system-spec-kit/scripts/tests/generate-context-cli-authority.vitest.ts:89:    const { main } = await import('../memory/generate-context');\\n.opencode/skills/system-spec-kit/scripts/tests/generate-context-cli-authority.vitest.ts:97:      sessionId,\\n.opencode/skills/system-spec-kit/scripts/tests/generate-context-cli-authority.vitest.ts:111:      sessionSummary: 'Structured stdin payload should not override an explicit CLI target.',\\n.opencode/skills/system-spec-kit/scripts/tests/generate-context-cli-authority.vitest.ts:114:    const { main } = await import('../memory/generate-context');\\n.opencode/skills/system-spec-kit/scripts/tests/generate-context-cli-authority.vitest.ts:123:        sessionSummary: 'Structured stdin payload should not override an explicit CLI target.',\\n.opencode/skills/system-spec-kit/scripts/tests/generate-context-cli-authority.vitest.ts:137:      sessionSummary: 'Inline JSON should resolve its own spec folder when no override exists.',\\n.opencode/skills/system-spec-kit/scripts/tests/generate-context-cli-authority.vitest.ts:140:    const { main } = await import('../memory/generate-context');\\n.opencode/skills/system-spec-kit/scripts/tests/generate-context-cli-authority.vitest.ts:149:        sessionSummary: 'Inline JSON should resolve its own spec folder when no override exists.',\\n.opencode/skills/system-spec-kit/scripts/tests/generate-context-cli-authority.vitest.ts:163:      sessionSummary: 'Equivalent structured payloads should resolve identically across stdin and inline JSON modes.',\\n.opencode/skills/system-spec-kit/scripts/tests/generate-context-cli-authority.vitest.ts:164:      triggerPhrases: ['structured parity', 'stdin json parity'],\\n.opencode/skills/system-spec-kit/scripts/tests/generate-context-cli-authority.vitest.ts:167:    const { main } = await import('../memory/generate-context');\\n.opencode/skills/system-spec-kit/scripts/tests/generate-context-cli-authority.vitest.ts:182:        sessionSummary: 'Equivalent structured payloads should resolve identically across stdin and inline JSON modes.',\\n.opencode/skills/system-spec-kit/scripts/tests/generate-context-cli-authority.vitest.ts:191:        sessionSummary: 'Equivalent structured payloads should resolve identically across stdin and inline JSON modes.',\\n.opencode/skills/system-spec-kit/scripts/tests/generate-context-cli-authority.vitest.ts:203:    const { main } = await import('../memory/generate-context');\\n.opencode/skills/system-spec-kit/scripts/tests/generate-context-cli-authority.vitest.ts:219:    const { main } = await import('../memory/generate-context');\\n.opencode/skills/system-spec-kit/scripts/tests/generate-context-cli-authority.vitest.ts:231:      sessionSummary: 'Missing target should fail before workflow execution.',\\n.opencode/skills/system-spec-kit/scripts/tests/generate-context-cli-authority.vitest.ts:234:    const { main } = await import('../memory/generate-context');\\n.opencode/skills/system-spec-kit/scripts/tests/generate-context-cli-authority.vitest.ts:246:      sessionSummary: 'Invalid target should fail validation before workflow execution.',\\n.opencode/skills/system-spec-kit/scripts/tests/generate-context-cli-authority.vitest.ts:249:    const { main } = await import('../memory/generate-context');\\n.opencode/skills/system-spec-kit/scripts/tests/generate-context-cli-authority.vitest.ts:264:      await import('../memory/generate-context');\\n.opencode/skills/system-spec-kit/scripts/tests/trigger-phrase-sanitizer.vitest.ts:6:} from '../lib/trigger-phrase-sanitizer';\\n.opencode/skills/system-spec-kit/scripts/tests/trigger-phrase-sanitizer.vitest.ts:8:describe('trigger-phrase sanitizer', () => {\\n.opencode/skills/system-spec-kit/scripts/tests/trigger-phrase-sanitizer.vitest.ts:32:    expect(sanitizeTriggerPhrase('session for')).toEqual({ keep: false, reason: 'synthetic_bigram' });\\n.opencode/skills/system-spec-kit/scripts/tests/trigger-phrase-sanitizer.vitest.ts:44:  it('deduplicates and preserves only kept phrases in wrapper output', () => {\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr9.test.ts:9:import type { CollectedDataFull } from '../extractors/collect-session-data';\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr9.test.ts:78:    sessionSummary: 'Healthy reviewer contract baseline for PR-9.',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr9.test.ts:90:  triggerPhrases?: string[];\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr9.test.ts:102:  const triggerPhrases = options.triggerPhrases ?? [\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr9.test.ts:115:    'trigger_phrases:',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr9.test.ts:116:    ...triggerPhrases.map((phrase) => `  - \\\"${phrase}\\\"`),\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr9.test.ts:144:    'session_id: \\\"phase4-pr9-inline\\\"',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr9.test.ts:152:    'causal_links:',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr9.test.ts:237:  it('triggers CHECK-D1 HIGH on the broken truncation fixture and emits M1 + M8', async () => {\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr9.test.ts:247:  it('triggers CHECK-D2 HIGH on placeholder contamination and emits M2 + M8', async () => {\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr9.test.ts:257:        sessionSummary: 'Placeholder contamination should be caught.',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr9.test.ts:269:  it('triggers CHECK-D3 MEDIUM on unsanitized trigger phrases and emits M3 + M8', async () => {\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr9.test.ts:271:      triggerPhrases: ['and', 'with phases', 'specs/026-graph-and-context-optimization'],\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr9.test.ts:278:        sessionSummary: 'Unsanitized trigger phrases should be caught.',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr9.test.ts:289:  it('triggers CHECK-D4 HIGH on the broken tier-drift fixture and emits M4 + M8', async () => {\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr9.test.ts:299:  it('triggers CHECK-D5 MEDIUM on continuation titles without supersedes and emits M5 + M8', async () => {\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr9.test.ts:309:        sessionSummary: 'Continuation saves should carry supersedes lineage.',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr9.test.ts:320:  it('triggers CHECK-D6 MEDIUM on duplicate trigger phrases and emits M8', async () => {\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr9.test.ts:322:      triggerPhrases: ['phase 4 reviewer fixture', 'phase 4 reviewer fixture'],\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr9.test.ts:329:        sessionSummary: 'Duplicate trigger phrases should be caught.',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr9.test.ts:339:  it('triggers CHECK-D7 HIGH on the broken provenance fixture and emits M6 + M8', async () => {\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr9.test.ts:349:  it('triggers CHECK-D8 MEDIUM on the broken anchor fixture and emits M7 + M8', async () => {\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr9.test.ts:365:    expect(events.some((event) => event.message === 'memory_save_review_violation')).toBe(false);\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr9.test.ts:381:        sessionSummary: 'This broken overview proves the reviewer catches truncation when the rendered text still ends mid token and falls back to the old ASCII ellipsis shape instead of the boundary safe contract that Phase 1 pinned down for JSON mode saves.',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr9.test.ts:403:        sessionSummary: 'Composite blocker should reject one HIGH plus two MEDIUM findings.',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr9.test.ts:442:        sessionSummary: 'Healthy reviewer contract baseline for PR-9.',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr9.test.ts:443:        triggerPhrases: ['phase 4 reviewer fixture', 'memory telemetry contract'],\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr9.test.ts:465:    expect(events.some((event) => event.message === 'memory_save_started')).toBe(true);\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr9.test.ts:466:    expect(events.some((event) => event.message === 'memory_save_review_completed')).toBe(true);\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr9.test.ts:468:    expect(stdout).not.toContain('\\\"message\\\":\\\"memory_save_started\\\"');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr9.test.ts:469:    expect(stdout).not.toContain('\\\"message\\\":\\\"memory_save_review_completed\\\"');\\n.opencode/skills/system-spec-kit/scripts/tests/test-naming-migration.js:70:  ['mcp_server/lib/search/causal-boost.ts', 1],\\n.opencode/skills/system-spec-kit/scripts/tests/test-naming-migration.js:79:  ['mcp_server/lib/session/session-manager.ts', 1],\\n.opencode/skills/system-spec-kit/scripts/tests/test-naming-migration.js:154:    msg.includes('sqlite') ||\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase2-pr3.test.ts:10:import { collectSessionData } from '../extractors/collect-session-data';\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase2-pr3.test.ts:22:  sessionSummary: string;\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase2-pr3.test.ts:26:  triggerPhrases?: string[];\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase2-pr3.test.ts:49:    'trigger_phrases:',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase2-pr3.test.ts:64:    'session_id: \\\"phase2-pr3-test\\\"',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase2-pr3.test.ts:112:        sessionSummary: 'Importance-tier drift should be detected after save.',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase2-pr3.test.ts:149:        sessionSummary: 'Matching tiers with inline comments should still pass.',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase2-pr3.test.ts:160:    const sessionData = await collectSessionData(normalized as never, fixture.specFolder);\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase2-pr3.test.ts:161:    const input = buildMemoryWithTierDrift('normal', sessionData.IMPORTANCE_TIER, sessionData.CONTEXT_TYPE);\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase2-pr3.test.ts:168:    expect(extractFrontmatterImportanceTier(result.content)).toBe(sessionData.IMPORTANCE_TIER);\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase2-pr3.test.ts:169:    expect(extractMetadataImportanceTier(result.content)).toBe(sessionData.IMPORTANCE_TIER);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/mutation-ledger.ts:6:// SQLite triggers enforce immutability (no UPDATE/DELETE on ledger)\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/mutation-ledger.ts:8:import type Database from 'better-sqlite3';\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/mutation-ledger.ts:27:  session_id: string | null;\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/mutation-ledger.ts:38:  session_id?: string | null;\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/mutation-ledger.ts:44:  session_id?: string;\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/mutation-ledger.ts:74:  session_id?: string | null;\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/mutation-ledger.ts:90:  CREATE TABLE IF NOT EXISTS mutation_ledger (\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/mutation-ledger.ts:100:    session_id TEXT\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/mutation-ledger.ts:108:  CREATE INDEX IF NOT EXISTS idx_ledger_session ON mutation_ledger(session_id);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/mutation-ledger.ts:150:    INSERT INTO mutation_ledger (mutation_type, reason, prior_hash, new_hash, linked_memory_ids, decision_meta, actor, session_id)\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/mutation-ledger.ts:162:    entry.session_id ?? null\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/mutation-ledger.ts:187:  if (opts.session_id) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/mutation-ledger.ts:188:    conditions.push('session_id = ?');\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/mutation-ledger.ts:189:    params.push(opts.session_id);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/mutation-ledger.ts:241: * Verify that append-only triggers exist on the mutation_ledger table.\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/mutation-ledger.ts:242: * Returns true if both UPDATE and DELETE triggers are present.\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/mutation-ledger.ts:245:  const triggers = db.prepare(\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/mutation-ledger.ts:246:    \\\"SELECT name FROM sqlite_master WHERE type = 'trigger' AND tbl_name = 'mutation_ledger'\\\"\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/mutation-ledger.ts:249:  const names = triggers.map(t => t.name);\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/mutation-ledger.ts:395:        session_id: input.session_id ?? null,\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/mutation-ledger.ts:431:      session_id: input.session_id ?? null,\\n.opencode/skills/system-spec-kit/scripts/spec-folder/alignment-validator.ts:8:// Validates conversation-to-spec-folder alignment using topic and keyword matching\\n.opencode/skills/system-spec-kit/scripts/spec-folder/alignment-validator.ts:16:import type { CollectedDataSubset } from '../types/session-types';\\n.opencode/skills/system-spec-kit/scripts/spec-folder/alignment-validator.ts:48:/** Alignment-focused subset of collected session data. */\\n.opencode/skills/system-spec-kit/scripts/spec-folder/alignment-validator.ts:315:  const topics = new Set<string>();\\n.opencode/skills/system-spec-kit/scripts/spec-folder/alignment-validator.ts:320:    words.forEach((w) => topics.add(w.toLowerCase()));\\n.opencode/skills/system-spec-kit/scripts/spec-folder/alignment-validator.ts:327:        words.forEach((w) => topics.add(w.toLowerCase()));\\n.opencode/skills/system-spec-kit/scripts/spec-folder/alignment-validator.ts:332:  return Array.from(topics).filter((t) =>\\n.opencode/skills/system-spec-kit/scripts/spec-folder/alignment-validator.ts:457:  // Accept full relative paths (with / separators) and extract topics from ALL segments\\n.opencode/skills/system-spec-kit/scripts/spec-folder/alignment-validator.ts:462:    const topic = segment.replace(/^\\\\d+-/, '');\\n.opencode/skills/system-spec-kit/scripts/spec-folder/alignment-validator.ts:463:    const words = topic.split(/[-_]/).filter((w) => w.length > 0);\\n.opencode/skills/system-spec-kit/scripts/spec-folder/alignment-validator.ts:477:    const topicRegex = new RegExp(`\\\\\\\\b${escapeRegExp(specTopic)}\\\\\\\\b`, 'i');\\n.opencode/skills/system-spec-kit/scripts/spec-folder/alignment-validator.ts:479:      topicRegex.test(ct) || new RegExp(`\\\\\\\\b${escapeRegExp(ct)}\\\\\\\\b`, 'i').test(specTopic)\\n.opencode/skills/system-spec-kit/scripts/spec-folder/alignment-validator.ts:535:  console.log(`   Conversation topics: ${combinedTopics.slice(0, 5).join(', ')}`);\\n.opencode/skills/system-spec-kit/scripts/tests/README.md:4:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/README.md:69:  - `collect-session-data.vitest.ts`\\n.opencode/skills/system-spec-kit/scripts/tests/README.md:70:  - `generate-context-cli-authority.vitest.ts`\\n.opencode/skills/system-spec-kit/scripts/tests/README.md:84:  - `session-enrichment.vitest.ts`\\n.opencode/skills/system-spec-kit/scripts/tests/README.md:101:  - `trigger-phrase-filter.vitest.ts`\\n.opencode/skills/system-spec-kit/scripts/tests/README.md:168:- Direct CLI authority coverage for explicit spec-folder saves through the real `generate-context -> runWorkflow` seam.\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-validation/no-children/tasks.md:4:trigger_phrases:\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/transaction-manager.ts:6:import type Database from 'better-sqlite3';\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/transaction-manager.ts:48: * Return `true` when the original path already has a committed `memory_index` row.\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/transaction-manager.ts:258:    // The dbOperation callback runs synchronously (better-sqlite3 transaction). If it\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/transaction-manager.ts:261:    // Can report which step failed. No SAVEPOINT is used — better-sqlite3 transactions\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/transaction-manager.ts:282:    // This state and trigger recovery (e.g., re-index from DB or replay the write).\\n.opencode/skills/system-spec-kit/scripts/tests/trigger-phrase-sanitizer-manual-preservation.vitest.ts:6:} from '../lib/trigger-phrase-sanitizer';\\n.opencode/skills/system-spec-kit/scripts/tests/trigger-phrase-sanitizer-manual-preservation.vitest.ts:8:describe('manual trigger phrase preservation', () => {\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase3-pr6.vitest.ts:14:  sessionSummary?: string;\\n.opencode/skills/system-spec-kit/scripts/tests/test-bug-fixes.js:82:      path.join(ROOT, 'scripts', 'dist', 'memory', 'generate-context.js'),\\n.opencode/skills/system-spec-kit/scripts/tests/test-bug-fixes.js:172:    // Test 2: better-sqlite3 wrapper replaces manual BEGIN/COMMIT/ROLLBACK control.\\n.opencode/skills/system-spec-kit/scripts/tests/test-bug-fixes.js:177:           'Mutation layer relies on better-sqlite3 transaction wrappers instead of manual BEGIN/COMMIT control');\\n.opencode/skills/system-spec-kit/scripts/tests/test-bug-fixes.js:270:    if (dbState.includes('CREATE TABLE IF NOT EXISTS config') || \\n.opencode/skills/system-spec-kit/scripts/tests/canonical-sources-auto-discovery.vitest.ts:8:import { detectRelatedDocs } from '../extractors/session-extractor';\\n.opencode/skills/system-spec-kit/scripts/tests/canonical-sources-auto-discovery.vitest.ts:9:import { deriveCanonicalDocPointers } from '../extractors/collect-session-data';\\n.opencode/skills/system-spec-kit/scripts/tests/test-phase-validation.js:369:      '--topic',\\n.opencode/skills/system-spec-kit/scripts/tests/test-phase-validation.js:394:      '--topic',\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/history.ts:6:import type Database from 'better-sqlite3';\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/history.ts:82:    CREATE TABLE IF NOT EXISTS memory_history (\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/history.ts:99:    \\\"SELECT sql FROM sqlite_master WHERE type='table' AND name='memory_history'\\\"\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/history.ts:102:    const hasMemoryIndexTable = hasTable(database, 'memory_index');\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/history.ts:105:      CREATE TABLE memory_history (\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/history.ts:123:        LEFT JOIN memory_index m ON m.id = h.memory_id;\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/history.ts:140:  if (hasTable(database, 'memory_index')) {\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/history.ts:144:        SELECT m.spec_folder FROM memory_index m WHERE m.id = memory_history.memory_id\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/history.ts:147:        AND EXISTS (SELECT 1 FROM memory_index m WHERE m.id = memory_history.memory_id)\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/history.ts:161:    'SELECT spec_folder FROM memory_index WHERE id = ? LIMIT 1'\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/history.ts:176:    \\\"SELECT 1 as present FROM sqlite_master WHERE type='table' AND name = ? LIMIT 1\\\"\\n.opencode/skills/system-spec-kit/mcp_server/lib/storage/history.ts:421:             SELECT 1 FROM memory_index m\\n.opencode/skills/system-spec-kit/scripts/tests/test-validation-system.js:716:    // Test duplicate anchor IDs (both closed)\\n.opencode/skills/system-spec-kit/scripts/tests/test-validation-system.js:717:    const duplicateAnchors = `# Memory File\\n.opencode/skills/system-spec-kit/scripts/tests/test-validation-system.js:732:    while (openPattern.exec(duplicateAnchors) !== null) {\\n.opencode/skills/system-spec-kit/scripts/tests/test-validation-system.js:735:    while (closePattern.exec(duplicateAnchors) !== null) {\\n.opencode/skills/system-spec-kit/scripts/tests/post-save-render-round-trip.vitest.ts:33:  const startIndex = lines.findIndex((line) => line.trim() === 'trigger_phrases:');\\n.opencode/skills/system-spec-kit/scripts/tests/post-save-render-round-trip.vitest.ts:83:      sessionSummary: 'Implemented the render-layer fixes for canonical sources, trigger phrases, evidence bullets, phase capture, and score naming.',\\n.opencode/skills/system-spec-kit/scripts/tests/post-save-render-round-trip.vitest.ts:84:      triggerPhrases: ['canonical sources', 'render quality', 'memory save'],\\n.opencode/skills/system-spec-kit/scripts/tests/post-save-render-round-trip.vitest.ts:87:          decision: 'Use authored trigger phrases as the canonical trigger surface.',\\n.opencode/skills/system-spec-kit/scripts/tests/post-save-render-round-trip.vitest.ts:92:        'scripts/core/workflow.ts:1260 manual trigger phrases now outrank prose bigrams.',\\n.opencode/skills/system-spec-kit/scripts/tests/post-save-render-round-trip.vitest.ts:93:        'scripts/extractors/collect-session-data.ts:1176 canonical docs now render as relative links.',\\n.opencode/skills/system-spec-kit/scripts/tests/post-save-render-round-trip.vitest.ts:94:        'scripts/extractors/collect-session-data.ts:1176 canonical docs now render as relative links.',\\n.opencode/skills/system-spec-kit/scripts/tests/post-save-render-round-trip.vitest.ts:97:        { path: 'scripts/core/workflow.ts', description: 'Fixed trigger and metadata render bindings.' },\\n.opencode/skills/system-spec-kit/scripts/tests/post-save-render-round-trip.vitest.ts:98:        { path: 'scripts/extractors/collect-session-data.ts', description: 'Fixed canonical discovery and counts.' },\\n.opencode/skills/system-spec-kit/scripts/tests/post-save-render-round-trip.vitest.ts:110:    const { main } = await import('../memory/generate-context');\\n.opencode/skills/system-spec-kit/scripts/tests/post-save-render-round-trip.vitest.ts:129:    expect(evidence).toContain('scripts/extractors/collect-session-data.ts:1176');\\n.opencode/skills/system-spec-kit/scripts/tests/post-save-render-round-trip.vitest.ts:130:    expect((evidence.match(/scripts\\\\/extractors\\\\/collect-session-data\\\\.ts:1176/g) ?? []).length).toBe(1);\\n.opencode/skills/system-spec-kit/scripts/types/session-types.ts:17:/** Captures a file change discovered in session data. */\\n.opencode/skills/system-spec-kit/scripts/types/session-types.ts:50: * JSON-parsed session data whose shape is not fully controlled at compile time.\\n.opencode/skills/system-spec-kit/scripts/types/session-types.ts:74:/** Raw user prompt metadata consumed by the session pipeline. */\\n.opencode/skills/system-spec-kit/scripts/types/session-types.ts:80:/** Recent context entry used for session summarization. */\\n.opencode/skills/system-spec-kit/scripts/types/session-types.ts:109:/** Summary of a tool call made during the session (JSON-mode enrichment). */\\n.opencode/skills/system-spec-kit/scripts/types/session-types.ts:118:/** Summary of a user-assistant exchange during the session (JSON-mode enrichment). */\\n.opencode/skills/system-spec-kit/scripts/types/session-types.ts:151:  sessionSummary?: string;\\n.opencode/skills/system-spec-kit/scripts/types/session-types.ts:159:  _sessionId?: string;\\n.opencode/skills/system-spec-kit/scripts/types/session-types.ts:167:  // Fields surfaced during O3-6 index signature removal (captured-session enrichment + capture pipeline)\\n.opencode/skills/system-spec-kit/scripts/types/session-types.ts:176:  // Fields accessed by workflow.ts read helpers for memory classification, dedup, and causal links\\n.opencode/skills/system-spec-kit/scripts/types/session-types.ts:177:  // (AI-composed JSON data from generate-context.js input)\\n.opencode/skills/system-spec-kit/scripts/types/session-types.ts:184:  /** Snake-case variant for raw JSON compatibility. Prefer sessionDedup (camelCase) in new code. */\\n.opencode/skills/system-spec-kit/scripts/types/session-types.ts:185:  session_dedup?: Record<string, unknown>;\\n.opencode/skills/system-spec-kit/scripts/types/session-types.ts:186:  sessionDedup?: Record<string, unknown>;\\n.opencode/skills/system-spec-kit/scripts/types/session-types.ts:187:  /** Snake-case variant for raw JSON compatibility. Prefer causalLinks (camelCase) in new code. */\\n.opencode/skills/system-spec-kit/scripts/types/session-types.ts:188:  causal_links?: Record<string, unknown>;\\n.opencode/skills/system-spec-kit/scripts/types/session-types.ts:189:  causalLinks?: Record<string, unknown>;\\n.opencode/skills/system-spec-kit/scripts/types/session-types.ts:216:/** Counts tool usage by category within a session.\\n.opencode/skills/system-spec-kit/scripts/types/session-types.ts:218: * in `countToolsByType()` (session-extractor.ts) via `counts[tool]++`.\\n.opencode/skills/system-spec-kit/scripts/types/session-types.ts:234:/** File entry metadata consumed by session state helpers. */\\n.opencode/skills/system-spec-kit/scripts/types/session-types.ts:241:/** Spec file entry metadata consumed by the session pipeline. */\\n.opencode/skills/system-spec-kit/scripts/types/session-types.ts:259:/** Represents a pending task extracted from session context. */\\n.opencode/skills/system-spec-kit/scripts/types/session-types.ts:266:/** Represents a context item included in continue-session payloads. */\\n.opencode/skills/system-spec-kit/scripts/types/session-types.ts:301:  | 'missing_trigger_phrases'\\n.opencode/skills/system-spec-kit/scripts/types/session-types.ts:302:  | 'missing_key_topics'\\n.opencode/skills/system-spec-kit/scripts/types/session-types.ts:307:  | 'duplicate_observations'\\n.opencode/skills/system-spec-kit/scripts/types/session-types.ts:312:  | 'has_session_source_mismatch'\\n.opencode/skills/system-spec-kit/scripts/types/session-types.ts:318:  | 'has_topical_mismatch';\\n.opencode/skills/system-spec-kit/scripts/types/session-types.ts:347:    triggerPhrases: number;\\n.opencode/skills/system-spec-kit/scripts/types/session-types.ts:573:  /** RC1: Raw sessionSummary from JSON payload, used as preferred title candidate */\\n.opencode/skills/system-spec-kit/scripts/tests/memory-save-d5-continuation-and-causal-links.vitest.ts:68:describe('D5 continuation and causal links', () => {\\n.opencode/skills/system-spec-kit/scripts/tests/memory-save-d5-continuation-and-causal-links.vitest.ts:69:  it('passes explicit causalLinks.supersedes through the save path and avoids D5 warnings', async () => {\\n.opencode/skills/system-spec-kit/scripts/tests/memory-save-d5-continuation-and-causal-links.vitest.ts:92:          sessionSummary: 'Continuation verification for explicit causal links.',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-save-d5-continuation-and-causal-links.vitest.ts:97:          causalLinks: { supersedes: ['explicit-predecessor-session'] },\\n.opencode/skills/system-spec-kit/scripts/tests/memory-save-d5-continuation-and-causal-links.vitest.ts:98:          triggerPhrases: ['explicit lineage verification'],\\n.opencode/skills/system-spec-kit/scripts/tests/memory-save-d5-continuation-and-causal-links.vitest.ts:104:      expect(rendered).toContain('\\\"explicit-predecessor-session\\\"');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-save-d5-continuation-and-causal-links.vitest.ts:113:          sessionSummary: 'Continuation verification for explicit causal links.',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-save-d5-continuation-and-causal-links.vitest.ts:116:          causalLinks: { supersedes: ['explicit-predecessor-session'] },\\n.opencode/skills/system-spec-kit/scripts/tests/memory-save-d5-continuation-and-causal-links.vitest.ts:135:      sessionId: 'hit-current-3',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-save-d5-continuation-and-causal-links.vitest.ts:147:      title: 'Implementation session',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-save-d5-continuation-and-causal-links.vitest.ts:150:      sessionId: 'hit-current-4',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-save-d5-continuation-and-causal-links.vitest.ts:151:      filename: '06-04-26_13-30__implementation-session.md',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-save-d5-continuation-and-causal-links.vitest.ts:162:title: Regular implementation session\\n.opencode/skills/system-spec-kit/scripts/tests/memory-save-d5-continuation-and-causal-links.vitest.ts:166:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/memory-save-d5-continuation-and-causal-links.vitest.ts:170:# Regular implementation session\\n.opencode/skills/system-spec-kit/scripts/tests/memory-save-d5-continuation-and-causal-links.vitest.ts:186:        sessionSummary: 'Regular implementation summary with no lineage signal.',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-save-d5-continuation-and-causal-links.vitest.ts:216:          sessionSummary: 'Continuation request with two equally recent predecessors.',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-save-d5-continuation-and-causal-links.vitest.ts:220:          triggerPhrases: ['continuation deep research'],\\n.opencode/skills/system-spec-kit/scripts/tests/memory-save-d5-continuation-and-causal-links.vitest.ts:232:          sessionSummary: 'Continuation request with two equally recent predecessors.',\\n.opencode/skills/system-spec-kit/scripts/tests/input-normalizer-unit.vitest.ts:12:    sessionSummary: 'Test session',\\n.opencode/skills/system-spec-kit/scripts/tests/input-normalizer-unit.vitest.ts:28:    expect(files[0].DESCRIPTION).toBe('Modified during session');\\n.opencode/skills/system-spec-kit/scripts/tests/input-normalizer-unit.vitest.ts:69:    expect(files[0].DESCRIPTION).toBe('Modified during session');\\n.opencode/skills/system-spec-kit/scripts/tests/input-normalizer-unit.vitest.ts:102:    expect(files[0].DESCRIPTION).toBe('Modified during session');\\n.opencode/skills/system-spec-kit/scripts/tests/input-normalizer-unit.vitest.ts:166:      sessionSummary: 'Test',\\n.opencode/skills/system-spec-kit/scripts/tests/input-normalizer-unit.vitest.ts:174:      sessionSummary: 'Test',\\n.opencode/skills/system-spec-kit/scripts/tests/input-normalizer-unit.vitest.ts:192:      sessionSummary: 'Test',\\n.opencode/skills/system-spec-kit/scripts/tests/input-normalizer-unit.vitest.ts:199:  it('preserves explicit title, description, and causalLinks through the slow path', () => {\\n.opencode/skills/system-spec-kit/scripts/tests/input-normalizer-unit.vitest.ts:201:      sessionSummary: 'Slow-path metadata propagation test.',\\n.opencode/skills/system-spec-kit/scripts/tests/input-normalizer-unit.vitest.ts:204:      causalLinks: {\\n.opencode/skills/system-spec-kit/scripts/tests/input-normalizer-unit.vitest.ts:205:        supersedes: ['previous-session'],\\n.opencode/skills/system-spec-kit/scripts/tests/input-normalizer-unit.vitest.ts:206:        derivedFrom: ['planning-session'],\\n.opencode/skills/system-spec-kit/scripts/tests/input-normalizer-unit.vitest.ts:212:    expect(result.causalLinks).toMatchObject({\\n.opencode/skills/system-spec-kit/scripts/tests/input-normalizer-unit.vitest.ts:213:      supersedes: ['previous-session'],\\n.opencode/skills/system-spec-kit/scripts/tests/input-normalizer-unit.vitest.ts:214:      derivedFrom: ['planning-session'],\\n.opencode/skills/system-spec-kit/scripts/tests/input-normalizer-unit.vitest.ts:215:      derived_from: ['planning-session'],\\n.opencode/skills/system-spec-kit/scripts/tests/input-normalizer-unit.vitest.ts:217:    expect(result.causal_links).toMatchObject({\\n.opencode/skills/system-spec-kit/scripts/tests/input-normalizer-unit.vitest.ts:218:      supersedes: ['previous-session'],\\n.opencode/skills/system-spec-kit/scripts/tests/input-normalizer-unit.vitest.ts:219:      derivedFrom: ['planning-session'],\\n.opencode/skills/system-spec-kit/scripts/tests/input-normalizer-unit.vitest.ts:223:  it('preserves explicit title, description, and causal_links through the fast path', () => {\\n.opencode/skills/system-spec-kit/scripts/tests/input-normalizer-unit.vitest.ts:230:      causal_links: {\\n.opencode/skills/system-spec-kit/scripts/tests/input-normalizer-unit.vitest.ts:238:    expect(result.causalLinks).toMatchObject({\\n.opencode/skills/system-spec-kit/scripts/tests/input-normalizer-unit.vitest.ts:243:    expect(result.causal_links).toMatchObject({\\n.opencode/skills/system-spec-kit/scripts/tests/input-normalizer-unit.vitest.ts:253:      user_prompts: ['Capture the session context'],\\n.opencode/skills/system-spec-kit/scripts/tests/input-normalizer-unit.vitest.ts:259:    expect(result.userPrompts[0].prompt).toBe('Capture the session context');\\n.opencode/skills/system-spec-kit/scripts/tests/input-normalizer-unit.vitest.ts:280:      sessionSummary: 'Patched the fast-path normalizer and verified the save flow end to end.',\\n.opencode/skills/system-spec-kit/scripts/tests/input-normalizer-unit.vitest.ts:305:  it('deduplicates duplicate observations in fast-path structured payloads', () => {\\n.opencode/skills/system-spec-kit/scripts/tests/workflow-e2e.vitest.ts:12:import { buildRichSessionData, buildSparseSessionData, buildTreeThinningSessionData } from './fixtures/session-data-factory';\\n.opencode/skills/system-spec-kit/scripts/tests/workflow-e2e.vitest.ts:32:const SPEC_RELATIVE_PATH = 'system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/010-integration-testing';\\n.opencode/skills/system-spec-kit/scripts/tests/workflow-e2e.vitest.ts:80:    description: 'Integration testing coverage for the perfect session capturing save pipeline.',\\n.opencode/skills/system-spec-kit/scripts/tests/workflow-e2e.vitest.ts:114:      'trigger_phrases:',\\n.opencode/skills/system-spec-kit/scripts/tests/workflow-e2e.vitest.ts:115:      '  - \\\"perfect session capturing\\\"',\\n.opencode/skills/system-spec-kit/scripts/tests/workflow-e2e.vitest.ts:153:    session_summary: 'Implemented the integration testing phase with a real workflow save harness and Vitest migration.',\\n.opencode/skills/system-spec-kit/scripts/tests/workflow-e2e.vitest.ts:154:    trigger_phrases: [\\n.opencode/skills/system-spec-kit/scripts/tests/workflow-e2e.vitest.ts:155:      'perfect session capturing',\\n.opencode/skills/system-spec-kit/scripts/tests/workflow-e2e.vitest.ts:166:        prompt: 'Cover duplicate deduplication, insufficiency aborts, index failures, and tree-thinning interaction.',\\n.opencode/skills/system-spec-kit/scripts/tests/workflow-e2e.vitest.ts:190:        request: 'Finish integration testing for perfect session capturing.',\\n.opencode/skills/system-spec-kit/scripts/tests/workflow-e2e.vitest.ts:208:      'Keep deterministic session data collection limited to save-boundary assertions that would otherwise flap.',\\n.opencode/skills/system-spec-kit/scripts/tests/workflow-e2e.vitest.ts:272:  process.env.MEMORY_DB_PATH = path.join(harness.dbDir, 'context-index.sqlite');\\n.opencode/skills/system-spec-kit/scripts/tests/workflow-e2e.vitest.ts:411:    expect(rendered).not.toContain('> **Note:** This session had limited actionable content');\\n.opencode/skills/system-spec-kit/scripts/tests/workflow-e2e.vitest.ts:412:    expect(rendered).not.toContain('<!-- WARNING: This is simulated/placeholder content - NOT from a real session -->');\\n.opencode/skills/system-spec-kit/scripts/tests/workflow-e2e.vitest.ts:444:      session_summary: 'Exercise the write-only indexing disposition for an index-blocking rule.',\\n.opencode/skills/system-spec-kit/scripts/tests/workflow-e2e.vitest.ts:469:  it('skips duplicate markdown content on a second identical save without bumping description tracking', async () => {\\n.opencode/skills/system-spec-kit/scripts/tests/workflow-e2e.vitest.ts:472:    const dataFile = writeInputFile(harness, 'duplicate.json', createExplicitJsonInput());\\n.opencode/skills/system-spec-kit/scripts/tests/workflow-e2e.vitest.ts:474:    const sessionDataFactory = async (_collectedData: unknown, specFolderName?: string | null) => (\\n.opencode/skills/system-spec-kit/scripts/tests/workflow-e2e.vitest.ts:481:      collectSessionDataFn: sessionDataFactory,\\n.opencode/skills/system-spec-kit/scripts/tests/workflow-e2e.vitest.ts:489:      collectSessionDataFn: sessionDataFactory,\\n.opencode/skills/system-spec-kit/scripts/tests/workflow-e2e.vitest.ts:502:  it.skip('creates unique filenames and independent indexing records for same-minute non-duplicate saves', async () => {\\n.opencode/skills/system-spec-kit/scripts/tests/workflow-e2e.vitest.ts:511:      session_summary: 'First same-minute save to verify unique filename generation.',\\n.opencode/skills/system-spec-kit/scripts/tests/workflow-e2e.vitest.ts:524:      session_summary: 'Second same-minute save to verify collision-safe filename generation.',\\n.opencode/skills/system-spec-kit/scripts/tests/workflow-e2e.vitest.ts:567:      session_summary: 'Sparse insufficiency probe for the workflow guard chain.',\\n.opencode/skills/system-spec-kit/scripts/tests/workflow-e2e.vitest.ts:568:      trigger_phrases: ['integration testing', 'sufficiency'],\\n.opencode/skills/system-spec-kit/scripts/tests/workflow-e2e.vitest.ts:624:      trigger_phrases: ['tree thinning', 'workflow integration', 'memory sequence'],\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:7:const Database = require('better-sqlite3');\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:17:// Track sqlite-vec availability (loaded once)\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:18:let sqliteVecAvailable = false;\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:20:let sqliteVecUnavailableReason = '';\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:26:  const sqliteVec = require('sqlite-vec');\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:27:  loadSqliteVec = sqliteVec.load;\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:31:    sqliteVecAvailable = true;\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:33:    sqliteVecUnavailableReason = e instanceof Error ? e.message : String(e);\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:34:    sqliteVecAvailable = false;\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:39:  sqliteVecUnavailableReason = e instanceof Error ? e.message : String(e);\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:40:  sqliteVecAvailable = false;\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:111: * @param {boolean} opts.withVec - Include vec_memories virtual table (default true, requires sqlite-vec)\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:112: * @returns {Database} better-sqlite3 Database instance\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:123:  // Core memory_index table (simplified for tests)\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:125:    CREATE TABLE memory_index (\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:140:      CREATE TABLE memory_history (\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:149:        FOREIGN KEY (memory_id) REFERENCES memory_index(id)\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:154:  // Vec_memories virtual table (requires sqlite-vec extension)\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:155:  if (withVec && sqliteVecAvailable) {\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:168: * Insert a memory record into memory_index.\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:173:    INSERT INTO memory_index (spec_folder, file_path, title)\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:234:    if (content.includes('memory_history') && content.includes('LEFT JOIN memory_index')) {\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:324:    LEFT JOIN memory_index m ON h.memory_id = m.id\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:350:    db.prepare('DELETE FROM memory_index WHERE id = ?').run(memId);\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:382:    db.prepare('DELETE FROM memory_index WHERE id = ?').run(toDeleteId);\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:404:    db.prepare('DELETE FROM memory_index WHERE id = ?').run(toDeleteId);\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:436:  if (!sqliteVecAvailable) {\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:437:    skip('T-COV-003a: Orphaned vector detection (entire section)', `sqlite-vec unavailable: ${sqliteVecUnavailableReason || 'unknown reason'}`);\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:444:    LEFT JOIN memory_index m ON v.rowid = m.id\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:468:    db.prepare('DELETE FROM memory_index WHERE id = ?').run(memId);\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:501:      db.prepare('DELETE FROM memory_index WHERE id = ?').run(memIds[i]);\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:518:    db.prepare('DELETE FROM memory_index WHERE id = ?').run(memId);\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:548:    db.exec('DELETE FROM memory_index');\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:589:    const db = createTestDatabase({ withVec: sqliteVecAvailable });\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:597:    if (sqliteVecAvailable) {\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:603:    const memoryCount = db.prepare('SELECT COUNT(*) as count FROM memory_index').get();\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:604:    assertEqual(memoryCount.count, 2, 'T-COV-004a: memory_index count is correct');\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:609:    if (sqliteVecAvailable) {\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:613:      skip('T-COV-004c: vec_memories count', `sqlite-vec unavailable: ${sqliteVecUnavailableReason || 'unknown reason'}`);\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:623:    const db = createTestDatabase({ withVec: sqliteVecAvailable });\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:635:    if (sqliteVecAvailable) {\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:642:    db.prepare('DELETE FROM memory_index WHERE id = ?').run(toDelete);\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:647:      LEFT JOIN memory_index m ON h.memory_id = m.id\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:656:    if (sqliteVecAvailable) {\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:659:        LEFT JOIN memory_index m ON v.rowid = m.id\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:669:    const finalMemCount = db.prepare('SELECT COUNT(*) as count FROM memory_index').get();\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:670:    assertEqual(finalMemCount.count, 2, 'T-COV-004d: memory_index count after cleanup');\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:675:    if (sqliteVecAvailable) {\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:679:      skip('T-COV-004f: vec_memories count after cleanup', `sqlite-vec unavailable: ${sqliteVecUnavailableReason || 'unknown reason'}`);\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:750:      LEFT JOIN memory_index m ON h.memory_id = m.id\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:760:  // Test 3: Database with only memory_index (no history, no vectors to clean)\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:768:      LEFT JOIN memory_index m ON h.memory_id = m.id\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:784:    db.prepare('DELETE FROM memory_index WHERE id = ?').run(memId);\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:863:    db.prepare(`INSERT INTO memory_index (id, spec_folder, file_path, title) VALUES (?, ?, ?, ?)`).run(\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:869:    db.prepare('DELETE FROM memory_index WHERE id = ?').run(99999);\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:873:      LEFT JOIN memory_index m ON h.memory_id = m.id\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:896:  if (!sqliteVecAvailable) {\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:897:    skip('T-COV-006a: Full cleanup workflow (entire section)', `sqlite-vec unavailable: ${sqliteVecUnavailableReason || 'unknown reason'}`);\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:927:      db.prepare('DELETE FROM memory_index WHERE id = ?').run(id);\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:931:    const preMemCount = db.prepare('SELECT COUNT(*) as count FROM memory_index').get();\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:946:      LEFT JOIN memory_index m ON h.memory_id = m.id\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:967:      LEFT JOIN memory_index m ON v.rowid = m.id\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:992:    const finalMemCount = db.prepare('SELECT COUNT(*) as count FROM memory_index').get();\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:1004:      LEFT JOIN memory_index m ON h.memory_id = m.id WHERE m.id IS NULL\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:1010:      LEFT JOIN memory_index m ON v.rowid = m.id WHERE m.id IS NULL\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:1122:  log(`sqlite-vec available: ${sqliteVecAvailable}`);\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:1123:  if (!sqliteVecAvailable && sqliteVecUnavailableReason) {\\n.opencode/skills/system-spec-kit/scripts/tests/test-cleanup-orphaned-vectors.js:1124:    log(`sqlite-vec unavailable reason: ${sqliteVecUnavailableReason}`);\\n.opencode/skills/system-spec-kit/scripts/renderers/README.md:4:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/renderers/README.md:25:The `renderers/` directory turns extracted session data into markdown output for memory and spec-context documents.\\n.opencode/skills/system-spec-kit/scripts/renderers/template-renderer.ts:8:// Mustache-based template engine — renders memory files from collected session data\\n.opencode/skills/system-spec-kit/scripts/types/README.md:3:description: \\\"Shared session type definitions used across the Spec Kit scripts pipeline.\\\"\\n.opencode/skills/system-spec-kit/scripts/types/README.md:4:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/types/README.md:5:  - \\\"session types\\\"\\n.opencode/skills/system-spec-kit/scripts/types/README.md:7:  - \\\"session data interface\\\"\\n.opencode/skills/system-spec-kit/scripts/types/README.md:12:> Shared session type definitions used across the Spec Kit scripts pipeline.\\n.opencode/skills/system-spec-kit/scripts/types/README.md:23:- [5. ROOT TYPE: SESSIONDATA](#5--root-type-sessiondata)\\n.opencode/skills/system-spec-kit/scripts/types/README.md:34:**Shared session type definitions** used across the Spec Kit scripts pipeline. This module is the **canonical source of truth** for all session-related types, eliminating parallel type hierarchies that previously existed between `simulation-factory` and the extractors (resolves **TECH-DEBT P6-05**).\\n.opencode/skills/system-spec-kit/scripts/types/README.md:45:└── session-types.ts    # Canonical session interfaces across 4 sections\\n.opencode/skills/system-spec-kit/scripts/types/README.md:50:- `../extractors/session-extractor` for `ToolCounts`, `SpecFileEntry`\\n.opencode/skills/system-spec-kit/scripts/types/README.md:64:├── SpecFileEntry[]           ← from session-extractor\\n.opencode/skills/system-spec-kit/scripts/types/README.md:65:├── ToolCounts                ← from session-extractor\\n.opencode/skills/system-spec-kit/scripts/types/README.md:123:| `OutcomeEntry` | `OUTCOME`, `TYPE?` | Single session outcome |\\n.opencode/skills/system-spec-kit/scripts/types/README.md:124:| `SessionData` | 35+ fields | **Root type**: complete AI coding session context |\\n.opencode/skills/system-spec-kit/scripts/types/README.md:130:<!-- ANCHOR:session-data -->\\n.opencode/skills/system-spec-kit/scripts/types/README.md:133:`SessionData` is the top-level type representing a complete session. Key field groups:\\n.opencode/skills/system-spec-kit/scripts/types/README.md:146:<!-- /ANCHOR:session-data -->\\n.opencode/skills/system-spec-kit/scripts/types/README.md:153:**Before:** Types duplicated in `simulation-factory.ts` and extractor modules.\\n.opencode/skills/system-spec-kit/scripts/types/README.md:154:**After:** Single source in `types/session-types.ts`, imported by all consumers.\\n.opencode/skills/system-spec-kit/scripts/types/README.md:166:| Session extractor (provides `ToolCounts`, `SpecFileEntry`) | `../extractors/session-extractor.ts` |\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-resume.vitest.ts:67:      const b = board.createBoard({ sessionId: 's1', loopType: 'review' });\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-resume.vitest.ts:109:      const s1 = segState.createSegmentState('seg-1', { sessionId: 's1' });\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-resume.vitest.ts:112:      const s2 = segState.createSegmentState('seg-2', { sessionId: 's1' });\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-resume.vitest.ts:124:      const b = board.createBoard({ sessionId: 's1', loopType: 'review' });\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-resume.vitest.ts:139:      const b = board.createBoard({ sessionId: 's1', loopType: 'review' });\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-resume.vitest.ts:259:      const state = segState.createSegmentState('seg-1', { sessionId: 's1' });\\n.opencode/skills/system-spec-kit/scripts/tests/deep-loop-wave-resume.vitest.ts:268:      const state = segState.createSegmentState('seg-1', { sessionId: 's1' });\\n.opencode/skills/system-spec-kit/scripts/tests/workflow-warning.vitest.ts:8:import type { SessionData } from '../types/session-types';\\n.opencode/skills/system-spec-kit/scripts/tests/workflow-warning.vitest.ts:62:    SESSION_ID: 'session-workflow-warning',\\n.opencode/skills/system-spec-kit/scripts/tests/progressive-validation.vitest.js:469:            // File with trailing spaces → triggers WHITESPACE fix\\n.opencode/skills/system-spec-kit/scripts/tests/progressive-validation.vitest.js:500:            // File with trailing spaces → will trigger WHITESPACE fix\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-trigger.test.ts:7:import type { CollectedDataFull } from '../extractors/collect-session-data';\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-trigger.test.ts:36:  sessionSummary: string;\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-trigger.test.ts:37:  triggerPhrases?: string[];\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-trigger.test.ts:57:      'title: \\\"Spec: Phase 6 trigger fixture\\\"',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-trigger.test.ts:58:      'trigger_phrases:',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-trigger.test.ts:59:      '  - \\\"phase 6 trigger fixture\\\"',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-trigger.test.ts:71:  const triggerIndex = lines.findIndex((line) => line.trim() === 'trigger_phrases:');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-trigger.test.ts:72:  if (triggerIndex === -1) {\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-trigger.test.ts:77:  for (let index = triggerIndex + 1; index < lines.length; index++) {\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-trigger.test.ts:101:describe('Phase 6 trigger-surface duplication fixes', () => {\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-trigger.test.ts:103:    const fixture = readFixture('F-DUP-001-trigger-cluster.json');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-trigger.test.ts:104:    const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'speckit-phase6-trigger-cluster-'));\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-trigger.test.ts:119:    const triggerPhrases = parseFrontmatterTriggerPhrases(rendered);\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-trigger.test.ts:121:    expect(triggerPhrases).toContain('claude optimization settings');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-trigger.test.ts:122:    expect(triggerPhrases).toContain('graphify research');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-trigger.test.ts:123:    expect(triggerPhrases).not.toContain('graph and context optimization');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-trigger.test.ts:124:    expect(triggerPhrases).not.toContain('kit/026');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-trigger.test.ts:125:    expect(triggerPhrases).not.toContain('optimization/001');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-trigger.test.ts:128:  it('collapses hyphen-space aliases to one canonical trigger while preserving api cli mcp anchors', async () => {\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-trigger.test.ts:129:    const fixture = readFixture('F-DUP-003-canonical-trigger.json');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-trigger.test.ts:130:    const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'speckit-phase6-trigger-canonical-'));\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-trigger.test.ts:145:    const triggerPhrases = parseFrontmatterTriggerPhrases(rendered);\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-trigger.test.ts:147:    expect(triggerPhrases).toContain('codex-cli-compact');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-trigger.test.ts:148:    expect(triggerPhrases).toContain('tree-sitter');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-trigger.test.ts:149:    expect(triggerPhrases).toContain('implementation-summary');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-trigger.test.ts:150:    expect(triggerPhrases).not.toContain('codex cli compact');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-trigger.test.ts:151:    expect(triggerPhrases).not.toContain('tree sitter');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-trigger.test.ts:152:    expect(triggerPhrases).not.toContain('implementation summary');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-trigger.test.ts:153:    expect(triggerPhrases).toContain('api');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-trigger.test.ts:154:    expect(triggerPhrases).toContain('cli');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-trigger.test.ts:155:    expect(triggerPhrases).toContain('mcp');\\n.opencode/skills/system-spec-kit/scripts/tests/truncate-on-word-boundary.vitest.ts:16:    'session',\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC3-path-fragment.json:3:  \\\"sessionSummary\\\": \\\"Phase 3 replay verifies that reusable trigger sanitization strips folder leaks before persistence while preserving the intended memory pipeline phrasing for retrieval.\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC3-path-fragment.json:4:  \\\"triggerPhrases\\\": [\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC3-path-fragment.json:13:      \\\"description\\\": \\\"Routes merged and folder-derived trigger phrases through the D3 sanitizer\\\"\\n.opencode/skills/system-spec-kit/scripts/tests/file-capture-structured-mode.vitest.ts:15:    const { collectSessionData } = await import('../extractors/collect-session-data');\\n.opencode/skills/system-spec-kit/scripts/tests/file-capture-structured-mode.vitest.ts:17:    const sessionData = await collectSessionData({\\n.opencode/skills/system-spec-kit/scripts/tests/file-capture-structured-mode.vitest.ts:19:      sessionSummary: 'Verified structured file capture counts.',\\n.opencode/skills/system-spec-kit/scripts/tests/file-capture-structured-mode.vitest.ts:24:        { path: 'scripts/extractors/collect-session-data.ts', description: 'Fixed packet doc discovery.' },\\n.opencode/skills/system-spec-kit/scripts/tests/file-capture-structured-mode.vitest.ts:29:    expect(sessionData.CAPTURED_FILE_COUNT).toBe(5);\\n.opencode/skills/system-spec-kit/scripts/tests/file-capture-structured-mode.vitest.ts:30:    expect(sessionData.FILESYSTEM_FILE_COUNT).toBe(5);\\n.opencode/skills/system-spec-kit/scripts/tests/file-capture-structured-mode.vitest.ts:31:    expect(sessionData.GIT_CHANGED_FILE_COUNT).toBe(5);\\n.opencode/skills/system-spec-kit/scripts/tests/file-capture-structured-mode.vitest.ts:35:    const { collectSessionData } = await import('../extractors/collect-session-data');\\n.opencode/skills/system-spec-kit/scripts/tests/file-capture-structured-mode.vitest.ts:37:    const sessionData = await collectSessionData({\\n.opencode/skills/system-spec-kit/scripts/tests/file-capture-structured-mode.vitest.ts:39:      sessionSummary: 'Verified fallback git capture counts.',\\n.opencode/skills/system-spec-kit/scripts/tests/file-capture-structured-mode.vitest.ts:43:    expect(sessionData.CAPTURED_FILE_COUNT).toBe(2);\\n.opencode/skills/system-spec-kit/scripts/tests/file-capture-structured-mode.vitest.ts:44:    expect(sessionData.FILESYSTEM_FILE_COUNT).toBe(2);\\n.opencode/skills/system-spec-kit/scripts/tests/file-capture-structured-mode.vitest.ts:45:    expect(sessionData.GIT_CHANGED_FILE_COUNT).toBe(2);\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC1-truncation.json:3:  \\\"sessionSummary\\\": \\\"Phase 1 foundation work focused on two narrow repairs that improve memory quality without widening the remediation packet into unrelated metadata or reviewer behavior. The first repair aligned the OVERVIEW anchor identity so the table of contents, the HTML anchor, and the internal comment marker all point to the same destination. The second repair extracted a shared truncation helper so long session summaries stop at a clean word boundary and carry the canonical Unicode ellipsis instead of drifting between punctuation styles. The fixture describes a realistic verification pass where the helper was reused by the observation summary path, the OVERVIEW owner adopted the same contract, the compiled CLI replay was exercised with explicit JSON input, and the temporary replay artifacts were removed immediately after the check so the packet memory store stayed clean for the real documentation workflow.\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC1-truncation.json:11:      \\\"path\\\": \\\".opencode/skills/system-spec-kit/scripts/extractors/collect-session-data.ts\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC1-truncation.json:22:  \\\"triggerPhrases\\\": [\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC8-clean.json:5:    \\\"sessionSummary\\\": \\\"This healthy overview proves the reviewer stays quiet when the saved artifact remains internally consistent and the telemetry contract is satisfied end to end.\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC8-clean.json:19:    \\\"trigger_phrases:\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC8-clean.json:49:    \\\"session_id: \\\\\\\"phase4-pr9-clean\\\\\\\"\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC8-clean.json:57:    \\\"causal_links:\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/causal-links-auto-populate.vitest.ts:7:import type { CollectedDataFull } from '../extractors/collect-session-data';\\n.opencode/skills/system-spec-kit/scripts/tests/causal-links-auto-populate.vitest.ts:37:describe('causal link auto-population', () => {\\n.opencode/skills/system-spec-kit/scripts/tests/causal-links-auto-populate.vitest.ts:39:    const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'speckit-causal-links-'));\\n.opencode/skills/system-spec-kit/scripts/tests/causal-links-auto-populate.vitest.ts:49:        '010-causal-link-fixture',\\n.opencode/skills/system-spec-kit/scripts/tests/causal-links-auto-populate.vitest.ts:62:session_id: \\\"planning-save-1\\\"\\n.opencode/skills/system-spec-kit/scripts/tests/causal-links-auto-populate.vitest.ts:74:session_id: \\\"review-save-1\\\"\\n.opencode/skills/system-spec-kit/scripts/tests/causal-links-auto-populate.vitest.ts:89:        sessionId: 'implementation-save-2',\\n.opencode/skills/system-spec-kit/scripts/tests/causal-links-auto-populate.vitest.ts:92:          sessionSummary: 'Implemented the follow-on runtime after the planning save.',\\n.opencode/skills/system-spec-kit/scripts/tests/causal-links-auto-populate.vitest.ts:95:            { path: 'scripts/core/memory-metadata.ts', description: 'Auto-populated causal links from prior saves.' },\\n.opencode/skills/system-spec-kit/scripts/tests/causal-links-auto-populate.vitest.ts:97:          triggerPhrases: ['causal links', 'derived from'],\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:172:    const { extractKeyTopics } = require(path.join(SCRIPTS_DIR, 'core', 'topic-extractor'));\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:204:    // Test 4: extractKeyTopics returns array of topics\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:205:    const topics = extractKeyTopics('Implemented OAuth authentication with JWT tokens');\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:206:    if (Array.isArray(topics) && topics.length > 0) {\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:207:      pass('T-002k: extractKeyTopics extracts topics', `Found: ${topics.slice(0, 3).join(', ')}`);\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:209:      fail('T-002k: extractKeyTopics extracts topics', 'No topics extracted');\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:290:      sessionSummary: 'Test session summary',\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:309:    // Test 5: validateInputData throws on invalid triggerPhrases type\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:310:    assertThrows(() => validateInputData({ triggerPhrases: 'not-an-array' }),\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:311:      'T-004e: validateInputData throws on invalid triggerPhrases');\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:330:    const summaryObs = buildSessionSummaryObservation('Test summary', ['trigger1', 'trigger2']);\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:332:      pass('T-004h: buildSessionSummaryObservation creates observation', 'Facts include triggers');\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:342:      sessionTitle: 'Test Session'\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:707:    if (pipeline.filter && pipeline.filterNoise && pipeline.deduplicate) {\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:916:    // Test 1: create_session_data creates valid structure\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:917:    const session = createSessionData({ specFolder: 'test-spec' });\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:918:    if (session.TITLE && session.SPEC_FOLDER === 'test-spec' && session.DATE) {\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:919:      pass('T-013a: create_session_data creates valid structure', 'Key fields present');\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:921:      fail('T-013a: create_session_data creates valid structure', 'Missing fields');\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:987:    const topics = extractConversationTopics(data);\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:988:    if (Array.isArray(topics) && topics.includes('oauth')) {\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:989:      pass('T-014b: extractConversationTopics extracts topics', topics.join(', '));\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:991:      fail('T-014b: extractConversationTopics extracts topics', topics.join(', '));\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1237:    const files = [{ FILE_PATH: '/test/file.js', DESCRIPTION: 'Modified during session' }];\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1343:  log('\\\\n🔬 EXTRACTORS: session-extractor.js');\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1354:    } = require(path.join(SCRIPTS_DIR, 'extractors', 'session-extractor'));\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1417:    // Test 8: extractKeyTopics extracts topics\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1418:    const topics = extractKeyTopics('Implemented OAuth authentication with JWT');\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1419:    if (Array.isArray(topics) && topics.length > 0) {\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1420:      pass('T-022i: extractKeyTopics extracts topics', topics.slice(0, 3).join(', '));\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1422:      fail('T-022i: extractKeyTopics extracts topics', 'No topics');\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1431:  log('\\\\n🔬 EXTRACTORS: collect-session-data.js');\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1434:    const { collectSessionData, shouldAutoSave } = require(path.join(SCRIPTS_DIR, 'extractors', 'collect-session-data'));\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1436:    // Test 1: shouldAutoSave triggers at message count threshold\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1440:      pass('T-023a: shouldAutoSave triggers at threshold', `Threshold: ${CONFIG.MESSAGE_COUNT_TRIGGER}`);\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1442:      fail('T-023a: shouldAutoSave triggers at threshold', `shouldSave: ${shouldSave}`);\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1457:    skip('T-023d: collectSessionData returns full session data', 'Requires mock spec folder');\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1460:    fail('T-023: Collect session data module', error.message);\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1576:    const topicFromFolder = extractMainTopic([], '042-oauth-authentication');\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1577:    if (topicFromFolder === 'oauth-authentication') {\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1578:      pass('T-026c: extractMainTopic extracts from spec folder', topicFromFolder);\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1580:      fail('T-026c: extractMainTopic extracts from spec folder', topicFromFolder);\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1585:    const topicFromObs = extractMainTopic(obsWithTopic, null);\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1586:    if (topicFromObs.includes('user') || topicFromObs.includes('profile')) {\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1587:      pass('T-026d: extractMainTopic extracts from observations', topicFromObs);\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1589:      fail('T-026d: extractMainTopic extracts from observations', topicFromObs);\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1696:  log('\\\\n🔬 EXTRACTORS: session-extractor.js (Additional Functions)');\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1699:    const sessionExtractor = require(path.join(SCRIPTS_DIR, 'extractors', 'session-extractor'));\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1702:    assertType(sessionExtractor.extractActiveFile, 'function', 'T-027a: extractActiveFile exported');\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1705:    assertType(sessionExtractor.extractNextAction, 'function', 'T-027b: extractNextAction exported');\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1708:    assertType(sessionExtractor.extractBlockers, 'function', 'T-027c: extractBlockers exported');\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1711:    assertType(sessionExtractor.buildFileProgress, 'function', 'T-027d: buildFileProgress exported');\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1714:    assertType(sessionExtractor.calculateExpiryEpoch, 'function', 'T-027e: calculateExpiryEpoch exported');\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1717:    assertType(sessionExtractor.detectRelatedDocs, 'function', 'T-027f: detectRelatedDocs exported');\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1720:    assertType(sessionExtractor.detectSessionCharacteristics, 'function', 'T-027g: detectSessionCharacteristics exported');\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1723:    assertType(sessionExtractor.buildProjectStateSnapshot, 'function', 'T-027h: buildProjectStateSnapshot exported');\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1730:    const activeFile = sessionExtractor.extractActiveFile(obsWithFiles, []);\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1734:    const fallbackFile = sessionExtractor.extractActiveFile([], [{ FILE_PATH: '/backup.js' }]);\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1738:    const noFileResult = sessionExtractor.extractActiveFile([], []);\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1743:    const nextAction = sessionExtractor.extractNextAction(obsWithNext, []);\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1751:    const defaultNext = sessionExtractor.extractNextAction([], []);\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1756:    const blocker = sessionExtractor.extractBlockers(obsWithBlocker);\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1764:    const noBlocker = sessionExtractor.extractBlockers([{ narrative: 'Everything is working fine.' }]);\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1769:    const progress = sessionExtractor.buildFileProgress(specFiles);\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1777:    const emptyProgress = sessionExtractor.buildFileProgress(null);\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1786:    const criticalExpiry = sessionExtractor.calculateExpiryEpoch('critical', createdAt);\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1790:    const constitutionalExpiry = sessionExtractor.calculateExpiryEpoch('constitutional', createdAt);\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1794:    const tempExpiry = sessionExtractor.calculateExpiryEpoch('temporary', createdAt);\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1803:    const normalExpiry = sessionExtractor.calculateExpiryEpoch('normal', createdAt);\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1812:    const relatedDocs = await sessionExtractor.detectRelatedDocs(__dirname);\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1823:    const characteristics = sessionExtractor.detectSessionCharacteristics(observations, userPrompts, FILES);\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:1841:    const snapshot = sessionExtractor.buildProjectStateSnapshot(snapshotInput);\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:2025:      // \\\"Chose:\\\" at start triggers decision classification\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:2235:    assertEqual(isDescriptionValid('Modified during session'), false, 'T-034f: isDescriptionValid rejects garbage patterns');\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:2463:  log('\\\\n🔬 LIB: trigger-extractor.js (re-export verification)');\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:2466:    const triggerModule = require(path.join(SCRIPTS_DIR, 'lib', 'trigger-extractor'));\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:2469:    assertType(triggerModule.extractTriggerPhrases, 'function', 'T-037a: extractTriggerPhrases is exported');\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:2471:    // Test 2: extract_trigger_phrases is also exported (snake_case alias)\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:2472:    assertType(triggerModule.extractTriggerPhrases, 'function', 'T-037b: extract_trigger_phrases is exported');\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:2476:    const phrases = triggerModule.extractTriggerPhrases(text);\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:2484:    const emptyResult = triggerModule.extractTriggerPhrases(null);\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:2492:    const shortResult = triggerModule.extractTriggerPhrases('Hi');\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:2500:    const configPreview = triggerModule.CONFIG\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:2501:      ? JSON.stringify(triggerModule.CONFIG).substring(0, 50)\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:2503:    assertExists(triggerModule.CONFIG, 'T-037f: CONFIG is exported', configPreview);\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:2506:    if (triggerModule.STOP_WORDS_ENGLISH instanceof Set) {\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:2507:      pass('T-037g: STOP_WORDS_ENGLISH is exported', `${triggerModule.STOP_WORDS_ENGLISH.size} words`);\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:2602:    // Test 3: extractConversationTopics extracts topics correctly\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:2607:    const topics = extractConversationTopics(testData);\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:2608:    if (Array.isArray(topics) && topics.some(t => t.includes('oauth'))) {\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:2609:      pass('T-039c: extractConversationTopics extracts OAuth topics', topics.join(', '));\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:2611:      fail('T-039c: extractConversationTopics extracts OAuth topics', topics.join(', '));\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:2627:    // Test 5: calculateAlignmentScore returns high score for matching topics\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:2635:    // Test 6: calculateAlignmentScore returns low score for non-matching topics\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:2688:    // Test 3: extractPhasesFromData returns empty for short sessions\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:2692:      pass('T-040c: extractPhasesFromData returns empty for short sessions', 'Empty array');\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:2694:      fail('T-040c: extractPhasesFromData returns empty for short sessions', `Length: ${shortResult.length}`);\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:2841:  log('\\\\n🔬 MEMORY: generate-context.js');\\n.opencode/skills/system-spec-kit/scripts/tests/test-scripts-modules.js:2848:    } = require(path.join(SCRIPTS_DIR, 'memory', 'generate-context'));\\n.opencode/skills/system-spec-kit/scripts/tests/project-phase-e2e.vitest.ts:11:} from '../extractors/session-extractor';\\n.opencode/skills/system-spec-kit/scripts/tests/test-integration.vitest.ts:77:  const dbPath = path.join(workspaceRoot, 'test-context-index.sqlite');\\n.opencode/skills/system-spec-kit/scripts/tests/test-integration.vitest.ts:326:  it('confirms generate-context.js compiled entrypoint exists', () => {\\n.opencode/skills/system-spec-kit/scripts/tests/test-integration.vitest.ts:327:    // W1-T3 parity: compiled generate-context must be present for CLI invocation\\n.opencode/skills/system-spec-kit/scripts/tests/test-integration.vitest.ts:328:    const generateContextPath = path.join(SCRIPTS_DIR, 'dist', 'memory', 'generate-context.js');\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/deep-loop-replay/028/sample-iterations.jsonl:1:{\\\"type\\\":\\\"config\\\",\\\"mode\\\":\\\"research\\\",\\\"topic\\\":\\\"Legacy holdout replay fixture\\\",\\\"maxIterations\\\":5,\\\"convergenceThreshold\\\":0.15,\\\"stuckThreshold\\\":3,\\\"sessionId\\\":\\\"replay-028-fixture\\\"}\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC7-anchor.json:3:  \\\"sessionSummary\\\": \\\"Phase 1 foundation work aligned the OVERVIEW anchor names across the template.\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC7-anchor.json:17:  \\\"triggerPhrases\\\": [\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC6-provenance.json:3:  \\\"sessionSummary\\\": \\\"Phase 2 PR-4 adds JSON-mode git provenance without changing the authored memory narrative.\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC6-provenance.json:27:      \\\"rationale\\\": \\\"Avoid leaking captured-session summary, observations, trigger phrases, and decisions into structured JSON saves.\\\"\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC6-provenance.json:30:  \\\"triggerPhrases\\\": [\\n.opencode/skills/system-spec-kit/scripts/tests/test-five-checks.js:559:      pass('T-LA-005: >100 LOC threshold documented', '>100 LOC trigger found');\\n.opencode/skills/system-spec-kit/scripts/tests/test-five-checks.js:564:    // Test: Architectural decisions trigger documented\\n.opencode/skills/system-spec-kit/scripts/tests/test-five-checks.js:566:      pass('T-LA-006: Architectural decisions trigger documented', 'Architectural trigger found');\\n.opencode/skills/system-spec-kit/scripts/tests/test-five-checks.js:568:      fail('T-LA-006: Architectural decisions trigger documented', 'Architectural trigger not documented');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase2-pr4.test.ts:8:import type { CollectedDataFull } from '../extractors/collect-session-data';\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase2-pr4.test.ts:9:import type { SessionData } from '../types/session-types';\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase2-pr4.test.ts:73:  sessionSummary: string;\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase2-pr4.test.ts:77:  triggerPhrases: string[];\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase2-pr4.test.ts:222:      expect(rendered).toContain(fixture.sessionSummary);\\n.opencode/skills/system-spec-kit/scripts/tests/deep-research-reducer.vitest.ts:47:        topic: 'Reducer fixture topic',\\n.opencode/skills/system-spec-kit/scripts/tests/deep-research-reducer.vitest.ts:54:          sessionId: 'session-001',\\n.opencode/skills/system-spec-kit/scripts/tests/deep-research-reducer.vitest.ts:69:      '{\\\"type\\\":\\\"config\\\",\\\"topic\\\":\\\"Reducer fixture topic\\\",\\\"maxIterations\\\":5,\\\"convergenceThreshold\\\":0.05,\\\"createdAt\\\":\\\"2026-04-03T00:00:00Z\\\",\\\"specFolder\\\":\\\"fixture\\\"}',\\n.opencode/skills/system-spec-kit/scripts/tests/deep-research-reducer.vitest.ts:89:<!-- ANCHOR:topic -->\\n.opencode/skills/system-spec-kit/scripts/tests/deep-research-reducer.vitest.ts:91:Reducer fixture topic\\n.opencode/skills/system-spec-kit/scripts/tests/deep-research-reducer.vitest.ts:92:<!-- /ANCHOR:topic -->\\n.opencode/skills/system-spec-kit/scripts/tests/deep-research-reducer.vitest.ts:256:    expect(firstDashboard).toContain('Session ID: session-001');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase3-pr5.vitest.ts:7:import type { CollectedDataFull } from '../extractors/collect-session-data';\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase3-pr5.vitest.ts:8:import { sanitizeTriggerPhrase } from '../lib/trigger-phrase-sanitizer';\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase3-pr5.vitest.ts:37:  sessionSummary: string;\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase3-pr5.vitest.ts:38:  triggerPhrases?: string[];\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase3-pr5.vitest.ts:62:      'trigger_phrases:',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase3-pr5.vitest.ts:64:      '  - \\\"trigger phrase sanitizer\\\"',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase3-pr5.vitest.ts:76:  const triggerIndex = lines.findIndex((line) => line.trim() === 'trigger_phrases:');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase3-pr5.vitest.ts:77:  if (triggerIndex === -1) {\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase3-pr5.vitest.ts:82:  for (let index = triggerIndex + 1; index < lines.length; index++) {\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase3-pr5.vitest.ts:124:  it.each(fixtureNames)('keeps saved triggers and rendered topics free of junk for %s', async (fixtureName) => {\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase3-pr5.vitest.ts:142:    const triggerPhrases = parseFrontmatterTriggerPhrases(rendered);\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase3-pr5.vitest.ts:145:      (fixture.triggerPhrases ?? []).map((phrase) => phrase.toLowerCase()),\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase3-pr5.vitest.ts:148:    for (const phrase of triggerPhrases) {\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase3-pr5.vitest.ts:161:      expect(triggerPhrases).not.toContain(phrase.toLowerCase());\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase3-pr5.vitest.ts:165:      expect(triggerPhrases).toContain(phrase.toLowerCase());\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC2-degraded-fallback.json:3:  \\\"sessionSummary\\\": \\\"Degraded payload with no authored decisions but decision-like prose that should still produce lexical placeholders.\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/session-cached-consumer.vitest.ts.test.ts:12:} from '../../mcp_server/handlers/session-resume.js';\\n.opencode/skills/system-spec-kit/scripts/tests/session-cached-consumer.vitest.ts.test.ts:20:const VALID_SPEC_FOLDER = 'specs/system-spec-kit/026-graph-and-context-optimization/012-cached-sessionstart-consumer-gated';\\n.opencode/skills/system-spec-kit/scripts/tests/session-cached-consumer.vitest.ts.test.ts:51:  run: (context: { sessionId: string }) => Promise<T>,\\n.opencode/skills/system-spec-kit/scripts/tests/session-cached-consumer.vitest.ts.test.ts:58:  const sessionId = `session-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`;\\n.opencode/skills/system-spec-kit/scripts/tests/session-cached-consumer.vitest.ts.test.ts:70:    return await run({ sessionId });\\n.opencode/skills/system-spec-kit/scripts/tests/session-cached-consumer.vitest.ts.test.ts:82:  sessionId: string,\\n.opencode/skills/system-spec-kit/scripts/tests/session-cached-consumer.vitest.ts.test.ts:99:    claudeSessionId: sessionId,\\n.opencode/skills/system-spec-kit/scripts/tests/session-cached-consumer.vitest.ts.test.ts:100:    speckitSessionId: `speckit-${sessionId}`,\\n.opencode/skills/system-spec-kit/scripts/tests/session-cached-consumer.vitest.ts.test.ts:102:    sessionSummary: {\\n.opencode/skills/system-spec-kit/scripts/tests/session-cached-consumer.vitest.ts.test.ts:125:  saveState(sessionId, state);\\n.opencode/skills/system-spec-kit/scripts/tests/session-cached-consumer.vitest.ts.test.ts:277:    expect(additiveResult.cachedSummary?.continuityText).toContain('Last session worked on');\\n.opencode/skills/system-spec-kit/scripts/tests/session-cached-consumer.vitest.ts.test.ts:281:  it('exercises session_resume, session_bootstrap, and session-prime against the frozen corpus via hook state', async () => {\\n.opencode/skills/system-spec-kit/scripts/tests/session-cached-consumer.vitest.ts.test.ts:304:    vi.doMock('../../mcp_server/lib/session/context-metrics.js', () => ({\\n.opencode/skills/system-spec-kit/scripts/tests/session-cached-consumer.vitest.ts.test.ts:310:    vi.doMock('../../mcp_server/lib/session/session-snapshot.js', () => ({\\n.opencode/skills/system-spec-kit/scripts/tests/session-cached-consumer.vitest.ts.test.ts:314:        recommendedAction: 'Use code_graph_query for structural lookups.',\\n.opencode/skills/system-spec-kit/scripts/tests/session-cached-consumer.vitest.ts.test.ts:315:        sourceSurface: 'session_bootstrap',\\n.opencode/skills/system-spec-kit/scripts/tests/session-cached-consumer.vitest.ts.test.ts:320:    vi.doMock('../../mcp_server/handlers/session-health.js', () => ({\\n.opencode/skills/system-spec-kit/scripts/tests/session-cached-consumer.vitest.ts.test.ts:332:        sessionContinuity: null,\\n.opencode/skills/system-spec-kit/scripts/tests/session-cached-consumer.vitest.ts.test.ts:348:    const { handleSessionResume } = await import('../../mcp_server/handlers/session-resume.js');\\n.opencode/skills/system-spec-kit/scripts/tests/session-cached-consumer.vitest.ts.test.ts:349:    const { handleSessionBootstrap } = await import('../../mcp_server/handlers/session-bootstrap.js');\\n.opencode/skills/system-spec-kit/scripts/tests/session-cached-consumer.vitest.ts.test.ts:350:    const { handleStartup } = await import('../../mcp_server/hooks/claude/session-prime.js');\\n.opencode/skills/system-spec-kit/scripts/tests/session-cached-consumer.vitest.ts.test.ts:375:      await withHookSandbox(async ({ sessionId }) => {\\n.opencode/skills/system-spec-kit/scripts/tests/session-cached-consumer.vitest.ts.test.ts:378:        const liveStartup = handleStartup({ session_id: sessionId, specFolder: VALID_SPEC_FOLDER });\\n.opencode/skills/system-spec-kit/scripts/tests/session-cached-consumer.vitest.ts.test.ts:380:        seedHookState(sessionId, scenario);\\n.opencode/skills/system-spec-kit/scripts/tests/session-cached-consumer.vitest.ts.test.ts:384:        const cachedStartup = handleStartup({ session_id: sessionId, specFolder: VALID_SPEC_FOLDER });\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr7.test.ts:9:import type { CollectedDataFull } from '../extractors/collect-session-data';\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr7.test.ts:65:  it('returns the exact predecessor when continuation lineage supplies a matching source session id', async () => {\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr7.test.ts:71:      sessionId: 'hit-current-3',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr7.test.ts:79:  it('returns null when a continuation save has no valid predecessor session id to attach', async () => {\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr7.test.ts:85:      sessionId: 'miss-current-2',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr7.test.ts:98:      sessionId: 'ambiguity-current-3',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr7.test.ts:105:  it('renders causal_links.supersedes into the saved memory on the hit path', async () => {\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr7.test.ts:125:        sessionId: 'hit-current-3',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr7.test.ts:130:          sessionSummary: 'Extended continuation run for the lineage fixture.',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr7.test.ts:141:              narrative: 'The save should inherit the predecessor session id before render.',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr7.test.ts:142:              facts: ['Touched workflow.ts immediately before causal link render.'],\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr7.test.ts:156:              description: 'Inject predecessor discovery before causal link render.',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr7.test.ts:159:          triggerPhrases: ['phase 4 pr7', 'auto supersedes'],\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase4-pr7.test.ts:166:      expect(rendered).toContain('causal_links:');\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/migration/F-MIG-003-title-overlap.md:4:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/migration/F-MIG-003-title-overlap.md:6:  - \\\"trigger phrase migration\\\"\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/session-data-factory.ts:8:import type { SessionData } from '../../types/session-types';\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/session-data-factory.ts:49:      OBSERVATION: 'Verified duplicate content skips the markdown write and leaves bookkeeping unchanged.',\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/session-data-factory.ts:56:  SESSION_ID: 'session-workflow-e2e',\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/session-data-factory.ts:157:    LAST_ACTION: 'Prepared a sparse session to verify the sufficiency abort path.',\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/deep-loop-replay/040/sample-iterations.jsonl:1:{\\\"type\\\":\\\"config\\\",\\\"mode\\\":\\\"review\\\",\\\"topic\\\":\\\"Replay fixture for 040\\\",\\\"maxIterations\\\":7,\\\"convergenceThreshold\\\":0.10,\\\"stuckThreshold\\\":2,\\\"sessionId\\\":\\\"replay-040-fixture\\\"}\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-template.test.ts:58:    TRIGGER_PHRASES_YAML: 'trigger_phrases:\\\\n  - \\\"phase 6 template fixture\\\"\\\\n  - \\\"memory duplication reduction\\\"',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-template.test.ts:182:    'trigger_phrases:',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-template.test.ts:183:    ...frontmatterTriggers.map((triggerPhrase) => `  - \\\"${triggerPhrase}\\\"`),\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-template.test.ts:193:    'session_id: \\\"phase6-mirror-drift\\\"',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-template.test.ts:196:    'trigger_phrases:',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-template.test.ts:197:    ...metadataTriggers.map((triggerPhrase) => `  - \\\"${triggerPhrase}\\\"`),\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-template.test.ts:217:  const frontmatterTriggers = spec.frontmatterTriggerPhrases ?? ['phase 6 reviewer fixture', 'clean trigger'];\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-template.test.ts:245:    'trigger_phrases:',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-template.test.ts:246:    ...frontmatterTriggers.map((triggerPhrase) => `  - \\\"${triggerPhrase}\\\"`),\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-template.test.ts:303:    'session_id: \\\"phase6-dup-fixture\\\"',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-template.test.ts:310:    'trigger_phrases:',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-template.test.ts:311:    ...metadataTriggers.map((triggerPhrase) => `  - \\\"${triggerPhrase}\\\"`),\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-template.test.ts:313:    'causal_links:',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-template.test.ts:346:  it.skip('F004.1 keeps a single closeout instruction for completed sessions and preserves all continuation surfaces for in-progress sessions', async () => {\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-template.test.ts:361:    expect(inProgress).toContain('Collapse completed-session closure duplication');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-template.test.ts:374:    expect(rendered).toContain('<!-- ANCHOR:continue-session -->');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-template.test.ts:403:    expect(rewrite.content).not.toContain('  - \\\"stale metadata trigger\\\"');\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-template.test.ts:412:        sessionSummary: 'Phase 6 mirror drift reviewer fixture.',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-template.test.ts:424:      field: 'trigger_phrases',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-template.test.ts:434:        sessionSummary: 'Phase 6 clean mirror reviewer fixture.',\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-template.test.ts:448:      { fixture: 'F-CHECK-DUP1-trigger.json', checkId: 'DUP1', severity: 'MEDIUM', field: 'observations' },\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-template.test.ts:449:      { fixture: 'F-CHECK-DUP2-trigger.json', checkId: 'DUP2', severity: 'MEDIUM', field: 'decisions' },\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-template.test.ts:450:      { fixture: 'F-CHECK-DUP3-trigger.json', checkId: 'DUP3', severity: 'MEDIUM', field: 'continuation' },\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-template.test.ts:451:      { fixture: 'F-CHECK-DUP4-trigger.json', checkId: 'DUP4', severity: 'MEDIUM', field: 'resume_context' },\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-template.test.ts:452:      { fixture: 'F-CHECK-DUP5-trigger.json', checkId: 'DUP5', severity: 'HIGH', field: 'trigger_phrases' },\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-template.test.ts:453:      { fixture: 'F-CHECK-DUP6-trigger.json', checkId: 'DUP6', severity: 'MEDIUM', field: 'anchors' },\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-template.test.ts:454:      { fixture: 'F-CHECK-DUP7-trigger.json', checkId: 'DUP7', severity: 'MEDIUM', field: 'files' },\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-template.test.ts:466:          sessionSummary: `Trigger fixture for ${expectation.checkId}.`,\\n.opencode/skills/system-spec-kit/scripts/tests/memory-quality-phase6-template.test.ts:487:        sessionSummary: 'Clean Phase 6 duplication reviewer fixture.',\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-DUP-004a-in-progress.json:10:        \\\"TASK_DESCRIPTION\\\": \\\"Collapse completed-session closure duplication\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-creation/expected-2phase-default/tasks.md:5:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/migration/F-MIG-002-clean.md:3:description: \\\"Fixture whose trigger_phrases should remain unchanged.\\\"\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/migration/F-MIG-002-clean.md:4:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-creation/expected-2phase-default/002-phase-2/spec.md:5:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-creation/expected-2phase-default/002-phase-2/spec.md:44:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-creation/expected-2phase-default/001-phase-1/spec.md:5:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-creation/expected-2phase-default/001-phase-1/spec.md:44:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/deep-loop-optimizer/sample-040-corpus.jsonl:1:{\\\"type\\\":\\\"config\\\",\\\"mode\\\":\\\"review\\\",\\\"topic\\\":\\\"Review of graph optimization module\\\",\\\"reviewTarget\\\":\\\"specs/040-graph-optimization\\\",\\\"reviewTargetType\\\":\\\"spec-folder\\\",\\\"reviewDimensions\\\":[\\\"correctness\\\",\\\"security\\\",\\\"traceability\\\",\\\"maintainability\\\"],\\\"sessionId\\\":\\\"rvw-2026-03-20T14-00-00Z\\\",\\\"parentSessionId\\\":null,\\\"lineageMode\\\":\\\"new\\\",\\\"generation\\\":1,\\\"continuedFromRun\\\":null,\\\"maxIterations\\\":7,\\\"convergenceThreshold\\\":0.10,\\\"stuckThreshold\\\":2,\\\"createdAt\\\":\\\"2026-03-20T14:00:00Z\\\",\\\"specFolder\\\":\\\"040-graph-optimization\\\",\\\"releaseReadinessState\\\":\\\"in-progress\\\"}\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/deep-loop-optimizer/sample-040-corpus.jsonl:2:{\\\"type\\\":\\\"iteration\\\",\\\"mode\\\":\\\"review\\\",\\\"run\\\":1,\\\"status\\\":\\\"complete\\\",\\\"focus\\\":\\\"D1 Correctness - reducer logic review\\\",\\\"dimensions\\\":[\\\"correctness\\\"],\\\"filesReviewed\\\":[\\\"src/graph-reducer.ts\\\",\\\"src/parser.ts\\\"],\\\"sessionId\\\":\\\"rvw-2026-03-20T14-00-00Z\\\",\\\"parentSessionId\\\":null,\\\"lineageMode\\\":\\\"new\\\",\\\"generation\\\":1,\\\"continuedFromRun\\\":null,\\\"findingsCount\\\":4,\\\"findingsSummary\\\":{\\\"P0\\\":1,\\\"P1\\\":2,\\\"P2\\\":1},\\\"findingsNew\\\":{\\\"P0\\\":1,\\\"P1\\\":2,\\\"P2\\\":1},\\\"newFindingsRatio\\\":0.90,\\\"timestamp\\\":\\\"2026-03-20T14:12:00Z\\\",\\\"durationMs\\\":72000}\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/deep-loop-optimizer/sample-040-corpus.jsonl:3:{\\\"type\\\":\\\"iteration\\\",\\\"mode\\\":\\\"review\\\",\\\"run\\\":2,\\\"status\\\":\\\"complete\\\",\\\"focus\\\":\\\"D2 Security - injection prevention audit\\\",\\\"dimensions\\\":[\\\"security\\\",\\\"correctness\\\"],\\\"filesReviewed\\\":[\\\"src/sanitizer.ts\\\",\\\"src/input-validator.ts\\\"],\\\"sessionId\\\":\\\"rvw-2026-03-20T14-00-00Z\\\",\\\"parentSessionId\\\":null,\\\"lineageMode\\\":\\\"new\\\",\\\"generation\\\":1,\\\"continuedFromRun\\\":null,\\\"findingsCount\\\":6,\\\"findingsSummary\\\":{\\\"P0\\\":1,\\\"P1\\\":3,\\\"P2\\\":2},\\\"findingsNew\\\":{\\\"P0\\\":0,\\\"P1\\\":1,\\\"P2\\\":1},\\\"newFindingsRatio\\\":0.40,\\\"timestamp\\\":\\\"2026-03-20T14:24:00Z\\\",\\\"durationMs\\\":65000}\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/deep-loop-optimizer/sample-040-corpus.jsonl:5:{\\\"type\\\":\\\"iteration\\\",\\\"mode\\\":\\\"review\\\",\\\"run\\\":3,\\\"status\\\":\\\"complete\\\",\\\"focus\\\":\\\"D3 Traceability + D4 Maintainability sweep\\\",\\\"dimensions\\\":[\\\"traceability\\\",\\\"maintainability\\\"],\\\"filesReviewed\\\":[\\\"specs/040/spec.md\\\",\\\"src/graph-reducer.ts\\\",\\\"src/utils.ts\\\"],\\\"sessionId\\\":\\\"rvw-2026-03-20T14-00-00Z\\\",\\\"parentSessionId\\\":null,\\\"lineageMode\\\":\\\"new\\\",\\\"generation\\\":1,\\\"continuedFromRun\\\":null,\\\"findingsCount\\\":7,\\\"findingsSummary\\\":{\\\"P0\\\":0,\\\"P1\\\":3,\\\"P2\\\":4},\\\"findingsNew\\\":{\\\"P0\\\":0,\\\"P1\\\":0,\\\"P2\\\":2},\\\"newFindingsRatio\\\":0.08,\\\"convergenceSignals\\\":{\\\"rollingAvg\\\":0.09,\\\"madScore\\\":0.06,\\\"noveltyRatio\\\":0.08,\\\"compositeStop\\\":0.62},\\\"timestamp\\\":\\\"2026-03-20T14:36:00Z\\\",\\\"durationMs\\\":58000}\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-creation/expected-2phase-default/spec.md:5:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-creation/expected-2phase-default/spec.md:179:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-creation/expected-3phase-named/decision-record.md:5:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-creation/expected-2phase-default/checklist.md:5:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-creation/expected-2phase-default/002-phase-2/tasks.md:5:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-creation/expected-2phase-default/plan.md:5:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-creation/expected-2phase-default/002-phase-2/plan.md:5:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-creation/expected-2phase-default/001-phase-1/plan.md:5:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/migration/F-MIG-001-junk-residual.md:3:description: \\\"Fixture with stale residual triggers plus useful short anchors.\\\"\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/migration/F-MIG-001-junk-residual.md:4:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-broken-D8.json:5:    \\\"sessionSummary\\\": \\\"This healthy overview proves the reviewer catches anchor drift without introducing unrelated findings.\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-broken-D8.json:19:    \\\"trigger_phrases:\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-broken-D8.json:49:    \\\"session_id: \\\\\\\"phase4-pr9-d8\\\\\\\"\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-broken-D8.json:57:    \\\"causal_links:\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-CHECK-DUP3-trigger.json:2:  \\\"pendingNoTasksLine\\\": \\\"- No pending tasks - session completed successfully\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-creation/expected-3phase-named/spec.md:5:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-creation/expected-3phase-named/spec.md:227:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC3-synthetic-bigrams.json:3:  \\\"sessionSummary\\\": \\\"We reject across 4 prioritization tiers and the full Level 3 spec set while the spec kit validator stays green for adjacent topic extraction.\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC3-synthetic-bigrams.json:4:  \\\"triggerPhrases\\\": [\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC3-synthetic-bigrams.json:6:    \\\"session for\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC3-synthetic-bigrams.json:22:    \\\"session for\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC4-importance-tier.json:3:  \\\"sessionSummary\\\": \\\"Phase 2 PR-3 validation keeps the importance-tier resolver authoritative while the managed-frontmatter rewrite re-emits both serialized tier locations from the same resolved value. This fixture models the historical drift case where an explicit important-tier save could later be normalized back to a default-looking frontmatter tier if migration treated the serializer as a second authority.\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC4-importance-tier.json:14:      \\\"decision\\\": \\\"Use session-extractor as the canonical importance-tier resolver\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC4-importance-tier.json:18:  \\\"triggerPhrases\\\": [\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC4-importance-tier.json:24:    \\\"Replay the fixture through generate-context.js and confirm tier parity\\\"\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-creation/expected-2phase-default/001-phase-1/tasks.md:5:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-DUP-004b-last-clipping.json:9:        \\\".opencode/skills/system-spec-kit/scripts/extractors/collect-session-data.ts\\\"\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC3-happy-path.json:3:  \\\"sessionSummary\\\": \\\"Phase 3 replay preserves spec kit retrieval language, semantic search adjacency, and the mcp integration topic without introducing junk trigger phrases.\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC3-happy-path.json:4:  \\\"triggerPhrases\\\": [\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC3-happy-path.json:13:      \\\"description\\\": \\\"Applies the reusable sanitizer without disturbing healthy trigger phrases\\\"\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-broken-D4.json:5:    \\\"sessionSummary\\\": \\\"This healthy overview proves the reviewer catches tier drift without introducing unrelated findings.\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-broken-D4.json:19:    \\\"trigger_phrases:\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-broken-D4.json:53:    \\\"session_id: \\\\\\\"phase4-pr9-d4\\\\\\\"\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-broken-D4.json:61:    \\\"causal_links:\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-DUP-002b-proposition-overlap.json:3:  \\\"session_summary\\\": \\\"Decision and outcome dedupe fixture for Phase 6 extractor coverage.\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-DUP-002b-proposition-overlap.json:6:      \\\"prompt\\\": \\\"Deduplicate repeated propositions across outcomes and decisions without dropping authored rationale.\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-DUP-002b-proposition-overlap.json:24:        \\\".opencode/skills/system-spec-kit/scripts/extractors/collect-session-data.ts\\\"\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-DUP-002b-proposition-overlap.json:32:        \\\".opencode/skills/system-spec-kit/scripts/extractors/collect-session-data.ts\\\"\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-DUP-002b-proposition-overlap.json:47:      \\\"path\\\": \\\".opencode/skills/system-spec-kit/scripts/extractors/collect-session-data.ts\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-DUP-002b-proposition-overlap.json:48:      \\\"changes_summary\\\": \\\"Remove duplicate outcome propositions before rendering.\\\"\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-DUP-003-canonical-trigger.json:3:  \\\"sessionSummary\\\": \\\"Codex-cli-compact audit for tree-sitter and implementation-summary coverage across api cli mcp entry points.\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-DUP-003-canonical-trigger.json:4:  \\\"triggerPhrases\\\": [\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-DUP-003-canonical-trigger.json:23:      \\\"path\\\": \\\".opencode/skills/system-spec-kit/scripts/lib/trigger-phrase-sanitizer.ts\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC3-suspicious-prefix.json:3:  \\\"sessionSummary\\\": \\\"Phase 3 replay keeps meaningful indexing terms while removing numbered and identifier-shaped junk that previously polluted saved trigger phrases.\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC3-suspicious-prefix.json:4:  \\\"triggerPhrases\\\": [\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC3-suspicious-prefix.json:13:      \\\"path\\\": \\\".opencode/skills/system-spec-kit/scripts/lib/trigger-phrase-sanitizer.ts\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC3-suspicious-prefix.json:19:    \\\"Verify the saved trigger list\\\"\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-creation/expected-3phase-named/plan.md:5:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC3-standalone-stopwords.json:3:  \\\"sessionSummary\\\": \\\"Phase 3 replay proves standalone trigger junk no longer survives the save path when the packet context includes graph and issues language next to a valid mcp surface.\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC3-standalone-stopwords.json:4:  \\\"triggerPhrases\\\": [\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC3-standalone-stopwords.json:15:      \\\"path\\\": \\\".opencode/skills/system-spec-kit/scripts/lib/trigger-phrase-sanitizer.ts\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-DUP-001-trigger-cluster.json:3:  \\\"sessionSummary\\\": \\\"Investigated sibling-memory trigger duplication while keeping the claude optimization settings continuation discoverable for Phase 6.\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-DUP-001-trigger-cluster.json:4:  \\\"triggerPhrases\\\": [\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-DUP-001-trigger-cluster.json:17:      \\\"description\\\": \\\"Guarded the fallback cluster anchor append for trigger phrase generation.\\\"\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-DUP-005a-anchor-scaffolding.json:25:    \\\"continue-session\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-DUP-005a-anchor-scaffolding.json:31:    \\\"session-history\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-broken-D7.json:5:    \\\"sessionSummary\\\": \\\"This healthy overview proves the reviewer catches missing provenance without introducing unrelated findings.\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-broken-D7.json:19:    \\\"trigger_phrases:\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-broken-D7.json:53:    \\\"session_id: \\\\\\\"phase4-pr9-d7\\\\\\\"\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-broken-D7.json:61:    \\\"causal_links:\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC2-authored-decisions.json:3:  \\\"sessionSummary\\\": \\\"Short neutral session summary for decision precedence testing.\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-creation/expected-3phase-named/tasks.md:5:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-DUP-002a-blank-observation-titles.json:3:  \\\"session_summary\\\": \\\"Observation-title filtering fixture for Phase 6 extractor coverage.\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-broken-D1.json:5:    \\\"sessionSummary\\\": \\\"This broken overview proves the reviewer catches truncation when the rendered text still ends mid token and falls back to the old ASCII ellipsis shape instead of the boundary safe contract that Phase 1 pinned down for JSON mode saves.\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-broken-D1.json:19:    \\\"trigger_phrases:\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-broken-D1.json:53:    \\\"session_id: \\\\\\\"phase4-pr9-d1\\\\\\\"\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-broken-D1.json:61:    \\\"causal_links:\\\",\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-DUP-005b-frontmatter-mirror.json:9:    \\\"stale metadata trigger\\\"\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-creation/expected-3phase-named/checklist.md:5:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-creation/expected-3phase-named/001-design/spec.md:5:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-creation/expected-3phase-named/001-design/spec.md:44:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-creation/expected-3phase-named/003-verify/spec.md:5:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-creation/expected-3phase-named/003-verify/spec.md:44:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-creation/expected-3phase-named/001-design/plan.md:5:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-detection/phase-blocked-by-level/spec.md:19:- Phase score: 30/50 (3 of 5 dimensions triggered -- qualifies on its own)\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-creation/expected-3phase-named/001-design/tasks.md:5:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-detection/phase-maximum/spec.md:12:Maximum-complexity fixture that triggers all 5 phase scoring dimensions,\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-detection/phase-maximum/spec.md:18:- Phase score: 50/50 (all 5 dimensions triggered)\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-detection/phase-high/spec.md:12:High-complexity fixture that triggers 4 of 5 phase scoring dimensions.\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-detection/phase-high/spec.md:18:- Phase score: 40/50 (4 of 5 dimensions triggered)\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-creation/expected-3phase-named/002-build/spec.md:5:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-creation/expected-3phase-named/002-build/spec.md:44:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-creation/expected-3phase-named/003-verify/tasks.md:5:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC5-lineage/hit/memory/06-04-26_12-30__project-notes.md:4:session_id: \\\"hit-unrelated-2\\\"\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC5-lineage/miss/memory/06-04-26_09-00__orphan-notes.md:3:description: \\\"Malformed predecessor fixture without a session id.\\\"\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-creation/expected-3phase-named/003-verify/plan.md:5:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC5-lineage/ambiguity/memory/06-04-26_09-00__candidate-b.md:4:session_id: \\\"ambiguous-b\\\"\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-creation/expected-3phase-named/002-build/plan.md:5:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-creation/expected-3phase-named/002-build/tasks.md:5:trigger_phrases:\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-detection/no-phase/spec.md:18:- Phase score: 0/50 (no dimensions triggered)\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC5-lineage/hit/memory/06-04-26_12-05__deep-research-run-8.md:4:session_id: \\\"hit-predecessor-1\\\"\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/phase-detection/phase-minimum/spec.md:20:- Phase score: 30/50 (3 of 5 dimensions triggered)\\n.opencode/skills/system-spec-kit/scripts/tests/fixtures/memory-quality/F-AC5-lineage/ambiguity/memory/06-04-26_09-00__candidate-a.md:4:session_id: \\\"ambiguous-a\\\"\\n\", truncated_after_lines: None }, duration: 0ns, timed_out: false }, network_policy_decision: None }))" }
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:19756:.opencode/skills/system-spec-kit/mcp_server/lib/storage/post-insert-metadata.ts:55:  'content_hash', 'context_type', 'importance_tier', 'memory_type',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:19885:.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:179:    CREATE INDEX IF NOT EXISTS idx_content_hash ON memory_index(content_hash);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:20050:- `incremental-index.ts` uses `file_mtime_ms`, `content_hash`, and `embedding_status` together, so unchanged-path fast paths still requeue rows whose embeddings are unhealthy.
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:20107:  content_hash?: string;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:20825:    'idx_save_parent_content_hash_scope',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:20886:  CREATE INDEX IF NOT EXISTS idx_save_parent_content_hash_scope
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:20889:    content_hash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:20942:  return /PRIMARY\s+KEY\s*\(\s*content_hash\s*,\s*model_id\s*,\s*dimensions\s*\)/i.test(tableSql);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:20962:      content_hash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:20970:      content_hash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:21414:      content_hash TEXT,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:21732:/bin/zsh -lc 'rg -n "memory_index|writeFile|generate-context|sessionSummary|trigger_phrases|importance_tier|content_hash|parent_id|chunk_index|quality_score|memory file|index" .opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts .opencode/skills/system-spec-kit/scripts/memory/generate-context.ts .opencode/skills/system-spec-kit/scripts/dist/memory/generate-context.js' in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:21783:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:914:    let existing: { id: number; content_hash: string } | undefined;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:21784:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:935:      ) as { id: number; content_hash: string } | undefined;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:21785:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:937:      const memoryId = existing && existing.content_hash !== parsed.contentHash
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:21786:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:969:        predecessorMemoryId: existing && existing.content_hash !== parsed.contentHash
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:21787:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:973:        transitionEvent: existing && existing.content_hash !== parsed.contentHash
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:24650:  2329	      content_hash TEXT,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:25356:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:969:        predecessorMemoryId: existing && existing.content_hash !== parsed.contentHash
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:25615:   935	      ) as { id: number; content_hash: string } | undefined;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:25617:   937	      const memoryId = existing && existing.content_hash !== parsed.contentHash
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:25649:   969	        predecessorMemoryId: existing && existing.content_hash !== parsed.contentHash
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:25653:   973	        transitionEvent: existing && existing.content_hash !== parsed.contentHash
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:48769:/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/save/dedup.ts:95:    SELECT id, content_hash, embedding_status, trigger_phrases, quality_score, quality_flags
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55428:/bin/zsh -lc 'rg -n "archived|deleted|soft delete|content_hash|duplicate|dedup|upsert|revision|trigger phrases|memory_update|memory_delete|memory_save|importanceTier|title|state|ARCHIVED|deleted_at|contentHash" .opencode/skills/system-spec-kit/mcp_server .opencode/skills/system-spec-kit/scripts' in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55484:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-types.ts:70:  content_hash: string | null;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55503:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-bulk-delete.ts:184:  let selectSql = 'SELECT id, content_hash, file_path, spec_folder FROM memory_index WHERE importance_tier = ?';
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55504:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-bulk-delete.ts:199:    content_hash: string | null;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55541:.opencode/skills/system-spec-kit/mcp_server/handlers/save/create-record.ts:101:): { id: number; title: string | null; content_hash?: string | null } | undefined {
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55542:.opencode/skills/system-spec-kit/mcp_server/handlers/save/create-record.ts:109:    SELECT id, title, content_hash
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55543:.opencode/skills/system-spec-kit/mcp_server/handlers/save/create-record.ts:135:  ) as { id: number; title: string | null; content_hash?: string | null } | undefined;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55546:.opencode/skills/system-spec-kit/mcp_server/handlers/save/create-record.ts:216:      content_hash: parsed.contentHash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55575:.opencode/skills/system-spec-kit/mcp_server/handlers/save/types.ts:144:  content_hash?: string;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55580:.opencode/skills/system-spec-kit/mcp_server/handlers/save/pe-orchestration.ts:89:            priorHash: priorSnapshot?.content_hash ?? null,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55585:.opencode/skills/system-spec-kit/mcp_server/handlers/save/pe-orchestration.ts:141:          priorHash: priorSnapshot?.content_hash ?? null,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55589:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-health.ts:94:  content_hash: string | null;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55591:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-health.ts:183:    bucket.variants.set(normalizedPath, row.content_hash ?? null);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55592:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-health.ts:184:    if (typeof row.content_hash === 'string' && row.content_hash.trim().length > 0) {
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55593:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-health.ts:185:      bucket.hashes.add(row.content_hash.trim());
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55595:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-health.ts:318:        SELECT file_path, content_hash, spec_folder
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55613:.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:60:  content_hash?: string;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55614:.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:94:  'content_hash', 'context_type', 'importance_tier', 'memory_type',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55621:.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:241:        content_hash: parsed.contentHash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55626:.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:342:          content_hash: parsed.contentHash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55640:.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:505:        SET content_hash = ?,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55662:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-delete.ts:123:          priorHash: singleSnapshot?.content_hash ?? null,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55666:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-delete.ts:148:          SELECT id, content_hash, spec_folder, file_path
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55673:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-delete.ts:221:          priorHash: snapshot?.content_hash ?? null,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55698:.opencode/skills/system-spec-kit/mcp_server/handlers/save/reconsolidation-bridge.ts:260:                  content_hash: parsed.contentHash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55732:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-update.ts:204:        priorHash: priorSnapshot?.content_hash ?? (existing.content_hash as string | null) ?? null,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55765:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:914:    let existing: { id: number; content_hash: string } | undefined;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55767:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:935:      ) as { id: number; content_hash: string } | undefined;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55768:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:937:      const memoryId = existing && existing.content_hash !== parsed.contentHash
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55770:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:969:        predecessorMemoryId: existing && existing.content_hash !== parsed.contentHash
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55772:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:973:        transitionEvent: existing && existing.content_hash !== parsed.contentHash
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55831:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-utils.ts:32:      SELECT id, content_hash, spec_folder, file_path
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55860:.opencode/skills/system-spec-kit/mcp_server/handlers/save/dedup.ts:38:  content_hash: string;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55862:.opencode/skills/system-spec-kit/mcp_server/handlers/save/dedup.ts:95:    SELECT id, content_hash, embedding_status, trigger_phrases, quality_score, quality_flags
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55865:.opencode/skills/system-spec-kit/mcp_server/handlers/save/dedup.ts:229:  if (existing && existing.content_hash === parsed.contentHash && isUnchangedEligible && isMetadataEquivalent) {
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55868:.opencode/skills/system-spec-kit/mcp_server/handlers/save/dedup.ts:257:      'content_hash = ?',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55886:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index-alias.ts:22:  content_hash: string | null;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55887:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index-alias.ts:146:    if (typeof row.content_hash === 'string' && row.content_hash.trim().length > 0) {
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55888:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index-alias.ts:147:      bucket.hashes.add(row.content_hash.trim());
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55889:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index-alias.ts:203:      SELECT file_path, content_hash
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55890:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index-alias.ts:228:    SELECT file_path, content_hash
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55916:.opencode/skills/system-spec-kit/mcp_server/handlers/pe-gating.ts:178:          content_hash = CASE WHEN content_text IS NULL THEN ? ELSE content_hash END,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55924:.opencode/skills/system-spec-kit/mcp_server/handlers/pe-gating.ts:278:      content_hash: parsed.contentHash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55943:.opencode/skills/system-spec-kit/mcp_server/handlers/save/response-builder.ts:47:  existing: { id: number; content_hash: string } | undefined;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:55946:.opencode/skills/system-spec-kit/mcp_server/handlers/save/response-builder.ts:146:    priorHash: existing?.content_hash ?? null,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:56121:.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:36:  content_hash?: string;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:56130:.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:485:  if (memory.content_hash) {
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:56131:.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:486:    hashInput = memory.content_hash;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:56413:.opencode/skills/system-spec-kit/mcp_server/handlers/quality-loop.ts:656:        // Return mutated content so caller can persist it and recompute content_hash
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:56610:.opencode/skills/system-spec-kit/mcp_server/lib/validation/preflight.ts:67:  content_hash: string | null;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:56612:.opencode/skills/system-spec-kit/mcp_server/lib/validation/preflight.ts:98:  content_hash?: string;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:56620:.opencode/skills/system-spec-kit/mcp_server/lib/validation/preflight.ts:420:    content_hash: provided_hash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:56624:.opencode/skills/system-spec-kit/mcp_server/lib/validation/preflight.ts:443:    content_hash: null,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:56632:.opencode/skills/system-spec-kit/mcp_server/lib/validation/preflight.ts:510:  const content_hash = provided_hash || computeContentHash(content);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:56633:.opencode/skills/system-spec-kit/mcp_server/lib/validation/preflight.ts:511:  result.content_hash = content_hash;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:56635:.opencode/skills/system-spec-kit/mcp_server/lib/validation/preflight.ts:516:      const whereClauses = ['content_hash = ?'];
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:56636:.opencode/skills/system-spec-kit/mcp_server/lib/validation/preflight.ts:517:      const paramsArray: unknown[] = [content_hash];
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:56820:.opencode/skills/system-spec-kit/mcp_server/lib/parsing/memory-parser.ts:256:  const content_hash = computeContentHash(content);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:56825:.opencode/skills/system-spec-kit/mcp_server/lib/parsing/memory-parser.ts:279:    contentHash: content_hash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:57523:.opencode/skills/system-spec-kit/mcp_server/lib/cache/embedding-cache.ts:48:      content_hash TEXT NOT NULL,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:57524:.opencode/skills/system-spec-kit/mcp_server/lib/cache/embedding-cache.ts:54:      PRIMARY KEY (content_hash, model_id, dimensions)
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:57527:.opencode/skills/system-spec-kit/mcp_server/lib/cache/embedding-cache.ts:79:    'SELECT embedding FROM embedding_cache WHERE content_hash = ? AND model_id = ? AND dimensions = ?',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:57529:.opencode/skills/system-spec-kit/mcp_server/lib/cache/embedding-cache.ts:93:    "UPDATE embedding_cache SET last_used_at = datetime('now') WHERE content_hash = ? AND model_id = ? AND dimensions = ?",
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:57531:.opencode/skills/system-spec-kit/mcp_server/lib/cache/embedding-cache.ts:108: * Uses INSERT OR REPLACE so duplicate (content_hash, model_id, dimensions)
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:57534:.opencode/skills/system-spec-kit/mcp_server/lib/cache/embedding-cache.ts:146:       (content_hash, model_id, embedding, dimensions, last_used_at)
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:57986:.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index.vitest.ts:164:          content_hash: 'hash-1',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:57987:.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index.vitest.ts:168:          content_hash: 'hash-1',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:57988:.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index.vitest.ts:184:          content_hash: 'hash-1',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:57989:.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index.vitest.ts:188:          content_hash: 'hash-2',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:57990:.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index.vitest.ts:202:          content_hash: 'hash-1',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:57991:.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index.vitest.ts:206:          content_hash: 'hash-1',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:57992:.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index.vitest.ts:346:        { file_path: '/workspace/specs/system-spec-kit/801-a/memory/x.md', content_hash: 'hash-a' },
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:57993:.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index.vitest.ts:347:        { file_path: '/workspace/.opencode/specs/system-spec-kit/801-a/memory/x.md', content_hash: 'hash-b' },
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:57994:.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index.vitest.ts:348:        { file_path: '/workspace/specs/system-spec-kit/802-b/memory/y.md', content_hash: 'hash-c' },
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:57995:.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index.vitest.ts:349:        { file_path: '/workspace/.opencode/specs/system-spec-kit/802-b/memory/y.md', content_hash: 'hash-d' },
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:57996:.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index.vitest.ts:350:        { file_path: '/workspace/specs/system-spec-kit/803-c/memory/z.md', content_hash: 'hash-e' },
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:57997:.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-index.vitest.ts:351:        { file_path: '/workspace/.opencode/specs/system-spec-kit/803-c/memory/z.md', content_hash: 'hash-f' },
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58292:.opencode/skills/system-spec-kit/scripts/tests/test-retry-manager-behavioral.js:93:      content_hash TEXT DEFAULT ''
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58358:.opencode/skills/system-spec-kit/mcp_server/tests/unit-normalization.vitest.ts:35:    content_hash: 'sha256-abc',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58364:.opencode/skills/system-spec-kit/mcp_server/tests/unit-normalization.vitest.ts:123:    expect(row.content_hash).toBe('sha256-abc');
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58366:.opencode/skills/system-spec-kit/mcp_server/tests/unit-normalization.vitest.ts:163:    row.content_hash = null;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58542:.opencode/skills/system-spec-kit/mcp_server/tests/chunking-orchestrator.vitest.ts:58:        content_hash TEXT NOT NULL,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58543:.opencode/skills/system-spec-kit/mcp_server/tests/chunking-orchestrator.vitest.ts:64:        PRIMARY KEY (content_hash, model_id)
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58680:.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts:115:        content_hash TEXT DEFAULT '',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58709:.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts:659:          id, spec_folder, file_path, title, content_text, content_hash, importance_weight, created_at, updated_at
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58711:.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts:682:              content_hash = 'hash-after',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58715:.opencode/skills/system-spec-kit/mcp_server/tests/reconsolidation.vitest.ts:713:          id, spec_folder, file_path, title, content_text, content_hash, importance_weight, created_at, updated_at
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58749:.opencode/skills/system-spec-kit/mcp_server/tests/retry-manager.vitest.ts:527:            content_hash TEXT NOT NULL,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58750:.opencode/skills/system-spec-kit/mcp_server/tests/retry-manager.vitest.ts:533:            PRIMARY KEY (content_hash, model_id)
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58813:.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-extended.vitest.ts:77:        content_hash TEXT,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58814:.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-extended.vitest.ts:146:      INSERT INTO memory_index (id, spec_folder, file_path, title, content, content_hash, stability, difficulty)
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58817:.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-extended.vitest.ts:269:          id, spec_folder, file_path, canonical_file_path, title, content, content_hash, stability, difficulty
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58831:.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-extended.vitest.ts:603:    it('backfills content_hash when reinforcement populates missing content_text', () => {
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58835:.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-extended.vitest.ts:621:            id, spec_folder, file_path, title, content_text, content_hash, stability, difficulty, review_count
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58837:.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-extended.vitest.ts:638:          SELECT content_text, content_hash
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58838:.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-extended.vitest.ts:641:        `).get(55) as { content_text: string | null; content_hash: string | null };
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58839:.opencode/skills/system-spec-kit/mcp_server/tests/memory-save-extended.vitest.ts:644:        expect(updated.content_hash).toBe(parsed.contentHash);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58868:.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:53:      content_hash TEXT,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58869:.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:73:  content_hash?: string | null;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58870:.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:78:    INSERT INTO memory_index (spec_folder, file_path, file_mtime_ms, content_hash, embedding_status)
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58871:.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:85:    opts.content_hash ?? null,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58872:.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:205:  it('returns correct row shape {file_path, file_mtime_ms, content_hash, embedding_status}', () => {
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58873:.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:211:      content_hash: 'abc123',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58874:.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:221:    expect(row.content_hash).toBe('abc123');
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58875:.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:232:      content_hash: null,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58876:.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:241:    expect(row.content_hash).toBeNull();
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58877:.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:267:      INSERT INTO memory_index (spec_folder, file_path, canonical_file_path, file_mtime_ms, content_hash, embedding_status)
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58878:.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:277:    expect(row.content_hash).toBe('alias-hash');
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58882:.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:347:      content_hash: sha256('original content'),
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58883:.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:443:      INSERT INTO memory_index (spec_folder, file_path, canonical_file_path, file_mtime_ms, content_hash, embedding_status)
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58888:.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:572:      INSERT INTO memory_index (spec_folder, file_path, canonical_file_path, file_mtime_ms, content_hash, embedding_status)
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58889:.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:620:      INSERT INTO memory_index (spec_folder, file_path, canonical_file_path, file_mtime_ms, content_hash, embedding_status)
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58890:.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:688:    insertRow(db, { file_path: successFile, file_mtime_ms: successMeta.mtime, content_hash: 'hash-ok', embedding_status: 'success' });
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58891:.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index-v2.vitest.ts:705:    insertRow(db, { file_path: failedFile, file_mtime_ms: failedMeta.mtime, content_hash: 'hash-fail', embedding_status: 'failed' });
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58927:.opencode/skills/system-spec-kit/mcp_server/tests/handler-helpers.vitest.ts:115:      content_hash TEXT,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58928:.opencode/skills/system-spec-kit/mcp_server/tests/handler-helpers.vitest.ts:182:    INSERT INTO memory_index (id, spec_folder, file_path, title, content, content_hash, stability, difficulty)
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:58931:.opencode/skills/system-spec-kit/mcp_server/tests/handler-helpers.vitest.ts:617:      INSERT INTO memory_index (id, spec_folder, file_path, title, content, content_hash, stability, difficulty)
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59166:.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:6:// Same content_hash) and proceeds to embed for changed content.
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59170:.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:52:      content_hash TEXT,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59171:.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:58:    CREATE INDEX IF NOT EXISTS idx_content_hash ON memory_index(content_hash);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59174:.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:88:      content_hash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59191:.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:213:        INSERT INTO memory_index (spec_folder, file_path, content_hash, embedding_status)
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59205:.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:330:          spec_folder, file_path, canonical_file_path, title, content_hash, content_text, embedding_status, parent_id
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59207:.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:414:          spec_folder, file_path, canonical_file_path, title, content_hash, embedding_status, parent_id
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59208:.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:435:          spec_folder, file_path, canonical_file_path, title, content_hash, embedding_status, parent_id
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59211:.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:457:          spec_folder, file_path, canonical_file_path, title, content_hash, embedding_status, trigger_phrases, quality_score, quality_flags, parent_id
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59214:.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:487:          spec_folder, file_path, canonical_file_path, title, content_hash, embedding_status, trigger_phrases, quality_score, quality_flags, parent_id
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59217:.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:519:          spec_folder, file_path, canonical_file_path, title, content_hash, embedding_status, parent_id
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59220:.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:546:          spec_folder, file_path, canonical_file_path, title, content_hash, embedding_status, parent_id
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59222:.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:573:          spec_folder, file_path, canonical_file_path, title, content_hash, embedding_status, parent_id
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59223:.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:598:          spec_folder, file_path, canonical_file_path, title, content_hash, embedding_status, tenant_id, parent_id
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59224:.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:627:          spec_folder, file_path, canonical_file_path, title, content_hash, embedding_status, tenant_id, parent_id
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59232:.opencode/skills/system-spec-kit/mcp_server/tests/content-hash-dedup.vitest.ts:722:        INSERT INTO memory_index (spec_folder, file_path, content_hash, embedding_status)
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59301:.opencode/skills/system-spec-kit/mcp_server/tests/checkpoints-extended.vitest.ts:29:  content_hash: string | null;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59316:.opencode/skills/system-spec-kit/mcp_server/tests/checkpoints-extended.vitest.ts:535:        'ALTER TABLE memory_index ADD COLUMN content_hash TEXT',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59319:.opencode/skills/system-spec-kit/mcp_server/tests/checkpoints-extended.vitest.ts:554:            content_hash = ?,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59320:.opencode/skills/system-spec-kit/mcp_server/tests/checkpoints-extended.vitest.ts:579:            content_hash = NULL,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59321:.opencode/skills/system-spec-kit/mcp_server/tests/checkpoints-extended.vitest.ts:593:        SELECT canonical_file_path, content_hash, content_text, quality_score, quality_flags, chunk_index, chunk_label
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59322:.opencode/skills/system-spec-kit/mcp_server/tests/checkpoints-extended.vitest.ts:601:      expect(restored.content_hash).toBe('abc123hash');
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59361:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-types.ts:63:  content_hash?: string | null;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59402:.opencode/skills/system-spec-kit/mcp_server/tests/session-manager.vitest.ts:37:  content_hash?: string;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59405:.opencode/skills/system-spec-kit/mcp_server/tests/session-manager.vitest.ts:122:    it('T002: Hash generated with content_hash', () => {
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59406:.opencode/skills/system-spec-kit/mcp_server/tests/session-manager.vitest.ts:123:      const memory1: MemoryObject = createMemory({ content_hash: 'abc123def456' });
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59407:.opencode/skills/system-spec-kit/mcp_server/tests/session-manager.vitest.ts:142:      const memory: MemoryObject = createMemory({ content_hash: 'abc123def456' });
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59408:.opencode/skills/system-spec-kit/mcp_server/tests/session-manager.vitest.ts:149:      const memory1: MemoryObject = createMemory({ content_hash: 'abc123def456' });
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59432:.opencode/skills/system-spec-kit/mcp_server/tests/session-manager.vitest.ts:412:        content_hash: 'cross-path-hash-123',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59433:.opencode/skills/system-spec-kit/mcp_server/tests/session-manager.vitest.ts:418:        content_hash: 'cross-path-hash-123',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59434:.opencode/skills/system-spec-kit/mcp_server/tests/session-manager.vitest.ts:421:      // Same content_hash → same dedup hash regardless of path
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59474:.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-db.ts:59:    content_hash TEXT NOT NULL,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59475:.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-db.ts:83:    content_hash TEXT NOT NULL
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59476:.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-db.ts:114:  CREATE INDEX IF NOT EXISTS idx_files_hash ON code_files(content_hash);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59479:.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-db.ts:278:      UPDATE code_files SET language = ?, content_hash = ?, node_count = ?, edge_count = ?,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59481:.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-db.ts:287:      file_path, language, content_hash, file_mtime_ms, node_count, edge_count, parse_health, indexed_at, parse_duration_ms
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59483:.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-db.ts:299:      start_line, end_line, start_column, end_column, language, signature, docstring, content_hash)
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59485:.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-db.ts:692:    contentHash: r.content_hash as string,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59567:.opencode/skills/system-spec-kit/mcp_server/lib/coverage-graph/coverage-graph-query.ts:257:        contentHash: r.content_hash as string | undefined,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59568:.opencode/skills/system-spec-kit/mcp_server/lib/coverage-graph/coverage-graph-query.ts:286:    contentHash: r.content_hash as string | undefined,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59623:.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:303:        content_hash: existingMemory?.content_hash ?? 'old-hash',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59625:.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:455:        if (sql.includes('file_path, content_hash')) return aliasRows;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59667:.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1307:        { file_path: '/workspace/specs/system-spec-kit/001-test/memory/a.md', content_hash: 'hash-1' },
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59668:.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1308:        { file_path: '/workspace/.opencode/specs/system-spec-kit/001-test/memory/a.md', content_hash: 'hash-1' },
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59669:.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1324:        { file_path: '/workspace/specs/system-spec-kit/002-test/memory/b.md', content_hash: 'hash-1' },
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59670:.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1325:        { file_path: '/workspace/.opencode/specs/system-spec-kit/002-test/memory/b.md', content_hash: 'hash-2' },
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59671:.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1340:        { file_path: '/workspace/specs/system-spec-kit/010-test/memory/a.md', content_hash: 'hash-1', spec_folder: 'system-spec-kit/010-test' },
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59672:.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1341:        { file_path: '/workspace/.opencode/specs/system-spec-kit/010-test/memory/a.md', content_hash: 'hash-2', spec_folder: 'system-spec-kit/010-test' },
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59673:.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1363:        { file_path: 'C:\\workspace\\specs\\system-spec-kit\\011-test\\memory\\b.md', content_hash: 'hash-1', spec_folder: 'system-spec-kit/011-test' },
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59674:.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1364:        { file_path: 'C:\\workspace\\.opencode\\specs\\system-spec-kit\\011-test\\memory\\b.md', content_hash: 'hash-2', spec_folder: 'system-spec-kit/011-test' },
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59675:.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1384:        { file_path: 'specs/system-spec-kit/012-test/memory/c.md', content_hash: 'hash-1', spec_folder: 'system-spec-kit/012-test' },
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59676:.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1385:        { file_path: '.opencode/specs/system-spec-kit/012-test/memory/c.md', content_hash: 'hash-2', spec_folder: 'system-spec-kit/012-test' },
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59677:.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1405:        { file_path: '/workspace/specs/system-spec-kit/020-test/memory/a.md', content_hash: 'hash-1', spec_folder: 'system-spec-kit/020-test' },
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59678:.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1406:        { file_path: '/workspace/.opencode/specs/system-spec-kit/020-test/memory/a.md', content_hash: 'hash-2', spec_folder: 'system-spec-kit/020-test' },
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59679:.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1407:        { file_path: '/workspace/specs/system-spec-kit/021-test/memory/b.md', content_hash: 'hash-3', spec_folder: 'system-spec-kit/021-test' },
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59680:.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1408:        { file_path: '/workspace/.opencode/specs/system-spec-kit/021-test/memory/b.md', content_hash: 'hash-4', spec_folder: 'system-spec-kit/021-test' },
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59686:.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1806:    installUpdateMocks({ existingMemory: { id: 7, title: 'Old title', content_hash: 'old-hash' } });
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59687:.opencode/skills/system-spec-kit/mcp_server/tests/memory-crud-extended.vitest.ts:1809:        get: (_id: number) => ({ id: 7, content_hash: 'old-hash', spec_folder: 'specs/test', file_path: '/tmp/memory.md' }),
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59691:.opencode/skills/system-spec-kit/mcp_server/tests/cli.vitest.ts:62:      (spec_folder, file_path, title, content_hash, importance_tier, created_at, updated_at, embedding_status)
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59696:.opencode/skills/system-spec-kit/mcp_server/lib/coverage-graph/coverage-graph-db.ts:160:    content_hash TEXT,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59698:.opencode/skills/system-spec-kit/mcp_server/lib/coverage-graph/coverage-graph-db.ts:296:        kind = ?, name = ?, content_hash = ?, iteration = ?,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59700:.opencode/skills/system-spec-kit/mcp_server/lib/coverage-graph/coverage-graph-db.ts:309:      content_hash, iteration, metadata, created_at, updated_at
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:59706:.opencode/skills/system-spec-kit/mcp_server/lib/coverage-graph/coverage-graph-db.ts:608:    contentHash: r.content_hash as string | undefined,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:60273:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:60:    'idx_save_parent_content_hash_scope',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:60274:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:121:  CREATE INDEX IF NOT EXISTS idx_save_parent_content_hash_scope
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:60275:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:124:    content_hash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:60276:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:177:  return /PRIMARY\s+KEY\s*\(\s*content_hash\s*,\s*model_id\s*,\s*dimensions\s*\)/i.test(tableSql);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:60277:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:197:      content_hash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:60278:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:205:      content_hash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:60315:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1741:  if (!column_names.includes('content_hash')) {
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:60316:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1743:      database.exec(`ALTER TABLE memory_index ADD COLUMN content_hash TEXT`);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:60317:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1744:      console.warn('[vector-index] Migration: Added content_hash column');
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:60319:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1749:      logDuplicateColumnMigrationSkip('content_hash', error);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:60333:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2030:    database.exec(`CREATE INDEX IF NOT EXISTS idx_content_hash ON memory_index(content_hash)`);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:60334:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2033:      'idx_save_parent_content_hash_scope',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:60335:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2037:    logger.info('Created idx_content_hash index');
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:60336:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2041:      index: 'idx_content_hash/idx_save_parent_content_hash_scope',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:60346:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2329:      content_hash TEXT,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:60357:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2453:    CREATE INDEX IF NOT EXISTS idx_content_hash ON memory_index(content_hash);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:60358:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2454:    CREATE INDEX IF NOT EXISTS idx_save_parent_content_hash_scope ON memory_index(
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:60359:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2456:      content_hash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:60585:.opencode/skills/system-spec-kit/mcp_server/tests/embedding-cache.vitest.ts:135:      .prepare('SELECT last_used_at FROM embedding_cache WHERE content_hash = ? AND model_id = ? AND dimensions = ?')
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:60586:.opencode/skills/system-spec-kit/mcp_server/tests/embedding-cache.vitest.ts:140:      "UPDATE embedding_cache SET last_used_at = datetime('now', '-1 day') WHERE content_hash = ? AND model_id = ? AND dimensions = ?",
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:60587:.opencode/skills/system-spec-kit/mcp_server/tests/embedding-cache.vitest.ts:144:      .prepare('SELECT last_used_at FROM embedding_cache WHERE content_hash = ? AND model_id = ? AND dimensions = ?')
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:60588:.opencode/skills/system-spec-kit/mcp_server/tests/embedding-cache.vitest.ts:151:      .prepare('SELECT last_used_at FROM embedding_cache WHERE content_hash = ? AND model_id = ? AND dimensions = ?')
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:60589:.opencode/skills/system-spec-kit/mcp_server/tests/embedding-cache.vitest.ts:169:      "UPDATE embedding_cache SET last_used_at = datetime('now', '-10 days') WHERE content_hash = ? AND model_id = ? AND dimensions = ?",
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:60596:.opencode/skills/system-spec-kit/mcp_server/tests/safety.vitest.ts:117:          content_hash TEXT,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:60611:.opencode/skills/system-spec-kit/mcp_server/tests/mpab-quality-gate-integration.vitest.ts:366:            content_hash TEXT DEFAULT '',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:60972:.opencode/skills/system-spec-kit/mcp_server/tests/preflight.vitest.ts:115:      expect(result.content_hash).toBeTruthy();
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:60973:.opencode/skills/system-spec-kit/mcp_server/tests/preflight.vitest.ts:116:      expect(result.content_hash).toHaveLength(64);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:60976:.opencode/skills/system-spec-kit/mcp_server/tests/preflight.vitest.ts:142:          content_hash: contentHash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:60985:.opencode/skills/system-spec-kit/mcp_server/tests/preflight.vitest.ts:471:      expect(result.content_hash).toBe(contentHash);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:60989:.opencode/skills/system-spec-kit/mcp_server/tests/preflight.vitest.ts:490:      expect(result.content_hash).toBeTruthy();
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61035:.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-save.vitest.ts:208:      existingSamePathMemory?: { id: number; content_hash: string };
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61048:.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-save.vitest.ts:664:      const existingSamePathMemory = { id: 42, content_hash: 'older-hash' };
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61066:.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-save.vitest.ts:1927:          content_hash: 'fi-hash',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61067:.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-save.vitest.ts:1935:          content_hash: 'fi-hash',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61068:.opencode/skills/system-spec-kit/mcp_server/tests/handler-memory-save.vitest.ts:1943:          content_hash: 'fi-hash',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61147:.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:63:  'content_hash',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61150:.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:139:      content_hash TEXT,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61152:.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:179:    CREATE INDEX IF NOT EXISTS idx_content_hash ON memory_index(content_hash);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61326:.opencode/skills/system-spec-kit/mcp_server/tests/checkpoint-completeness.vitest.ts:174:      content_hash TEXT NOT NULL,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61327:.opencode/skills/system-spec-kit/mcp_server/tests/checkpoint-completeness.vitest.ts:180:      PRIMARY KEY (content_hash, model_id)
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61329:.opencode/skills/system-spec-kit/mcp_server/tests/checkpoint-completeness.vitest.ts:219:      content_hash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61331:.opencode/skills/system-spec-kit/mcp_server/tests/checkpoint-completeness.vitest.ts:267:      content_hash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61335:.opencode/skills/system-spec-kit/mcp_server/tests/checkpoint-completeness.vitest.ts:401:    INSERT INTO embedding_cache (content_hash, model_id, embedding, dimensions, created_at, last_used_at)
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61396:.opencode/skills/system-spec-kit/mcp_server/lib/storage/post-insert-metadata.ts:18:  content_hash?: string;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61397:.opencode/skills/system-spec-kit/mcp_server/lib/storage/post-insert-metadata.ts:55:  'content_hash', 'context_type', 'importance_tier', 'memory_type',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61524:.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1335:    'content_hash',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61586:.opencode/skills/system-spec-kit/mcp_server/lib/storage/README.md:65:- `incremental-index.ts` uses `file_mtime_ms`, `content_hash`, and `embedding_status` together, so unchanged-path fast paths still requeue rows whose embeddings are unhealthy.
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61667:.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:40:  content_hash?: string | null;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61671:.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:353:    contentHash: typeof row.content_hash === 'string' ? row.content_hash : null,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61675:.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:500:    content_hash: parsed.contentHash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61744:.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:307:        content_hash: mergedHash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61745:.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:335:        content_hash: mergedHash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61749:.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:529:              content_hash = ?,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61756:.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:820:    contentHash: getOptionalString(row, 'content_hash') ?? null,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61758:.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:829:  return snapshot.contentHash !== (getOptionalString(currentRow, 'content_hash') ?? null)
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61760:.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:901:    content_hash: existingRow.content_hash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61798:.opencode/skills/system-spec-kit/mcp_server/tests/feature-eval-scoring-calibration.vitest.ts:120:      "UPDATE embedding_cache SET last_used_at = datetime('now', '-15 days') WHERE content_hash = ?",
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61873:.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:37:  content_hash: string | null;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61875:.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:119:          SELECT file_path, canonical_file_path, file_mtime_ms, content_hash, embedding_status
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61876:.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:126:          SELECT file_path, file_mtime_ms, content_hash, embedding_status
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61878:.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:179:    if (stored.content_hash) {
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61879:.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:181:      if (currentContentHash && currentContentHash !== stored.content_hash) {
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61881:.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index.vitest.ts:18:      content_hash TEXT,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61882:.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index.vitest.ts:81:      INSERT INTO memory_index (spec_folder, file_path, file_mtime_ms, content_hash, embedding_status)
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61883:.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index.vitest.ts:94:      INSERT INTO memory_index (spec_folder, file_path, file_mtime_ms, content_hash, embedding_status)
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61884:.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index.vitest.ts:109:      INSERT INTO memory_index (spec_folder, file_path, file_mtime_ms, content_hash, embedding_status)
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61886:.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index.vitest.ts:115:      INSERT INTO memory_index (spec_folder, file_path, file_mtime_ms, content_hash, embedding_status)
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61889:.opencode/skills/system-spec-kit/mcp_server/tests/incremental-index.vitest.ts:131:      INSERT INTO memory_index (spec_folder, file_path, file_mtime_ms, content_hash, embedding_status)
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61920:.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:720:        content_hash: 'previous-hash',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:61923:.opencode/skills/system-spec-kit/mcp_server/tests/bm25-index.vitest.ts:757:      getMemoryHashSnapshot: vi.fn(() => ({ content_hash: 'previous-hash' })),
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:62278:.opencode/skills/system-spec-kit/mcp_server/tests/chunking-orchestrator-swap.vitest.ts:142:      content_hash TEXT,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:62287:.opencode/skills/system-spec-kit/mcp_server/tests/chunking-orchestrator-swap.vitest.ts:263:      content_hash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:62289:.opencode/skills/system-spec-kit/mcp_server/tests/chunking-orchestrator-swap.vitest.ts:384:      SELECT content_hash, content_text
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:62290:.opencode/skills/system-spec-kit/mcp_server/tests/chunking-orchestrator-swap.vitest.ts:387:    `).get(parentId) as { content_hash: string; content_text: string };
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:62291:.opencode/skills/system-spec-kit/mcp_server/tests/chunking-orchestrator-swap.vitest.ts:388:    expect(parentRow.content_hash).toBe(parsed.contentHash);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:62410:.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-schema-compatibility.vitest.ts:36:          content_hash TEXT,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:62411:.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-schema-compatibility.vitest.ts:58:        CREATE INDEX idx_save_parent_content_hash_scope
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:62412:.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-schema-compatibility.vitest.ts:61:            content_hash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:62433:.opencode/skills/system-spec-kit/mcp_server/tests/unit-normalization-roundtrip.vitest.ts:41:        content_hash: null,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:62566:.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-schema-migration-refinements.vitest.ts:239:        content_hash TEXT NOT NULL,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:62567:.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-schema-migration-refinements.vitest.ts:245:        PRIMARY KEY (content_hash, model_id)
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:62568:.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-schema-migration-refinements.vitest.ts:250:      INSERT INTO embedding_cache (content_hash, model_id, embedding, dimensions, created_at, last_used_at)
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:62569:.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-schema-migration-refinements.vitest.ts:262:    expect(tableSql.sql).toMatch(/PRIMARY KEY \(content_hash, model_id, dimensions\)/);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:62570:.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-schema-migration-refinements.vitest.ts:265:      INSERT INTO embedding_cache (content_hash, model_id, embedding, dimensions, created_at, last_used_at)
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:62571:.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-schema-migration-refinements.vitest.ts:272:      WHERE content_hash = ? AND model_id = ?
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:62572:.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-schema-migration-refinements.vitest.ts:286:        AND name IN ('idx_save_parent_content_hash_scope', 'idx_save_parent_canonical_path')
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:62573:.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-schema-migration-refinements.vitest.ts:297:        name: 'idx_save_parent_content_hash_scope',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:62574:.opencode/skills/system-spec-kit/mcp_server/tests/vector-index-schema-migration-refinements.vitest.ts:303:    expect(indexes[1]?.sql).toContain('content_hash');
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:62623:.opencode/skills/system-spec-kit/mcp_server/tests/session-manager-extended.vitest.ts:17:  content_hash?: string;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64017:/bin/zsh -lc "rg -n \"recordHistory|mutationLedger|reconsolid|dedup|content hash|content_hash|checkContentHashDedup|checkExistingRow|memory_delete|DELETE FROM memory_index|is_archived|archived_at|ARCHIVED|session_state|COALESCE\\(|upsert\" .opencode/skills/system-spec-kit/mcp_server/handlers .opencode/skills/system-spec-kit/mcp_server/lib" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64042:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-types.ts:70:  content_hash: string | null;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64043:.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:36:  content_hash?: string;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64049:.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:485:  if (memory.content_hash) {
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64050:.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:486:    hashInput = memory.content_hash;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64103:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-bulk-delete.ts:184:  let selectSql = 'SELECT id, content_hash, file_path, spec_folder FROM memory_index WHERE importance_tier = ?';
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64104:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-bulk-delete.ts:199:    content_hash: string | null;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64136:.opencode/skills/system-spec-kit/mcp_server/handlers/save/create-record.ts:101:): { id: number; title: string | null; content_hash?: string | null } | undefined {
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64137:.opencode/skills/system-spec-kit/mcp_server/handlers/save/create-record.ts:109:    SELECT id, title, content_hash
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64138:.opencode/skills/system-spec-kit/mcp_server/handlers/save/create-record.ts:135:  ) as { id: number; title: string | null; content_hash?: string | null } | undefined;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64139:.opencode/skills/system-spec-kit/mcp_server/handlers/save/create-record.ts:216:      content_hash: parsed.contentHash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64149:.opencode/skills/system-spec-kit/mcp_server/handlers/save/types.ts:144:  content_hash?: string;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64166:.opencode/skills/system-spec-kit/mcp_server/lib/validation/preflight.ts:67:  content_hash: string | null;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64167:.opencode/skills/system-spec-kit/mcp_server/lib/validation/preflight.ts:98:  content_hash?: string;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64168:.opencode/skills/system-spec-kit/mcp_server/lib/validation/preflight.ts:420:    content_hash: provided_hash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64169:.opencode/skills/system-spec-kit/mcp_server/lib/validation/preflight.ts:443:    content_hash: null,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64171:.opencode/skills/system-spec-kit/mcp_server/lib/validation/preflight.ts:510:  const content_hash = provided_hash || computeContentHash(content);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64172:.opencode/skills/system-spec-kit/mcp_server/lib/validation/preflight.ts:511:  result.content_hash = content_hash;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64174:.opencode/skills/system-spec-kit/mcp_server/lib/validation/preflight.ts:516:      const whereClauses = ['content_hash = ?'];
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64175:.opencode/skills/system-spec-kit/mcp_server/lib/validation/preflight.ts:517:      const paramsArray: unknown[] = [content_hash];
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64190:.opencode/skills/system-spec-kit/mcp_server/handlers/save/reconsolidation-bridge.ts:260:                  content_hash: parsed.contentHash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64200:.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:63:  'content_hash',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64202:.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:139:      content_hash TEXT,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64204:.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:179:    CREATE INDEX IF NOT EXISTS idx_content_hash ON memory_index(content_hash);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64207:.opencode/skills/system-spec-kit/mcp_server/handlers/save/dedup.ts:38:  content_hash: string;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64208:.opencode/skills/system-spec-kit/mcp_server/handlers/save/dedup.ts:95:    SELECT id, content_hash, embedding_status, trigger_phrases, quality_score, quality_flags
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64211:.opencode/skills/system-spec-kit/mcp_server/handlers/save/dedup.ts:229:  if (existing && existing.content_hash === parsed.contentHash && isUnchangedEligible && isMetadataEquivalent) {
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64213:.opencode/skills/system-spec-kit/mcp_server/handlers/save/dedup.ts:257:      'content_hash = ?',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64240:.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:37:  content_hash: string | null;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64241:.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:119:          SELECT file_path, canonical_file_path, file_mtime_ms, content_hash, embedding_status
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64242:.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:126:          SELECT file_path, file_mtime_ms, content_hash, embedding_status
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64243:.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:179:    if (stored.content_hash) {
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64244:.opencode/skills/system-spec-kit/mcp_server/lib/storage/incremental-index.ts:181:      if (currentContentHash && currentContentHash !== stored.content_hash) {
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64245:.opencode/skills/system-spec-kit/mcp_server/lib/coverage-graph/coverage-graph-query.ts:257:        contentHash: r.content_hash as string | undefined,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64246:.opencode/skills/system-spec-kit/mcp_server/lib/coverage-graph/coverage-graph-query.ts:286:    contentHash: r.content_hash as string | undefined,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64249:.opencode/skills/system-spec-kit/mcp_server/handlers/save/response-builder.ts:47:  existing: { id: number; content_hash: string } | undefined;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64250:.opencode/skills/system-spec-kit/mcp_server/handlers/save/response-builder.ts:146:    priorHash: existing?.content_hash ?? null,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64251:.opencode/skills/system-spec-kit/mcp_server/lib/cache/embedding-cache.ts:48:      content_hash TEXT NOT NULL,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64252:.opencode/skills/system-spec-kit/mcp_server/lib/cache/embedding-cache.ts:54:      PRIMARY KEY (content_hash, model_id, dimensions)
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64254:.opencode/skills/system-spec-kit/mcp_server/lib/cache/embedding-cache.ts:79:    'SELECT embedding FROM embedding_cache WHERE content_hash = ? AND model_id = ? AND dimensions = ?',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64255:.opencode/skills/system-spec-kit/mcp_server/lib/cache/embedding-cache.ts:93:    "UPDATE embedding_cache SET last_used_at = datetime('now') WHERE content_hash = ? AND model_id = ? AND dimensions = ?",
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64256:.opencode/skills/system-spec-kit/mcp_server/lib/cache/embedding-cache.ts:108: * Uses INSERT OR REPLACE so duplicate (content_hash, model_id, dimensions)
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64257:.opencode/skills/system-spec-kit/mcp_server/lib/cache/embedding-cache.ts:146:       (content_hash, model_id, embedding, dimensions, last_used_at)
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64265:.opencode/skills/system-spec-kit/mcp_server/lib/storage/post-insert-metadata.ts:18:  content_hash?: string;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64266:.opencode/skills/system-spec-kit/mcp_server/lib/storage/post-insert-metadata.ts:55:  'content_hash', 'context_type', 'importance_tier', 'memory_type',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64269:.opencode/skills/system-spec-kit/mcp_server/lib/coverage-graph/coverage-graph-db.ts:160:    content_hash TEXT,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64271:.opencode/skills/system-spec-kit/mcp_server/lib/coverage-graph/coverage-graph-db.ts:296:        kind = ?, name = ?, content_hash = ?, iteration = ?,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64272:.opencode/skills/system-spec-kit/mcp_server/lib/coverage-graph/coverage-graph-db.ts:309:      content_hash, iteration, metadata, created_at, updated_at
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64277:.opencode/skills/system-spec-kit/mcp_server/lib/coverage-graph/coverage-graph-db.ts:608:    contentHash: r.content_hash as string | undefined,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64279:.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:40:  content_hash?: string | null;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64280:.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:353:    contentHash: typeof row.content_hash === 'string' ? row.content_hash : null,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64282:.opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts:500:    content_hash: parsed.contentHash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64291:.opencode/skills/system-spec-kit/mcp_server/lib/storage/README.md:65:- `incremental-index.ts` uses `file_mtime_ms`, `content_hash`, and `embedding_status` together, so unchanged-path fast paths still requeue rows whose embeddings are unhealthy.
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64301:.opencode/skills/system-spec-kit/mcp_server/lib/storage/checkpoints.ts:1335:    'content_hash',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64303:.opencode/skills/system-spec-kit/mcp_server/handlers/save/pe-orchestration.ts:89:            priorHash: priorSnapshot?.content_hash ?? null,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64304:.opencode/skills/system-spec-kit/mcp_server/handlers/save/pe-orchestration.ts:141:          priorHash: priorSnapshot?.content_hash ?? null,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64319:.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:307:        content_hash: mergedHash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64320:.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:335:        content_hash: mergedHash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64331:.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:529:              content_hash = ?,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64342:.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:820:    contentHash: getOptionalString(row, 'content_hash') ?? null,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64343:.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:829:  return snapshot.contentHash !== (getOptionalString(currentRow, 'content_hash') ?? null)
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64345:.opencode/skills/system-spec-kit/mcp_server/lib/storage/reconsolidation.ts:901:    content_hash: existingRow.content_hash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64355:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-delete.ts:123:          priorHash: singleSnapshot?.content_hash ?? null,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64360:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-delete.ts:148:          SELECT id, content_hash, spec_folder, file_path
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64364:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-delete.ts:221:          priorHash: snapshot?.content_hash ?? null,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64392:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-update.ts:204:        priorHash: priorSnapshot?.content_hash ?? (existing.content_hash as string | null) ?? null,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64433:.opencode/skills/system-spec-kit/mcp_server/lib/parsing/memory-parser.ts:256:  const content_hash = computeContentHash(content);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64434:.opencode/skills/system-spec-kit/mcp_server/lib/parsing/memory-parser.ts:279:    contentHash: content_hash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64447:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:60:    'idx_save_parent_content_hash_scope',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64448:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:121:  CREATE INDEX IF NOT EXISTS idx_save_parent_content_hash_scope
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64449:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:124:    content_hash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64450:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:177:  return /PRIMARY\s+KEY\s*\(\s*content_hash\s*,\s*model_id\s*,\s*dimensions\s*\)/i.test(tableSql);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64451:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:197:      content_hash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64452:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:205:      content_hash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64456:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1741:  if (!column_names.includes('content_hash')) {
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64457:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1743:      database.exec(`ALTER TABLE memory_index ADD COLUMN content_hash TEXT`);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64458:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1744:      console.warn('[vector-index] Migration: Added content_hash column');
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64459:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1749:      logDuplicateColumnMigrationSkip('content_hash', error);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64460:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2030:    database.exec(`CREATE INDEX IF NOT EXISTS idx_content_hash ON memory_index(content_hash)`);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64461:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2033:      'idx_save_parent_content_hash_scope',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64462:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2037:    logger.info('Created idx_content_hash index');
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64463:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2041:      index: 'idx_content_hash/idx_save_parent_content_hash_scope',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64470:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2329:      content_hash TEXT,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64472:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2453:    CREATE INDEX IF NOT EXISTS idx_content_hash ON memory_index(content_hash);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64473:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2454:    CREATE INDEX IF NOT EXISTS idx_save_parent_content_hash_scope ON memory_index(
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64474:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:2456:      content_hash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64491:.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-db.ts:59:    content_hash TEXT NOT NULL,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64492:.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-db.ts:83:    content_hash TEXT NOT NULL
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64493:.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-db.ts:114:  CREATE INDEX IF NOT EXISTS idx_files_hash ON code_files(content_hash);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64495:.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-db.ts:278:      UPDATE code_files SET language = ?, content_hash = ?, node_count = ?, edge_count = ?,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64496:.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-db.ts:287:      file_path, language, content_hash, file_mtime_ms, node_count, edge_count, parse_health, indexed_at, parse_duration_ms
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64497:.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-db.ts:299:      start_line, end_line, start_column, end_column, language, signature, docstring, content_hash)
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64499:.opencode/skills/system-spec-kit/mcp_server/lib/code-graph/code-graph-db.ts:692:    contentHash: r.content_hash as string,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64541:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-health.ts:94:  content_hash: string | null;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64542:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-health.ts:183:    bucket.variants.set(normalizedPath, row.content_hash ?? null);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64543:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-health.ts:184:    if (typeof row.content_hash === 'string' && row.content_hash.trim().length > 0) {
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64544:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-health.ts:185:      bucket.hashes.add(row.content_hash.trim());
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64545:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-health.ts:318:        SELECT file_path, content_hash, spec_folder
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64564:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-types.ts:63:  content_hash?: string | null;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64584:.opencode/skills/system-spec-kit/mcp_server/handlers/quality-loop.ts:656:        // Return mutated content so caller can persist it and recompute content_hash
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64615:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-utils.ts:32:      SELECT id, content_hash, spec_folder, file_path
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64649:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index-alias.ts:22:  content_hash: string | null;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64653:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index-alias.ts:146:    if (typeof row.content_hash === 'string' && row.content_hash.trim().length > 0) {
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64654:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index-alias.ts:147:      bucket.hashes.add(row.content_hash.trim());
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64655:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index-alias.ts:203:      SELECT file_path, content_hash
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64656:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-index-alias.ts:228:    SELECT file_path, content_hash
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64661:.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:60:  content_hash?: string;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64662:.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:94:  'content_hash', 'context_type', 'importance_tier', 'memory_type',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64666:.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:241:        content_hash: parsed.contentHash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64667:.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:342:          content_hash: parsed.contentHash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64671:.opencode/skills/system-spec-kit/mcp_server/handlers/chunking-orchestrator.ts:505:        SET content_hash = ?,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64695:.opencode/skills/system-spec-kit/mcp_server/handlers/pe-gating.ts:178:          content_hash = CASE WHEN content_text IS NULL THEN ? ELSE content_hash END,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64697:.opencode/skills/system-spec-kit/mcp_server/handlers/pe-gating.ts:278:      content_hash: parsed.contentHash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64708:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:914:    let existing: { id: number; content_hash: string } | undefined;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64711:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:935:      ) as { id: number; content_hash: string } | undefined;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64712:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:937:      const memoryId = existing && existing.content_hash !== parsed.contentHash
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64713:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:969:        predecessorMemoryId: existing && existing.content_hash !== parsed.contentHash
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64714:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:973:        transitionEvent: existing && existing.content_hash !== parsed.contentHash
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64751:/bin/zsh -lc "rg -n \"function handleMemoryDelete|DELETE FROM memory_index|recordHistory\\(|appendEntry\\(|removeFileIfExists|unlinkSync|deletedCount|content_hash\" .opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud* .opencode/skills/system-spec-kit/mcp_server/handlers/memory-bulk-delete.ts .opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts .opencode/skills/system-spec-kit/mcp_server/handlers/save/dedup.ts .opencode/skills/system-spec-kit/mcp_server/handlers/save/create-record.ts .opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts .opencode/skills/system-spec-kit/mcp_server/lib/storage/history.ts .opencode/skills/system-spec-kit/mcp_server/lib/storage/mutation-ledger.ts" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64753:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-health.ts:94:  content_hash: string | null;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64754:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-health.ts:183:    bucket.variants.set(normalizedPath, row.content_hash ?? null);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64755:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-health.ts:184:    if (typeof row.content_hash === 'string' && row.content_hash.trim().length > 0) {
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64756:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-health.ts:185:      bucket.hashes.add(row.content_hash.trim());
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64757:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-health.ts:318:        SELECT file_path, content_hash, spec_folder
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64763:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-delete.ts:123:          priorHash: singleSnapshot?.content_hash ?? null,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64764:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-delete.ts:148:          SELECT id, content_hash, spec_folder, file_path
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64767:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-delete.ts:221:          priorHash: snapshot?.content_hash ?? null,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64777:.opencode/skills/system-spec-kit/mcp_server/handlers/save/create-record.ts:101:): { id: number; title: string | null; content_hash?: string | null } | undefined {
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64778:.opencode/skills/system-spec-kit/mcp_server/handlers/save/create-record.ts:109:    SELECT id, title, content_hash
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64779:.opencode/skills/system-spec-kit/mcp_server/handlers/save/create-record.ts:135:  ) as { id: number; title: string | null; content_hash?: string | null } | undefined;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64780:.opencode/skills/system-spec-kit/mcp_server/handlers/save/create-record.ts:216:      content_hash: parsed.contentHash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64783:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-bulk-delete.ts:184:  let selectSql = 'SELECT id, content_hash, file_path, spec_folder FROM memory_index WHERE importance_tier = ?';
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64784:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-bulk-delete.ts:199:    content_hash: string | null;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64797:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:914:    let existing: { id: number; content_hash: string } | undefined;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64798:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:935:      ) as { id: number; content_hash: string } | undefined;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64799:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:937:      const memoryId = existing && existing.content_hash !== parsed.contentHash
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64800:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:969:        predecessorMemoryId: existing && existing.content_hash !== parsed.contentHash
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64801:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-save.ts:973:        transitionEvent: existing && existing.content_hash !== parsed.contentHash
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64802:.opencode/skills/system-spec-kit/mcp_server/handlers/save/dedup.ts:38:  content_hash: string;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64803:.opencode/skills/system-spec-kit/mcp_server/handlers/save/dedup.ts:95:    SELECT id, content_hash, embedding_status, trigger_phrases, quality_score, quality_flags
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64804:.opencode/skills/system-spec-kit/mcp_server/handlers/save/dedup.ts:229:  if (existing && existing.content_hash === parsed.contentHash && isUnchangedEligible && isMetadataEquivalent) {
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64805:.opencode/skills/system-spec-kit/mcp_server/handlers/save/dedup.ts:257:      'content_hash = ?',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64806:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-utils.ts:32:      SELECT id, content_hash, spec_folder, file_path
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64808:.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:36:  content_hash?: string;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64810:.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:485:  if (memory.content_hash) {
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64811:.opencode/skills/system-spec-kit/mcp_server/lib/session/session-manager.ts:486:    hashInput = memory.content_hash;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64819:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-update.ts:204:        priorHash: priorSnapshot?.content_hash ?? (existing.content_hash as string | null) ?? null,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:64820:.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-types.ts:70:  content_hash: string | null;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:65266:    38	  content_hash: string;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:65323:    95	    SELECT id, content_hash, embedding_status, trigger_phrases, quality_score, quality_flags
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:65457:   229	  if (existing && existing.content_hash === parsed.contentHash && isUnchangedEligible && isMetadataEquivalent) {
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:65485:   257	      'content_hash = ?',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:65755:   914	    let existing: { id: number; content_hash: string } | undefined;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:65776:   935	      ) as { id: number; content_hash: string } | undefined;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:65778:   937	      const memoryId = existing && existing.content_hash !== parsed.contentHash
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:65810:   969	        predecessorMemoryId: existing && existing.content_hash !== parsed.contentHash
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:65814:   973	        transitionEvent: existing && existing.content_hash !== parsed.contentHash
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:65847:   101	): { id: number; title: string | null; content_hash?: string | null } | undefined {
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:65855:   109	    SELECT id, title, content_hash
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:65881:   135	  ) as { id: number; title: string | null; content_hash?: string | null } | undefined;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:65962:   216	      content_hash: parsed.contentHash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:66108:   123	          priorHash: singleSnapshot?.content_hash ?? null,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:66133:   148	          SELECT id, content_hash, spec_folder, file_path
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:66206:   221	          priorHash: snapshot?.content_hash ?? null,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:66584:/bin/zsh -lc "rg -n \"deleteMemory\\(|is_archived|archived_at|importance_tier = 'deprecated'|recordLineageVersion|recordLineageTransition|mutation ledger|appendOnly|content_hash UNIQUE|CREATE TABLE memory_index|canonical_file_path\" .opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-store.ts .opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-queries.ts .opencode/skills/system-spec-kit/mcp_server/lib/storage/lineage-state.ts .opencode/skills/system-spec-kit/mcp_server/handlers/save/create-record.ts" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:66651:    40	  content_hash?: string | null;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:67699:  2329	      content_hash TEXT,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:68384:/bin/zsh -lc "rg -n \"CREATE UNIQUE INDEX|UNIQUE\\(|content_hash\" .opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:68386:60:    'idx_save_parent_content_hash_scope',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:68387:121:  CREATE INDEX IF NOT EXISTS idx_save_parent_content_hash_scope
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:68388:124:    content_hash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:68389:177:  return /PRIMARY\s+KEY\s*\(\s*content_hash\s*,\s*model_id\s*,\s*dimensions\s*\)/i.test(tableSql);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:68390:197:      content_hash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:68391:205:      content_hash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:68397:1741:  if (!column_names.includes('content_hash')) {
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:68398:1743:      database.exec(`ALTER TABLE memory_index ADD COLUMN content_hash TEXT`);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:68399:1744:      console.warn('[vector-index] Migration: Added content_hash column');
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:68400:1749:      logDuplicateColumnMigrationSkip('content_hash', error);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:68401:2030:    database.exec(`CREATE INDEX IF NOT EXISTS idx_content_hash ON memory_index(content_hash)`);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:68402:2033:      'idx_save_parent_content_hash_scope',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:68403:2037:    logger.info('Created idx_content_hash index');
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:68404:2041:      index: 'idx_content_hash/idx_save_parent_content_hash_scope',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:68405:2329:      content_hash TEXT,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:68407:2453:    CREATE INDEX IF NOT EXISTS idx_content_hash ON memory_index(content_hash);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:68408:2454:    CREATE INDEX IF NOT EXISTS idx_save_parent_content_hash_scope ON memory_index(
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:68409:2456:      content_hash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:77353:   101	): { id: number; title: string | null; content_hash?: string | null } | undefined {
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:77361:   109	    SELECT id, title, content_hash
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:77387:   135	  ) as { id: number; title: string | null; content_hash?: string | null } | undefined;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:87837:.opencode/skills/system-spec-kit/mcp_server/lib/search/vector-index-schema.ts:1744:      console.warn('[vector-index] Migration: Added content_hash column');
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:100929:        SELECT file_path, content_hash, spec_folder
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:102289:      'content_hash = ?',
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:102426:              content_hash = ?,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:102584:    content_hash: provided_hash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:103462:    priorHash: existing?.content_hash ?? null,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:110073:   146	    if (typeof row.content_hash === 'string' && row.content_hash.trim().length > 0) {
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:110074:   147	      bucket.hashes.add(row.content_hash.trim());
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:110130:   203	      SELECT file_path, content_hash
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:110155:   228	    SELECT file_path, content_hash
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:114891:/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/storage/schema-downgrade.ts:179:    CREATE INDEX IF NOT EXISTS idx_content_hash ON memory_index(content_hash);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:115274:/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-bulk-delete.ts:184:  let selectSql = 'SELECT id, content_hash, file_path, spec_folder FROM memory_index WHERE importance_tier = ?';
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:115319:/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-crud-health.ts:183:    bucket.variants.set(normalizedPath, row.content_hash ?? null);
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:119386:    22	  content_hash: string | null;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:119510:   146	    if (typeof row.content_hash === 'string' && row.content_hash.trim().length > 0) {
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:119511:   147	      bucket.hashes.add(row.content_hash.trim());
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:119567:   203	      SELECT file_path, content_hash
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:119592:   228	    SELECT file_path, content_hash
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:125974:    contentHash: typeof row.content_hash === 'string' ? row.content_hash : null,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:127620:  content_hash?: string;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:129320:): { id: number; title: string | null; content_hash?: string | null } | undefined {
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:129328:    SELECT id, title, content_hash
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:129354:  ) as { id: number; title: string | null; content_hash?: string | null } | undefined;
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:129435:      content_hash: parsed.contentHash,
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:158800:        SELECT file_path, content_hash, spec_folder
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:161836:   318	        SELECT file_path, content_hash, spec_folder
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:177055:   101	): { id: number; title: string | null; content_hash?: string | null } | undefined {
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:177063:   109	    SELECT id, title, content_hash
./.opencode/specs/system-spec-kit/z_future/hybrid-rag-fusion-upgrade/001-research-hybrid-rag-fusion-systems/001-engram-main/research/research.md:177089:   135	  ) as { id: number; title: string | null; content_hash?: string | null } | undefined;
./.opencode/specs/system-spec-kit/023-hybrid-rag-fusion-refinement/research/iterations/iteration-003.md:28:5. **Intent propagation -- PRESENT.** The `hybrid-search.ts` imports `classifyIntent` from `intent-classifier.js` and `INTENT_LAMBDA_MAP` for per-intent weight adjustments. The `HybridSearchOptions` interface includes an `intent` field (line 92) that threads classified intent through the entire pipeline. The search-results formatter resolves `intentAdjustedScore` as the highest-priority score in `resolveCompositeScore()` (lines 205-206) and `resolveScoreResolution()` (line 217).

codex
One more useful find: the CocoIndex source of truth is not the old guessed `cocoindex_code/*.py` at repo root. The repo README says the forked wrapper lives under `.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/`, which changes where I’d start if the bug is on the code-search side.
exec
/bin/zsh -lc "sed -n '1,180p' .opencode/skills/mcp-coco-index/SKILL.md && find .opencode/skills/mcp-coco-index/mcp_server/cocoindex_code -maxdepth 2 -type f | sort | sed -n '1,120p'" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
---
name: mcp-coco-index
description: "Semantic code search via vector embeddings. CocoIndex Code enables natural-language discovery of relevant code, patterns, and implementations. CLI for direct use; MCP exposes a single `search` tool for AI agent integration."
allowed-tools: [Bash, Read, Grep, Glob]
version: 1.0.0
---

<!-- Keywords: cocoindex-code, semantic-search, vector-embeddings, code-search, mcp-server, ccc, codebase-indexing, voyage-code-3, all-MiniLM-L6-v2 -->

# CocoIndex Code - Semantic Code Search via Vector Embeddings

Natural language code search through two complementary approaches: CLI (ccc) for speed and one-off queries, MCP server (1 tool: `search`) for AI agent integration via stdio transport.


<!-- ANCHOR:when-to-use -->
## 1. WHEN TO USE

> **Forked From**: This skill bundles a soft-fork of [cocoindex-code](https://github.com/cocoindex-io/cocoindex-code) (Apache 2.0). Upstream version forked: 0.2.3. Current fork version: 0.2.3+spec-kit-fork.0.2.0. Patches: REQ-001..006 (mirror dedup + path-class reranking) from the spec packet at `.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/004-cocoindex-overfetch-dedup-rerank/` (currently numbered `004`; tracked as `009` during research and in commit history). See NOTICE and changelog/CHANGELOG.md for the full attribution and modification list.

### Activation Triggers

**Use when**:
- User asks to "find code that does X" or "search for implementations of Y"
- User needs to discover code by concept or intent rather than exact text
- User wants to find similar code patterns across the codebase
- Grep/Glob exact matching is insufficient and fuzzy or semantic matching is needed
- User mentions "semantic search", "code search", "find similar code"
- User needs to locate logic handling a specific concern (e.g., "where is the retry logic")
- User wants to understand how a concept is implemented across multiple files
- User asks "how is X implemented" or "what handles Y"
- User wants to understand architecture or module relationships
- Starting work on an unfamiliar part of the codebase (onboarding queries)
- @context agent is exploring code structure and needs concept-based discovery
- Any exploration task where the exact function/class name is unknown

**Automatic Triggers**:
- "semantic search", "find code that", "search for implementations"
- "similar code", "code that handles", "where is the logic for"
- "cocoindex", "ccc", "vector search"
- "find similar", "code search", "search codebase"
- "how is", "what handles", "where does", "understand the"
- "explore", "architecture", "module relationships"
- "onboarding", "unfamiliar code", "new to this"

### When NOT to Use

**Do not use for**:
- Exact text or regex search (use Grep instead)
- File name or path search (use Glob instead)
- Reading known files (use Read instead)
- The codebase has not been indexed yet (run `ccc index` first)
- Simple string matching where the exact token is known
- Non-code files (semantic search is optimized for source code)

---

<!-- /ANCHOR:when-to-use -->
<!-- ANCHOR:smart-routing -->
## 2. SMART ROUTING

### Resource Loading Levels

| Level       | When to Load             | Resources                                   |
| ----------- | ------------------------ | ------------------------------------------- |
| ALWAYS      | Every skill invocation   | references/tool_reference.md                |
| CONDITIONAL | If intent signals match  | references/search_patterns.md, references/cross_cli_playbook.md |
| ON_DEMAND   | Only on explicit request | Full troubleshooting and configuration docs |

### Smart Router Pseudocode

The authoritative routing logic for scoped loading, weighted intent scoring, and ambiguity handling.

```python
from pathlib import Path

SKILL_ROOT = Path(__file__).resolve().parent
RESOURCE_BASES = (SKILL_ROOT / "references", SKILL_ROOT / "assets")
DEFAULT_RESOURCE = "references/tool_reference.md"

INTENT_SIGNALS = {
    "SEARCH": {"weight": 4, "keywords": ["search", "find", "where", "similar", "semantic", "code that"]},
    "INDEX": {"weight": 4, "keywords": ["index", "reindex", "update index", "build index", "refresh"]},
    "INSTALL": {"weight": 4, "keywords": ["install", "setup", "configure", "ccc not found"]},
    "STATUS": {"weight": 3, "keywords": ["status", "stats", "how many files", "indexed"]},
    "TROUBLESHOOT": {"weight": 3, "keywords": ["error", "failed", "not working", "empty results"]},
    "CROSS_CLI": {"weight": 3, "keywords": ["copilot", "gemini", "claude", "codex", "cross cli", "multi query"]},
    "CONCURRENCY": {"weight": 3, "keywords": ["refresh_index", "concurrency", "concurrent", "follow-up query"]},
}

RESOURCE_MAP = {
    "SEARCH": ["references/search_patterns.md", "references/cross_cli_playbook.md", "references/tool_reference.md"],
    "INDEX": ["references/tool_reference.md"],
    "INSTALL": ["references/tool_reference.md"],
    "STATUS": ["references/tool_reference.md"],
    "TROUBLESHOOT": ["references/tool_reference.md", "references/cross_cli_playbook.md", "references/search_patterns.md"],
    "CROSS_CLI": ["references/cross_cli_playbook.md", "references/tool_reference.md"],
    "CONCURRENCY": ["references/cross_cli_playbook.md", "references/tool_reference.md"],
}

LOADING_LEVELS = {
    "ALWAYS": [DEFAULT_RESOURCE],
    "ON_DEMAND_KEYWORDS": ["full troubleshooting", "all commands", "configuration guide", "cross cli playbook", "semantic code search", "semantic search", "vector-search blending", "before grep", "find code that"],
    "ON_DEMAND": ["references/tool_reference.md", "references/search_patterns.md", "references/cross_cli_playbook.md"],
}

def _task_text(task) -> str:
    parts = [
        str(getattr(task, "text", "")),
        str(getattr(task, "query", "")),
        " ".join(getattr(task, "keywords", []) or []),
    ]
    return " ".join(parts).lower()

def _guard_in_skill(relative_path: str) -> str:
    resolved = (SKILL_ROOT / relative_path).resolve()
    resolved.relative_to(SKILL_ROOT)
    if resolved.suffix.lower() != ".md":
        raise ValueError(f"Only markdown resources are routable: {relative_path}")
    return resolved.relative_to(SKILL_ROOT).as_posix()

def discover_markdown_resources() -> set[str]:
    docs = []
    for base in RESOURCE_BASES:
        if base.exists():
            docs.extend(p for p in base.rglob("*.md") if p.is_file())
    return {doc.relative_to(SKILL_ROOT).as_posix() for doc in docs}

def score_intents(task) -> dict[str, float]:
    """Weighted intent scoring from request text and capability signals."""
    text = _task_text(task)
    scores = {intent: 0.0 for intent in INTENT_SIGNALS}
    for intent, cfg in INTENT_SIGNALS.items():
        for keyword in cfg["keywords"]:
            if keyword in text:
                scores[intent] += cfg["weight"]
    if getattr(task, "has_error", False):
        scores["TROUBLESHOOT"] += 4
    if getattr(task, "index_missing", False):
        scores["INDEX"] += 5
    return scores

def select_intents(scores: dict[str, float], ambiguity_delta: float = 1.0, max_intents: int = 2) -> list[str]:
    ranked = sorted(scores.items(), key=lambda item: item[1], reverse=True)
    if not ranked or ranked[0][1] <= 0:
        return ["SEARCH"]
    selected = [ranked[0][0]]
    if len(ranked) > 1 and ranked[1][1] > 0 and (ranked[0][1] - ranked[1][1]) <= ambiguity_delta:
        selected.append(ranked[1][0])
    return selected[:max_intents]

def route_cocoindex_code_resources(task):
    inventory = discover_markdown_resources()
    intents = select_intents(score_intents(task), ambiguity_delta=1.0)
    loaded = []
    seen = set()

    def load_if_available(relative_path: str) -> None:
        guarded = _guard_in_skill(relative_path)
        if guarded in inventory and guarded not in seen:
            load(guarded)
            loaded.append(guarded)
            seen.add(guarded)

    for relative_path in LOADING_LEVELS["ALWAYS"]:
        load_if_available(relative_path)
    for intent in intents:
        for relative_path in RESOURCE_MAP.get(intent, []):
            load_if_available(relative_path)

    text = _task_text(task)
    if any(keyword in text for keyword in LOADING_LEVELS["ON_DEMAND_KEYWORDS"]):
        for relative_path in LOADING_LEVELS["ON_DEMAND"]:
            load_if_available(relative_path)

    if not loaded:
        load_if_available(DEFAULT_RESOURCE)

    return {"intents": intents, "resources": loaded}
```

.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/LICENSE
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/__init__.py
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/__main__.py
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/__pycache__/__init__.cpython-311.pyc
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/__pycache__/_version.cpython-311.pyc
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/__pycache__/cli.cpython-311.pyc
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/__pycache__/client.cpython-311.pyc
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/__pycache__/daemon.cpython-311.pyc
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/__pycache__/indexer.cpython-311.pyc
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/__pycache__/project.cpython-311.pyc
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/__pycache__/protocol.cpython-311.pyc
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/__pycache__/query.cpython-311.pyc
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/__pycache__/schema.cpython-311.pyc
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/__pycache__/server.cpython-311.pyc
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/__pycache__/settings.cpython-311.pyc
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/__pycache__/shared.cpython-311.pyc
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/_version.py
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/cli.py
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/client.py
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/config.py
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/daemon.py
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/indexer.py
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/project.py
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/protocol.py
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/schema.py
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/server.py
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/settings.py
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/shared.py

exec
/bin/zsh -lc 'rg -n "source_realpath|content_hash|path_class|dedup|over_fetch|overfetch|rankingSignals|uniqueResultCount|dedupedAliases|raw_score" .opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/indexer.py .opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py .opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/project.py .opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/server.py .opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/protocol.py' in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:22:    """List of query results with response-level dedup telemetry."""
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:24:    dedupedAliases: int
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:25:    uniqueResultCount: int
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:31:        deduped_aliases: int,
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:35:        self.dedupedAliases = deduped_aliases
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:36:        self.uniqueResultCount = unique_result_count
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:76:    source_realpath = "source_realpath" if "source_realpath" in columns else "NULL"
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:77:    content_hash = "content_hash" if "content_hash" in columns else "NULL"
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:78:    path_class = "path_class" if "path_class" in columns else "'implementation'"
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:81:        f"{source_realpath} AS source_realpath, "
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:83:        f"{content_hash} AS content_hash, "
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:84:        f"{path_class} AS path_class, "
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:158:def _dedup_key(row: tuple[Any, ...]) -> tuple[str, str, int, int]:
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:161:        source_realpath,
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:164:        content_hash,
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:165:        _path_class,
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:170:    if source_realpath:
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:171:        return ("source_realpath", str(source_realpath), start_line, end_line)
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:172:    fallback_hash = content_hash or _hash_content(content)
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:173:    return ("content_hash", str(fallback_hash), start_line, end_line)
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:183:        _source_realpath,
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:186:        _content_hash,
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:187:        path_class,
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:192:    raw_score = _l2_to_score(distance)
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:193:    score = raw_score
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:197:        if path_class == "implementation":
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:200:        elif path_class == "spec_research":
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:203:        elif path_class == "docs":
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:214:        raw_score=raw_score,
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:215:        path_class=path_class or "implementation",
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:216:        rankingSignals=ranking_signals,
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:220:def _dedup_and_rank_rows(
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:236:    deduped_aliases = 0
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:238:        key = _dedup_key(row)
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:240:            deduped_aliases += 1
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:248:        deduped_aliases=deduped_aliases,
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:302:    return _dedup_and_rank_rows(rows, query=query, limit=limit, offset=offset)
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/indexer.py:219:    source_realpath = os.path.realpath(project_root / file.file_path.path)
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/indexer.py:220:    path_class = classify_path(file.file_path.path)
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/indexer.py:238:                source_realpath=source_realpath,
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/indexer.py:241:                content_hash=hashlib.sha256(normalized_content.encode()).hexdigest(),
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/indexer.py:242:                path_class=path_class,
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/indexer.py:270:                "source_realpath",
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/indexer.py:272:                "content_hash",
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/indexer.py:273:                "path_class",
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/protocol.py:102:    raw_score: float = 0.0
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/protocol.py:103:    path_class: str = "implementation"
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/protocol.py:104:    rankingSignals: list[str] = []
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/protocol.py:112:    dedupedAliases: int = 0
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/protocol.py:113:    uniqueResultCount: int = 0
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/server.py:51:    raw_score: float = Field(description="Raw vector similarity score before reranking")
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/server.py:52:    path_class: str = Field(description="Source path class used for bounded reranking")
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/server.py:53:    rankingSignals: list[str] = Field(
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/server.py:66:    dedupedAliases: int = Field(default=0)
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/server.py:67:    uniqueResultCount: int = Field(default=0)
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/server.py:162:                        raw_score=r.raw_score,
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/server.py:163:                        path_class=r.path_class,
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/server.py:164:                        rankingSignals=r.rankingSignals,
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/server.py:170:                dedupedAliases=resp.dedupedAliases,
.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/server.py:171:                uniqueResultCount=resp.uniqueResultCount,

exec
/bin/zsh -lc "nl -ba .opencode/skills/mcp-coco-index/references/tool_reference.md | sed -n '1,220p'" in /Users/michelkerkmeester/MEGA/Development/Code_Environment/Public
 succeeded in 0ms:
     1	---
     2	title: CocoIndex Code Tool Reference
     3	description: Complete reference for the CocoIndex Code CLI commands and MCP tool with parameters, examples, and expected output.
     4	trigger_phrases:
     5	  - ccc commands
     6	  - cocoindex tools
     7	  - search parameters
     8	  - mcp tools cocoindex
     9	  - ccc cli reference
    10	---
    11	
    12	# CocoIndex Code Tool Reference
    13	
    14	Complete reference for all CLI commands and the MCP tool exposed by CocoIndex Code.
    15	
    16	---
    17	
    18	<!-- ANCHOR:overview -->
    19	## OVERVIEW
    20	
    21	This document provides the complete reference for CocoIndex Code CLI commands and MCP tool. It covers all available commands (search, index, status, init, reset, mcp, daemon), their parameters, expected output, supported languages, environment variables, settings schema, and related resources.
    22	
    23	**Important distinction:** The MCP server exposes exactly **1 tool** (`search`). The `status`, `index`, and `reset` operations are **CLI-only commands** and are not available through the MCP protocol.
    24	
    25	---
    26	
    27	<!-- /ANCHOR:overview -->
    28	<!-- ANCHOR:cli-commands -->
    29	## 1. CLI COMMANDS
    30	
    31	### ccc search
    32	
    33	Perform a semantic search across the indexed codebase.
    34	
    35	```bash
    36	ccc search QUERY [--lang LANG ...] [--path PATH] [--limit N] [--offset N] [--refresh]
    37	```
    38	
    39	| Parameter   | Required | Default | Description                                                        |
    40	| ----------- | -------- | ------- | ------------------------------------------------------------------ |
    41	| `QUERY`     | Yes      | -       | Natural language search query                                      |
    42	| `--lang`    | No       | all     | Filter by language (repeatable: `--lang python --lang typescript`) |
    43	| `--path`    | No       | .       | Filter by directory path                                           |
    44	| `--limit`   | No       | 10      | Maximum number of results                                          |
    45	| `--offset`  | No       | 0       | Skip first N results (pagination)                                  |
    46	| `--refresh` | No       | false   | Force index refresh before searching                               |
    47	
    48	**Note:** `--lang` is repeatable. Specify it multiple times to filter by multiple languages.
    49	
    50	**Examples:**
    51	```bash
    52	# Basic search
    53	ccc search "error handling in API routes"
    54	
    55	# Filter by single language
    56	ccc search "database connection pooling" --lang python
    57	
    58	# Filter by multiple languages
    59	ccc search "authentication middleware" --lang python --lang typescript
    60	
    61	# Scope to directory
    62	ccc search "authentication middleware" --path src/api/
    63	
    64	# Paginate results
    65	ccc search "configuration" --limit 5 --offset 10
    66	
    67	# Refresh index before searching
    68	ccc search "new feature" --refresh
    69	```
    70	
    71	**Output format:** Each result includes:
    72	- File path
    73	- Line range
    74	- Code snippet
    75	- Relevance score (0.0 to 1.0)
    76	- Language
    77	
    78	> **Fork-specific telemetry.** This skill bundles a soft-fork of `cocoindex-code` (version `0.2.3+spec-kit-fork.0.2.0`) that adds dedup + path-class reranking. Result rows from `ccc search` carry additional fields (`dedupedAliases`, `uniqueResultCount`, `rankingSignals`, `source_realpath`, `content_hash`, `path_class`, `raw_score`) that vanilla upstream cocoindex-code does NOT emit. See [§7 Fork-Specific Output Telemetry](#-7-fork-specific-output-telemetry) for the full schema.
    79	
    80	---
    81	
    82	### ccc index
    83	
    84	Build or update the semantic index for the current project.
    85	
    86	```bash
    87	ccc index
    88	```
    89	
    90	| Parameter | Required | Description |
    91	| --------- | -------- | ----------- |
    92	| (none)    | -        | No parameters. Indexes from COCOINDEX_CODE_ROOT_PATH |
    93	
    94	**Example:**
    95	```bash
    96	cd /path/to/project
    97	ccc index
    98	# Scans files, generates embeddings, stores in .cocoindex_code/
    99	```
   100	
   101	**Notes:**
   102	- First run indexes all supported files
   103	- Subsequent runs perform incremental updates (only changed files)
   104	- Duration depends on codebase size (typically 1-5 minutes for first build)
   105	- For forced refresh during search, use `ccc search ... --refresh`; the installed `ccc index` command does not expose a `--refresh` flag
   106	
   107	---
   108	
   109	### ccc status
   110	
   111	Display project and index statistics.
   112	
   113	```bash
   114	ccc status
   115	```
   116	
   117	| Parameter | Required | Description |
   118	| --------- | -------- | ----------- |
   119	| (none)    | -        | No parameters |
   120	
   121	**Example:**
   122	```bash
   123	ccc status
   124	# Shows: indexed files count, languages, index size, last update time
   125	```
   126	
   127	---
   128	
   129	### ccc init
   130	
   131	Initialize a new project for indexing. Creates the `.cocoindex_code/` directory.
   132	
   133	```bash
   134	ccc init [-f | --force]
   135	```
   136	
   137	| Parameter       | Required | Default | Description                                      |
   138	| --------------- | -------- | ------- | ------------------------------------------------ |
   139	| `-f`, `--force` | No       | false   | Force re-initialization even if already exists    |
   140	
   141	**Examples:**
   142	```bash
   143	cd /path/to/project
   144	ccc init
   145	# Creates .cocoindex_code/ directory
   146	
   147	# Force re-initialization
   148	ccc init --force
   149	```
   150	
   151	**Notes:**
   152	- Run this once per project before building the index
   153	- The install script runs `ccc init` automatically if `.cocoindex_code/` does not exist
   154	- Use `-f` / `--force` to re-initialize an existing project
   155	
   156	---
   157	
   158	### ccc reset
   159	
   160	Reset the index databases. Optionally remove all data.
   161	
   162	```bash
   163	ccc reset [--all]
   164	```
   165	
   166	| Parameter | Required | Default | Description                                       |
   167	| --------- | -------- | ------- | ------------------------------------------------- |
   168	| `--all`   | No       | false   | Remove all data (full clean reset including settings) |
   169	
   170	**Examples:**
   171	```bash
   172	# Reset databases only (keep settings)
   173	ccc reset
   174	
   175	# Full reset including all data and settings
   176	ccc reset --all
   177	
   178	# After reset, rebuild
   179	ccc init
   180	ccc index
   181	```
   182	
   183	---
   184	
   185	### ccc mcp
   186	
   187	Run CocoIndex Code as an MCP server in stdio mode. Used by AI clients.
   188	
   189	```bash
   190	ccc mcp
   191	```
   192	
   193	| Parameter | Required | Description |
   194	| --------- | -------- | ----------- |
   195	| (none)    | -        | Starts MCP server on stdio. Ctrl+C to stop |
   196	
   197	**Notes:**
   198	- This command is used in MCP configuration files (not run manually)
   199	- Communicates via stdin/stdout using the MCP protocol
   200	- Exposes 1 tool: `search`
   201	- The `status`, `index`, and `reset` operations are CLI-only and not exposed via MCP
   202	
   203	---
   204	
   205	### ccc daemon
   206	
   207	Manage the background indexing daemon.
   208	
   209	```bash
   210	ccc daemon status|restart|stop
   211	```
   212	
   213	| Subcommand | Description                          |
   214	| ---------- | ------------------------------------ |
   215	| `status`   | Check if the daemon is running       |
   216	| `restart`  | Restart the running daemon           |
   217	| `stop`     | Stop the running daemon              |
   218	
   219	**Examples:**
   220	```bash

codex
The deliberately weak `memory_search` probe did not return the expected weak-quality envelope. Both attempts came back as `user cancelled MCP tool call`, so I could not observe `requestQuality.label`, `recovery.status`, or `suggestedQueries`. I would not treat that as evidence of the weak-result behavior itself.

Start here:

1. [009-memory-search-citation-response-policy/spec.md](/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/009-memory-search-citation-response-policy/spec.md:57)  
   This is the direct spec for the bug pattern: weak `memory_search` results being wrapped as success and letting callers invent canonical-looking paths.

2. [010-stress-test-close-loop-measurement-rerun/spec.md](/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/010-stress-test-close-loop-measurement-rerun/spec.md:141)  
   This is the current measurement packet. REQ-011 is the live assertion: if I2 returns `requestQuality.label:"weak"`, it must include `responsePolicy.noCanonicalPathClaims:true` and no hallucinated paths.

Core files to inspect first:

- [search-results.ts](/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:273): derives `responsePolicy` and `citationPolicy`.
- [recovery-payload.ts](/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:324): builds `recovery.status`, `recommendedAction`, and `suggestedQueries`.
- [confidence-scoring.ts](/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/confidence-scoring.ts:293): decides `requestQuality.label`.
- [memory-search.ts](/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:613): handler orchestration and final formatter call.

If the bug is specifically CocoIndex ranking/dedup rather than `memory_search` weak-result policy, start with [004-cocoindex-overfetch-dedup-rerank/spec.md](/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/004-cocoindex-overfetch-dedup-rerank/spec.md:57), then inspect:

- [query.py](/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:158)
- [indexer.py](/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/indexer.py:219)
- [server.py](/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/server.py:51)

My read: for the exact failure you just probed, start with `009` + `search-results.ts`. For the broader “hybrid retrieval/CocoIndex” bug, start with `004` + `query.py`.
hook: Stop
hook: Stop Completed
2026-04-27T15:04:51.677393Z ERROR codex_core::session: failed to record rollout items: thread 019dcf77-3951-7302-9e1e-08116385bbdf not found
tokens used
168,539
The deliberately weak `memory_search` probe did not return the expected weak-quality envelope. Both attempts came back as `user cancelled MCP tool call`, so I could not observe `requestQuality.label`, `recovery.status`, or `suggestedQueries`. I would not treat that as evidence of the weak-result behavior itself.

Start here:

1. [009-memory-search-citation-response-policy/spec.md](/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/009-memory-search-citation-response-policy/spec.md:57)  
   This is the direct spec for the bug pattern: weak `memory_search` results being wrapped as success and letting callers invent canonical-looking paths.

2. [010-stress-test-close-loop-measurement-rerun/spec.md](/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/010-stress-test-close-loop-measurement-rerun/spec.md:141)  
   This is the current measurement packet. REQ-011 is the live assertion: if I2 returns `requestQuality.label:"weak"`, it must include `responsePolicy.noCanonicalPathClaims:true` and no hallucinated paths.

Core files to inspect first:

- [search-results.ts](/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/formatters/search-results.ts:273): derives `responsePolicy` and `citationPolicy`.
- [recovery-payload.ts](/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/recovery-payload.ts:324): builds `recovery.status`, `recommendedAction`, and `suggestedQueries`.
- [confidence-scoring.ts](/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/lib/search/confidence-scoring.ts:293): decides `requestQuality.label`.
- [memory-search.ts](/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/mcp_server/handlers/memory-search.ts:613): handler orchestration and final formatter call.

If the bug is specifically CocoIndex ranking/dedup rather than `memory_search` weak-result policy, start with [004-cocoindex-overfetch-dedup-rerank/spec.md](/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/specs/system-spec-kit/026-graph-and-context-optimization/011-mcp-runtime-stress-remediation/004-cocoindex-overfetch-dedup-rerank/spec.md:57), then inspect:

- [query.py](/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/query.py:158)
- [indexer.py](/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/indexer.py:219)
- [server.py](/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/mcp-coco-index/mcp_server/cocoindex_code/server.py:51)

My read: for the exact failure you just probed, start with `009` + `search-results.ts`. For the broader “hybrid retrieval/CocoIndex” bug, start with `004` + `query.py`.
