@bugb-technologies/bravos 1.4.2 → 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.
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`
package/docs/UPGRADING.md CHANGED
@@ -2,6 +2,26 @@
2
2
 
3
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
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
+
5
25
  ## 1.4.2
6
26
 
7
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`.
@@ -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
 
@@ -406,6 +431,7 @@ export async function collect(root, env, { deadlineMs = 20000, nextCount = 3 } =
406
431
  changedFiles: facts.changedFiles,
407
432
  inFlight,
408
433
  intent: readIntent(root),
434
+ annotationMode: readAnnotationMode(root),
409
435
  // bravos on PATH: what its probe says (a graph for this commit or not); else codegraph-mcp on PATH means the MCP route.
410
436
  codegraph: graphState ?? (whichOnPath('codegraph-mcp', env) ? 'unknown' : 'unavailable'),
411
437
  sast: { summary: readSast(root, env), available: sastAvailable(env) },
@@ -453,11 +479,12 @@ export const MASCOT = [
453
479
  ];
454
480
  const MASCOT_WIDTH = 26;
455
481
  const LEFT_WIDTH = 36;
456
- const INTRO = [
457
- 'bravos makes this agent a guardlink power user: it keeps the threat model',
458
- 'beside the code, proves exposures with authorized cxg runs on targets you own,',
459
- 'and gates pull requests on what they change. For developers and security alike.',
460
- ];
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';
461
488
 
462
489
  export const fit = (s, w) => (s.length <= w ? s : s.slice(0, Math.max(0, w - 1)) + '…');
463
490
 
@@ -555,6 +582,7 @@ const SKILL_HINT = {
555
582
  'bravos-templatize': 'write templates',
556
583
  bravos: 'where to start',
557
584
  'bravos-ship': 'check before a PR',
585
+ 'bravos-report': 'write it up',
558
586
  };
559
587
 
560
588
  /** Three skills chosen from state, bravos-ship always last; `harness` picks /x (Claude Code), $x (Codex), /skill:x (omp) or the bare name. */
@@ -570,7 +598,9 @@ export function quickStart(inputs, harness) {
570
598
  if (arr(g.next?.queue).some((q) => q?.state === 'untested')) picks.push('bravos-templatize');
571
599
  const chosen = picks.slice(0, 2);
572
600
  if (chosen.length < 2) chosen.unshift('bravos');
573
- 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');
574
604
  const sigil = SIGIL[harness] ?? '';
575
605
  return chosen.slice(0, 3).map((name) => ({ name, command: sigil + name, hint: SKILL_HINT[name] }));
576
606
  }
@@ -607,13 +637,20 @@ function countsLine(g) {
607
637
  return line;
608
638
  }
609
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."
610
641
  function statusLine(i) {
611
642
  const intent = i.intent?.status ?? 'unknown';
612
- const graph = i.codegraph === 'unavailable' ? 'graph off' : i.codegraph === 'not-built' ? 'graph none' : i.codegraph === 'diverged' ? 'graph stale' : 'graph on';
613
- 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';
614
644
  const setup = i.root ? readSetup(i.root, i, i.harness) : null;
615
645
  const hook = (on) => (!on ? 'off' : hooksLocked(i) ? 'locked' : 'on');
616
- 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);
617
654
  }
618
655
 
619
656
  /**
@@ -631,7 +668,9 @@ export function buildBanner(inputs, opts = {}) {
631
668
  [`bravos${opts.version ? ` ${opts.version}` : ''}`, i.repo].filter(Boolean).join(' · '),
632
669
  [i.branch, i.sha ? `@ ${i.sha}` : ''].filter(Boolean).join(' '),
633
670
  ];
634
- 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];
635
674
  const lines = MASCOT.map((row, r) => `${row} ${fit(header[r] ?? '', room)}`);
636
675
 
637
676
  if (i.guardlink === 'missing') {
@@ -641,7 +680,10 @@ export function buildBanner(inputs, opts = {}) {
641
680
  }
642
681
  const g = i.guardlink ?? {};
643
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.
644
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`);
645
687
  if (i.stale) lines.push(`! ${i.branch ?? 'this checkout'} is ${i.stale.behind} behind ${i.base} · findings describe older code · bravos-resync`);
646
688
  else if (arr(i.stranded).length > 0) lines.push(`~ annotation work on ${i.stranded[0].branch} is not on ${i.base} · bravos-resync`);
647
689
  if (i.shadow) {
@@ -671,13 +713,15 @@ export function buildBanner(inputs, opts = {}) {
671
713
  };
672
714
  left = ['Top threats', ...(top.length ? top.map(row) : ['none open'])];
673
715
  }
674
- // One column: the Next line below carries the step to take, so the old Quick start column is gone.
675
- for (const row of left) lines.push(fit(row, BANNER_WIDTH));
676
-
677
- // 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.
678
718
  const sk = (name) => (SIGIL[harness] ?? '') + name;
679
- const roles = [['developer', 'bravos-annotate'], ['security', 'bravos-prove'], ['team lead', 'bravos-campaign'], ['new here', 'bravos']];
680
- 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);
681
725
  lines.push('', 'If you are'.padEnd(LEFT_WIDTH) + 'To');
682
726
  for (let r = 0; r < roles.length; r++) {
683
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])}`);
@@ -690,9 +734,13 @@ export function buildBanner(inputs, opts = {}) {
690
734
  lines.push('Guide (free, no tokens): bravos guide · bravos guide roles · bravos guide tasks');
691
735
 
692
736
  if (i.intent?.status === 'none') {
693
- 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.');
694
738
  }
695
- 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);
696
744
  return (opts.color ? colorize(out, i, opts.theme) : out).join('\n');
697
745
  }
698
746
 
@@ -704,8 +752,10 @@ export function buildSummary(inputs, opts = {}) {
704
752
  if (i.guardlink === 'missing') return `${head}\nguardlink not found on PATH — run bravos doctor\n${guide}`;
705
753
  const next = quickStart(i, opts.harness).map((q) => q.command).join(' · ');
706
754
  const setup = i.root ? readSetup(i.root, i, opts.harness) : null;
707
- const third = setup ? `setup ${setup.done}/${setup.total}${setup.next ? ` · next: ${setup.next.label} · bravos next` : ''} · bravos guide` : guide;
708
- 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}`;
709
759
  }
710
760
 
711
761
  // Brand palette by theme (hooks/lib/palette.mjs). Colour is truecolor ANSI, added after
@@ -747,6 +797,7 @@ export function colorize(lines, inputs = {}, theme = 'dark') {
747
797
  const left = runs(chars.slice(0, MASCOT_WIDTH), mascotColour);
748
798
  const rest = chars.slice(MASCOT_WIDTH).join('');
749
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));
750
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)}`);
751
802
  if (n === MASCOT.length - 1) return left + rest.replace(/\S.*$/, (m) => paint(m, P.steel));
752
803
  return left + rest;
@@ -756,7 +807,7 @@ export function colorize(lines, inputs = {}, theme = 'dark') {
756
807
  return line.split(/((?:\/skill:|\/|\$)?bravos(?:-[a-z]+)?(?= |$))/).map((part, k) => (k % 2 ? paint(part, P.green) : part)).join('');
757
808
  }
758
809
  if (/^! your user-level bravos/.test(line)) return paint(line, P.red, true);
759
- 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);
760
811
  if (/^Tip: /.test(line)) return paint('Tip: ', P.green, true) + paint(line.slice(5), P.light);
761
812
  if (/^Next: /.test(line)) {
762
813
  const [what, rest = ''] = line.slice(6).split(' → ');
@@ -780,7 +831,7 @@ export function colorize(lines, inputs = {}, theme = 'dark') {
780
831
  .replace(/coverage \d+%( \(\d+\/\d+\))?/, (m) => paint(m, P.green))
781
832
  .replace(/((?:\/skill:|\/|\$)bravos(?:-[a-z]+)?)(\s+)([^\x1b]+)$/, (_m, cmd, sp, hint) => `${paint(cmd, P.green)}${sp}${paint(hint, P.steel)}`)
782
833
  .replace(/(?<![\w/$:-])((?:\/skill:|\/|\$)bravos(?:-[a-z]+)?)(?![\w-])(?![^\x1b]*\x1b\[0m)/g, (m) => paint(m, P.green));
783
- 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)) {
784
835
  l = line.split(/((?:\/skill:|\/|\$)bravos-[a-z]+)/).map((part, k) => (k % 2 ? paint(part, P.green) : part ? paint(part, P.steel) : '')).join('');
785
836
  }
786
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;
@@ -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.2",
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",
@@ -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
 
@@ -26,7 +26,7 @@ description: "Keep the GuardLink threat model correct and growing, in this sessi
26
26
  8. Gate: run `guardlink lint . --since <start> --json`. For each entry in `violations[]`, apply its `fix`. Repeat until `summary.errors` is 0. A violation on a line you did not write this session is not yours: leave the line as it is and report it to the user.
27
27
  9. Run `guardlink validate .` and fix what it reports in the lines you wrote.
28
28
  10. Run `guardlink ci -f json` again and report `+<files>, <p0>% → <p1>%, <errors> lint errors`. Deep only: repeat steps 4–10 once per round, and stop when `coverage` comes back empty or a round adds no claims.
29
- 11. On a normal coding turn keep annotations with the code change and preserve the user's staged and uncommitted edits. For a requested standalone coverage slice, commit the slice on its own: `git add` only the annotated files, message `annotate: <n> files, <playbook>`. Ship it as a small PR or on the feature branch, whichever the team does.
29
+ 11. On a normal coding turn keep annotations with the code change and preserve the user's staged and uncommitted edits. For a requested standalone coverage slice, with the person's go-ahead (ask once per session unless they already asked for commits), commit the slice on its own: `git add` only the annotated files, message `annotate: <n> files, <playbook>`. Ship it as a small PR or on the feature branch, whichever the team does.
30
30
  12. Read `guardlink hypothesis list --json`. Keep each changed exposure's stable key, source location, sidecar location when applicable, and tested state. Include untested claims with a declared mitigation. Hand new claims to bravos-templatize for a concrete kit; expired or previously tested claims go to bravos-recheck. Apply the recorded proving choice before execution: auto follows bravos-env and bravos-prove in its authorized scope; ask seeks a decision; schedule leaves the claim queued; none records that it was not tested. Evidence from a real run is required before marking a claim confirmed or refuted. Hand the change to bravos-ship before a PR.
31
31
 
32
32
  ## Never
@@ -1,4 +1,4 @@
1
- // @comment -- "Pure slice picker for bravos-annotate: ranks the worklist (entry points first, tests/generated/CI last), decides which files this session or its subagents annotate, skips files teammates have in open PRs, and splits the pick into disjoint directory-coherent batches; dependency-free, copied verbatim into target repos."
1
+ // @comment -- "Pure slice picker for bravos-annotate: ranks the worklist (entry points first, tests/generated/CI last), decides which files this session or its subagents annotate, skips files teammates have in open PRs, and splits the pick into disjoint directory-coherent batches; dependency-free, copied into target repos with this annotation turned into a plain comment."
2
2
 
3
3
  const arr = (v) => (Array.isArray(v) ? v : []);
4
4
  const dirOf = (p) => (p.includes('/') ? p.slice(0, p.lastIndexOf('/')) : '');
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // @comment -- "Entry for bravos-annotate: gathers git diff, guardlink worklist/coverage and open PRs via read-only spawnSync calls, runs pickSlice and prints bravos.slice/v2 JSON (coverage, coverage_detail, batches, tiers); dependency-free, copied verbatim into target repos."
2
+ // @comment -- "Entry for bravos-annotate: gathers git diff, guardlink worklist/coverage and open PRs via read-only spawnSync calls, runs pickSlice and prints bravos.slice/v2 JSON (coverage, coverage_detail, batches, tiers); dependency-free, copied into target repos with its annotations turned into plain comments."
3
3
  import { spawnSync } from 'node:child_process';
4
4
  import { closeSync, openSync, readSync } from 'node:fs';
5
5
  import { join } from 'node:path';
@@ -13,14 +13,14 @@ description: "Learn what the software intends before judging its code: for a pro
13
13
  ## Do
14
14
 
15
15
  1. Decide the perspective. **Researcher** (the default): the repo is software being studied, such as an open-source project or a vendor's code; its intent is upstream's to state. **Owner**: the repo is the user's own product; it is theirs. Use what the user said, the origin remote and the README; ask in one line only if it is unclear.
16
- 2. Read before you suggest. Researcher: upstream's security docs, deployment and hardening guides, SECURITY.md and docs/, each with its URL or path, then the auth and role code. Owner: the README, route table, auth and role code, data models, anything touching money or other users' data. Both: `.guardlink/definitions.*`, and `.guardlink/intent.md` if it exists (you are refreshing, not starting over). Build the code graph first when there is none or it is diverged: `bravos graph build . --scip no-exec` (no tokens, a few minutes; bravos-codegraph step 2). With the code graph (its MCP tools, or `bravos graph <question> --json` — same answers; see bravos-codegraph) (briefing `Code graph:` says `current`): `codegraph_routes`, `codegraph_attack_surface` and `codegraph_auth_boundary` give the real public surface — which routes answer unauthenticated callers, which need a tenant, which are admin-only; cite "code graph" as the source of each fact, suggestion and candidate INT item they produce ("these N APIs answer unauthenticated callers; upstream documents M of them"). Without it, say "code graph unavailable; surface read from the route table" and read the routes and auth code.
16
+ 2. Read before you suggest. Researcher: upstream's security docs, deployment and hardening guides, SECURITY.md and docs/, each with its URL or path, then the auth and role code. Owner: the README, route table, auth and role code, data models, anything touching money or other users' data. Both: `.guardlink/definitions.*`, and `.guardlink/intent.md` if it exists (you are refreshing, not starting over). On the Team plan (the briefing's `Plan:` line), build the code graph first when there is none or it is diverged: `bravos graph build . --scip no-exec` (no tokens, a few minutes; bravos-codegraph step 2). On the Free plan there is no code graph: read the route table and the auth code instead, and don't offer to build it. With the code graph (its MCP tools, or `bravos graph <question> --json` — same answers; see bravos-codegraph) (briefing `Code graph:` says `current`): `codegraph_routes`, `codegraph_attack_surface` and `codegraph_auth_boundary` give the real public surface — which routes answer unauthenticated callers, which need a tenant, which are admin-only; cite "code graph" as the source of each fact, suggestion and candidate INT item they produce ("these N APIs answer unauthenticated callers; upstream documents M of them"). Without it, say "code graph unavailable; surface read from the route table" and read the routes and auth code.
17
17
  3. Suggest every answer yourself. Researcher, the open decisions (5 to 8, each `mustTouch: true`): which configuration to rate against (shipped defaults, upstream's recommended hardened setup, or both); single organisation or multi-tenant; which attackers are in scope (`multi`: unauthenticated network, authenticated low-privilege tenant, malicious client or worker, compromised peer or replica, internal network, operator, suggesting the last two out unless upstream says otherwise); each intended-looking behaviour upstream does not clearly document ("upstream is silent"); which invariants to test first. Everything else is a fact with `folded: true` and its source: actors, crown jewels, boundaries, behaviours upstream documents as intended (cite where), and invariants worded as the properties upstream claims. Owner: purpose, users and roles, crown jewels, two to five must-never rules, intended-by-design powers and boundaries; open by default, the rule and intended items `mustTouch`. Give every question a `suggested` answer, a one-line `reason`, its `sources` and a `confidence`; mark `low` and `mustTouch` anything you are unsure of.
18
18
  4. Write it to `.guardlink/intent-draft.json` (schema `bravos.review/v1`, `perspective` set; question types `choice`, `multi`, `item`, `text`) and run `bravos review intent`. Tell the user: "the page that just opened has my suggestions filled in; change what is wrong, make the calls marked 'needs your call', then Confirm. Teammates run `bravos review intent` after pulling; say done when everyone has." If they prefer chat, or no browser can open, ask the same open decisions in one message. If they ask to share it on claude.ai and this is Claude Code, run `bravos review intent --share`, say first that their security intent will sit on claude.ai, publish the page it writes with the Artifact tool and `capabilities: {db: {}}`, and give them the link.
19
19
  5. Wait for "done". Run `bravos review intent --summary` (for a shared page, first copy each document in its `answers` collection to `.guardlink/intent-answers/<name>.json` with ArtifactData). Settle each DISAGREE with the people involved; take EDITED answers as given. If the user is away on an unattended campaign, record your suggestions marked `— draft` and carry on; never record a decision nobody made.
20
- 6. Write `.guardlink/intent.md` from `{{SKILL_DIR}}/intent.example.md`. Researcher: an `## Assumptions` section first, with the configuration baseline, deployment and attackers in scope, each ending `— set by <names>, <date>`. Then purpose, actors, crown jewels, invariants `INV-1`…, intended-by-design `INT-1`… (researcher items carry `(upstream: <url or path>)`, or `(upstream is silent)`), and boundaries. End each item with how it was decided: `— suggested by bravos, accepted by <names>`, `— edited by <names>`, `— chosen by <names>`, or `— draft`. Commit the draft and answers files with it.
21
- 7. Put the structured facts in the threat model. In `.guardlink/definitions.*`, reusing ids and never redefining one: `@actor` per role, `@asset` per crown jewel, and one `@threat` per invariant, e.g. `@threat Cross-tenant read (#inv-tenant-isolation) [high] -- "INV-2: a user reads only their own tenant's orders"`. Beside the code they describe: `@handles <class> on <Asset>` for each crown jewel's data and `@boundary` for each boundary.
20
+ 6. Write `.guardlink/intent.md` from `{{SKILL_DIR}}/intent.example.md`. Researcher: an `## Assumptions` section first, with the configuration baseline, deployment and attackers in scope, each ending `— set by <names>, <date>`. Then purpose, actors, crown jewels, invariants `INV-1`…, intended-by-design `INT-1`… (researcher items carry `(upstream: <url or path>)`, or `(upstream is silent)`), and boundaries. End each item with how it was decided: `— suggested by bravos, accepted by <names>`, `— edited by <names>`, `— chosen by <names>`, or `— draft`.
21
+ 7. Put the structured facts in the threat model. In `.guardlink/definitions.*`, reusing ids and never redefining one: `@actor` per role, `@asset` per crown jewel, and one `@threat` per invariant, e.g. `@threat Cross-tenant read (#inv-tenant-isolation) [high] -- "INV-2: a user reads only their own tenant's orders"`. Then `@handles <class> on <Asset>` for each crown jewel's data and `@boundary` for each boundary, placed where this repository keeps annotations (the briefing's `Annotations:` line, or `annotation_mode` in `.guardlink/config.json`): in external mode in the file's `.guardlink/annotations/<source-path>.gal` sidecar, never in the source file; in inline mode in a comment directly above the code (bravos-annotate step 7).
22
22
  8. Run `guardlink validate .` and fix what it reports in the lines you wrote.
23
- 9. Commit `.guardlink/intent.md` and the definitions together, message `context: intent and invariants`.
23
+ 9. Ask before you commit: "Commit the intent and the definitions now, or leave them for you to review?" Skip the question only when the person already asked for commits in this session (a campaign, a schedule). On yes, commit `.guardlink/intent.md`, the draft and answers files and the definitions together, message `context: intent and invariants`. Otherwise name the files and leave them uncommitted.
24
24
  10. Hand the invariant threat ids, the Assumptions and the intended-by-design list to bravos-annotate.
25
25
 
26
26
  ## Never
@@ -33,6 +33,7 @@ description: "Learn what the software intends before judging its code: for a pro
33
33
  - Rewrite a confirmed line in `.guardlink/intent.md`; append a dated change beneath it instead.
34
34
  - Treat an intended-by-design item as an accepted risk: write `@accepts`, `@entitles` or `@confirmed`, or remove an existing claim because of it.
35
35
  - Redefine an id that already exists in `.guardlink/definitions.*`.
36
+ - Commit, push or stash without the person's go-ahead, or write an annotation into a source file when the repository keeps them in sidecars.
36
37
 
37
38
  ## Done when
38
39
 
@@ -20,7 +20,7 @@ description: "Turn the threat model's open exposures into correct, testable cxg
20
20
  6. Record repo context for the probes you write. Copy `{{SKILL_DIR}}/operator-guidance.md` to `.guardlink/operator-guidance.md` if it is not there, and fill each section from the code: framework, auth shape, test identities, known false positives, out-of-bounds routes. Read it before writing each kit; cxg never generates probes for this repository.
21
21
  7. For a first test or regression kit, write a single JavaScript probe in .guardlink/cxg-replay/. Include an exact `// @guardlink_threat: threat@logical/file:line`, `// @attach_scheme: path`, the required identity names, and a precise test with a positive control. Run `bravos hook replay bind <kit.js>` before executing it. The binding command associates the kit with the key of the current GuardLink exposure. Review that mapping when the claim is edited or moved. Leave native CXG identity stamps to the engine.
22
22
  8. Apply the oracle rule: a vulnerability class cxg cannot judge from a response has no oracle. Record it in `.guardlink/cxg-templates/README.md` as unsupported, with the threat id and why, instead of writing a template that pretends to prove it. An invariant threat (`#inv-…`, from intent.md) maps to the cxg class that can judge it: another user's or tenant's data → `idor`; a role or permission gained → `privilege_escalation`; a field the caller should not set → `mass_assignment`; a check bypassed by concurrent requests → `race_condition`; a workflow step skipped or reordered → `business_logic`. Record each invariant's class in the README.
23
- 9. Commit the templates, the README and the filled guidance together, and hand the template ids and threat ids to bravos-prove.
23
+ 9. With the person's go-ahead (ask once per session unless they already asked for commits), commit the templates, the README and the filled guidance together, and hand the template ids and threat ids to bravos-prove.
24
24
 
25
25
  ## Never
26
26