Skip to content

fix(project-context): admit commands agents get wrong - #2703

Draft
alexeyv wants to merge 1 commit into
mainfrom
fix/project-context-command-admission
Draft

fix(project-context): admit commands agents get wrong#2703
alexeyv wants to merge 1 commit into
mainfrom
fix/project-context-command-admission

Conversation

@alexeyv

@alexeyv alexeyv commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

What

Teach bmad-project-context to admit exact commands when unaided session history shows agents getting them wrong, even when the command is derivable from repository files.

Why

The previous derivability rule treated a command's presence in configuration as proof that agents would choose it correctly. Actual session history can show otherwise. Later clean sessions are aided by the instruction, so their success alone cannot prove the line is unnecessary.

How

  • Add supplied session history and review corrections to discovery evidence.
  • Keep commands agents consistently get right in their canonical source.
  • Preserve history-admitted commands until they are stale, wrong, superseded, or deliberately retired.
  • Align the skill contract, template, explanation, theory, and how-to documentation.

Testing

HUSKY=0 npm ci && npm run quality

Use unaided session history to decide which command invocations earn a
guide line. Keep aided success from serving as removal evidence.

@greptile-apps greptile-apps 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.

Your trial has ended. Reactivate Greptile to resume code reviews.

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The project-context theory, documentation, skill, and reference templates now use unaided session history and review corrections to identify command errors and runtime pitfalls. Refresh, record, audit, admission, exclusion, and retirement rules now apply evidence-based criteria.

Changes

Project Context Evidence Rules

Layer / File(s) Summary
Context model and refresh rules
docs/explanation/project-context-theory.md, docs/explanation/project-context.md
The documentation defines stored context, evidence-based command admission, runtime caveats, retirement conditions, and refresh handling for deletions and renames.
Skill discovery and audit workflow
docs/how-to/project-context.md, src/bmm-skills/plan/bmad-project-context/SKILL.md
Setup, refresh, record, and audit workflows use unaided session history and review corrections. Commands and pitfalls require captured evidence and are retained until stale, superseded, retired, or otherwise invalid.
Operational guidance and examples
src/bmm-skills/plan/bmad-project-context/references/best-practices.md, src/bmm-skills/plan/bmad-project-context/references/template.md
Best practices define command admission and retirement rules. The template adds single-test, Docker Compose, and pnpm typecheck verification guidance.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: bmadcode

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: admitting commands that agents repeatedly get wrong.
Description check ✅ Passed The description directly explains the change, rationale, implementation, and testing for project-context command admission.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/project-context-command-admission

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: 3

🤖 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 `@src/bmm-skills/plan/bmad-project-context/references/template.md`:
- Line 8: The project-context output and brainstorming loader use different
default files, so verified facts are not consistently loaded downstream. Update
the bmad-project-context generation flow and the bmad-brainstorming
customize.toml default loader path to share the same contract: include AGENTS.md
in the loader defaults, or also write the generated context to
project-context.md; preserve existing context-loading behavior.

In `@src/bmm-skills/plan/bmad-project-context/SKILL.md`:
- Line 33: Update the wording in SKILL.md to use the hyphenated compound
modifier “agent-specific” instead of “agent specific,” without changing the
surrounding guidance.
🪄 Autofix

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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 9473b8a7-c92c-4287-be27-a7bc0001b6ae

📥 Commits

Reviewing files that changed from the base of the PR and between 328d286 and 8b8efbf.

📒 Files selected for processing (6)
  • docs/explanation/project-context-theory.md
  • docs/explanation/project-context.md
  • docs/how-to/project-context.md
  • src/bmm-skills/plan/bmad-project-context/SKILL.md
  • src/bmm-skills/plan/bmad-project-context/references/best-practices.md
  • src/bmm-skills/plan/bmad-project-context/references/template.md

Comment on lines +14 to +18
Written context earns its cost when it carries something the agent cannot derive by reading the repository, or a command that unaided session history shows agents still get wrong.

Two results from different literatures locate the same boundary. Separating code reasoning from documentation memorization across repository-level tasks, **code access delivers the dominant gains over documentation access** — a document describing how the system works loses to the source it describes. Running the inverse experiment — generating requirements *from* code — models prove unreliable at producing anything not already implemented. Current behavior is recoverable from source. **Intent, rationale, and what was deliberately rejected are not.**

So anything derivable is read live and never stored. A stored copy is a stale duplicate of something the agent reads more accurately first-hand, and it is charged on every single call.
So derivable facts are read live and never stored. The exception is evidence of behavior: if unaided session history shows agents choose the wrong command, the exact invocation changes behavior despite being derivable. Everything else stays at its source of truth, where it cannot drift from a stored copy.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Repo files matching project context docs/skill:"
git ls-files | rg '(^docs/|src/.*)project-context|src/.*/bmad-project-context'

echo
echo "Locate references to review corrections:"
rg -n -i "review.?correct|review.?correction|review corrections|correction" .

echo
echo "Locate canonical terms around evidence/session history:"
rg -n "unaided session|interview the gaps|supplied unaided|session history|review" docs src/bmm-skills/plan/bmad-project-context

Repository: bmad-code-org/BMAD-METHOD

Length of output: 50381


🏁 Script executed:

#!/bin/bash
set -euo pipefail

for f in \
  docs/explanation/project-context-theory.md \
  docs/explanation/project-context.md \
  docs/how-to/project-context.md \
  src/bmm-skills/plan/bmad-project-context/SKILL.md \
  src/bmm-skills/plan/bmad-project-context/references/best-practices.md \
  src/bmm-skills/plan/bmad-project-context/references/template.md
do
  echo "===== $f ====="
  wc -l "$f"
done

