#174

feat(prompt): scope promptAppend entries to declared paths

Openbytaesuwants to merge intofrom

What changed

promptAppend can now be an array instead of one string. Each entry says which paths it applies to, and it only shows up in batches that touch those files. A plain string still works exactly as before.

Why

Today every file gets the same appendix. Write a checklist for your payment code and it rides along on every unrelated file too, leaving the model to work out which parts apply.

The assembler already solves this everywhere else. Highlights get filtered by the batch's languages, slug notes by its slugs. promptAppend was the last section that always went out in full.

In a monorepo you can work around it by splitting a surface into its own project so it gets its own prompt. That works, but then the agent only sees that subtree and loses the callers that would have explained the bug.

Verification

  • pnpm test passes:

For your information, the 18 failures in e2e/bundle.test.ts and e2e/pipeline.test.ts reproduce on main branch without this change. everything else is green.

  • pnpm lint passes
  • pnpm knip passes
  • If this adds a matcher: ran it against at least one real repo and confirmed the candidate count is sane

Notes for reviewer

  • Existing string configs are untouched.
  • Globs use the same minimatch options as a matcher's filePatterns, so whatever picks a file for scanning picks it here too.

Activity

13
vercel[bot]2mo ago

@bytaesu is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

auto-maintain[bot]2mo ago

🤖 auto-maintain review

Automated, advisory triage for @bytaesu's PR. Facts below are read from the GitHub API.

CheckResult
Author's merged PRs (this repo)0 — ⚠️ first-time contributor
Account established✅ (age 880d · 94 followers · 53 public repos)
Commits signed/verified✅ 3/3

Review panel: 🟡 medium highest severity

deepsec maintainer code review: 🟡 medium

Path scoping works for valid configurations, but malformed legacy JSON can broaden scope and the published type surface is incomplete.

  • packages/processor/src/prompt/assemble.ts:135 — Malformed `paths` values are treated as unscoped, so a JSON typo such as `"paths": "payments/**"` applies sensitive guidance to every batch instead of skipping the malformed rule as documented.
  • packages/deepsec/src/config.ts:16 — The new `PromptAppend` and `PromptAppendRule` types are omitted from the published `deepsec/config` type exports, preventing consumers from importing the public types named by the documentation.

General code review: 🟢 low

No actionable correctness issues found in the complete diff.

Scanner and matcher quality: 🟡 medium

Path-scoped prompt guidance can still overmatch globally when a hand-authored rule has a malformed `paths` field.

  • packages/processor/src/prompt/assemble.ts:135 — Malformed `paths` values are treated as unscoped. A config typo such as `paths: "payments/**"` therefore injects payment-only guidance into every batch, defeating the feature's isolation guarantee; skip malformed rules instead of broadening them.

Sandbox and credential boundaries: 🟢 low

promptAppend array scoping is contained to prompt assembly: globs only select text (no filesystem or command use), matching options and relative POSIX paths match the scanner's filePatterns semantics, malformed entries are skipped, config.json precedence is preserved, and minimatch is declared in both the processor and the bundled deepsec package so local/installed/sandbox execution behave the same. No credential, egress, or sandbox boundary is touched; no actionable findings.

Durability and distributed state: 🟡 medium

Path-scoped prompts use inconsistent glob semantics and can be applied to unintended batches.

  • packages/processor/src/prompt/assemble.ts:139 — Prompt scoping does not use the scanner's matcher semantics as claimed: the scanner sets `nonegate` and `nocomment`, while this call leaves both disabled. Patterns beginning with `!` or `#` therefore select different files and can unexpectedly append guidance to unrelated batches.

Posted by auto-maintain. This automated code review is advisory; a human maintainer makes the call.

cramforce2mo ago
cramforce2mo ago

Please push verified signatures and get the review green

bytaesu2mo ago

Please push verified signatures and get the review green

I've made follow-up changes from the review, but the review bot hasn't been retriggered yet.

bytaesu2mo ago
bytaesu2mo ago

@cramforce signatures and review findings are both addressed 😁

cramforceapproved changes1mo ago