Skip to content

fix(engram): resolve project before scoped search - #2022

Open
dnlrsls wants to merge 10 commits into
Gentleman-Programming:mainfrom
dnlrsls:fix/engram-project-resolution
Open

fix(engram): resolve project before scoped search#2022
dnlrsls wants to merge 10 commits into
Gentleman-Programming:mainfrom
dnlrsls:fix/engram-project-resolution

Conversation

@dnlrsls

@dnlrsls dnlrsls commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

🔗 Linked Issue

Closes #1903


🏷️ PR Type

  • type:bug - Bug fix
  • type:feature - New feature
  • type:docs - Documentation only
  • type:refactor - Code refactoring
  • type:chore - Build, CI, or tooling
  • type:breaking-change - Breaking change

📝 Summary

  • Resolve the canonical Engram project before project-scoped context or search calls across every provider surface.
  • Correct Gemini, Kimi, and OpenCode no-project behavior, and remove OpenCode command-level workspace-basename project bypasses.
  • Prove the shared contract with all-12-surface regression coverage and rendered OpenCode command goldens.

📂 Changes

File / Area What Changed
internal/assets/*/sdd-orchestrator.md and Claude workflow Applied the canonical project-resolution and no-project contract across all 12 orchestrator surfaces.
internal/assets/opencode/commands/{sdd-continue,sdd-status}.md Removed basename-derived project routing and require canonical resolution before scoped Engram status or continuation access.
internal/assets/assets_test.go Expanded the provider-parity regression to all 12 surfaces and added OpenCode command contract coverage.
internal/components/golden_test.go Checks rendered OpenCode sdd-continue and sdd-status command assets.
testdata/golden/* Updated provider snapshots and added the two rendered OpenCode command goldens.

🧪 Test Plan

  • gofmt completed for the changed Go files.
  • Focused all-12-surface project-resolution regression and the full internal/assets package passed.
  • Focused rendered OpenCode command golden regression and the full internal/components package passed.
  • Rendered command golden checks passed.
  • git diff --check passed.
  • Benchmark validation: N/A. This change affects embedded provider assets and their regression snapshots, not benchmark or review-lifecycle behavior.
  • Full repository suite and E2E were not run locally; CI remains authoritative.

🤖 Automated Checks

Check Status Description
Check PR Cognitive Load size:exception applied Live PR size is 646 changed lines. Provider parity spans all 12 orchestrator surfaces and generated installation snapshots are necessary regression evidence; splitting this correction would separate the shared contract from its parity/golden proof.
Check Issue Reference Ready Closes #1903 links the approved issue.
Check Issue Has status:approved Ready Issue #1903 has status:approved.
Check PR Has type:* Label Ready Exactly one type label is applied: type:bug.
Unit Tests Local package checks passed Focused and full internal/assets and internal/components checks passed; the full repository suite was not run locally.
Go Format Local pass gofmt completed for the changed Go files.
E2E Tests Not run locally CI remains authoritative.

✅ Contributor Checklist

  • PR is linked to an issue with status:approved
  • PR exceeds 400 changed lines and has the maintainer-approved size:exception documented above
  • Exactly one appropriate type:* label is applied: type:bug
  • Full repository unit tests (go test ./...) were not run locally
  • Focused and full affected package tests passed
  • Go formatting and whitespace checks passed
  • E2E tests were not run locally
  • Benchmark validation is not applicable, as explained in the Test Plan
  • Behavior documentation is included in the changed prompt assets
  • Commits follow Conventional Commits format
  • Commits do not include Co-Authored-By trailers

💬 Notes for Reviewers

Receipt-driven development is globally disabled, so delivery is ordinary disabled/unmanaged.

Live PR size: 32 files, 596 additions, 50 deletions, 646 changed lines.

Maintainer-approved size:exception rationale: Provider parity spans all 12 orchestrator surfaces and generated installation snapshots are necessary regression evidence; splitting this correction would separate the shared contract from its parity/golden proof.

Please focus on the canonical no-project behavior, the Gemini/Kimi/OpenCode provider parity, and the separately injected OpenCode command assets.

Summary by CodeRabbit

  • New Features

    • Added mandatory project resolution before project-scoped Engram searches.
    • Workflows now use canonical project keys and wait for resolution to complete.
    • Ambiguous projects prompt for selection before searching.
    • Missing projects proceed without invented keys or broad searches unless explicitly requested.
    • SDD routing, initialization, and strict-TDD checks skip project-scoped lookups when no project is resolved.
    • File-based workflows continue when project memory is unavailable.
  • Tests

    • Added coverage verifying project-resolution rules across supported workflows.

@dnlrsls dnlrsls added the type:bug Bug fix label Jul 30, 2026
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

SDD orchestrator assets now resolve the canonical Engram project before scoped memory operations. They handle unique, ambiguous, and missing projects. Routing, initialization, strict-TDD, and apply/verify guards skip project-scoped Engram access when no project is resolved. Tests cover coordinator contracts and exclusions.

Changes

Engram project resolution

Layer / File(s) Summary
Propagate mandatory project resolution across orchestrators
internal/assets/*/sdd-orchestrator*.md
Orchestrator variants await engram_mem_current_project, use its canonical key, and define unique, ambiguous, and no-project paths before scoped memory calls.
Gate SDD routing and initialization
internal/assets/antigravity/sdd-orchestrator.md, internal/assets/claude/sdd-orchestrator-workflow.md, internal/assets/codex/sdd-orchestrator.md, internal/assets/cursor/sdd-orchestrator.md, internal/assets/generic/sdd-orchestrator.md, internal/assets/kiro/sdd-orchestrator.md, internal/assets/qwen/sdd-orchestrator.md, internal/assets/windsurf/sdd-orchestrator.md
Routing resolves the canonical project before Engram state checks. Initialization, strict-TDD, and apply/verify project-scoped operations are skipped when no project is resolved.
Verify coordinator contract coverage
internal/assets/assets_test.go
Tests verify contract counts, ordering before scoped calls, dispatcher guards, and exclusions from apply-related assets.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Orchestrator
  participant Engram
  participant User
  Orchestrator->>Engram: Call engram_mem_current_project
  Engram-->>Orchestrator: Return canonical project or alternatives
  Orchestrator->>User: Request selection when ambiguous
  Orchestrator->>Engram: Run scoped memory operation with canonical key
  Orchestrator->>Engram: Check SDD state only when project and artifact store permit it
Loading

Possibly related PRs

Suggested reviewers: alan-thegentleman, bhanuprasad14

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes satisfy issue #1903 by resolving canonical projects and handling unique, ambiguous, missing, and broad-search cases.
Out of Scope Changes check ✅ Passed The asset updates and regression test remain within the linked issue's Engram coordinator protocol scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes resolving the Engram project before scoped searches.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Fix failing CI checks
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/assets/antigravity/sdd-orchestrator.md`:
- Around line 128-134: Make the no-project branch consistent with each SDD Init
Guard by defining one shared behavior that skips project-scoped Engram
initialization or stops with a clear user-facing explanation; never derive a
basename, use an empty key, or perform broad search. Apply this at
internal/assets/antigravity/sdd-orchestrator.md:128-134,
internal/assets/codex/sdd-orchestrator.md:212-218,
internal/assets/qwen/sdd-orchestrator.md:111-118, and
internal/assets/windsurf/sdd-orchestrator.md:112-119, while preserving the
existing project-scoped flow when a canonical project key is available.

In `@internal/assets/assets_test.go`:
- Around line 53-76: Extend
TestCoordinatorEngramProjectResolutionPrecedesScopedCalls to inspect each
asset’s content before the matched project-resolution contract and fail if that
prefix contains operational mem_context or mem_search invocations. Exclude the
contract text itself from this scan, while preserving the existing exact
contract-count and coordinator coverage assertions.

In `@internal/assets/cursor/sdd-orchestrator.md`:
- Around line 131-137: The SDD project-resolution rules conflict with the
mandatory project-scoped SDD Init Guard when no project is available. Update the
downstream SDD Init Guard in internal/assets/cursor/sdd-orchestrator.md:131-137,
the model-capable coordinator in
internal/assets/generic/sdd-orchestrator.md:113-119, and the Kiro coordinator in
internal/assets/kiro/sdd-orchestrator.md:181-187 to explicitly skip
project-scoped initialization and continue without Engram persistence until a
project is selected; preserve the existing unique and ambiguous project
behavior.

In `@internal/assets/generic/sdd-orchestrator.md`:
- Around line 272-278: Change the “Engram Project Resolution (MANDATORY)”
heading in the SDD orchestrator documentation from level three to level two so
it follows the document’s heading hierarchy and satisfies MD001; leave the
section content unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: be70dd6b-40d1-4a47-adee-47b16985046d

📥 Commits

Reviewing files that changed from the base of the PR and between dea2f94 and 71944d5.

📒 Files selected for processing (14)
  • internal/assets/antigravity/sdd-orchestrator.md
  • internal/assets/assets_test.go
  • internal/assets/claude/sdd-orchestrator-workflow.md
  • internal/assets/claude/sdd-orchestrator.md
  • internal/assets/codex/sdd-orchestrator.md
  • internal/assets/cursor/sdd-orchestrator.md
  • internal/assets/gemini/sdd-orchestrator.md
  • internal/assets/generic/sdd-orchestrator.md
  • internal/assets/hermes/sdd-orchestrator.md
  • internal/assets/kimi/sdd-orchestrator.md
  • internal/assets/kiro/sdd-orchestrator.md
  • internal/assets/opencode/sdd-orchestrator.md
  • internal/assets/qwen/sdd-orchestrator.md
  • internal/assets/windsurf/sdd-orchestrator.md

Comment thread internal/assets/antigravity/sdd-orchestrator.md Outdated
Comment thread internal/assets/assets_test.go
Comment thread internal/assets/cursor/sdd-orchestrator.md Outdated
Comment thread internal/assets/generic/sdd-orchestrator.md Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
internal/assets/assets_test.go (1)

83-91: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Make apply-asset exclusion independent of heading level.

The test rejects only ### Engram Project Resolution (MANDATORY). It will miss the same coordinator instructions if an apply asset uses ## or no heading. Check for the contract text itself, or use a heading-independent marker.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/assets/assets_test.go` around lines 83 - 91, Update the apply-asset
validation loop to detect the coordinator project-resolution contract
independently of Markdown heading level. In the checks around MustRead(path),
match the distinctive instruction text or another heading-independent marker
rather than only the exact “### Engram Project Resolution (MANDATORY)” heading.
♻️ Duplicate comments (1)
internal/assets/assets_test.go (1)

65-80: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Validate every coordinator contract occurrence.

strings.Index always selects the first contract. For generic/sdd-orchestrator.md, the test expects two contracts but checks ordering only before the first one. A scoped call could appear before the second small-model contract and the test would still pass. Iterate over every contract occurrence and validate each coordinator section.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/assets/assets_test.go` around lines 65 - 80, Update the ordering
validation in the test loop around strings.Count and strings.Index to inspect
every project-resolution contract occurrence, not only the first. Iterate
through each contract position and check the preceding coordinator section for
mem_context or mem_search invocations, while preserving the existing
expected-count assertions and failure messages.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/assets/antigravity/sdd-orchestrator.md`:
- Line 142: Align the Native SDD Dispatcher Guards so `sdd-init/{project}`
lookup occurs only after a canonical project and artifact store are established;
otherwise follow the explicit no-project path and continue without
project-scoped Engram persistence. Apply this behavior in
`internal/assets/antigravity/sdd-orchestrator.md` lines 142-142,
`internal/assets/codex/sdd-orchestrator.md` lines 226-226,
`internal/assets/cursor/sdd-orchestrator.md` lines 143-145,
`internal/assets/generic/sdd-orchestrator.md` lines 127-127,
`internal/assets/kiro/sdd-orchestrator.md` lines 193-195,
`internal/assets/qwen/sdd-orchestrator.md` lines 125-129, and
`internal/assets/windsurf/sdd-orchestrator.md` lines 124-126.

---

Outside diff comments:
In `@internal/assets/assets_test.go`:
- Around line 83-91: Update the apply-asset validation loop to detect the
coordinator project-resolution contract independently of Markdown heading level.
In the checks around MustRead(path), match the distinctive instruction text or
another heading-independent marker rather than only the exact “### Engram
Project Resolution (MANDATORY)” heading.

---

Duplicate comments:
In `@internal/assets/assets_test.go`:
- Around line 65-80: Update the ordering validation in the test loop around
strings.Count and strings.Index to inspect every project-resolution contract
occurrence, not only the first. Iterate through each contract position and check
the preceding coordinator section for mem_context or mem_search invocations,
while preserving the existing expected-count assertions and failure messages.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d3417f3f-50f0-42cf-ae4d-4389512ca836

📥 Commits

Reviewing files that changed from the base of the PR and between 71944d5 and 8baab8e.

📒 Files selected for processing (8)
  • internal/assets/antigravity/sdd-orchestrator.md
  • internal/assets/assets_test.go
  • internal/assets/codex/sdd-orchestrator.md
  • internal/assets/cursor/sdd-orchestrator.md
  • internal/assets/generic/sdd-orchestrator.md
  • internal/assets/kiro/sdd-orchestrator.md
  • internal/assets/qwen/sdd-orchestrator.md
  • internal/assets/windsurf/sdd-orchestrator.md

Comment thread internal/assets/antigravity/sdd-orchestrator.md

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
internal/assets/antigravity/sdd-orchestrator.md (1)

142-142: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Handle none as a separate artifact-store mode.

These assets define none as inline-only. The dispatcher wording maps every non-OpenSpec choice to Engram, and the Otherwise branch in SDD Init Guard still searches Engram. When the documented none mode is selected, the coordinator can fail or persist data through a backend the user did not select. Use explicit mode branches: engram and hybrid may use Engram only with a canonical project; openspec uses file artifacts; none skips Engram persistence.

  • internal/assets/antigravity/sdd-orchestrator.md#L142-L142: make initialization conditional on an Engram-permitting store.
  • internal/assets/cursor/sdd-orchestrator.md#L145-L145: skip Engram initialization for none.
  • internal/assets/generic/sdd-orchestrator.md#L127-L127: preserve inline-only behavior for none.
  • internal/assets/kiro/sdd-orchestrator.md#L195-L195: add an explicit none branch before Engram search.
  • internal/assets/qwen/sdd-orchestrator.md#L125-L125: prevent none from entering the Engram init path.
  • internal/assets/windsurf/sdd-orchestrator.md#L126-L126: prevent none from entering the Engram init path.
  • internal/assets/assets_test.go#L60-L60: replace the shared gate string with explicit artifact-store behavior and test the none path.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/assets/antigravity/sdd-orchestrator.md` at line 142, Handle
artifact-store mode explicitly so none remains inline-only and never initializes
or searches Engram. In internal/assets/antigravity/sdd-orchestrator.md:142-142,
internal/assets/cursor/sdd-orchestrator.md:145-145,
internal/assets/generic/sdd-orchestrator.md:127-127,
internal/assets/kiro/sdd-orchestrator.md:195-195,
internal/assets/qwen/sdd-orchestrator.md:125-125, and
internal/assets/windsurf/sdd-orchestrator.md:126-126, allow Engram only for
engram or hybrid with a canonical project, use file artifacts for openspec, and
add an explicit none path that skips persistence; update
internal/assets/assets_test.go:60-60 to replace the shared gate assertion with
explicit artifact-store behavior covering none.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/assets/antigravity/sdd-orchestrator.md`:
- Line 138: Add a terminal no-project guard before every Engram status, TDD,
apply, verify, and persistence operation: in
internal/assets/antigravity/sdd-orchestrator.md:138,
codex/sdd-orchestrator.md:222, cursor/sdd-orchestrator.md:141,
generic/sdd-orchestrator.md:123, kiro/sdd-orchestrator.md:191,
qwen/sdd-orchestrator.md:121, and windsurf/sdd-orchestrator.md:122, prevent
projectless change-topic lookups; additionally gate the project-scoped
apply/verify searches at codex/sdd-orchestrator.md:330-337 and
kiro/sdd-orchestrator.md:300-309, and the TDD search at
windsurf/sdd-orchestrator.md:400-410. Extend
internal/assets/assets_test.go:82-99 to verify these later project-scoped calls
are also skipped without a canonical project.

In `@internal/assets/assets_test.go`:
- Line 101: Extend the dispatcher condition in the asset coverage test to
include claude/sdd-orchestrator-workflow.md alongside the existing provider
paths. Keep the existing seven asset checks unchanged so the lazy-loaded Claude
workflow is validated for its Native SDD Dispatcher Guard.

---

Outside diff comments:
In `@internal/assets/antigravity/sdd-orchestrator.md`:
- Line 142: Handle artifact-store mode explicitly so none remains inline-only
and never initializes or searches Engram. In
internal/assets/antigravity/sdd-orchestrator.md:142-142,
internal/assets/cursor/sdd-orchestrator.md:145-145,
internal/assets/generic/sdd-orchestrator.md:127-127,
internal/assets/kiro/sdd-orchestrator.md:195-195,
internal/assets/qwen/sdd-orchestrator.md:125-125, and
internal/assets/windsurf/sdd-orchestrator.md:126-126, allow Engram only for
engram or hybrid with a canonical project, use file artifacts for openspec, and
add an explicit none path that skips persistence; update
internal/assets/assets_test.go:60-60 to replace the shared gate assertion with
explicit artifact-store behavior covering none.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 8f067688-1c1c-4c5d-9132-ecc649944072

📥 Commits

Reviewing files that changed from the base of the PR and between 8baab8e and b7c5df6.

⛔ Files ignored due to path filters (13)
  • testdata/golden/combined-claude-claudemd.golden is excluded by !testdata/**
  • testdata/golden/combined-windsurf-global-rules.golden is excluded by !testdata/**
  • testdata/golden/sdd-antigravity-rulesmd.golden is excluded by !testdata/**
  • testdata/golden/sdd-claude-claudemd.golden is excluded by !testdata/**
  • testdata/golden/sdd-codex-agentsmd-lowcost.golden is excluded by !testdata/**
  • testdata/golden/sdd-codex-agentsmd-powerful.golden is excluded by !testdata/**
  • testdata/golden/sdd-codex-agentsmd.golden is excluded by !testdata/**
  • testdata/golden/sdd-cursor-rules.golden is excluded by !testdata/**
  • testdata/golden/sdd-gemini-geminimd.golden is excluded by !testdata/**
  • testdata/golden/sdd-kiro-instructions.golden is excluded by !testdata/**
  • testdata/golden/sdd-opencode-multi-settings.golden is excluded by !testdata/**
  • testdata/golden/sdd-vscode-instructions.golden is excluded by !testdata/**
  • testdata/golden/sdd-windsurf-global-rules.golden is excluded by !testdata/**
📒 Files selected for processing (8)
  • internal/assets/antigravity/sdd-orchestrator.md
  • internal/assets/assets_test.go
  • internal/assets/codex/sdd-orchestrator.md
  • internal/assets/cursor/sdd-orchestrator.md
  • internal/assets/generic/sdd-orchestrator.md
  • internal/assets/kiro/sdd-orchestrator.md
  • internal/assets/qwen/sdd-orchestrator.md
  • internal/assets/windsurf/sdd-orchestrator.md

Comment thread internal/assets/antigravity/sdd-orchestrator.md
Comment thread internal/assets/assets_test.go Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
internal/assets/hermes/sdd-orchestrator.md (1)

141-148: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Guard all later Engram lookups when no canonical project exists.

Line 147 says to continue without an invented project and without broad search. However, the following Native SDD Dispatcher Guard still instructs the coordinator to check sdd-init/{project} when the artifact store is not established. The SDD Init Guard also searches that key without an explicit no-project branch.

Add the no-project skip before both lookups. Only use sdd-init/{project} after engram_mem_current_project returns a canonical project.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/assets/hermes/sdd-orchestrator.md` around lines 141 - 148, Add an
explicit no-project branch to both the Native SDD Dispatcher Guard and SDD Init
Guard, skipping their artifact-store and sdd-init/{project} lookups when no
canonical project is returned. Ensure sdd-init/{project} is queried only after
engram_mem_current_project provides a canonical project, while preserving the
existing unique and ambiguous project behavior.
internal/assets/codex/sdd-orchestrator.md (1)

146-155: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Resolve the Markdown lint warning on the launch example.

markdownlint-cli2 reports MD031 and MD040 at Line 147. Add blank lines around the fenced block and specify a language such as text.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/assets/codex/sdd-orchestrator.md` around lines 146 - 155, Update the
sdd-design launch example in the surrounding Markdown by adding blank lines
immediately before and after its fenced code block, and specify an explicit
fence language such as text to satisfy MD031 and MD040.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@internal/assets/codex/sdd-orchestrator.md`:
- Around line 146-155: Update the sdd-design launch example in the surrounding
Markdown by adding blank lines immediately before and after its fenced code
block, and specify an explicit fence language such as text to satisfy MD031 and
MD040.

In `@internal/assets/hermes/sdd-orchestrator.md`:
- Around line 141-148: Add an explicit no-project branch to both the Native SDD
Dispatcher Guard and SDD Init Guard, skipping their artifact-store and
sdd-init/{project} lookups when no canonical project is returned. Ensure
sdd-init/{project} is queried only after engram_mem_current_project provides a
canonical project, while preserving the existing unique and ambiguous project
behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 4dd5e352-b264-4383-9ea3-f91e8e185a65

📥 Commits

Reviewing files that changed from the base of the PR and between b7c5df6 and 5f9fa13.

⛔ Files ignored due to path filters (13)
  • testdata/golden/combined-claude-claudemd.golden is excluded by !testdata/**
  • testdata/golden/combined-windsurf-global-rules.golden is excluded by !testdata/**
  • testdata/golden/sdd-antigravity-rulesmd.golden is excluded by !testdata/**
  • testdata/golden/sdd-claude-claudemd.golden is excluded by !testdata/**
  • testdata/golden/sdd-codex-agentsmd-lowcost.golden is excluded by !testdata/**
  • testdata/golden/sdd-codex-agentsmd-powerful.golden is excluded by !testdata/**
  • testdata/golden/sdd-codex-agentsmd.golden is excluded by !testdata/**
  • testdata/golden/sdd-cursor-rules.golden is excluded by !testdata/**
  • testdata/golden/sdd-gemini-geminimd.golden is excluded by !testdata/**
  • testdata/golden/sdd-kiro-instructions.golden is excluded by !testdata/**
  • testdata/golden/sdd-opencode-multi-settings.golden is excluded by !testdata/**
  • testdata/golden/sdd-vscode-instructions.golden is excluded by !testdata/**
  • testdata/golden/sdd-windsurf-global-rules.golden is excluded by !testdata/**
📒 Files selected for processing (13)
  • internal/assets/antigravity/sdd-orchestrator.md
  • internal/assets/claude/sdd-orchestrator-workflow.md
  • internal/assets/claude/sdd-orchestrator.md
  • internal/assets/codex/sdd-orchestrator.md
  • internal/assets/cursor/sdd-orchestrator.md
  • internal/assets/gemini/sdd-orchestrator.md
  • internal/assets/generic/sdd-orchestrator.md
  • internal/assets/hermes/sdd-orchestrator.md
  • internal/assets/kimi/sdd-orchestrator.md
  • internal/assets/kiro/sdd-orchestrator.md
  • internal/assets/opencode/sdd-orchestrator.md
  • internal/assets/qwen/sdd-orchestrator.md
  • internal/assets/windsurf/sdd-orchestrator.md

@dnlrsls dnlrsls added the size:exception Maintainer-approved exception for PRs above the 400 changed-line review budget label Jul 31, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
internal/assets/antigravity/sdd-orchestrator.md (2)

151-153: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Apply the artifact-store gate to every Engram operation.

The dispatcher requires both a canonical project and an artifact store that permits Engram. The initialization, strict-TDD, and apply-progress rules check only the project. An OpenSpec-only session can still perform project-scoped Engram searches.

  • internal/assets/antigravity/sdd-orchestrator.md#L151-L153: gate sdd-init lookup by engram or hybrid.
  • internal/assets/antigravity/sdd-orchestrator.md#L356-L356: gate strict-TDD capability lookup by engram or hybrid.
  • internal/assets/codex/sdd-orchestrator.md#L251-L253: gate initialization lookup by artifact store.
  • internal/assets/codex/sdd-orchestrator.md#L357-L358: gate apply/verify context searches by artifact store.
  • internal/assets/cursor/sdd-orchestrator.md#L154-L156: gate initialization lookup by artifact store.
  • internal/assets/cursor/sdd-orchestrator.md#L369-L370: gate strict-TDD lookup by artifact store.
  • internal/assets/generic/sdd-orchestrator.md#L136-L138: gate initialization lookup by artifact store.
  • internal/assets/generic/sdd-orchestrator.md#L387-L388: gate strict-TDD lookup by artifact store.
  • internal/assets/kiro/sdd-orchestrator.md#L204-L206: gate initialization lookup by artifact store.
  • internal/assets/kiro/sdd-orchestrator.md#L313-L314: gate apply/verify context searches by artifact store.
  • internal/assets/qwen/sdd-orchestrator.md#L130-L136: gate initialization and dispatcher-related Engram access by artifact store.
  • internal/assets/qwen/sdd-orchestrator.md#L332-L333: gate strict-TDD lookup by artifact store.
  • internal/assets/windsurf/sdd-orchestrator.md#L135-L137: gate initialization lookup by artifact store.
  • internal/assets/windsurf/sdd-orchestrator.md#L415-L416: gate strict-TDD lookup by artifact store.
  • internal/assets/claude/sdd-orchestrator-workflow.md#L113-L113: gate initialization lookup by artifact store.
  • internal/assets/claude/sdd-orchestrator-workflow.md#L287-L287: gate strict-TDD lookup by artifact store.
  • internal/assets/claude/sdd-orchestrator-workflow.md#L289-L291: gate apply-progress lookup by artifact store.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/assets/antigravity/sdd-orchestrator.md` around lines 151 - 153,
Apply the artifact-store gate to every Engram operation: require an
Engram-enabled store (engram or hybrid) in the SDD Init Guard, strict-TDD, and
apply/verify lookups. Update internal/assets/antigravity/sdd-orchestrator.md
lines 151-153 and 356; internal/assets/codex/sdd-orchestrator.md lines 251-253
and 357-358; internal/assets/cursor/sdd-orchestrator.md lines 154-156 and
369-370; internal/assets/generic/sdd-orchestrator.md lines 136-138 and 387-388;
internal/assets/kiro/sdd-orchestrator.md lines 204-206 and 313-314;
internal/assets/qwen/sdd-orchestrator.md lines 130-136 and 332-333;
internal/assets/windsurf/sdd-orchestrator.md lines 135-137 and 415-416; and
internal/assets/claude/sdd-orchestrator-workflow.md lines 113, 287, and 289-291.
Ensure OpenSpec-only sessions skip project-scoped Engram initialization,
searches, and persistence.

149-149: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Preserve the none artifact-store contract.

These assets define none as inline-only, but their dispatcher text treats every state without OpenSpec as Engram-backed. A selected none store can therefore trigger Engram initialization or persistence.

  • internal/assets/antigravity/sdd-orchestrator.md#L149-L149: handle none separately from engram.
  • internal/assets/cursor/sdd-orchestrator.md#L152-L152: handle none separately from engram.
  • internal/assets/generic/sdd-orchestrator.md#L134-L134: handle none separately from engram.
  • internal/assets/kiro/sdd-orchestrator.md#L202-L202: handle none separately from engram.
  • internal/assets/windsurf/sdd-orchestrator.md#L133-L133: handle none separately from engram.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/assets/antigravity/sdd-orchestrator.md` at line 149, Update the
artifact-store routing around the native dispatcher in
internal/assets/antigravity/sdd-orchestrator.md:149-149,
internal/assets/cursor/sdd-orchestrator.md:152-152,
internal/assets/generic/sdd-orchestrator.md:134-134,
internal/assets/kiro/sdd-orchestrator.md:202-202, and
internal/assets/windsurf/sdd-orchestrator.md:133-133 to handle `none` separately
from `engram`. For `none`, preserve inline-only behavior: do not initialize or
persist through Engram and do not perform project-scoped Engram lookups; retain
the existing Engram routing only for `engram`.
internal/assets/generic/sdd-orchestrator.md (1)

283-290: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Keep the small-model section behind the full SDD gates.

The model-small section defines SDD execution modes and Engram access rules, but it does not include the Native SDD Dispatcher Guard or SDD Init Guard. If this section can be rendered independently, small model coordinators can bypass artifact-store routing and initialization. Add compact guards here or ensure the renderer always injects them.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/assets/generic/sdd-orchestrator.md` around lines 283 - 290, The
model-small section must enforce the same SDD execution gates as the full SDD
flow. Add compact Native SDD Dispatcher Guard and SDD Init Guard instructions
within the model-small section, or update its rendering path to always inject
both guards before execution and Engram access.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/assets/antigravity/sdd-orchestrator.md`:
- Line 145: Unscoped Engram fallback is not consistently gated by explicit
cross-project recall. In internal/assets/antigravity/sdd-orchestrator.md:145,
internal/assets/cursor/sdd-orchestrator.md:148,
internal/assets/generic/sdd-orchestrator.md:130,
internal/assets/qwen/sdd-orchestrator.md:128,
internal/assets/windsurf/sdd-orchestrator.md:129, and
internal/assets/claude/sdd-orchestrator-workflow.md:36, update the no-project
contract so the referenced later delegation/non-SDD rules only permit unscoped
Engram searches or persistence during explicit cross-project recall; preserve
valid OpenSpec/file behavior and prohibit invented keys or broad searches
otherwise.

In `@internal/assets/assets_test.go`:
- Around line 67-90: The test duplicates coordinator paths in dispatcherPaths
and paths, allowing their coverage to diverge. Update the test around
dispatcherPaths and paths to use a single path slice and derive the dispatcher
lookup set from it, or explicitly assert both collections contain exactly the
same entries while preserving the existing eight-path coverage check.
- Around line 127-132: The scoped Engram validation loop must check
noProjectTerminalPolicy within the current coordinator section rather than
across the entire content prefix. Update the section-scanning logic around
scopedEngramInvocation and firstContractOffset to track each model section and
require its own local project-resolution contract before accepting an
invocation, including independent contract occurrences in the generic
coordinator.

---

Outside diff comments:
In `@internal/assets/antigravity/sdd-orchestrator.md`:
- Around line 151-153: Apply the artifact-store gate to every Engram operation:
require an Engram-enabled store (engram or hybrid) in the SDD Init Guard,
strict-TDD, and apply/verify lookups. Update
internal/assets/antigravity/sdd-orchestrator.md lines 151-153 and 356;
internal/assets/codex/sdd-orchestrator.md lines 251-253 and 357-358;
internal/assets/cursor/sdd-orchestrator.md lines 154-156 and 369-370;
internal/assets/generic/sdd-orchestrator.md lines 136-138 and 387-388;
internal/assets/kiro/sdd-orchestrator.md lines 204-206 and 313-314;
internal/assets/qwen/sdd-orchestrator.md lines 130-136 and 332-333;
internal/assets/windsurf/sdd-orchestrator.md lines 135-137 and 415-416; and
internal/assets/claude/sdd-orchestrator-workflow.md lines 113, 287, and 289-291.
Ensure OpenSpec-only sessions skip project-scoped Engram initialization,
searches, and persistence.
- Line 149: Update the artifact-store routing around the native dispatcher in
internal/assets/antigravity/sdd-orchestrator.md:149-149,
internal/assets/cursor/sdd-orchestrator.md:152-152,
internal/assets/generic/sdd-orchestrator.md:134-134,
internal/assets/kiro/sdd-orchestrator.md:202-202, and
internal/assets/windsurf/sdd-orchestrator.md:133-133 to handle `none` separately
from `engram`. For `none`, preserve inline-only behavior: do not initialize or
persist through Engram and do not perform project-scoped Engram lookups; retain
the existing Engram routing only for `engram`.

In `@internal/assets/generic/sdd-orchestrator.md`:
- Around line 283-290: The model-small section must enforce the same SDD
execution gates as the full SDD flow. Add compact Native SDD Dispatcher Guard
and SDD Init Guard instructions within the model-small section, or update its
rendering path to always inject both guards before execution and Engram access.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 8ccaad0f-e90a-400a-907f-70a42a5d68ea

📥 Commits

Reviewing files that changed from the base of the PR and between 5f9fa13 and 104870f.

⛔ Files ignored due to path filters (9)
  • testdata/golden/combined-windsurf-global-rules.golden is excluded by !testdata/**
  • testdata/golden/sdd-antigravity-rulesmd.golden is excluded by !testdata/**
  • testdata/golden/sdd-codex-agentsmd-lowcost.golden is excluded by !testdata/**
  • testdata/golden/sdd-codex-agentsmd-powerful.golden is excluded by !testdata/**
  • testdata/golden/sdd-codex-agentsmd.golden is excluded by !testdata/**
  • testdata/golden/sdd-cursor-rules.golden is excluded by !testdata/**
  • testdata/golden/sdd-kiro-instructions.golden is excluded by !testdata/**
  • testdata/golden/sdd-vscode-instructions.golden is excluded by !testdata/**
  • testdata/golden/sdd-windsurf-global-rules.golden is excluded by !testdata/**
📒 Files selected for processing (9)
  • internal/assets/antigravity/sdd-orchestrator.md
  • internal/assets/assets_test.go
  • internal/assets/claude/sdd-orchestrator-workflow.md
  • internal/assets/codex/sdd-orchestrator.md
  • internal/assets/cursor/sdd-orchestrator.md
  • internal/assets/generic/sdd-orchestrator.md
  • internal/assets/kiro/sdd-orchestrator.md
  • internal/assets/qwen/sdd-orchestrator.md
  • internal/assets/windsurf/sdd-orchestrator.md

Comment thread internal/assets/antigravity/sdd-orchestrator.md
Comment thread internal/assets/assets_test.go Outdated
Comment thread internal/assets/assets_test.go Outdated
@Alan-TheGentleman

Copy link
Copy Markdown
Contributor

One provider-parity blocker remains on the current c8b4396f head. Gemini, Kimi, and OpenCode still use the weaker no-project wording while retaining project-scoped sdd-init/{project} and later mem_search(... project: "{project}") flows; the regression covers only 9 of 12 orchestrator surfaces and omits all three. The diff is also 487 lines while the PR body still claims it stays within 400, despite the size:exception label. Apply the terminal no-project contract and parity coverage to those three providers, then update the body with the actual size and the exception rationale.

@dnlrsls

dnlrsls commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Implemented in ee2020c157658a06c39b4d75e9482f9f661b7e8f.

Gemini, Kimi, OpenCode, and the OpenCode /sdd-continue and /sdd-status basename bypass are corrected. Regression now covers all 12 orchestrator surfaces with rendered command goldens.

The body now reports the live 646-line size and existing maintainer-approved size:exception rationale. Passing package checks: go test ./internal/assets -run ^TestCoordinatorEngramProjectResolutionPrecedesScopedCalls$ -count=1, go test ./internal/assets -count=1, go test ./internal/components -run ^TestGoldenSDD_OpenCode$ -count=1, and go test ./internal/components -count=1; gofmt and git diff --check also passed. Full repository and E2E were not run locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:exception Maintainer-approved exception for PRs above the 400 changed-line review budget type:bug Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(engram): proactive memory search is ineffective — agent does not discover user projects before searching

2 participants