@bugb-technologies/bravos 1.4.1 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +53 -219
  2. package/dist/account.js +2 -11
  3. package/dist/cli.js +77 -29
  4. package/dist/codegraph.js +25 -0
  5. package/dist/dashboard.js +242 -0
  6. package/dist/guardlink.js +4 -3
  7. package/dist/guide.js +2 -1
  8. package/dist/help.js +8 -0
  9. package/dist/hooks.js +27 -5
  10. package/dist/install-proof-tool.js +5 -7
  11. package/dist/install.js +2 -2
  12. package/dist/licence.js +11 -4
  13. package/dist/omp.js +2 -1
  14. package/dist/open.js +22 -0
  15. package/dist/opencode.js +2 -1
  16. package/dist/setup.js +11 -2
  17. package/dist/skills.js +8 -0
  18. package/dist/start/index.js +10 -2
  19. package/dist/watch.js +8 -24
  20. package/docs/GUIDE.md +7 -1
  21. package/docs/UPGRADING.md +50 -0
  22. package/hooks/lib/briefing.mjs +82 -27
  23. package/hooks/lib/licence.mjs +13 -0
  24. package/hooks/lib/nightly-tools.sh +8 -2
  25. package/hooks/lib/replay.mjs +18 -7
  26. package/hooks/lib/setup.mjs +1 -1
  27. package/package.json +3 -2
  28. package/skills/bravos/SKILL.md +3 -2
  29. package/skills/bravos-annotate/SKILL.md +1 -1
  30. package/skills/bravos-annotate/scripts/lib/pick.mjs +1 -1
  31. package/skills/bravos-annotate/scripts/slice.mjs +1 -1
  32. package/skills/bravos-context/SKILL.md +5 -4
  33. package/skills/bravos-env/SKILL.md +2 -2
  34. package/skills/bravos-env/scope.example.yaml +2 -2
  35. package/skills/bravos-prove/SKILL.md +5 -5
  36. package/skills/bravos-templatize/SKILL.md +3 -3
  37. package/skills/bravos-templatize/operator-guidance.md +4 -4
  38. package/templates/dashboard/codegraph-pages.css +279 -0
  39. package/templates/dashboard/codegraph-pages.js +6230 -0
  40. package/templates/dashboard/codegraph-pages.json +11 -0
  41. package/templates/dashboard/dashboard.html +252 -0
package/dist/watch.js CHANGED
@@ -5,6 +5,7 @@ import { basename, join } from 'node:path';
5
5
  import { pathToFileURL } from 'node:url';
6
6
  import * as graph from './codegraph.js';
7
7
  import { LOCK_PATH } from './lock.js';
8
+ import { openInBrowser } from './open.js';
8
9
  import { hooksDir, version } from './paths.js';
9
10
  import { readAllAnswers, readDraft } from './review.js';
10
11
  import { listReports, readMeta, reportDir } from './report/meta.js';
@@ -40,20 +41,6 @@ export function readReportSummary(root, env) {
40
41
  };
41
42
  }
42
43
  const libs = {};
43
- // @comment -- "The header's plan label from the briefing's licence status: short enough for one bar, honest about trial days and expiry."
44
- export function planLabel(v) {
45
- if (!v || typeof v !== 'object')
46
- return { label: 'Free', licensed: false };
47
- const tier = typeof v.tier === 'string' ? v.tier.charAt(0).toUpperCase() + v.tier.slice(1) : 'Free';
48
- if (v.licensed) {
49
- if (v.trial)
50
- return { label: `${tier} trial · ${Math.max(0, Math.ceil((v.trial.endsAt - Date.now() / 1000) / 86400))}d left`, licensed: true };
51
- return { label: `${tier} · ${v.seats} seat${v.seats === 1 ? '' : 's'}${v.state === 'grace' ? ' · in grace' : ''}`, licensed: true };
52
- }
53
- if (v.state === 'expired')
54
- return { label: `${tier} · expired`, licensed: false };
55
- return { label: 'Free', licensed: false };
56
- }
57
44
  export const lib = (name) => (libs[name] ??= import(pathToFileURL(join(hooksDir(), 'lib', name)).href));
58
45
  export const runner = async () => (await lib('autopilot.mjs')).asyncRunner;