echo
echo "Relevant file sections:"
sed -n '1,110p' docs/explanation/project-context-theory.md
echo "---- docs/explanation/project-context.md ----"
sed -n '1,80p' docs/explanation/project-context.md
echo "---- docs/how-to/project-context.md ----"
sed -n '1,80p' docs/how-to/project-context.md
echo "---- SKILL.md step 2-4 and refresh/record ----"
sed -n '1,130p' src/bmm-skills/plan/bmad-project-context/SKILL.md
echo "---- best-practices.md admission/exclusion/retirement ----"
sed -n '1,70p' src/bmm-skills/plan/bmad-project-context/references/best-practices.md
echo "---- template Running section ----"
sed -n '1,80p' src/bmm-skills/plan/bmad-project-context/references/template.md

Repository: bmad-code-org/BMAD-METHOD

Length of output: 36962


Apply the same evidence rule to review corrections.

docs/how-to/project-context.md and src/bmm-skills/plan/bmad-project-context/SKILL.md let users supply review corrections, but the admission, section, retention, and refresh rules still treat only unaided session history as command-error evidence. Define whether corrections are admissible, apply the decision consistently across docs/, SKILL.md, best-practices.md, and template.md, and state an explicit retirement rule for correction-admitted commands if aided success alone does not remove them.

📍 Affects 5 files
  • docs/explanation/project-context-theory.md#L14-L18 (this comment)
  • docs/explanation/project-context-theory.md#L49-L50
  • docs/explanation/project-context-theory.md#L77-L83
  • docs/explanation/project-context.md#L8-L22
  • docs/how-to/project-context.md#L37-L43
  • docs/how-to/project-context.md#L61-L61
  • src/bmm-skills/plan/bmad-project-context/SKILL.md#L45-L53
  • src/bmm-skills/plan/bmad-project-context/SKILL.md#L81-L81
  • src/bmm-skills/plan/bmad-project-context/SKILL.md#L93-L101
  • src/bmm-skills/plan/bmad-project-context/references/best-practices.md#L7-L16
  • src/bmm-skills/plan/bmad-project-context/references/best-practices.md#L29-L29
  • src/bmm-skills/plan/bmad-project-context/references/best-practices.md#L38-L39

Source: Path instructions

2. **Policy** — what the org requires.
3. **Where things are** — entry points, and pointers to children and linked files.
4. **Running and verifying** — only what `package.json`, a `Makefile`, or CI config does not already say.
4. **Running and verifying** — commands unaided session history shows agents get wrong, plus what `package.json`, a `Makefile`, or CI config does not already say.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C 4 'persistent_facts|project-context\.md|AGENTS\.md' \
  src/core-skills src/bmm-skills docs

Repository: bmad-code-org/BMAD-METHOD

Length of output: 50386


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf 'Files matching AGENTS/project-context/customize:\n'
fd -a '(^|/)AGENTS\.md$|project-context\.md$|customize\.toml$|SKILL\.md$|module-help\.csv$' . | sed 's#^\./##' | sort | head -300

printf '\nRelevant templates and customize values:\n'
for f in \
  src/bmm-skills/plan/bmad-project-context/references/template.md \
  src/bmm-skills/plan/bmad-project-context/SKILL.md \
  src/core-skills/bmad-brainstorming/customize.toml \
  src/bmm-skills/ship/bmad-code-review/SKILL.md
do
  if [ -f "$f" ]; then
    echo "--- $f"
    wc -l "$f"
    sed -n '1,180p' "$f"
  fi
done

printf '\nTargeted search for AGENTS.md references in src/docs:\n'
rg -n --glob '!node_modules' --glob '!dist' --glob '!build' \
  '\bAGENTS\.md\b|bmad-project-context|persistent_facts\s*=|file:\{project-root\}/\*\*/project-context\.md' \
  src docs | head -500

Repository: bmad-code-org/BMAD-METHOD

Length of output: 50385


Preserve the downstream context-loading contract.

bmad-project-context writes the verified block to AGENTS.md, but src/core-skills/bmad-brainstorming/customize.toml only defaults to file:{project-root}/**/project-context.md. Add AGENTS.md to this loader’s default path if brainstorming should carry the same facts, or keep the generated context in project-context.md as well.

🤖 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 `@src/bmm-skills/plan/bmad-project-context/references/template.md` at line 8,
The project-context output and brainstorming loader use different default files,
so verified facts are not consistently loaded downstream. Update the
bmad-project-context generation flow and the bmad-brainstorming customize.toml
default loader path to share the same contract: include AGENTS.md in the loader
defaults, or also write the generated context to project-context.md; preserve
existing context-loading behavior.

### 1. Assess and report

Read `AGENTS.md`, harness or agent specific rule files, docs folders, and any notes carrying lessons. Report what exists and how it measures up, per `best-practices.md`.
Read `AGENTS.md`, harness or agent specific rule files, docs folders, notes carrying lessons, and any agent session history or review corrections the user supplied. Report what exists and how it measures up, per `best-practices.md`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Use the hyphenated modifier.

Change agent specific to agent-specific.

Based on the static analysis hint, the compound modifier needs a hyphen.

🧰 Tools
🪛 LanguageTool

[grammar] ~33-~33: Use a hyphen to join words.
Context: ...port Read AGENTS.md, harness or agent specific rule files, docs folders, notes...

(QB_NEW_EN_HYPHEN)

🤖 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 `@src/bmm-skills/plan/bmad-project-context/SKILL.md` at line 33, Update the
wording in SKILL.md to use the hyphenated compound modifier “agent-specific”
instead of “agent specific,” without changing the surrounding guidance.

Source: Linters/SAST tools

@alexeyv
alexeyv marked this pull request as draft August 9, 2026 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant