Skip to content

[codex] polish repo knowledge skill#1

Open
kmshdev wants to merge 16 commits into
mainfrom
codex/adapter-drift-detection
Open

[codex] polish repo knowledge skill#1
kmshdev wants to merge 16 commits into
mainfrom
codex/adapter-drift-detection

Conversation

@kmshdev

@kmshdev kmshdev commented Jun 30, 2026

Copy link
Copy Markdown
Owner

Summary

  • Clarifies Codex optional metadata for the update-repo-knowledge skill.
  • Splits repo-knowledge helper scripts into focused modules and adds benchmark scenarios.
  • Adds an AGENTS.md guidance alignment evaluation plan and records the implementation plan.

Validation

  • python3 -m unittest discover -s tests -v
  • python3 -m py_compile scripts/*.py
  • uv run --script scripts/repo_level_tdd_fixture.py --refresh
  • Installed skill validation with python3 -m unittest discover -s tests -v and metadata/benchmark JSON checks
  • Installed Plugin Eval: 100/100, grade A, no fail/warn checks

Summary by CodeRabbit

  • New Features
    • Added a disposable repo-level TDD fixture CLI to run knowledge diagnostics against a fresh clone (with refresh support).
    • Added stricter structural adapter drift detection, including a new adapter-extra-content warning.
    • Expanded repository validation tooling and updated the update-repo-knowledge agent to refresh knowledge using these checks.
  • Bug Fixes
    • Improved adapter-warning accuracy and tightened refresh safety so disposable checkouts are handled reliably.
  • Documentation
    • Added adapter drift detection specs/plans, evaluation guidance, and benchmark configuration; clarified adapter policy/evidence rules.
  • Tests
    • Added/extended unit tests for adapter shape/drift, docs index warnings, nested scope behavior, and the new fixture CLI.

@kmshdev kmshdev requested a review from Copilot June 30, 2026 08:57
@coderabbitai

coderabbitai Bot commented Jun 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

Adds AST change-analysis and knowledge-diff helper modules, a structural adapter-shape checker with tests, a repo-level TDD fixture, and supporting docs, benchmark, and guidance updates.

Changes

AST Change and Hinting Pipeline

Layer / File(s) Summary
Configuration and helper modules
scripts/ast_change_*
Adds shared AST change constants plus helpers for diff parsing, language lookup, path scoping, git/subprocess access, and ast-grep match normalization.
Analysis, hinting, and summary accounting
scripts/ast_change_analysis.py, scripts/ast_change_hint_building.py, scripts/ast_change_hints.py, scripts/ast_change_summary.py, tests/test_ast_change_hints.py
Adds change analysis, hint collection, summary counters, CLI parsing, and the main summary workflow.

Knowledge Diff and Baseline Script Modularization

Layer / File(s) Summary
Knowledge-store check helpers
scripts/check_knowledge_common.py, scripts/check_knowledge_links.py, scripts/check_knowledge_docs.py, scripts/check_knowledge_adapters.py, scripts/check_knowledge_adapter_shape.py, scripts/check_knowledge_adapter_emit.py, scripts/check_knowledge_store.py, tests/test_check_knowledge_store.py
Adds shared check formatting plus Markdown link, docs index, adapter-shape, adapter warning, and store validation wiring.
Knowledge diff and agent baseline scripts
scripts/knowledge_diff_*, scripts/find_agents_*, tests/test_knowledge_diff.py, scripts/check_knowledge_store.py
Adds knowledge-diff classification, git, and summary helpers, plus the find-agents git/collection helpers and updated script entry points.

Adapter Drift Detection, Fixture, and Guidance Updates

Layer / File(s) Summary
Adapter shape classifier and store wiring
docs/specs/2026-06-19-adapter-drift-detection.md, docs/superpowers/plans/2026-06-19-adapter-drift-detection.md, docs/superpowers/plans/2026-06-30-update-repo-knowledge-skill-polish.md, docs/evaluations/2026-06-30-agents-guidance-alignment.md, .plugin-eval/benchmark.json, agents/openai.yaml, references/intent-layer-capture.md, SKILL.md
Adds adapter-drift spec and implementation plan documents, benchmark and evaluation artifacts, agent metadata, SKILL.md guidance, and intent-layer clarifications.
Repo-level TDD fixture script and tests
scripts/repo_level_tdd_fixture.py, tests/test_repo_level_tdd_fixture.py
Adds the disposable repo fixture CLI, its subprocess and clone helpers, and tests for the official repository URL and default work root constants.

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Poem

🐇 I nibbled the diff and found many bright clues,
A classifier, fixtures, and docs in two hues.
In /tmp I hop, then I test with delight,
While adapters stay tidy and scripts run just right. ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 6.59% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title is related to the skill changes, but it is too broad to convey the main update clearly. Use a more specific title, e.g. "Polish update-repo-knowledge skill with adapter checks and fixture safeguards".
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/adapter-drift-detection

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.

@kmshdev kmshdev changed the title Codex/adapter drift detection Add adapter drift detection and repo-level fixture Jun 30, 2026

Copilot AI 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.

Pull request overview

This PR tightens repository knowledge-store validation by detecting “adapter drift” (tool-specific instruction files that point at AGENTS.md but also contain extra instructions) and adds a repo-level fixture script to forward-test the skill against a disposable agentskills/agentskills clone.

Changes:

  • Add adapter-shape classification to scripts/check_knowledge_store.py, including a new adapter-extra-content warning.
  • Add unittest coverage for valid/invalid adapter shapes and basic repo structure checks.
  • Document the structural adapter boundary in references/specs and add a repo-level TDD fixture script + quick reference entry.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tests/test_repo_level_tdd_fixture.py Verifies fixture script constants (repo URL and default tmp work root).
tests/test_check_knowledge_store.py Adds adapter-shape and repo-structure tests for check_knowledge_store.validate().
scripts/repo_level_tdd_fixture.py New script to clone/update a disposable agentskills checkout and run baseline/diff/health scripts.
scripts/check_knowledge_store.py Adds adapter-shape detection and emits adapter-extra-content warnings.
SKILL.md Updates quick reference + clarifies adapter expectations.
references/intent-layer-capture.md Documents that adapter checks are structural (not semantic equivalence).
docs/superpowers/plans/2026-06-19-adapter-drift-detection.md Implementation plan for adapter drift detection.
docs/specs/2026-06-19-adapter-drift-detection.md Spec describing goals, non-goals, thresholds, and acceptance criteria.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/check_knowledge_store.py Outdated
r"\b(auto[- ]?generated|generated|do not edit|source)\b",
re.IGNORECASE,
)
ADAPTER_DECORATIVE_LINE_PATTERN = re.compile(r"^(#|<!--|-->|//)")
Comment thread scripts/check_knowledge_store.py Outdated
Comment on lines +59 to +63
if (
len(lines) <= ADAPTER_SHORT_POINTER_MAX_LINES
and len(stripped) <= ADAPTER_SHORT_POINTER_MAX_CHARS
and all(ADAPTER_POINTER_PATTERN.search(line) for line in content_lines)
):
Comment thread scripts/repo_level_tdd_fixture.py Outdated
Comment on lines +41 to +42
if refresh and repo.exists():
shutil.rmtree(repo)
Comment thread scripts/repo_level_tdd_fixture.py
Comment thread docs/superpowers/plans/2026-06-19-adapter-drift-detection.md Outdated
Comment thread docs/specs/2026-06-19-adapter-drift-detection.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: 7

🧹 Nitpick comments (3)
tests/test_check_knowledge_store.py (1)

79-165: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add regression coverage for the header-based false negatives.

The suite only checks paragraph-body extra content. It would miss a manual adapter whose header says source of truth, and one whose extra instruction lives entirely in a markdown heading/comment line, even though both paths can currently suppress adapter-extra-content. Locking those cases in here will keep the classifier from regressing silently.

🤖 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 `@tests/test_check_knowledge_store.py` around lines 79 - 165, Add regression
tests in test_check_knowledge_store for the header-based false negatives by
extending the existing adapter coverage around validate() and adapter_checks().
Include one CLAUDE.md fixture where the header itself claims a source of truth
instead of pointing to AGENTS.md, and another where the extra instruction
appears only in a markdown heading or comment line, then assert adapter-drift or
adapter-extra-content is still reported as appropriate. Use the existing test
patterns in test_generated_adapter_with_source_marker_passes and
test_pointer_with_extra_instruction_content_warns to keep the cases aligned with
the current classifier behavior.
docs/specs/2026-06-19-adapter-drift-detection.md (1)

31-37: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Vary the "Do not" repetition for readability.

Three successive non-goal bullets start with "Do not". Consider rephrasing for smoother flow, e.g., "Avoid semantic equivalence checking", "Skip LLM review...", "Keep knowledge_diff.py schema unchanged".

🤖 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 `@docs/specs/2026-06-19-adapter-drift-detection.md` around lines 31 - 37, The
Non-Goals list is too repetitive because several consecutive bullets start with
“Do not,” so revise the wording for smoother readability. Update the bullets in
the adapter drift detection spec to vary the phrasing while preserving meaning,
using clearer alternatives such as “Avoid semantic adapter equivalence
checking,” “Skip LLM review, embeddings, AST analysis, or runtime behavior
checks,” and “Keep knowledge_diff.py JSON schema or path/status routing
unchanged.”
tests/test_repo_level_tdd_fixture.py (1)

20-28: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add behavior coverage for the fixture’s failure paths.

This only locks down the exported constants. The new logic that parses child stdout and chains baseline → diff is untested, so regressions there will still merge unnoticed.

🤖 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 `@tests/test_repo_level_tdd_fixture.py` around lines 20 - 28, The current test
only verifies exported constants, so add coverage in RepoLevelTddFixtureTests
for the fixture’s failure paths around the new child stdout parsing and
baseline-to-diff chaining behavior. Extend the tests that load the module so
they exercise the relevant fixture/helper methods that consume child process
output and build the baseline/diff sequence, and assert the expected failures or
error handling when stdout is malformed or chaining breaks. Keep the focus on
the new logic rather than just AGENTSKILLS_REPO_URL and DEFAULT_WORK_ROOT.
🤖 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 `@docs/specs/2026-06-19-adapter-drift-detection.md`:
- Around line 124-136: The verification commands in the spec use hardcoded
absolute paths that make the document non-portable. Update the verification
section to use relative instructions from the repository root or
parameterized/environment-based paths instead of the author-specific
`/Users/kmsh/...` locations. Adjust the text around the verification commands so
it still references the same commands, but no longer depends on a local machine
path.

In `@docs/superpowers/plans/2026-06-19-adapter-drift-detection.md`:
- Around line 456-464: The validation command in this plan uses an
author-specific absolute path, which breaks portability. Update the referenced
validation step to use a parameterized or environment-agnostic way to locate the
quick_validate.py script, and make sure the instructions in this section clearly
tell readers how to find the script in their current setup instead of relying on
the local Codex install path.
- Around line 217-252: The Step 3 adapter_shape() plan is out of sync with the
actual scripts/check_knowledge_store.py implementation because it omits
decorative-line filtering and the stricter pointer validation. Update the
documented constants and adapter_shape() flow so it matches the real contract:
include ADAPTER_DECORATIVE_LINE_PATTERN, filter content_lines before
classification, and use the same all() pointer-pattern check and
generated/short-pointer ordering as the implementation. Keep the plan text
aligned with the existing adapter_shape(), ADAPTER_POINTER_PATTERN, and rel()
symbols so it mirrors the committed behavior exactly.
- Around line 398-409: The Step 3 command in the plan is using `uv run --script`
against `scripts/check_knowledge_store.py`, but that script does not have the
required PEP 723 metadata. Update the command to use the existing
`check_knowledge_store.py` entrypoint via `uv run python ... --json`, or add the
inline script metadata to `check_knowledge_store.py` if you want to keep
`--script`; keep the change aligned with the `Run markdown link and skill health
checks` step text.

In `@scripts/check_knowledge_store.py`:
- Around line 20-24: `adapter_shape()` in `scripts/check_knowledge_store.py` is
over-matching generated content and stripping too many lines, so manual adapters
can be misclassified as generated/short-pointer. Narrow
`ADAPTER_GENERATED_MARKER_PATTERN` so it only matches explicit boilerplate
markers and does not treat generic text like “source” as generated, and tighten
`ADAPTER_DECORATIVE_LINE_PATTERN` so `#`/comment-prefixed lines are only ignored
when they are true decorative headers, not meaningful prose before a pointer
line. Update the `adapter_shape()` checks to preserve real content and still
flag extra adapter text correctly.

In `@scripts/repo_level_tdd_fixture.py`:
- Around line 58-71: run_skill_script() should not assume any non-empty stdout
is valid JSON, because that can crash the fixture when a failed child prints
plain text. Update the result handling in run_skill_script so json.loads() is
only used when stdout is actually JSON, and otherwise preserve the raw stdout as
the captured failure payload; keep the returned structure with command,
returncode, stdout, and stderr unchanged.
- Around line 80-89: The fixture currently always writes baseline.json and runs
knowledge_diff.py even when find_agents_baseline.py fails, which can create a
misleading follow-up failure. Update the summarize() flow in
repo_level_tdd_fixture.py so the diff step is only invoked after a successful
baseline run, using the existing run_skill_script result from baseline_script to
decide whether to continue; if the baseline fails, stop before writing the
baseline file or calling diff_script. Keep the logic centered around
summarize(), baseline_script, diff_script, and baseline_path so it’s easy to
locate.

---

Nitpick comments:
In `@docs/specs/2026-06-19-adapter-drift-detection.md`:
- Around line 31-37: The Non-Goals list is too repetitive because several
consecutive bullets start with “Do not,” so revise the wording for smoother
readability. Update the bullets in the adapter drift detection spec to vary the
phrasing while preserving meaning, using clearer alternatives such as “Avoid
semantic adapter equivalence checking,” “Skip LLM review, embeddings, AST
analysis, or runtime behavior checks,” and “Keep knowledge_diff.py JSON schema
or path/status routing unchanged.”

In `@tests/test_check_knowledge_store.py`:
- Around line 79-165: Add regression tests in test_check_knowledge_store for the
header-based false negatives by extending the existing adapter coverage around
validate() and adapter_checks(). Include one CLAUDE.md fixture where the header
itself claims a source of truth instead of pointing to AGENTS.md, and another
where the extra instruction appears only in a markdown heading or comment line,
then assert adapter-drift or adapter-extra-content is still reported as
appropriate. Use the existing test patterns in
test_generated_adapter_with_source_marker_passes and
test_pointer_with_extra_instruction_content_warns to keep the cases aligned with
the current classifier behavior.

In `@tests/test_repo_level_tdd_fixture.py`:
- Around line 20-28: The current test only verifies exported constants, so add
coverage in RepoLevelTddFixtureTests for the fixture’s failure paths around the
new child stdout parsing and baseline-to-diff chaining behavior. Extend the
tests that load the module so they exercise the relevant fixture/helper methods
that consume child process output and build the baseline/diff sequence, and
assert the expected failures or error handling when stdout is malformed or
chaining breaks. Keep the focus on the new logic rather than just
AGENTSKILLS_REPO_URL and DEFAULT_WORK_ROOT.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 17d22ef6-93ca-4e03-a4ac-fc832e937266

📥 Commits

Reviewing files that changed from the base of the PR and between 88a50e6 and 88b56e2.

📒 Files selected for processing (8)
  • SKILL.md
  • docs/specs/2026-06-19-adapter-drift-detection.md
  • docs/superpowers/plans/2026-06-19-adapter-drift-detection.md
  • references/intent-layer-capture.md
  • scripts/check_knowledge_store.py
  • scripts/repo_level_tdd_fixture.py
  • tests/test_check_knowledge_store.py
  • tests/test_repo_level_tdd_fixture.py

Comment thread docs/specs/2026-06-19-adapter-drift-detection.md
Comment thread docs/superpowers/plans/2026-06-19-adapter-drift-detection.md
Comment thread docs/superpowers/plans/2026-06-19-adapter-drift-detection.md
Comment thread docs/superpowers/plans/2026-06-19-adapter-drift-detection.md
Comment thread scripts/check_knowledge_store.py Outdated
Comment on lines +20 to +24
ADAPTER_GENERATED_MARKER_PATTERN = re.compile(
r"\b(auto[- ]?generated|generated|do not edit|source)\b",
re.IGNORECASE,
)
ADAPTER_DECORATIVE_LINE_PATTERN = re.compile(r"^(#|<!--|-->|//)")

@coderabbitai coderabbitai Bot Jun 30, 2026

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 | ⚡ Quick win

The new heuristics can hide real adapter drift.

adapter_shape() currently treats any header containing the word source as generated, and it drops every #... / comment-prefixed line before the short-pointer check. That means a manual adapter like Canonical source is AGENTS.md or # Run npm test before docs updates plus a pointer line will be skipped as generated-pointer / short-pointer instead of warning on extra content. Please narrow the generated-marker match and only ignore truly decorative boilerplate, not arbitrary heading/comment text.

Also applies to: 56-63, 157-158

🤖 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 `@scripts/check_knowledge_store.py` around lines 20 - 24, `adapter_shape()` in
`scripts/check_knowledge_store.py` is over-matching generated content and
stripping too many lines, so manual adapters can be misclassified as
generated/short-pointer. Narrow `ADAPTER_GENERATED_MARKER_PATTERN` so it only
matches explicit boilerplate markers and does not treat generic text like
“source” as generated, and tighten `ADAPTER_DECORATIVE_LINE_PATTERN` so
`#`/comment-prefixed lines are only ignored when they are true decorative
headers, not meaningful prose before a pointer line. Update the
`adapter_shape()` checks to preserve real content and still flag extra adapter
text correctly.

✅ Addressed in commits 90c4894 to c10704b

Comment thread scripts/repo_level_tdd_fixture.py
Comment thread scripts/repo_level_tdd_fixture.py
@kmshdev kmshdev changed the title Add adapter drift detection and repo-level fixture [codex] polish repo knowledge skill Jun 30, 2026
@kmshdev kmshdev marked this pull request as draft June 30, 2026 09:59

@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 `@scripts/ast_change_config.py`:
- Line 89: The Haskell AST profile in ast_change_config.py uses a misspelled
node kind, so it will not match type synonym declarations. Update the Haskell
entry in the config to use the tree-sitter-haskell symbol type_alias instead of
type_synomym, keeping the existing function and data_type mappings unchanged.

In `@scripts/knowledge_diff_git.py`:
- Around line 41-60: The changed_files() function currently only aggregates
committed, working-tree, and staged paths via run_git diff output, so brand-new
untracked files are missed. Update changed_files() in
scripts/knowledge_diff_git.py to also collect untracked paths (for example by
querying git status for untracked entries) and merge them into the seen map with
an appropriate status before returning the sorted list. Keep the existing
normalize_status() handling and make sure the new untracked-path source uses the
same scope filtering logic as the current git diff calls.
- Around line 24-29: `load_baseline()` only checks for the presence of
`agent_files`, so non-array values slip through and are misclassified as a
missing baseline. Update the validation in `load_baseline()` to verify that
`data["agent_files"]` is actually a list/array before returning, and raise a
`ValueError` for any malformed payload so invalid baseline files fail fast
instead of being treated as “no baseline.”

In `@scripts/knowledge_diff_summary.py`:
- Around line 46-51: The ancestor-scope scan in the loop over agents is
incorrectly collecting files that should be owned by a deeper nested agent.
Update the logic around changed_files() and nearest_agent() so a path is only
added when the current scan’s agent is the nearest owning scope, or skip
ancestor results that fall under a deeper agent with a newer last_commit. Use
the existing symbols changed_files, nearest_agent, all_changes, and change_entry
to keep the summary from double-reporting nested files.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: eccd6ee4-78c9-4444-b9da-35ce8a96503a

📥 Commits

Reviewing files that changed from the base of the PR and between 88b56e2 and c10704b.

📒 Files selected for processing (28)
  • .plugin-eval/benchmark.json
  • agents/openai.yaml
  • docs/evaluations/2026-06-30-agents-guidance-alignment.md
  • docs/superpowers/plans/2026-06-30-update-repo-knowledge-skill-polish.md
  • scripts/ast_change_analysis.py
  • scripts/ast_change_config.py
  • scripts/ast_change_hint_building.py
  • scripts/ast_change_hints.py
  • scripts/ast_change_io.py
  • scripts/ast_change_match.py
  • scripts/ast_change_paths.py
  • scripts/ast_change_summary.py
  • scripts/check_knowledge_adapter_emit.py
  • scripts/check_knowledge_adapter_shape.py
  • scripts/check_knowledge_adapters.py
  • scripts/check_knowledge_common.py
  • scripts/check_knowledge_docs.py
  • scripts/check_knowledge_links.py
  • scripts/check_knowledge_store.py
  • scripts/find_agents_baseline.py
  • scripts/find_agents_collect.py
  • scripts/find_agents_git.py
  • scripts/knowledge_diff.py
  • scripts/knowledge_diff_classify.py
  • scripts/knowledge_diff_config.py
  • scripts/knowledge_diff_git.py
  • scripts/knowledge_diff_summary.py
  • tests/test_ast_change_hints.py

Comment thread scripts/ast_change_config.py Outdated
Comment thread scripts/knowledge_diff_git.py
Comment thread scripts/knowledge_diff_git.py
Comment thread scripts/knowledge_diff_summary.py
@kmshdev kmshdev marked this pull request as ready for review June 30, 2026 12:51
@kmshdev kmshdev requested a review from Copilot June 30, 2026 12:51

Copilot AI 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.

Pull request overview

Copilot reviewed 35 out of 35 changed files in this pull request and generated 7 comments.

Comment thread scripts/check_knowledge_store.py Outdated
Comment thread scripts/knowledge_diff.py Outdated
Comment thread scripts/find_agents_baseline.py Outdated
Comment thread scripts/ast_change_config.py Outdated
"css": ["rule_set", "at_rule"],
"elixir": ["call"],
"go": ["function_declaration", "method_declaration", "type_declaration"],
"haskell": ["function", "type_synomym", "data_type"],

**Goal:** Improve the `update-repo-knowledge` skill metadata, static quality, benchmark scenarios, and evaluation coverage while preserving strict repository-knowledge checker semantics.

**Architecture:** Make changes in the source skill repo at `/Users/kmsh/Researcher/update-repo-knowledge`, validate there, then copy the validated files into the installed skill at `/Users/kmsh/.agents/skills/update-repo-knowledge`. Keep `SKILL.md` concise and put evaluation detail in docs so the skill keeps using progressive disclosure. Use disposable target repositories for behavior validation instead of weakening checker behavior for this skill package.
Comment on lines +22 to +24
- Local guide: `/Users/kmsh/.codex/.agent/agents-md-skills-md.md`
- Installed skill target: `/Users/kmsh/.agents/skills/update-repo-knowledge`
- Source skill repo: `/Users/kmsh/Researcher/update-repo-knowledge`
Comment thread docs/evaluations/2026-06-30-agents-guidance-alignment.md Outdated

Copilot AI 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.

Pull request overview

Copilot reviewed 36 out of 36 changed files in this pull request and generated 2 comments.

Comment on lines +37 to +41
lines = [line.strip() for line in stripped.splitlines() if line.strip()]
header = "\n".join(lines[:ADAPTER_GENERATED_HEADER_LINES])
if ADAPTER_GENERATED_MARKER_PATTERN.search(header):
return "generated-pointer"
if is_short_pointer(stripped, lines):
Comment thread scripts/repo_level_tdd_fixture.py Outdated

def remove_disposable_clone(repo: Path) -> None:
"""Remove an existing checkout only when it is clearly disposable."""
if repo.is_symlink() or not repo.is_dir() or not (repo / ".git").exists():

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

🧹 Nitpick comments (8)
docs/superpowers/plans/2026-06-30-update-repo-knowledge-skill-polish.md (8)

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

Remove hardcoded plugin-eval path (repeat).

Same local evaluation path issue: $HOME/.codex/plugins/cache/openai-curated-remote/plugin-eval/0.1.2/scripts/plugin-eval.js should be parameterized per PR objectives.

🤖 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 `@docs/superpowers/plans/2026-06-30-update-repo-knowledge-skill-polish.md` at
line 588, The evaluation command still hardcodes the local plugin-eval script
path, which should be parameterized instead of baked into the plan. Update the
command in the affected plan step to use the repo’s configurable plugin-eval
location or a variable/placeholder aligned with the PR objectives, and keep the
change localized to the plan entry that references plugin-eval.

691-692: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove hardcoded plugin-eval path (repeat).

Same local evaluation path issue at line 692. This is the third occurrence of the hardcoded plugin-eval path in the document.

🤖 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 `@docs/superpowers/plans/2026-06-30-update-repo-knowledge-skill-polish.md`
around lines 691 - 692, The document still hardcodes the local plugin-eval
script path in the evaluation command, which should be removed to avoid
repeating environment-specific instructions. Update the command in the affected
section to use a portable reference or placeholder for the plugin-eval
invocation, and keep the guidance aligned with the rest of the plan by referring
to the same command context instead of the absolute path.

28-36: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoff

Remove or parameterize local sync target paths.

The file structure list repeatedly references $HOME/.agents/skills/update-repo-knowledge/ as a sync target (lines 33-36). These are local evaluation/installation paths that should not be hardcoded in repository documentation. Use a parameterized reference like <SKILL_HOME> or describe as "installed skill location" without hardcoding the 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 `@docs/superpowers/plans/2026-06-30-update-repo-knowledge-skill-polish.md`
around lines 28 - 36, The plan in this document hardcodes
`$HOME/.agents/skills/update-repo-knowledge/` as the sync target, which should
be parameterized instead. Update the affected bullet items to use a placeholder
like `<SKILL_HOME>` or a generic “installed skill location” reference, and keep
the source-file entries (`agents/openai.yaml`, `scripts/ast_change_hints.py`,
`tests/test_ast_change_hints.py`, `.plugin-eval/benchmark.json`) unchanged while
removing local path assumptions.

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

Remove hardcoded plugin-eval path.

The path $HOME/.codex/plugins/cache/openai-curated-remote/plugin-eval/0.1.2/scripts/plugin-eval.js is a local evaluation path that varies across installations and versions. Per the PR objective to remove local evaluation paths from docs, replace with a parameterized reference like <PLUGIN_EVAL_ROOT>/scripts/plugin-eval.js or describe it as "the plugin-eval CLI in your Codex installation."

🤖 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 `@docs/superpowers/plans/2026-06-30-update-repo-knowledge-skill-polish.md` at
line 314, The docs entry still hardcodes the local plugin-eval path, which
should be removed to avoid installation-specific references. Update the relevant
example in the plan doc to use a parameterized placeholder like
<PLUGIN_EVAL_ROOT>/scripts/plugin-eval.js or describe invoking the plugin-eval
CLI from the user’s Codex installation, keeping the guidance generic and
version-agnostic.

652-655: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

py_compile scripts/*.py may fail on non-Python files or subdirectories.

The glob scripts/*.py assumes all Python files are directly in scripts/ with .py extension. If scripts/ contains subdirectories with Python modules or non-Python files without .py extension, this command may miss files or be unnecessary. Consider python -m compileall scripts/ for recursive compilation, or ensure the glob matches your layout.

🤖 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 `@docs/superpowers/plans/2026-06-30-update-repo-knowledge-skill-polish.md`
around lines 652 - 655, The validation step using py_compile is too narrow and
may miss Python modules outside the top-level scripts glob. Update the command
sequence around the existing unittest and py_compile steps to use a layout-aware
compilation approach, such as compileall on the scripts tree, or otherwise align
the command with the actual scripts directory structure. Keep the change
localized to the setup/verification instructions so the documented workflow
matches the repo’s Python file layout.

698-708: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoff

Remove or parameterize local sync target paths in Task 5.

The sync commands (lines 703-707) and validation directory (line 717) hardcode $HOME/.agents/skills/update-repo-knowledge/. These are local evaluation/installation paths that should be parameterized or replaced with environment-agnostic instructions per the PR objective to remove local evaluation paths from docs.

🤖 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 `@docs/superpowers/plans/2026-06-30-update-repo-knowledge-skill-polish.md`
around lines 698 - 708, The Task 5 sync and validation steps still hardcode the
local $HOME/.agents/skills/update-repo-knowledge path, which should be removed
from the docs. Update the instructions in the affected plan section to use a
parameterized or environment-agnostic destination instead of fixed local
evaluation/installation paths, and make the validation directory reference
follow the same pattern. Keep the guidance aligned with the existing Task 5
steps and their sync/validation commands so readers can apply the setup in any
environment.

22-24: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoff

Remove local evaluation paths from docs per PR objective.

Lines 22 and 23 hardcode local filesystem paths ($HOME/.codex/.agent/agents-md-skills-md.md, $HOME/.agents/skills/update-repo-knowledge) that tie this documentation to a specific local environment. The PR objectives explicitly mention "remove local evaluation paths from docs" as a commit concern. Replace with environment-agnostic descriptions or parameterize with <SKILL_HOME> or similar placeholder.

🤖 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 `@docs/superpowers/plans/2026-06-30-update-repo-knowledge-skill-polish.md`
around lines 22 - 24, Remove the hardcoded local filesystem references in the
plan doc and replace them with environment-agnostic placeholders or generic
descriptions. Update the entries under the plan section so the skill locations
are described via a neutral symbol like <SKILL_HOME> or equivalent, keeping the
wording independent of any specific machine while preserving the intent of the
local guide, installed skill target, and source skill repo references.

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

Remove hardcoded plugin-eval path (repeat).

Same issue as line 314: $HOME/.codex/plugins/cache/openai-curated-remote/plugin-eval/0.1.2/scripts/plugin-eval.js is a local evaluation path that should be parameterized or described generically per PR objectives.

🤖 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 `@docs/superpowers/plans/2026-06-30-update-repo-knowledge-skill-polish.md` at
line 451, The command in the plan still hardcodes the local plugin-eval script
path, which should be generalized. Update the instruction around the benchmark
command to reference plugin-eval conceptually or via a configurable
path/variable instead of the specific
$HOME/.codex/plugins/cache/openai-curated-remote/plugin-eval/0.1.2/scripts/plugin-eval.js
location, keeping the guidance aligned with the existing plan wording.
🤖 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.

Nitpick comments:
In `@docs/superpowers/plans/2026-06-30-update-repo-knowledge-skill-polish.md`:
- Line 588: The evaluation command still hardcodes the local plugin-eval script
path, which should be parameterized instead of baked into the plan. Update the
command in the affected plan step to use the repo’s configurable plugin-eval
location or a variable/placeholder aligned with the PR objectives, and keep the
change localized to the plan entry that references plugin-eval.
- Around line 691-692: The document still hardcodes the local plugin-eval script
path in the evaluation command, which should be removed to avoid repeating
environment-specific instructions. Update the command in the affected section to
use a portable reference or placeholder for the plugin-eval invocation, and keep
the guidance aligned with the rest of the plan by referring to the same command
context instead of the absolute path.
- Around line 28-36: The plan in this document hardcodes
`$HOME/.agents/skills/update-repo-knowledge/` as the sync target, which should
be parameterized instead. Update the affected bullet items to use a placeholder
like `<SKILL_HOME>` or a generic “installed skill location” reference, and keep
the source-file entries (`agents/openai.yaml`, `scripts/ast_change_hints.py`,
`tests/test_ast_change_hints.py`, `.plugin-eval/benchmark.json`) unchanged while
removing local path assumptions.
- Line 314: The docs entry still hardcodes the local plugin-eval path, which
should be removed to avoid installation-specific references. Update the relevant
example in the plan doc to use a parameterized placeholder like
<PLUGIN_EVAL_ROOT>/scripts/plugin-eval.js or describe invoking the plugin-eval
CLI from the user’s Codex installation, keeping the guidance generic and
version-agnostic.
- Around line 652-655: The validation step using py_compile is too narrow and
may miss Python modules outside the top-level scripts glob. Update the command
sequence around the existing unittest and py_compile steps to use a layout-aware
compilation approach, such as compileall on the scripts tree, or otherwise align
the command with the actual scripts directory structure. Keep the change
localized to the setup/verification instructions so the documented workflow
matches the repo’s Python file layout.
- Around line 698-708: The Task 5 sync and validation steps still hardcode the
local $HOME/.agents/skills/update-repo-knowledge path, which should be removed
from the docs. Update the instructions in the affected plan section to use a
parameterized or environment-agnostic destination instead of fixed local
evaluation/installation paths, and make the validation directory reference
follow the same pattern. Keep the guidance aligned with the existing Task 5
steps and their sync/validation commands so readers can apply the setup in any
environment.
- Around line 22-24: Remove the hardcoded local filesystem references in the
plan doc and replace them with environment-agnostic placeholders or generic
descriptions. Update the entries under the plan section so the skill locations
are described via a neutral symbol like <SKILL_HOME> or equivalent, keeping the
wording independent of any specific machine while preserving the intent of the
local guide, installed skill target, and source skill repo references.
- Line 451: The command in the plan still hardcodes the local plugin-eval script
path, which should be generalized. Update the instruction around the benchmark
command to reference plugin-eval conceptually or via a configurable
path/variable instead of the specific
$HOME/.codex/plugins/cache/openai-curated-remote/plugin-eval/0.1.2/scripts/plugin-eval.js
location, keeping the guidance aligned with the existing plan wording.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e0b10280-121a-4fc7-9ec3-8c959125621f

📥 Commits

Reviewing files that changed from the base of the PR and between 8ddaa7e and 7e41af3.

📒 Files selected for processing (16)
  • docs/evaluations/2026-06-30-agents-guidance-alignment.md
  • docs/specs/2026-06-19-adapter-drift-detection.md
  • docs/superpowers/plans/2026-06-19-adapter-drift-detection.md
  • docs/superpowers/plans/2026-06-30-update-repo-knowledge-skill-polish.md
  • scripts/ast_change_config.py
  • scripts/check_knowledge_adapter_shape.py
  • scripts/check_knowledge_store.py
  • scripts/find_agents_baseline.py
  • scripts/knowledge_diff.py
  • scripts/knowledge_diff_git.py
  • scripts/knowledge_diff_summary.py
  • scripts/repo_level_tdd_fixture.py
  • tests/test_ast_change_hints.py
  • tests/test_check_knowledge_store.py
  • tests/test_knowledge_diff.py
  • tests/test_repo_level_tdd_fixture.py
💤 Files with no reviewable changes (1)
  • scripts/check_knowledge_store.py
✅ Files skipped from review due to trivial changes (3)
  • docs/evaluations/2026-06-30-agents-guidance-alignment.md
  • docs/superpowers/plans/2026-06-19-adapter-drift-detection.md
  • docs/specs/2026-06-19-adapter-drift-detection.md
🚧 Files skipped from review as they are similar to previous changes (8)
  • tests/test_check_knowledge_store.py
  • scripts/check_knowledge_adapter_shape.py
  • tests/test_repo_level_tdd_fixture.py
  • scripts/ast_change_config.py
  • scripts/knowledge_diff_git.py
  • scripts/find_agents_baseline.py
  • scripts/knowledge_diff_summary.py
  • scripts/repo_level_tdd_fixture.py

Copilot AI 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.

Pull request overview

Copilot reviewed 36 out of 36 changed files in this pull request and generated 2 comments.

Comment on lines +58 to +66
def remove_disposable_clone(repo: Path) -> None:
"""Remove an existing checkout only when it is clearly disposable."""
git_dir = repo / ".git"
if repo.is_symlink() or not repo.is_dir() or not git_dir.is_dir():
raise RuntimeError(
"Refusing to refresh non-disposable agentskills path: "
f"{repo}. Delete it manually or choose a different --work-root."
)
shutil.rmtree(repo)
Comment thread scripts/repo_level_tdd_fixture.py Outdated
Comment on lines +110 to +113
baseline_json = json.dumps(baseline["stdout"])
baseline_path = target_repo.parent / "baseline.json"
baseline_path.write_text(baseline_json, encoding="utf-8")

@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

🤖 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 `@scripts/check_knowledge_traversal.py`:
- Around line 44-53: The tracked_and_unignored_files() helper is including
cached entries even when the file has been deleted from the worktree, which lets
stale paths reach knowledge_files() and downstream checks. Update
tracked_and_unignored_files() to ignore cached paths that no longer exist on
disk before appending them, so check_agent_files() and check_docs_indexes() only
operate on files present in the current checkout.
- Around line 29-36: The run_git helper currently assumes git exists, so
subprocess.run can raise before knowledge_files() gets a chance to use
fallback_files(). Update run_git to gracefully handle missing git by catching
the executable-not-found failure and returning a completed-process-like result
with a nonzero status and empty output, then let knowledge_files() continue into
fallback_files() as intended.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 15464ff5-16d9-4d70-a94e-01f24756b4df

📥 Commits

Reviewing files that changed from the base of the PR and between 7e41af3 and 3fb132a.

📒 Files selected for processing (10)
  • scripts/ast_change_hints.py
  • scripts/ast_change_match.py
  • scripts/check_knowledge_adapters.py
  • scripts/check_knowledge_docs.py
  • scripts/check_knowledge_links.py
  • scripts/check_knowledge_traversal.py
  • scripts/repo_level_tdd_fixture.py
  • tests/test_ast_change_hints.py
  • tests/test_check_knowledge_store.py
  • tests/test_repo_level_tdd_fixture.py
🚧 Files skipped from review as they are similar to previous changes (3)
  • scripts/check_knowledge_links.py
  • scripts/ast_change_match.py
  • scripts/repo_level_tdd_fixture.py

Comment on lines +29 to +36
def run_git(repo: Path, args: list[str]) -> subprocess.CompletedProcess[str]:
return subprocess.run(
["git", "-C", str(repo), *args],
check=False,
text=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Handle missing git without crashing the fallback path.

If git is not installed, subprocess.run(...) raises before knowledge_files() can reach fallback_files(). That turns the non-worktree path into a hard failure instead of a graceful scan.

Proposed fix
 def run_git(repo: Path, args: list[str]) -> subprocess.CompletedProcess[str]:
-    return subprocess.run(
-        ["git", "-C", str(repo), *args],
-        check=False,
-        text=True,
-        stdout=subprocess.PIPE,
-        stderr=subprocess.PIPE,
-    )
+    command = ["git", "-C", str(repo), *args]
+    try:
+        return subprocess.run(
+            command,
+            check=False,
+            text=True,
+            stdout=subprocess.PIPE,
+            stderr=subprocess.PIPE,
+        )
+    except OSError as error:
+        return subprocess.CompletedProcess(command, 127, stdout="", stderr=str(error))
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def run_git(repo: Path, args: list[str]) -> subprocess.CompletedProcess[str]:
return subprocess.run(
["git", "-C", str(repo), *args],
check=False,
text=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
def run_git(repo: Path, args: list[str]) -> subprocess.CompletedProcess[str]:
command = ["git", "-C", str(repo), *args]
try:
return subprocess.run(
command,
check=False,
text=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
except OSError as error:
return subprocess.CompletedProcess(command, 127, stdout="", stderr=str(error))
🧰 Tools
🪛 ast-grep (0.44.0)

[error] 29-35: Command coming from incoming request
Context: subprocess.run(
["git", "-C", str(repo), *args],
check=False,
text=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
Note: [CWE-78] Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').

(subprocess-from-request)

🪛 Ruff (0.15.20)

[error] 30-30: subprocess call: check for execution of untrusted input

(S603)


[error] 31-31: Starting a process with a partial executable path

(S607)

🤖 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 `@scripts/check_knowledge_traversal.py` around lines 29 - 36, The run_git
helper currently assumes git exists, so subprocess.run can raise before
knowledge_files() gets a chance to use fallback_files(). Update run_git to
gracefully handle missing git by catching the executable-not-found failure and
returning a completed-process-like result with a nonzero status and empty
output, then let knowledge_files() continue into fallback_files() as intended.

Comment on lines +44 to +53
def tracked_and_unignored_files(repo: Path) -> list[Path]:
result = run_git(repo, ["ls-files", "--cached", "--others", "--exclude-standard"])
if result.returncode != 0:
return []
paths = []
for line in result.stdout.splitlines():
if not line.strip():
continue
paths.append(repo / line)
return sorted(paths)

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 | ⚡ Quick win

Filter out cached paths that no longer exist in the worktree.

git ls-files --cached --others --exclude-standard still returns tracked files after a local delete. That makes knowledge_files() feed stale paths into downstream checks, so check_agent_files() / check_docs_indexes() can infer deleted AGENTS.md or index.md files from the index instead of the current checkout.

Proposed fix
 def tracked_and_unignored_files(repo: Path) -> list[Path]:
     result = run_git(repo, ["ls-files", "--cached", "--others", "--exclude-standard"])
     if result.returncode != 0:
         return []
     paths = []
     for line in result.stdout.splitlines():
         if not line.strip():
             continue
-        paths.append(repo / line)
+        path = repo / line
+        if path.exists() or path.is_symlink():
+            paths.append(path)
     return sorted(paths)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def tracked_and_unignored_files(repo: Path) -> list[Path]:
result = run_git(repo, ["ls-files", "--cached", "--others", "--exclude-standard"])
if result.returncode != 0:
return []
paths = []
for line in result.stdout.splitlines():
if not line.strip():
continue
paths.append(repo / line)
return sorted(paths)
def tracked_and_unignored_files(repo: Path) -> list[Path]:
result = run_git(repo, ["ls-files", "--cached", "--others", "--exclude-standard"])
if result.returncode != 0:
return []
paths = []
for line in result.stdout.splitlines():
if not line.strip():
continue
path = repo / line
if path.exists() or path.is_symlink():
paths.append(path)
return sorted(paths)
🤖 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 `@scripts/check_knowledge_traversal.py` around lines 44 - 53, The
tracked_and_unignored_files() helper is including cached entries even when the
file has been deleted from the worktree, which lets stale paths reach
knowledge_files() and downstream checks. Update tracked_and_unignored_files() to
ignore cached paths that no longer exist on disk before appending them, so
check_agent_files() and check_docs_indexes() only operate on files present in
the current checkout.

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.

2 participants