59
46
  export const parseJson = (r) => {
@@ -273,7 +260,8 @@ export async function snapshot(root, env, opts = {}) {
273
260
  setup: { done: setup.done, total: setup.total, items: setup.items.map((x) => ({ id: x.id, label: x.label, on: x.on })), next: setup.next ? { label: setup.next.label, cta: setup.next.cta, how: setup.next.how } : null },
274
261
  sast: i.sast?.summary ? { total: i.sast.summary.total, reachable: i.sast.summary.reachable, unjoinedReachable: i.sast.summary.unjoinedReachable, staleCommits: i.sast.summary.staleCommits } : null,
275
262
  sastAvailable: !!i.sast?.available?.ok,
276
- plan: planLabel(i.licence),
263
+ // One short label, shared with the banner (hooks/lib/licence.mjs).
264
+ plan: (await lib('licence.mjs')).planLabel(i.licence),
277
265
  graph,
278
266
  team: { prs: num(i.inFlight?.prs), files: num(i.inFlight?.files), numbers: arr(i.inFlight?.numbers) },
279
267
  branchWork: {
@@ -568,7 +556,7 @@ export function graphAnswer(status, stdout, failure = '') {
568
556
  }
569
557
  return [`no answer${failure ? `: ${failure}` : status !== null ? ` (exit ${status})` : ''}`];
570
558
  }
571
- // @comment -- "Maps one key to a read-only action: copy the next command, open the intent review or guardlink's dashboard, ask the graph, show test-next, the recorded intent or the guide, scroll, refresh everything now, or quit; anything else does nothing."
559
+ // @comment -- "Maps one key to a read-only action: copy the next command, open the intent review or the dashboard (bravos dashboard, written outside the repository), ask the graph, show test-next, the recorded intent or the guide, scroll, refresh everything now, or quit; anything else does nothing."
572
560
  export function handleKey(key, sn, root = '.') {
573
561
  switch (key) {
574
562
  case 'n':
@@ -578,7 +566,7 @@ export function handleKey(key, sn, root = '.') {
578
566
  case 'd': {
579
567
  // Written outside the repository so the key never changes the working tree.
580
568
  const file = join(tmpdir(), `bravos-dashboard-${basename(root) || 'repo'}.html`);
581
- return { kind: 'spawn', cmd: 'guardlink', args: ['dashboard', '.', '-o', file], note: `writing guardlink's dashboard to ${file}`, open: file };
569
+ return { kind: 'spawn', cmd: process.execPath, args: [...selfArgs(), 'dashboard', root, '--out', file, '--no-open'], note: `writing the dashboard to ${file}`, open: file };
582
570
  }
583
571
  case 'g':
584
572
  return { kind: 'overlay', what: 'graph' };
@@ -632,7 +620,7 @@ export function ignoredChange(name) {
632
620
  return !(n === '.git/HEAD' || n.startsWith('.git/refs/'));
633
621
  if (n.startsWith('node_modules/') || n.includes('/node_modules/'))
634
622
  return true;
635
- if (n.startsWith('.bravos/sast/'))
623
+ if (n.startsWith('.bravos/sast/') || n.startsWith('.bravos/dashboard/'))
636
624
  return true;
637
625
  if (n.startsWith('.bravos/watch/'))
638
626
  return n !== '.bravos/watch/events.jsonl';
@@ -641,10 +629,6 @@ export function ignoredChange(name) {
641
629
  return !n.endsWith('/meta.json');
642
630
  return false;
643
631
  }
644
- function openTarget(target) {
645
- const [cmd, args] = process.platform === 'darwin' ? ['open', [target]] : process.platform === 'win32' ? ['cmd', ['/c', 'start', '', target]] : ['xdg-open', [target]];
646
- spawn(cmd, args, { detached: true, stdio: 'ignore' }).on('error', () => { }).unref();
647
- }
648
632
  function copyToClipboard(text) {
649
633
  const tries = process.platform === 'darwin' ? [['pbcopy', []]] : process.platform === 'win32' ? [['clip', []]] : [['wl-copy', []], ['xclip', ['-selection', 'clipboard']]];
650
634
  for (const [cmd, args] of tries) {
@@ -854,7 +838,7 @@ export async function runWatch(root, env, opts) {
854
838
  const file = r ? (['pdf', 'html'].map((f) => join(r.dir, `report.${f}`)).find((f) => existsSync(f)) ?? null) : null;
855
839
  note = file ? `opening ${file}` : r ? `no html or pdf yet: bravos report export ${r.id} --format html,pdf` : 'no report yet: ask "write the assessment report" (/bravos-report)';
856
840
  if (file)
857
- openTarget(file);
841
+ openInBrowser(file, env);
858
842
  }
859
843
  if (a.kind === 'theme') {
860
844
  theme = nextTheme(theme);
@@ -878,7 +862,7 @@ export async function runWatch(root, env, opts) {
878
862
  child.on('exit', (code) => {
879
863
  note = code === 0 ? `dashboard: ${file}` : `${a.cmd} exited ${code}`;
880
864
  if (code === 0)
881
- openTarget(file);
865
+ openInBrowser(file, env);
882
866
  draw();
883
867
  });
884
868
  }
package/docs/GUIDE.md CHANGED
@@ -40,7 +40,7 @@ Run bravos next in a shell (free): it shows which of the nine steps are done her
40
40
 
41
41
  Or just ask the agent "help me get started" (or run /bravos, $bravos in Codex): it gives a short tour fitted to this repo. BRAVOS_COACH=off stops the coaching; the Setup line stays.
42
42
 
43
- Keep bravos watch running in a second terminal pane beside your agent (free, read-only, no model): the setup score, open and confirmed exposures, what to test next, stale claims and autopilot nudges, redrawn within seconds of a change. It also shows the hypothesis ledger, boundaries, the model's size, the code graph's call resolution and entry points, and the branch's commits. Keys: n copies the next command, r opens the intent review, d guardlink's dashboard, g asks the code graph, t shows test-next, i shows the recorded intent, u refreshes now, j and k scroll, q quits. Three columns from 150 wide, two from 110, one in an 80-column split.
43
+ Keep bravos watch running in a second terminal pane beside your agent (free, read-only, no model): the setup score, open and confirmed exposures, what to test next, stale claims and autopilot nudges, redrawn within seconds of a change. It also shows the hypothesis ledger, boundaries, the model's size, the code graph's call resolution and entry points, and the branch's commits. Keys: n copies the next command, r opens the intent review, d the dashboard (bravos dashboard), g asks the code graph, t shows test-next, i shows the recorded intent, u refreshes now, j and k scroll, q quits. Three columns from 150 wide, two from 110, one in an 80-column split.
44
44
 
45
45
  ### Hands-off: autopilot
46
46
 
@@ -184,6 +184,12 @@ Skills: `/bravos-annotate` · `/bravos-codegraph` · `/bravos-prove`
184
184
 
185
185
  Clone the services side by side in one folder, then run bravos workspace create NAME --member ./gateway=gateway@http://127.0.0.1:8080 --member ./orders=orders@http://127.0.0.1:8081 (bravos workspace plus guardlink link-project plus bravos in each repo and in the shared folder). Work on a service from its own repo; ask questions that cross services from the shared folder, where the briefing and bravos watch show every service. Declare each call to another service as @flows #<this>-<x> -> #<other>-<y> via http (plain ids, not #repo.tag). Build the code graph over the shared folder so it links one service's client calls to another's handlers. bravos report data --workspace writes one report across the services.
186
186
 
187
+ ### See the findings on one page
188
+
189
+ Skills: `/bravos`
190
+
191
+ Run bravos dashboard (free, no model): it writes one self-contained page under .bravos/dashboard/ (git-ignored) and opens it in your browser. It is GuardLink's threat model with who introduced and fixed each exposure and what changed since the default branch; on the Team plan, with the code graph built, a second tab shows the code graph: a map of where the risk sits, owners and history, coupling, trust, the attack surface, entry points and links. --no-blame leaves git names out of a page you will share; --no-open only prints the path. Or ask your agent "show me the findings".
192
+
187
193
  ### Write up the assessment, a finding or a retest
188
194
 
189
195
  Skills: `/bravos-report`
@@ -0,0 +1,50 @@
1
+ # Upgrading Bravos
2
+
3
+ After `npm install -g @bugb-technologies/bravos`, run **`bravos setup --tools -y`** once on each machine and **`bravos sync`** in each repository. The notes below say what else changes, newest first.
4
+
5
+ ## 1.5.0
6
+
7
+ 1.5 adds a dashboard and tells you which plan you are on. It includes everything listed under 1.4.3, which was not published on its own.
8
+
9
+ - **`bravos dashboard`** writes one self-contained page and opens it in your browser. It is saved as `.bravos/dashboard/index.html`, which git ignores; it needs no server, network or model.
10
+ - **Threat model tab:** GuardLink's own dashboard, with who introduced and fixed each exposure and what changed since the default branch.
11
+ - **Code graph tab (Team plan, with the graph built):** the map of where the risk sits, owners and history, coupling, trust, the attack surface, entry points and links. On the Free plan the tab says so.
12
+ - `--no-blame` leaves git names out of both tabs, for a page you will share. `--no-open` only prints the path; `--out <file>` writes elsewhere.
13
+ - A large repository makes a large page (tens of megabytes) and takes a couple of minutes.
14
+ - **Ask your agent "show me the findings"** and it offers this page. `d` in `bravos watch` builds it too.
15
+ - **The banner states your plan** beside the mascot (`Plan: Free`, `Plan: Team trial · 25d left`, `Plan: Team · 5 seats`), and `bravos next` prints it under its title. Without a licence it shows `graph locked` instead of `graph on`, lists free skills where the Team-only ones were, and says once what Team adds.
16
+ - **Opening a browser** is skipped in CI and on Linux without a display; the path or URL is still printed.
17
+
18
+ ## 1.4.3
19
+
20
+ - **Coverage counts only your code.** Bravos's own annotations no longer travel into a repository with the skill scripts it installs, so a fresh project starts at 0% instead of 50%. After `bravos sync`, coverage in an existing repository drops by those files (two per agent); nothing of yours changed.
21
+ - **The briefing states the plan and where annotations go:** a `Plan:` line, and an `Annotations:` line saying external `.gal` sidecars or inline comments. bravos-context follows it instead of always writing beside the code.
22
+ - **On the Free plan the next step is a free one.** `bravos next` and the briefing list the code graph as a Team-plan step and start from "record what the app intends".
23
+ - **The agent asks before the first commit of a session,** in bravos-context, bravos-annotate and bravos-templatize. Campaigns and schedules, where you already asked for commits, are not interrupted.
24
+
25
+ ## 1.4.2
26
+
27
+ - **Bravos tests only with `cxg scan`.** It never runs `cxg pentest run`, `cxg scan --pentest` or cxg's model generation; every probe is written and reviewed in your agent's session. Electron apps run through `cxg scan --target-type electron` with `--app-cmd` or `--app-binary`, and Tauri's in-process proof through `--tauri-prove`. Test logins still use `cxg pentest auth`.
28
+ - **Setup no longer runs `cxg pentest install` or `update`.** The first `cxg scan` that runs a probe installs or refreshes cxg's pipeline itself. Browser probes still need cxg's Python requirements and Playwright Chromium where they run.
29
+ - **A probe that needs no login** declares `@requires_identities: {}` (or `@requires_auth_count: 0`); without it, cxg expects one captured login and refuses the probe.
30
+ - **`--agent` is exact.** Only the agents you name get hooks and files; Cursor, omp and opencode files are left alone unless selected. Leave `--agent` out to keep detecting them.
31
+ - **New repositories use GuardLink's default annotation mode**, which is external `.gal` sidecars, unless you pass `--guardlink-mode inline`. Existing repositories keep theirs.
32
+ - **Old `joseph` installs migrate** under `bravos start` and `bravos sync --agent …` too. Dead old-name hook entries are dropped from the agents you select; an agent you did not select that still runs the old `.joseph/hooks` scripts is named, with the command that fixes it.
33
+ - **SAST failures show their cause**, and the analyzer's full error output stays in the run's folder under `.bravos/sast/`.
34
+ - **Testing a clone of someone else's project:** a one-time loopback test (`run-once`, with your typed authorization) may use a policy and scope committed only in your clone.
35
+
36
+ ## 1.4.1
37
+
38
+ - `bravos setup` fetches analyzer 0.6.2 (Team plan), whose reachability matches the code graph and whose own GuardLink pin is 2.6.0.
39
+ - `bravos sast run` starts only with the GuardLink `bravos setup --tools -y` installs on PATH, so SAST and the rest of Bravos read the threat model with the same GuardLink.
40
+
41
+ ## 1.4.0
42
+
43
+ 1.4 adds continuous proof: autopilot reviews changed code in already-annotated files, the active agent writes a test bound to the claim it affects, and Bravos replays it through cxg and records the result in GuardLink.
44
+
45
+ 1. **`bravos setup --tools -y`** installs GuardLink 2.6.0 and cxg 1.8.0, the first releases with the interfaces 1.4 uses; `bravos doctor` shows both as ready.
46
+ 2. **`bravos sync`** refreshes the skills and hooks and keeps the hooks you already turned on. It tells you when the workflows are older than this version; **`bravos sync --ci`** refreshes the ones you have, keeping their schedule, and adds none.
47
+ 3. **Scheduled proving** in the nightly needs `choice: schedule` in `.guardlink/proving.md`, with a `— confirmed by <name>, <date>` line, merged to the default branch (bravos-prove records it). Until then the job summary says why scheduled proof is off.
48
+ 4. **Test kits written before 1.4** are reported as needing review and `bind`, and are not run until bound (bravos-templatize does it).
49
+ 5. **Automatic local testing** starts once a `target: http://localhost:<port>/` line for your app is merged to the default branch, and needs an `origin` remote; without one, tests run only once each, with your typed authorization.
50
+ 6. Teammates **without a licence** see that autopilot and the pre-PR gate are installed but locked for them, with the trial command, instead of "on".
@@ -4,7 +4,7 @@ import { accessSync, constants, readFileSync } from 'node:fs';
4
4
  import { basename, delimiter, dirname, join } from 'node:path';
5
5
  import { THEMES } from './palette.mjs';
6
6
  import { readProving } from './proving.mjs';
7
- import { planLine, status as licenceStatus } from './licence.mjs';
7
+ import { planLabel, planLine, status as licenceStatus } from './licence.mjs';
8
8
  import { refreshIfDue } from './refresh.mjs';
9
9
  import { gitStaleness, staleLine, staleness, strandedBranches, strandedLine } from './resync.mjs';
10
10
  import { readSast, sastAvailable, sastLine } from './sast.mjs';
@@ -67,6 +67,16 @@ function exposuresLine(g) {
67
67
  return line;
68
68
  }
69
69
 
70
+ // @comment -- "Reads annotation_mode from .guardlink/config.json: 'external' (sidecars), 'inline', or null when the file is missing, unreadable or names neither; read-only."
71
+ export function readAnnotationMode(root) {
72
+ try {
73
+ const mode = JSON.parse(readFileSync(join(root, '.guardlink', 'config.json'), 'utf8'))?.annotation_mode;
74
+ return mode === 'external' || mode === 'inline' ? mode : null;
75
+ } catch {
76
+ return null;
77
+ }
78
+ }
79
+
70
80
  // @comment -- "Reads .guardlink/intent.md (written by bravos-context) and reports whether the product's intent is recorded: none, draft (any item marked '— draft') or confirmed, with the invariant count; read-only."
71
81
  export function readIntent(root) {
72
82
  let text;
@@ -104,10 +114,11 @@ function coachLines(i) {
104
114
  }
105
115
  out.push(
106
116
  'How to help this person (offer, never lecture; one offer per topic per session):',
107
- `- In your first reply, if setup is under 5 or intent is none, offer once in plain words three starts that fit this repo, in setup order (build the code graph first if it is off, then learn what the app intends, annotate the uncovered files, run SAST, prove the top threats; or check this branch before a PR) and \`bravos guide\` for more; then follow their lead.`,
117
+ `- In your first reply, if setup is under 5 or intent is none, offer once in plain words three starts that fit this repo, in setup order (${i.licence?.licensed === false ? 'on the Free plan: learn what the app intends, annotate the uncovered files, prove the top threats; never lead with a Team-plan step' : 'build the code graph first if it is off, then learn what the app intends, annotate the uncovered files, run SAST, prove the top threats; or check this branch before a PR'}) and \`bravos guide\` for more; then follow their lead.`,
108
118
  `- After you edit security-relevant code, offer to record what it exposes (${k('bravos-annotate')}); before a PR, run the ship check (${k('bravos-ship')}); after a fix, offer a recheck (${k('bravos-recheck')}).`,
119
+ '- Commits are the person\'s call: before the first commit of a session ask once (commit now, or leave the files for them to review), even where a skill says to commit; skip the question only when they already asked for commits (a campaign, a schedule).',
109
120
  '- When a request would go better with the next unlock above, say what it would add, once. Plain words first, skill name second. Never send test traffic without the authorization bravos-env asks for.',
110
- '- Once, when it helps them follow along, mention that `bravos watch` in a second terminal pane shows this live as you work (free, read-only).',
121
+ '- Once, when it helps them follow along, mention that `bravos watch` in a second terminal pane shows this live as you work (free, read-only), and that `bravos dashboard` opens the findings as one page in their browser.',
111
122
  );
112
123
  return out;
113
124
  }
@@ -117,7 +128,9 @@ export function buildBriefing(inputs) {
117
128
  const i = inputs ?? {};
118
129
  const lines = [`GuardLink security picture (bravos) — ${i.repo} @ ${i.sha}, base ${i.base}`];
119
130
  for (const e of arr(i.errors).slice(0, MAX_DEGRADED)) lines.push(` (degraded: ${e})`);
120
- const nextLine = i.harness === 'claude' ? NEXT_CLAUDE : NEXT_OTHER;
131
+ // The pre-PR ship check is on the Team plan, so an unlicensed person's last pointer is the recheck instead.
132
+ const nextBase = i.harness === 'claude' ? NEXT_CLAUDE : NEXT_OTHER;
133
+ const nextLine = hooksLocked(i) ? nextBase.replace('bravos-ship before a PR', 'bravos-recheck after a fix') : nextBase;
121
134
 
122
135
  if (i.guardlink === 'missing') {
123
136
  lines.push('guardlink: not found on PATH — run bravos doctor', nextLine);
@@ -130,6 +143,18 @@ export function buildBriefing(inputs) {
130
143
  const staleText = staleLine(i.stale, { branch: i.branch, base: i.base });
131
144
  if (staleText) head.push(staleText);
132
145
  head.push(exposuresLine(g));
146
+ // The plan the skills and the lines below refer to ("see Plan above"): which tier this machine is on.
147
+ // A licence record missing a field must never cost the person their briefing, so a line that cannot be built is left out.
148
+ if (i.licence && typeof i.licence === 'object' && i.licence.state) {
149
+ try {
150
+ head.push(planLine(i.licence));
151
+ } catch {
152
+ /* no plan line */
153
+ }
154
+ }
155
+ // Where annotations go here, so no skill writes them in the wrong place.
156
+ if (i.annotationMode === 'external') head.push('Annotations: external — written in `.gal` sidecars under `.guardlink/annotations/<source path>.gal`, never in the source files; where a skill says "beside the code", that means the file\'s sidecar here.');
157
+ else if (i.annotationMode === 'inline') head.push('Annotations: inline — written in comments beside the code they describe.');
133
158
  const strandedText = strandedLine(i.stranded, i.base);
134
159
  if (strandedText) head.push(strandedText);
135
160
 
@@ -170,6 +195,7 @@ export function buildBriefing(inputs) {
170
195
  tail.push(p.status === 'set'
171
196
  ? `Proving: ${p.choice}${p.target ? ` on ${p.target}` : ''}${p.generation ? ', model-API probes allowed' : ''} (${p.by}, ${p.date}, .guardlink/proving.md)`
172
197
  : 'Proving: not set — when proving comes up, ask the person once how they want it handled and record it (bravos-prove)');
198
+ if (p.status === 'set' && p.choice === 'auto' && i.defaultBranch === null) tail.push('Proving blocked: origin/HEAD is missing or unresolved. Fetch the default branch and run git remote set-head origin --auto (or git remote set-head origin <branch>); on a local clone, use an ask policy with run-once.');
173
199
  }
174
200
  if (i.shadow) {
175
201
  tail.push(i.shadow.userNewer
@@ -335,13 +361,15 @@ export async function collect(root, env, { deadlineMs = 20000, nextCount = 3 } =
335
361
  const base = ref || 'origin/main';
336
362
  const name = branch && branch !== 'HEAD' ? branch : null;
337
363
  const later = (args) => git(args, budget());
338
- const [diff, behind, stranded] = await Promise.all([
364
+ const [diff, behind, stranded, defaultHead] = await Promise.all([
339
365
  later(['diff', '--name-only', `${base}...HEAD`]),
340
366
  gitStaleness(later, base),
341
367
  strandedBranches(later, base, { current: name }),
368
+ ref ? later(['rev-parse', '--verify', `${ref}^{commit}`]) : null,
342
369
  ]);
343
370
  return {
344
371
  sha: sha ?? 'unknown',
372
+ defaultBranch: defaultHead ? ref : null,
345
373
  base,
346
374
  branch: name,
347
375
  changedFiles: diff ? diff.split('\n').filter(Boolean) : [],
@@ -395,6 +423,7 @@ export async function collect(root, env, { deadlineMs = 20000, nextCount = 3 } =
395
423
  repo: basename(root),
396
424
  sha: facts.sha,
397
425
  base: facts.base,
426
+ defaultBranch: facts.defaultBranch,
398
427
  branch: facts.branch,
399
428
  stale: facts.stale,
400
429
  stranded: facts.stranded,
@@ -402,6 +431,7 @@ export async function collect(root, env, { deadlineMs = 20000, nextCount = 3 } =
402
431
  changedFiles: facts.changedFiles,
403
432
  inFlight,
404
433
  intent: readIntent(root),
434
+ annotationMode: readAnnotationMode(root),
405
435
  // bravos on PATH: what its probe says (a graph for this commit or not); else codegraph-mcp on PATH means the MCP route.
406
436
  codegraph: graphState ?? (whichOnPath('codegraph-mcp', env) ? 'unknown' : 'unavailable'),
407
437
  sast: { summary: readSast(root, env), available: sastAvailable(env) },
@@ -449,11 +479,12 @@ export const MASCOT = [
449
479
  ];
450
480
  const MASCOT_WIDTH = 26;
451
481
  const LEFT_WIDTH = 36;
452
- const INTRO = [
453
- 'bravos makes this agent a guardlink power user: it keeps the threat model',
454
- 'beside the code, proves exposures with authorized cxg runs on targets you own,',
455
- 'and gates pull requests on what they change. For developers and security alike.',
456
- ];
482
+ // Two lines, so the plan nudge below the counts has room. The pre-PR gate is named only to people who have it.
483
+ const INTRO_HEAD = 'bravos makes this agent a guardlink power user: it keeps the threat model beside';
484
+ const INTRO_TEAM = 'the code, proves exposures on targets you own, and gates pull requests.';
485
+ const INTRO_FREE = 'the code, proves exposures on targets you own, and rechecks them after a fix.';
486
+ // What the Team plan adds, short enough for one banner line.
487
+ const TEAM_ADDS = 'autopilot, PR gate, SAST, code graph';
457
488
 
458
489
  export const fit = (s, w) => (s.length <= w ? s : s.slice(0, Math.max(0, w - 1)) + '…');
459
490
 
@@ -551,6 +582,7 @@ const SKILL_HINT = {
551
582
  'bravos-templatize': 'write templates',
552
583
  bravos: 'where to start',
553
584
  'bravos-ship': 'check before a PR',
585
+ 'bravos-report': 'write it up',
554
586
  };
555
587
 
556
588
  /** Three skills chosen from state, bravos-ship always last; `harness` picks /x (Claude Code), $x (Codex), /skill:x (omp) or the bare name. */
@@ -566,7 +598,9 @@ export function quickStart(inputs, harness) {
566
598
  if (arr(g.next?.queue).some((q) => q?.state === 'untested')) picks.push('bravos-templatize');
567
599
  const chosen = picks.slice(0, 2);
568
600
  if (chosen.length < 2) chosen.unshift('bravos');
569
- chosen.push('bravos-ship');
601
+ // The ship check is on the Team plan; an unlicensed person gets a free last step instead.
602
+ if (inputs?.licence?.licensed === false) chosen.push(chosen.includes('bravos-recheck') ? 'bravos-report' : 'bravos-recheck');
603
+ else chosen.push('bravos-ship');
570
604
  const sigil = SIGIL[harness] ?? '';
571
605
  return chosen.slice(0, 3).map((name) => ({ name, command: sigil + name, hint: SKILL_HINT[name] }));
572
606
  }
@@ -603,13 +637,20 @@ function countsLine(g) {
603
637
  return line;
604
638
  }
605
639
 
640
+ // @comment -- "The banner's one-line state: intent, code graph, the two hooks, SAST and the setup score. A locked code graph says locked, never on. The full wording is kept while it fits 80 columns; past that it shortens in steps (one word for both hooks when they agree, PR for pre-PR, reach. for reachable, then the bare count) so the line is never cut mid-word."
606
641
  function statusLine(i) {
607
642
  const intent = i.intent?.status ?? 'unknown';
608
- const graph = i.codegraph === 'unavailable' ? 'graph off' : i.codegraph === 'not-built' ? 'graph none' : i.codegraph === 'diverged' ? 'graph stale' : 'graph on';
609
- const sast = i.sast?.summary ? `sast ${i.sast.summary.reachable} reachable` : i.sast?.available?.ok ? 'sast not run' : 'sast off';
643
+ const graph = i.codegraph === 'unavailable' ? 'graph off' : i.codegraph === 'not-built' ? 'graph none' : i.codegraph === 'diverged' ? 'graph stale' : i.codegraph === 'locked' ? 'graph locked' : 'graph on';
610
644
  const setup = i.root ? readSetup(i.root, i, i.harness) : null;
611
645
  const hook = (on) => (!on ? 'off' : hooksLocked(i) ? 'locked' : 'on');
612
- return `intent ${intent} · ${graph} · pre-PR ${hook(i.prePr)} · auto ${hook(i.autopilot)} · ${sast}${setup ? ` · setup ${setup.done}/${setup.total}` : ''}`;
646
+ const [pr, auto] = [hook(i.prePr), hook(i.autopilot)];
647
+ const build = (level) => {
648
+ const hooks = level >= 1 && pr === auto ? `hooks ${pr}` : `${level >= 2 ? 'PR' : 'pre-PR'} ${pr} · auto ${auto}`;
649
+ const sast = i.sast?.summary ? `sast ${i.sast.summary.reachable}${level >= 4 ? '' : level >= 3 ? ' reach.' : ' reachable'}` : i.sast?.available?.ok ? 'sast not run' : 'sast off';
650
+ return `intent ${intent} · ${graph} · ${hooks} · ${sast}${setup ? ` · setup ${setup.done}/${setup.total}` : ''}`;
651
+ };
652
+ for (let level = 0; level < 4; level++) if (build(level).length <= BANNER_WIDTH) return build(level);
653
+ return build(4);
613
654
  }
614
655
 
615
656
  /**
@@ -627,7 +668,9 @@ export function buildBanner(inputs, opts = {}) {
627
668
  [`bravos${opts.version ? ` ${opts.version}` : ''}`, i.repo].filter(Boolean).join(' · '),
628
669
  [i.branch, i.sha ? `@ ${i.sha}` : ''].filter(Boolean).join(' '),
629
670
  ];
630
- const header = ['', '', ...LOGO, '', ...facts];
671
+ // The plan sits on the row between the wordmark and the repo facts, so it costs no line; nothing is shown while the licence is unknown.
672
+ const plan = i.licence && typeof i.licence === 'object' && i.licence.state ? planLabel(i.licence) : null;
673
+ const header = ['', '', ...LOGO, plan ? `Plan: ${plan.label}` : '', ...facts];
631
674
  const lines = MASCOT.map((row, r) => `${row} ${fit(header[r] ?? '', room)}`);
632
675
 
633
676
  if (i.guardlink === 'missing') {
@@ -637,7 +680,10 @@ export function buildBanner(inputs, opts = {}) {
637
680
  }
638
681
  const g = i.guardlink ?? {};
639
682
  lines.push('', countsLine(g), statusLine(i));
683
+ // One plan nudge at most: hooks this repo registers but this person cannot run, a lapsed licence, or what Team would add.
640
684
  if ((i.autopilot || i.prePr) && hooksLocked(i)) lines.push(`~ ${i.autopilot ? 'autopilot' : 'the pre-PR gate'} is set up here, on the Team plan for you · bravos account activate`);
685
+ else if (plan && !plan.licensed && i.licence.state === 'expired') lines.push(`~ licence expired: ${TEAM_ADDS} locked · bravos licence`);
686
+ else if (plan && !plan.licensed) lines.push(`~ Team adds ${TEAM_ADDS} · bravos account activate`);
641
687
  if (i.stale) lines.push(`! ${i.branch ?? 'this checkout'} is ${i.stale.behind} behind ${i.base} · findings describe older code · bravos-resync`);
642
688
  else if (arr(i.stranded).length > 0) lines.push(`~ annotation work on ${i.stranded[0].branch} is not on ${i.base} · bravos-resync`);
643
689
  if (i.shadow) {
@@ -667,13 +713,15 @@ export function buildBanner(inputs, opts = {}) {
667
713
  };
668
714
  left = ['Top threats', ...(top.length ? top.map(row) : ['none open'])];
669
715
  }
670
- // One column: the Next line below carries the step to take, so the old Quick start column is gone.
671
- for (const row of left) lines.push(fit(row, BANNER_WIDTH));
672
-
673
- // By role and by task: the skill each starts with, in the harness's own syntax.
716
+ // By role and by task: the skill each starts with, in the harness's own syntax. Campaigns, the ship check and
717
+ // the code graph are on the Team plan, so an unlicensed person is shown free skills in their place.
674
718
  const sk = (name) => (SIGIL[harness] ?? '') + name;
675
- const roles = [['developer', 'bravos-annotate'], ['security', 'bravos-prove'], ['team lead', 'bravos-campaign'], ['new here', 'bravos']];
676
- const tasks = [['what next?', 'bravos'], ['before a PR', 'bravos-ship'], ['after a fix', 'bravos-recheck'], ['find routes', 'bravos-codegraph']];
719
+ const free = hooksLocked(i);
720
+ const roles = [['developer', 'bravos-annotate'], ['security', 'bravos-prove'], ['team lead', free ? 'bravos-report' : 'bravos-campaign'], ['new here', 'bravos']];
721
+ const tasks = free
722
+ ? [['what next?', 'bravos'], ['app intent', 'bravos-context'], ['after a fix', 'bravos-recheck'], ['write it up', 'bravos-report']]
723
+ : [['what next?', 'bravos'], ['before a PR', 'bravos-ship'], ['after a fix', 'bravos-recheck'], ['find routes', 'bravos-codegraph']];
724
+ const head = lines.splice(0);
677
725
  lines.push('', 'If you are'.padEnd(LEFT_WIDTH) + 'To');
678
726
  for (let r = 0; r < roles.length; r++) {
679
727
  lines.push(fit(`${roles[r][0].padEnd(11)}${sk(roles[r][1])}`, LEFT_WIDTH - 2).padEnd(LEFT_WIDTH) + `${tasks[r][0].padEnd(13)}${sk(tasks[r][1])}`);
@@ -686,9 +734,13 @@ export function buildBanner(inputs, opts = {}) {
686
734
  lines.push('Guide (free, no tokens): bravos guide · bravos guide roles · bravos guide tasks');
687
735
 
688
736
  if (i.intent?.status === 'none') {
689
- lines.push('', ...INTRO, `Start with the Next step above, or ask "help me get started" (${SIGIL[harness] ? `${SIGIL[harness]}bravos` : 'the bravos skill'}).`, 'Hide this banner with BRAVOS_BANNER=off.');
737
+ lines.push('', INTRO_HEAD, free ? INTRO_FREE : INTRO_TEAM, `Start with the Next step above, or ask "help me get started" (${SIGIL[harness] ? `${SIGIL[harness]}bravos` : 'the bravos skill'}).`, 'Hide this banner with BRAVOS_BANNER=off.');
690
738
  }
691
- const out = lines.map((l) => fit(l.trimEnd(), BANNER_WIDTH)).slice(0, i.intent?.status === 'none' ? 35 : 29);
739
+ // When notes above the threats push the banner past its cap, threat rows give way (one always stays),
740
+ // so the Next and Guide lines are never the ones cut.
741
+ const cap = i.intent?.status === 'none' ? 35 : 29;
742
+ while (head.length + left.length + lines.length > cap && left.length > 2) left.pop();
743
+ const out = [...head, ...left.map((row) => fit(row, BANNER_WIDTH)), ...lines].map((l) => fit(l.trimEnd(), BANNER_WIDTH)).slice(0, cap);
692
744
  return (opts.color ? colorize(out, i, opts.theme) : out).join('\n');
693
745
  }
694
746
 
@@ -700,8 +752,10 @@ export function buildSummary(inputs, opts = {}) {
700
752
  if (i.guardlink === 'missing') return `${head}\nguardlink not found on PATH — run bravos doctor\n${guide}`;
701
753
  const next = quickStart(i, opts.harness).map((q) => q.command).join(' · ');
702
754
  const setup = i.root ? readSetup(i.root, i, opts.harness) : null;
703
- const third = setup ? `setup ${setup.done}/${setup.total}${setup.next ? ` · next: ${setup.next.label} · bravos next` : ''} · bravos guide` : guide;
704
- return `${head} · ${countsLine(i.guardlink ?? {})}\nintent ${i.intent?.status ?? 'unknown'} · skills: ${next}\n${third}`;
755
+ const plan = i.licence && typeof i.licence === 'object' && i.licence.state ? planLabel(i.licence) : null;
756
+ const trial = !plan || plan.licensed ? '' : i.licence.state === 'expired' ? ' · renew: bravos licence' : ' · Team trial: bravos account activate';
757
+ const third = (setup ? `setup ${setup.done}/${setup.total}${setup.next ? ` · next: ${setup.next.label} · bravos next` : ''} · bravos guide` : guide) + trial;
758
+ return `${head} · ${countsLine(i.guardlink ?? {})}\n${plan ? `plan ${plan.label} · ` : ''}intent ${i.intent?.status ?? 'unknown'} · skills: ${next}\n${third}`;
705
759
  }
706
760
 
707
761
  // Brand palette by theme (hooks/lib/palette.mjs). Colour is truecolor ANSI, added after
@@ -743,6 +797,7 @@ export function colorize(lines, inputs = {}, theme = 'dark') {
743
797
  const left = runs(chars.slice(0, MASCOT_WIDTH), mascotColour);
744
798
  const rest = chars.slice(MASCOT_WIDTH).join('');
745
799
  if (n >= 2 && n < 2 + LOGO.length) return left + runs([...rest], wordColour);
800
+ if (n === MASCOT.length - 3) return left + rest.replace(/Plan: (.+)$/, (_m, label) => paint('Plan: ', P.steel) + paint(label, P.light, true));
746
801
  if (n === MASCOT.length - 2) return left + rest.replace(/bravos( [\d.]+)?/, (m) => paint(m, P.green, true)).replace(/ · (.+)$/, (_m, r) => ` · ${paint(r, P.light, true)}`);
747
802
  if (n === MASCOT.length - 1) return left + rest.replace(/\S.*$/, (m) => paint(m, P.steel));
748
803
  return left + rest;
@@ -752,7 +807,7 @@ export function colorize(lines, inputs = {}, theme = 'dark') {
752
807
  return line.split(/((?:\/skill:|\/|\$)?bravos(?:-[a-z]+)?(?= |$))/).map((part, k) => (k % 2 ? paint(part, P.green) : part)).join('');
753
808
  }
754
809
  if (/^! your user-level bravos/.test(line)) return paint(line, P.red, true);
755
- if (/^~ repo bravos /.test(line)) return paint(line, P.steel);
810
+ if (/^~ (repo bravos |Team adds |licence expired)/.test(line)) return paint(line, P.steel);
756
811
  if (/^Tip: /.test(line)) return paint('Tip: ', P.green, true) + paint(line.slice(5), P.light);
757
812
  if (/^Next: /.test(line)) {
758
813
  const [what, rest = ''] = line.slice(6).split(' → ');
@@ -776,7 +831,7 @@ export function colorize(lines, inputs = {}, theme = 'dark') {
776
831
  .replace(/coverage \d+%( \(\d+\/\d+\))?/, (m) => paint(m, P.green))
777
832
  .replace(/((?:\/skill:|\/|\$)bravos(?:-[a-z]+)?)(\s+)([^\x1b]+)$/, (_m, cmd, sp, hint) => `${paint(cmd, P.green)}${sp}${paint(hint, P.steel)}`)
778
833
  .replace(/(?<![\w/$:-])((?:\/skill:|\/|\$)bravos(?:-[a-z]+)?)(?![\w-])(?![^\x1b]*\x1b\[0m)/g, (m) => paint(m, P.green));
779
- if (/^(Start with|Hide this|bravos makes|beside the|and gates)/.test(line)) {
834
+ if (/^(Start with|Hide this|bravos makes|the code, proves)/.test(line)) {
780
835
  l = line.split(/((?:\/skill:|\/|\$)bravos-[a-z]+)/).map((part, k) => (k % 2 ? paint(part, P.green) : part ? paint(part, P.steel) : '')).join('');
781
836
  }
782
837
  return l;
@@ -443,6 +443,19 @@ export function planLine(v, now = Math.floor(Date.now() / 1000)) {
443
443
  return `Plan: ${tierName} · ${v.seats} seat${v.seats === 1 ? '' : 's'} · renews ${date(v.expiresAt)}`;
444
444
  }
445
445
 
446
+ // @comment -- "The short plan label for one-line places (the banner beside the mascot, Codex's summary, the watch header): Free, Team trial with days left, Team with seats (and grace), or expired. Never throws on a partial record; anything it cannot read is Free."
447
+ export function planLabel(v, now = Math.floor(Date.now() / 1000)) {
448
+ if (!v || typeof v !== 'object') return { label: 'Free', licensed: false };
449
+ const tier = typeof v.tier === 'string' && v.tier ? v.tier.charAt(0).toUpperCase() + v.tier.slice(1) : 'Free';
450
+ if (v.licensed) {
451
+ if (v.trial) return { label: `${tier} trial · ${days(Number(v.trial.endsAt) - now) || 0}d left`, licensed: true };
452
+ const seats = Number.isFinite(v.seats) ? ` · ${v.seats} seat${v.seats === 1 ? '' : 's'}` : '';
453
+ return { label: `${tier}${seats}${v.state === 'grace' ? ' · in grace' : ''}`, licensed: true };
454
+ }
455
+ if (v.state === 'expired') return { label: `${tier} · expired`, licensed: false };
456
+ return { label: 'Free', licensed: false };
457
+ }
458
+
446
459
  // @comment -- "What a gate says when a paid feature is asked for without the licence for it: what the feature does, that it is on the Team plan, and the two ways to get it. Never silent, never a stack trace."
447
460
  export function refusal(v, feature, what) {
448
461
  const label = PAID_FEATURE_LABELS[feature] ?? feature;
@@ -38,8 +38,14 @@ if ! test -x "$install_root/bin/cxg"; then
38
38
  fi
39
39
  export PATH="$install_root/bin:$PATH"
40
40
  echo "$install_root/bin" >> "$GITHUB_PATH"
41
- cxg pentest install
41
+ # Bravos runs cxg only through `cxg scan`: the first scan installs or refreshes cxg's embedded pipeline
42
+ # itself. The replay runner needs that pipeline's Python dependencies, taken from the cxg source the
43
+ # pinned binary was built from (its tag, or the pinned revision).
42
44
  if test "$role" = replay; then
43
- "$CXG_PYTHON" -m pip install -r "$HOME/.cert-x-gen/pentest/requirements.txt"
45
+ cxg_ref=${cxg_revision:-v$cxg_version}
46
+ requirements="$RUNNER_TEMP/cxg-requirements.txt"
47
+ curl --fail --silent --show-error --location --proto '=https' \
48
+ "https://raw.githubusercontent.com/Bugb-Technologies/cert-x-gen/$cxg_ref/pentest/requirements.txt" -o "$requirements"
49
+ "$CXG_PYTHON" -m pip install -r "$requirements"
44
50
  "$CXG_PYTHON" -m playwright install --with-deps chromium
45
51
  fi
@@ -47,13 +47,18 @@ function jsonTool(root, cmd, args) {
47
47
  }
48
48
 
49
49
  // A named choice on this checkout can revoke permission immediately. Local edits never expand a committed grant.
50
- function committedFile(root, file) {
50
+ function committedFile(root, file, defaultGrant = true) {
51
51
  const path = localFile(root, file);
52
52
  const current = readFileSync(path, 'utf8');
53
- // An agent can commit a broader policy on a feature branch. Use the default branch's grant as the upper bound there.
54
- const remoteDefault = spawnSync('git', ['symbolic-ref', '--quiet', 'refs/remotes/origin/HEAD'], { cwd: root, encoding: 'utf8' });
55
- if ([POLICY, SCOPE].includes(file) && remoteDefault.status === 0 && git(root, ['show', `${remoteDefault.stdout.trim()}:${file}`]) !== current) {
56
- throw new Error(`${file} differs from the default branch's recorded grant.`);
53
+ // @comment -- "Automatic and scheduled grants are bounded by the default branch. A typed loopback run-once authorization may use a tester's locally committed policy and scope on an upstream clone; dirty grants still fail the HEAD check."
54
+ if (defaultGrant && [POLICY, SCOPE].includes(file)) {
55
+ const remoteDefault = spawnSync('git', ['symbolic-ref', '--quiet', 'refs/remotes/origin/HEAD'], { cwd: root, encoding: 'utf8' });
56
+ if (remoteDefault.status === 0) {
57
+ const grant = spawnSync('git', ['show', `${remoteDefault.stdout.trim()}:${file}`], { cwd: root, encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 });
58
+ if (grant.status !== 0 || grant.stdout !== current) {
59
+ throw new Error(`${file} is missing from or differs from the default branch's recorded grant. On a clone, commit a local ask policy and scope, then use run-once with typed authorization.`);
60
+ }
61
+ }
57
62
  }
58
63
  if (git(root, ['show', `HEAD:${file}`]) !== current) throw new Error(`${file} differs from its reviewed commit.`);
59
64
  return current;
@@ -194,12 +199,14 @@ function authority(root, mode, env) {
194
199
  if (mode === 'run' && spawnSync('git', ['symbolic-ref', '--quiet', 'refs/remotes/origin/HEAD'], { cwd: root, encoding: 'utf8' }).status !== 0) {
195
200
  throw new Error('Automatic replay needs the proving policy on a reviewed default branch, and this repository has no origin default (git remote set-head origin --auto). Without one, use run-once with the person\'s typed authorization.');
196
201
  }
197
- const policy = committedFile(root, POLICY);
202
+ const runOnceTarget = mode === 'run-once' && env.BRAVOS_SCAN_TARGET ? new URL(env.BRAVOS_SCAN_TARGET) : null;
203
+ const localGrant = runOnceTarget !== null && loopback(runOnceTarget.hostname);
204
+ const policy = committedFile(root, POLICY, !localGrant);
198
205
  const required = { run: 'auto', 'run-once': 'ask', scheduled: 'schedule' }[mode];
199
206
  if (!/^—\s*confirmed by\s+[^,\n]+,\s*\S+/mi.test(policy) || policyValue(policy, 'choice') !== required) {
200
207
  throw new Error(`Replay requires a confirmed ${required} proving policy: .guardlink/proving.md with choice: ${required} and a "— confirmed by <name>, <date>" line, recorded with bravos-prove and merged to the default branch.`);
201
208
  }
202
- const scopeText = committedFile(root, SCOPE);
209
+ const scopeText = committedFile(root, SCOPE, !localGrant);
203
210
  const scope = parseScope(root, scopeText);
204
211
  const named = policyValue(policy, 'target');
205
212
  const raw = mode === 'run' ? named : env.BRAVOS_SCAN_TARGET;
@@ -492,6 +499,10 @@ export function replay(root, mode, names, env = process.env) {
492
499
  const receipt = executeKit(root, mode, env, auth, permit, name, dir, runId);
493
500
  receipts.push(receipt);
494
501
  output(`${receipt.kitId}: ${receipt.observed || 'inconclusive or not run'}; ${receipt.recorded ? 'recorded in GuardLink' : 'no current claim recorded'}${receipt.reason ? ' (' + receipt.reason + ')' : ''} (CXG exit ${receipt.exit}).`, env);
502
+ // @comment -- "A recorded engine confirmation prompts deliberate regression curation; raw evidence and identity state stay private, and replay never writes a security test automatically."
503
+ if (receipt.recorded && receipt.observed === 'confirmed') {
504
+ output(`Offer to promote ${receipt.kit} into security/ (or the configured security_tests_dir) as a curated regression test. Review its scope, oracle and portability with the person first; keep credentials and raw evidence out of Git.`, env);
505
+ }
495
506
  if (mode === 'scheduled' && env.GITHUB_STEP_SUMMARY) {
496
507
  const details = `Receipt ${receipt.id}, class ${receipt.vulnClass}, claim ${receipt.claimKey}, ${receipt.build}; ` +
497
508
  `${receipt.statuses.join(', ') || 'no HTTP status summary'}. Kit ${receipt.kitSha256}, build ${receipt.worktreeSha256}, evidence ${receipt.evidenceDigest}.\n`;
@@ -97,7 +97,7 @@ export function readSetup(root, i = {}, harness = 'other') {
97
97
  // Paid steps on an unlicensed machine say so in their `how` and are never the next step: the score
98
98
  // counts what the person can do today, and the plan line (briefing, doctor, watch) says how to change it.
99
99
  const licensed = !!i.licence?.licensed;
100
- const paid = { sast: 'SAST', autopilot: 'autopilot', prepr: 'the pre-PR gate', ci: 'the CI gate and nightly' };
100
+ const paid = { graph: 'the code graph', sast: 'SAST', autopilot: 'autopilot', prepr: 'the pre-PR gate', ci: 'the CI gate and nightly' };
101
101
  for (const x of items) {
102
102
  if (!licensed && x.id in paid && !x.on) {
103
103
  x.paid = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bugb-technologies/bravos",
3
- "version": "1.4.1",
3
+ "version": "1.5.0",
4
4
  "description": "Skills pack and installer that make Claude Code and Codex power users of guardlink (threat-model-as-code) and cert-x-gen (pentest-as-code).",
5
5
  "keywords": [
6
6
  "security",
@@ -23,7 +23,8 @@
23
23
  "skills",
24
24
  "hooks",
25
25
  "templates",
26
- "docs/GUIDE.md"
26
+ "docs/GUIDE.md",
27
+ "docs/UPGRADING.md"
27
28
  ],
28
29
  "engines": {
29
30
  "node": ">=20"
@@ -13,7 +13,7 @@ description: "Start here in any repo bravos is installed in: reads the security
13
13
 
14
14
  ## Do
15
15
 
16
- 1. If the user is new or asks how to start, give the guided start and stop there: read the briefing's `Setup n/9` line (or run `bravos next --json`); say in three sentences what bravos does here; show what is on and the next step with its exact command and what it unlocks; offer three things to try now that fit the repo, in setup order — the code graph comes first because every later step reads it (graph off → build it with `bravos graph build . --scip no-exec`; intent none → learn what the app intends; low coverage → annotate the top files; then SAST, which reads the annotations; untested exposures → prove the top 3; a branch with changes → the ship check), in plain words with the skill named second; point to `bravos guide roles`, and mention once that `bravos watch` in a second terminal pane shows all of this live while they work. Run a setup command that changes config or hooks only after the person agrees. Otherwise read the session-start briefing. It opens with `GuardLink security picture (bravos) — <repo> @ <sha>, base <base>`. If none is in context (a harness that ran no hook), run `node .bravos/hooks/session-start.mjs --briefing` once: it prints the briefing as plain text. Pull out: the `Open exposures:` line (severity counts, coverage, worklist), `FIX NOW — confirmed exploitable`, `Next to test or fix (guardlink hypothesis next)`, `Went stale in files you changed since <base>`, `Open tickets`, `In flight by teammates`, the `Code graph:` state, and the `Intent:` line (none or draft means severities are not yet calibrated to the product; offer bravos-context). `Open exposures: unknown (guardlink ci unavailable)` means the picture is unknown, not empty. bravos keeps no state of its own (`.bravos/` holds only the hook and the skills lock); when the briefing says a tool is unavailable, `bravos doctor` reports which tools are present. When the briefing has a `Workspace:` line, this repo is one service of a larger app: changes belong in the service's own repo, questions across services go to the app folder it names, and `bravos workspace show` lists the services, their URLs and the calls between them.
16
+ 1. If the user is new or asks how to start, give the guided start and stop there: read the briefing's `Setup n/9` line (or run `bravos next --json`); say in three sentences what bravos does here; show what is on and the next step with its exact command and what it unlocks; offer three things to try now that fit the repo and the plan, in setup order. On the Free plan (the briefing's `Plan:` line) offer only free steps: intent none → learn what the app intends; low coverage → annotate the top files; untested exposures → prove the top 3; mention the Team plan once, in one sentence, only if they ask what else there is. On Team the code graph comes first because every later step reads it (graph off → build it with `bravos graph build . --scip no-exec`; intent none → learn what the app intends; low coverage → annotate the top files; then SAST, which reads the annotations; untested exposures → prove the top 3; a branch with changes → the ship check). Say each in plain words with the skill named second; point to `bravos guide roles`, and mention once that `bravos watch` in a second terminal pane shows all of this live while they work. Run a setup command that changes config or hooks only after the person agrees. Otherwise read the session-start briefing. It opens with `GuardLink security picture (bravos) — <repo> @ <sha>, base <base>`. If none is in context (a harness that ran no hook), run `node .bravos/hooks/session-start.mjs --briefing` once: it prints the briefing as plain text. Pull out: the `Open exposures:` line (severity counts, coverage, worklist), `FIX NOW — confirmed exploitable`, `Next to test or fix (guardlink hypothesis next)`, `Went stale in files you changed since <base>`, `Open tickets`, `In flight by teammates`, the `Code graph:` state, and the `Intent:` line (none or draft means severities are not yet calibrated to the product; offer bravos-context). `Open exposures: unknown (guardlink ci unavailable)` means the picture is unknown, not empty. bravos keeps no state of its own (`.bravos/` holds only the hook and the skills lock); when the briefing says a tool is unavailable, `bravos doctor` reports which tools are present. When the briefing has a `Workspace:` line, this repo is one service of a larger app: changes belong in the service's own repo, questions across services go to the app folder it names, and `bravos workspace show` lists the services, their URLs and the calls between them.
17
17
  2. Explain the evidence loop in five lines when the user is new to it or asks what a finding means:
18
18
  claim (an annotation says code is exposed or mitigated) → testable template → authorized run against a target the user owns → verified outcome → recheck when the code changes.
19
19
  Three states are independent of each other: open / mitigated / accepted · untested / confirmed / refuted · verified / stale. A mitigated claim can still be untested; a confirmed one can go stale.
@@ -27,13 +27,14 @@ description: "Start here in any repo bravos is installed in: reads the security
27
27
  proving a finding, testing whether an exposure is exploitable → bravos-prove (after bravos-env).
28
28
  a fix landed, stale claims, closing a security ticket → bravos-recheck.
29
29
  the briefing says the branch is far behind its base, annotation work sits on an idle branch, a branch was moved or abandoned → bravos-resync.
30
+ "what is open?", "show me the findings", "is there a dashboard?" → answer in two or three lines from the briefing, then offer the page: `bravos dashboard` writes one self-contained HTML page (GuardLink's threat model, who introduced and fixed each exposure, what changed since the default branch; on the Team plan with the code graph built, also a Code graph tab: a map of where the risk sits, owners and history, coupling, the attack surface and entry points) under `.bravos/dashboard/`, git-ignored, and opens it in their browser. Run it when they say yes or asked to see it; add `--no-open` and give the path when no browser can open here, and `--no-blame` when they will share the page.
30
31
  write up the assessment, a finding, a retest or a brief for leadership → bravos-report.
31
32
  static analysis, dependency, secret or IaC findings → bravos-sast; "what did SAST find" → `bravos sast candidates` (the briefing's `SAST:` line says whether a run exists, or that SAST is unavailable).
32
33
  keep annotating while I work, nightly or periodic runs → bravos-schedule.
33
34
  security CI, a PR check, code-scanning upload → bravos-cicd.
34
35
  reach a goal over many rounds ("100% coverage", "test every exposure", "until done", autopilot, a campaign) → bravos-campaign.
35
36
  The briefing's `Plan:` line says which tier this machine is on. On Free, the research loop (context, annotate, templatize, env, prove, recheck, report, watch) is all there; the pre-PR gate, CI and nightly, schedule, workspaces, campaign, SAST and the code graph are on Team. When the request needs one of those, still name the right skill, say in one sentence that it is on the Team plan (`bravos account activate` starts a 30-day trial, no card), and offer the nearest free step instead; never pretend the feature ran.
36
- 4. bravos adds method and memory to what you can already do; it never caps it. Budgets in the skills are defaults: exceed them when the work calls for it and say why. Effort (low, medium, high, max) comes from the user's words, else a `bravos effort: <level>` line in `AGENTS.md` / `CLAUDE.md`, else medium. Only the safety rules under each skill's Never are hard.
37
+ 4. bravos adds method and memory to what you can already do; it never caps it. Budgets in the skills are defaults: exceed them when the work calls for it and say why. Effort (low, medium, high, max) comes from the user's words, else a `bravos effort: <level>` line in `AGENTS.md` / `CLAUDE.md`, else medium. Only the safety rules under each skill's Never are hard. Two of them hold in every skill: before the first commit of a session ask the person once (commit now, or leave the files for them to review), even where a skill says to commit, unless they already asked for commits (a campaign, a schedule); and write annotations where the briefing's `Annotations:` line says, a `.gal` sidecar in external mode and a comment above the code in inline mode.
37
38
  5. Name the next step in one line, taken from the briefing: a `FIX NOW` item first, then a stale claim in a file the user changed, then the top `guardlink hypothesis next` item, then coverage.
38
39
  6. When the user takes an item to work on and it already has a ticket in their tracker, record the pick-up beside its claim so the hive can see it: write `@ticket #<threat> on #<asset> <ticket-ref> sla "<label>" by <assignee> until <YYYY-MM-DD>` directly beside the claim's `@exposes`, clauses in that order, dropping `sla "<label>"` and `until <YYYY-MM-DD>` unless the user gives them, then run `guardlink validate .`. The briefing's `Open tickets` line and `guardlink lookup tickets` show it to teammates; removing the line is how the ticket leaves the model.
39
40