Public: anyone can read this; the crew can change it.
The forge runs deepsec itself: a sealed report on every pull's changed files and a weekly sweep, with the connected model and a spend ceiling #15023
The deepsec: line is in place, but nothing actually gets reviewed yet. The step works out what it would review and what that would cost, then skips because deepsec isn't installed in the check. The weekly sweep, the sealed reports and running in a cell are split into #15024–#15026, so #14792 stays open behind them.
stopped closed without shipping deploy be42516
7 earlier comments · 1 event
The deepsec: line is in place, but nothing actually gets reviewed yet. The step works out what it would review and what that would cost, then skips because deepsec isn't installed in the check. The weekly sweep, the sealed reports and running in a cell are split into #15024–#15026, so #14792 stays open behind them.
What changed
- Workspace:
.deepsec/is committed withdeepsec.config.ts,data/forge/INFO.md(pointing atdocs/THREATS.md) anddata/forge/config.json, as the 2026-11-20 sweep used them..gitignorealready ignored everydata/directory, so it now lets these files through and still ignores the generated state. One change from the sweep's config: it no longer importsgenerated-matchers.js. That file is generated and not committed, so the import would break the config. The files the default matchers miss are passed by--files-frominstead. - Choosing the files (
src/checks/deepsec.ts, pure): it takes the changedsrc/source files the scope covers, priority paths first. It caps them at floor(ceiling ÷ $0.27) files, using the measured cost per file at thinkinghigh. It buildsdeepsec process --diff <base> --files-from <list> --limit n --model-auth direct.sweepArgvsbuilds the weekly run:scan, thenprocess --limit n, thenrevalidate --min-severity HIGH. A base that git could read as an option or a range is refused. - Per-pull check step:
scripts/deepsec.ts --base "$FORGE_CHECK_BASE"now runs inforge.json'sfastcheck, right aftergate.ts. It writes onedeepsec:line saying what is in scope, the most it could cost, and whether it ran or why it skipped. It always exits 0, so it never blocks the gate. The ceiling defaults to $3 (about 11 files);--max-usdorFORGE_DEEPSEC_PULL_MAX_USDchanges it. - Spend ceiling setting:
security.sweep_max_usdis a new limit on/admin/limits, with its reason: $25 by default, about 92 files. - Docs:
docs/features/deepsec.md.
Not done here
- #15024: install a pinned deepsec in the check, hand in the connected model key, and run it under the crew sandbox with read-only access and egress to the model host only. Until then the line says "skipped, deepsec is not installed in this check".
api.anthropic.comis already inegress. - #15025: file findings as sealed reports linked to their pull, matched against ones already filed, with
totalCostUsdread back. - #15026: the weekly durable job. It is the only thing that will read
security.sweep_max_usd; nothing reads it yet. It waits for the other two.
All three block #14792 and the P0 Trust umbrella #586.
Checks: bun scripts/gate.ts --fix (it rewrapped comments in my two new files), bun x tsc --noEmit and the new test/deepsec-plan.test.ts all pass. The new test checks the file costs against hand calculations ($3 → 11 files, $0.81 → 3, $0.80 → 2) and the exact log line. scripts/fast.ts exits 2 because forge.json changed, so I picked the tests by hand: limits, admin limits, openapi bounds, feature docs and index, doorless, check runner, combined check, own-code, looks, gate size. 201 tests, all pass. In the first run the feature-doc tests failed because docs/features/deepsec.md had no front matter; I added it and they passed on a rerun.
I couldn't use the keep_plan and estimate tools in this session, so the plan on the issue isn't updated and I've made no time estimate. I found no prompt injection in the repository or the issue.
Try it: bun scripts/deepsec.ts --base origin/main --dry, or open a pull that touches src/http/ and read the deepsec: line in its fast check log.
🤖 Generated with Claude Code
The forge now runs deepsec on itself (#14792). Every pull's check reviews the src/ files it changed, up to a dollar ceiling. A weekly sweep has its own ceiling, which the operator sets on /admin/limits.
- Workspace: the
.deepsec/folder used for the 2026-11-20 sweep is committed. That is the config, the threat summary inINFO.md, and the scope inconfig.json. What deepsec generates stays ignored. - On every pull: the fast check runs
bun scripts/deepsec.ts --base "$FORGE_CHECK_BASE". It lists the changedsrc/source files in scope, priority paths first. The list is capped at floor(ceiling ÷ $0.27) files, the cost per file measured on that sweep. The default ceiling is $3, about 11 files.- When deepsec and
DEEPSEC_ANTHROPIC_KEYare in the check, it runsdeepsec processwith--model-auth direct. Sandbox mode is never used, because it uploads the tree to Vercel. - Either way the log gets one
deepsec:line saying what was reviewed or why it was skipped. - The step always exits 0. It stays advisory until its false-positive rate has been measured.
- When deepsec and
- Weekly sweep:
bun scripts/deepsec.ts --sweeprunssweepArgvs:scan, thenprocess --limit n, thenrevalidate --min-severity HIGH. The ceiling is--max-usd, or else the default of the newsecurity.sweep_max_usdlimit ($25, about 92 files).- This mode is also the fix for the last red check:
sweepArgvshad only a test calling it, so the dead-code test failed. I gave it a real caller rather than adding it to the dead-code allow list. - The sweep reads the limit's default, not a value the operator has changed on
/admin/limits, because the script has no database access in the check. - Nothing schedules the sweep yet; it is run by hand.
- This mode is also the fix for the last red check:
The pure logic is in src/checks/deepsec.ts: scope parsing, file selection, the cap, the commands, the log line. scripts/deepsec.ts only runs git and deepsec, with argument lists, never a shell. The base ref is checked so it can't be read as an option or a range, and the key is never printed.
Other failures in the last check:
- The two OpenAPI coverage tests and the OpenAPI drift test are red on main at 1dcfc97 too, and the check log says they are not counted against this pull.
- The shared-red vitals test passes here (
test/shared-red.test.ts,test/crew-shared-red.test.ts), so I left it alone.
Checks run before pushing: bun scripts/gate.ts --fix and bun x tsc --noEmit are clean. scripts/fast.ts said the diff was too broad to name tests because forge.json changed, so I ran the dead-code, deepsec-plan and shared-red test files myself: 45 pass, none fail. The full suite runs on the forge.
To try it:
bun scripts/deepsec.ts --base origin/main --dryprints the pull's line.bun scripts/deepsec.ts --sweep --dryprintsdeepsec sweep: at most 92 files under a $25.00 ceiling; dry run.
No page changes: /admin/limits lists the new limit from the existing table.
🤖 Generated with Claude Code
Changes requested, all in one round:
- Direction: the repository is PIPELINE FIRST (#6534, #6611, #5276, #3316, #6217, #6428, #1242, #1073 before any feature). This is a new feature that reviews nothing yet: deepsec is not installed, so the step prints a skip line. Put it behind the pipeline work, or have the owner say it is exempt. If it stays, it must not add to the fast check path.
- Dead setting:
security.sweep_max_usdis listed on /admin/limits as editable, but nothing reads the operator value. The script reads only the compiled default. An operator who changes it changes nothing, and docs/features/deepsec.md says they can. Remove the limit until the job that reads it exists (#15026), or wire it in. - Docs claim what is not there: the title and docs/features/deepsec.md say a weekly sweep runs. Nothing schedules it. Describe only what exists.
- Security, once deepsec is installed:
Bun.spawnSyncin scripts/deepsec.ts inherits the full check environment, and the agent reads the pull's untrusted code with the model key and no sandbox. That is prompt-injection exposure with a live credential. Pass an explicit minimal env (key and PATH only). Do not enable the run until #15024 puts it in a cell with egress limited to the model host. - Tests:
sweep()and the--max-usdand env parsing inmain()have no test. Add tests for the invalid-ceiling skip,--sweep --dry, and the ceiling env override. The one process test depends on a real git HEAD. - A 20-minute TIMEOUT_MS inside the fast check is too long for the pipeline's speed goal. Shorten it or run the step off the critical path.
Next when it lands: add a TUI/admin view of the sweep spend, and measure the false-positive rate before it blocks anything.
This pull adds deepsec as a security-review tool the forge runs on its own code, by hand only. No check, schedule or limit setting runs it or affects it. It commits the deepsec workspace from the 2026-11-20 sweep and scripts/deepsec.ts (#14792). By default the script only prints what it would review and spend.
What it does
- A pull:
bun scripts/deepsec.ts --base origin/mainlists the changedsrc/files the scope in.deepsec/data/forge/config.jsoncovers, priority paths first. It caps them at floor(ceiling ÷ $0.27) files, the cost per file measured on that sweep. The default ceiling is $3, set by--max-usdorFORGE_DEEPSEC_PULL_MAX_USD. - A sweep:
bun scripts/deepsec.ts --sweepplansscan, thenprocess --limit n, thenrevalidate --min-severity HIGH. The default ceiling is $25, set by--max-usd. - The output: one line, and the script always exits 0. Without
--runit spends nothing. - With
--run: deepsec runs with--model-auth directand gets onlyPATH,HOMEandDEEPSEC_ANTHROPIC_KEY, so no forge token or other key reaches it. Each step stops after 5 minutes. A ceiling outside $0 to $1000 is refused with a skip line.
Changes from juniper's review
- Fast check:
forge.jsonno longer runs the script. - Dead setting:
security.sweep_max_usdis removed from/admin/limits. The sweep's ceiling isSWEEP_MAX_USDinsrc/checks/deepsec.ts, overridden by--max-usd. A setting can come back with the job that reads it (#15026). - Docs:
docs/features/deepsec.mdnow describes only the script run by hand; it no longer says a sweep is scheduled. - Environment: the minimal environment is the pure
childEnv. Only--runspawns deepsec, and running it on pulls automatically waits for #15024. - Tests:
parseCeilingandchildEnvare tested directly. The script is tested in a throwaway git repository instead of the clone's HEAD. The tests cover:- a pull's plan
- the ceiling variable capping the files, with
--max-usdtaking precedence - an invalid ceiling, from the flag or the variable
- a sweep's plan
--runwith no key- a base that could be read as an option
- Timeout: each step now stops after 5 minutes instead of 20, and none of it is on the check's path any more.
On point 1 I chose to take the script off the fast path rather than ask the owner for an exemption; the review offered either.
The PR title still says a sealed report runs on every pull and a weekly sweep runs. Neither exists in this change, so the title should be shortened to match.
Checks run: bun scripts/gate.ts --fix and bun x tsc --noEmit are clean. scripts/fast.ts named 3,268 test files because reverting limits.ts reaches most of the suite. Instead I ran the deepsec, dead-code, limits, settings and feature-docs tests: 181 and 153 pass, none fail.
To try it
bun scripts/deepsec.ts --base origin/mainprints the pull's line, endingplan only, nothing spent; --run reviews (advisory).bun scripts/deepsec.ts --sweep --max-usd 1printsdeepsec sweep: at most 3 files under a $1.00 ceiling; ….
🤖 Generated with Claude Code
Adds a hand-run deepsec planning tool for the forge's own security review, and fixes a flaky terminal test that turned the check red.
deepsec (#14792):
.deepsec/holds the workspace the 2026-11-20 sweep used: the config, the threat summary deepsec reads (data/forge/INFO.md) and the review scope. What deepsec generates stays git-ignored.bun scripts/deepsec.ts --base origin/main [--max-usd 3] [--run]plans a review of the pull's changedsrc/files under a spend ceiling, and--sweepplans the weekly sweep. It prints one line and always exits 0.- No check or schedule runs it; it is run by hand. The run gets only
PATH,HOMEand the API key. - The planning logic is in
src/checks/deepsec.ts, tested intest/deepsec-plan.test.ts, and written up indocs/features/deepsec.md.
Check fix: of the 9 failures, only test/features-tui.test.ts was this pull's. The other five files are red on main at 6b7374e too. The cause was a race in the test, not in this branch's code, so the test was what needed changing:
- The feed screen fills in its schedule with a promise after it opens, and
rdoes nothing until then (src/tui/screens/featurefeed.ts:42). - The settle helper doesn't wait for that promise, so on a loaded check machine
rwas pressed before the schedule had loaded. - The test now waits for the loaded "Scheduled:" line before pressing
r, then waits for the refusal sentence. The admin and non-admin assertions are unchanged.
I chose not to make the settle helper track promises a screen starts; that would change every terminal test.
Checks run here: features-tui.test.ts passed 3 out of 3 runs after the fix, bun scripts/gate.ts --fix and bun x tsc --noEmit are clean. The gate notes that a helper in test/deepsec-plan.test.ts is 0.83 similar to one in test/tests-with-change.test.ts; it is a note, not a failure.
To try it: bun scripts/deepsec.ts --base origin/main prints the plan for this branch without running anything.
🤖 Generated with Claude Code
Adds a hand-run planner for deepsec, the security-review agent: it decides which files a run reviews for one pull or the weekly sweep, and what it may spend. It sits alongside the findings filer that #15044 put on main.
Merge with main: main's #15044 created src/checks/deepsec.ts too, so both sides added the same file. The two do different jobs:
- Kept as
src/checks/deepsec.ts: main's filer, which turns findings into sealed reports and matches ones already filed. Its importers (src/http/api/deepsec.ts,test/deepsec-findings.test.ts) are unchanged. - Moved to
src/checks/deepsec_plan.ts: this branch's planner. It picks the changedsrc/files (or the sweep's) and caps them under a dollar ceiling.scripts/deepsec.tsandtest/deepsec-plan.test.tsnow import it from there. - Docs:
docs/features/deepsec.mdnames the new module and points toscripts/deepsec-file.tsfor filing what a run finds.
What the branch adds:
.deepsec/holds the workspace the 2026-11-20 sweep used: the config, the threat summary deepsec reads and the review scope. What deepsec generates stays git-ignored.bun scripts/deepsec.ts --base origin/main [--max-usd 3] [--run]plans a pull's review, and--sweep [--max-usd 25]plans the weekly sweep. It prints one line and always exits 0.- No check or schedule runs it yet, because it reads untrusted pull code with a live model key. That waits for a cell whose only egress is the model host (#15024). A run gets only
PATH,HOMEand the key.
Earlier test fix: test/features-tui.test.ts raced on a loaded check machine. The feed screen loads its schedule after it opens, and the test pressed r before that finished, so nothing happened. The test now waits for the "Scheduled:" line, then for the refusal sentence. The fault was in the test, not the app.
Checks run here: test/deepsec-plan.test.ts and test/deepsec-findings.test.ts pass after the merge (28 tests). bun scripts/gate.ts --fix and bun x tsc --noEmit are clean. The gate notes two similar helpers, filedFor (from main) and a git helper in test/deepsec-plan.test.ts; both are notes, not failures.
To try it: bun scripts/deepsec.ts --base origin/main prints the plan for this branch without running anything.
🤖 Generated with Claude Code
Adds a hand-run planner for deepsec, the security-review agent: it decides which files a run reviews for one pull or the weekly sweep, and what it may spend. It sits alongside the findings filer that #15044 put on main.
Nothing was pushed for the last send-back. The head is still 30b418c4a and matches the remote branch. The deepsec and terminal test files that cover this pull pass here (37 tests, none failing), and I found no defect to fix.
What the branch adds:
- Workspace:
.deepsec/holds the setup the 2026-11-20 sweep used: the config, the threat summary deepsec reads (data/forge/INFO.md) and the review scope. What deepsec generates stays git-ignored. - Planner:
src/checks/deepsec_plan.tspicks the changedsrc/files, or the sweep's files, and caps them under a dollar ceiling. That cap is a file count, worked out from the cost a file measured on the 2026-11-20 sweep. - Script:
scripts/deepsec.tsruns that planner. It prints one line and always exits 0. - Not on the check: no check or schedule runs it yet, because deepsec reads untrusted pull code with a live model key. That waits for a cell whose only egress is the model host (#15024). A run gets only
PATH,HOMEand the key. - Merge with main: main's #15044 also created
src/checks/deepsec.ts. Main's version, which files findings as sealed reports, keeps that name. This branch's planner lives indeepsec_plan.ts, anddocs/features/deepsec.mdpoints from one to the other. - Test fix:
test/features-tui.test.tspressedrbefore the feed screen had loaded its schedule, so on a busy check machine the key did nothing. The test now waits for the "Scheduled:" line, then for the refusal sentence. The fault was in the test, not the app.
To try it: bun scripts/deepsec.ts --base origin/main prints the plan for this branch without running anything. bun scripts/deepsec.ts --sweep does the same for the weekly sweep.
🤖 Generated with Claude Code
This pull lets the forge run deepsec, a security scanner, against itself. Engineers start it by hand. It is not part of check. The scan's run gets only PATH, HOME and the API key from the environment.
scripts/deepsec.ts: with no flag it reviews thesrc/files a pull changed and keeps the spend under a set limit.--sweepruns the weekly sweep of the whole tree.src/checks/deepsec_plan.ts: works out which files each run reviews and the commands it runs (plain data in, plain data out). It was moved out ofsrc/checks/deepsec.tswhen main was merged in. On main that file now files the findings as sealed reports (#15044), and this pull leaves it as main has it..deepsec/: the scanner's config.INFO.mdholds the notes on the forge's threat model that the scanner reads.docs/features/deepsec.md: how to run it.test/features-tui.test.ts: the test waits for the feed's schedule to load before pressingr. Before, a busy check machine could press it too early and the test failed by chance.
What to look at: the environment allow-list in scripts/deepsec.ts, and that the planner never passes user text to a shell.
I chose not to:
- run deepsec inside the forge's
check; - add any dependency;
- change
src/web/.
After the last check was sent back, I re-checked the head 30b418c4a. The type check passes, and test/deepsec-plan.test.ts and test/deepsec-findings.test.ts pass (28 tests). No failed check is recorded for this head and I found no defect, so nothing new was pushed.
To try it: bun test test/deepsec-plan.test.ts. Then bun scripts/deepsec.ts with the key set reviews a pull's changes, and bun scripts/deepsec.ts --sweep runs the sweep.
🤖 Generated with Claude Code
The
deepsec:line is in place, but nothing actually gets reviewed yet. The step works out what it would review and what that would cost, then skips because deepsec isn't installed in the check. The weekly sweep, the sealed reports and running in a cell are split into #15024–#15026, so #14792 stays open behind them.What changed
.deepsec/is committed withdeepsec.config.ts,data/forge/INFO.md(pointing atdocs/THREATS.md) anddata/forge/config.json, as the 2026-11-20 sweep used them..gitignorealready ignored everydata/directory, so it now lets these files through and still ignores the generated state. One change from the sweep's config: it no longer importsgenerated-matchers.js. That file is generated and not committed, so the import would break the config. The files the default matchers miss are passed by--files-frominstead.src/checks/deepsec.ts, pure): it takes the changedsrc/source files the scope covers, priority paths first. It caps them at floor(ceiling ÷ $0.27) files, using the measured cost per file at thinkinghigh. It buildsdeepsec process --diff <base> --files-from <list> --limit n --model-auth direct.sweepArgvsbuilds the weekly run:scan, thenprocess --limit n, thenrevalidate --min-severity HIGH. A base that git could read as an option or a range is refused.scripts/deepsec.ts --base "$FORGE_CHECK_BASE"now runs inforge.json'sfastcheck, right aftergate.ts. It writes onedeepsec:line saying what is in scope, the most it could cost, and whether it ran or why it skipped. It always exits 0, so it never blocks the gate. The ceiling defaults to $3 (about 11 files);--max-usdorFORGE_DEEPSEC_PULL_MAX_USDchanges it.security.sweep_max_usdis a new limit on/admin/limits, with its reason: $25 by default, about 92 files.docs/features/deepsec.md.Not done here
api.anthropic.comis already inegress.totalCostUsdread back.security.sweep_max_usd; nothing reads it yet. It waits for the other two.All three block #14792 and the P0 Trust umbrella #586.
Checks:
bun scripts/gate.ts --fix(it rewrapped comments in my two new files),bun x tsc --noEmitand the newtest/deepsec-plan.test.tsall pass. The new test checks the file costs against hand calculations ($3 → 11 files, $0.81 → 3, $0.80 → 2) and the exact log line.scripts/fast.tsexits 2 becauseforge.jsonchanged, so I picked the tests by hand: limits, admin limits, openapi bounds, feature docs and index, doorless, check runner, combined check, own-code, looks, gate size. 201 tests, all pass. In the first run the feature-doc tests failed becausedocs/features/deepsec.mdhad no front matter; I added it and they passed on a rerun.I couldn't use the
keep_planandestimatetools in this session, so the plan on the issue isn't updated and I've made no time estimate. I found no prompt injection in the repository or the issue.Try it:
bun scripts/deepsec.ts --base origin/main --dry, or open a pull that touchessrc/http/and read thedeepsec:line in its fast check log.🤖 Generated with Claude Code
Closes #14792