@bugb-technologies/bravos 1.24.0 → 1.25.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 (45) hide show
  1. package/dist/bin.js +12 -0
  2. package/dist/cli.js +189 -15
  3. package/dist/context.js +4 -4
  4. package/dist/cursor.js +24 -5
  5. package/dist/dashboard.js +6 -0
  6. package/dist/doctor.js +29 -2
  7. package/dist/graphbin.js +2 -2
  8. package/dist/guide.js +3 -1
  9. package/dist/hook-launcher.js +92 -0
  10. package/dist/hooks.js +56 -3
  11. package/dist/prefs.js +13 -3
  12. package/dist/principles.js +1 -1
  13. package/dist/records-drafts.js +106 -0
  14. package/dist/records-ledger.js +103 -0
  15. package/dist/records-team.js +398 -0
  16. package/dist/records.js +158 -0
  17. package/dist/review-server.js +3 -1
  18. package/dist/review.js +16 -1
  19. package/dist/rules.js +48 -4
  20. package/dist/uninstall.js +1 -1
  21. package/dist/upkeep.js +3 -0
  22. package/docs/GUIDE.md +10 -0
  23. package/docs/UPGRADING.md +40 -0
  24. package/hooks/cards.mjs +62 -13
  25. package/hooks/coach.mjs +3 -1
  26. package/hooks/lib/agent-io.mjs +105 -0
  27. package/hooks/lib/briefing.mjs +94 -3
  28. package/hooks/lib/cards.mjs +8 -1
  29. package/hooks/lib/draft-check.mjs +104 -0
  30. package/hooks/lib/drafts.mjs +121 -0
  31. package/hooks/lib/ledger.mjs +270 -0
  32. package/hooks/lib/pre-pr.mjs +74 -0
  33. package/hooks/lib/prefs.mjs +7 -3
  34. package/hooks/lib/record-guard.mjs +272 -0
  35. package/hooks/lib/records.mjs +581 -0
  36. package/hooks/lib/replay.mjs +2 -1
  37. package/hooks/record-guard.mjs +60 -0
  38. package/hooks/session-start.mjs +4 -3
  39. package/package.json +2 -2
  40. package/skills/bravos/SKILL.md +1 -0
  41. package/skills/bravos-records/SKILL.md +57 -0
  42. package/templates/dashboard/dashboard.html +53 -0
  43. package/templates/omp/bravos.js +85 -1
  44. package/templates/opencode/bravos.js +84 -1
  45. package/templates/workflows/bravos-pr-gate.yml +23 -0
package/dist/bin.js ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ // @comment -- "The `bravos` executable. `bravos hook <name> [args]` goes straight to the hook launcher, so a hook a harness runs on every prompt and every edit does not pay for loading the CLI's commands; everything else (including `bravos hook` with no name or a flag such as --help) runs the CLI as before."
3
+ const argv = process.argv.slice(2);
4
+ if (argv[0] === 'hook' && argv[1] !== undefined && !argv[1].startsWith('-')) {
5
+ const { launch } = await import('./hook-launcher.js');
6
+ await launch(argv[1], argv.slice(2));
7
+ }
8
+ else {
9
+ const { main } = await import('./cli.js');
10
+ main();
11
+ }
12
+ export {};
package/dist/cli.js CHANGED
@@ -38,7 +38,7 @@ import { listBundledSkills } from './skills.js';
38
38
  import { installSkills, linkSkillRoots, mirrorGuardlinkSkills, skillRootsLinked } from './install.js';
39
39
  import { LOCK_PATH, readLock, sha256, writeLock } from './lock.js';
40
40
  import { mergeCodexConfig, mergeMcpJson, selectServers } from './mcp.js';
41
- import { hooksDir, skillsDir as bundledSkillsDir, version } from './paths.js';
41
+ import { hooksDir, packageRoot, skillsDir as bundledSkillsDir, version } from './paths.js';
42
42
  import { BravosError } from './types.js';
43
43
  // @comment -- "Which agents a repository already has Bravos installed for, read from the files Bravos wrote there: the two skills roots, the Codex and Antigravity hook registrations, and the opencode and omp plugins, and the Cursor session hook. Upkeep re-applies to exactly these, so a tool that happens to be on this machine, or an AGENTS.md someone added, never widens a team's setup."
44
44
  export function installedAgents(root) {
@@ -628,18 +628,25 @@ export function buildProgram(io, result) {
628
628
  }
629
629
  lines.push(JSON.stringify(opts.json ? a : a.result, null, 2));
630
630
  }));
631
- // @comment -- "bravos hook <name> runs one of the scripts this install ships (session-start, pre-pr, autopilot, replay) with the given arguments and stdin passed through; plugin skills use it where the repository has no .bravos/hooks/ copy. Only allowlisted entry points run; the script's own exit code is returned."
631
+ // @comment -- "bravos hook <name> runs one of the hook scripts this install ships (the table in src/hook-launcher.ts) with the given arguments. Run as the `bravos` executable it never reaches this command: the bin shim hands it to the launcher, which runs the script in-process with identical stdin, stdout and exit code. Here (dist/cli.js run directly, or run() in-process) the launcher runs as a child through the shim, with stdin passed through and its output relayed. An unknown name exits 0 and prints nothing, so a pointer never breaks an agent's turn; with no name it lists the hooks."
632
632
  program
633
- .command('hook <name> [args...]')
634
- .description('Run one of bravos\'s hook scripts from this install (session-start, pre-pr, autopilot, replay), e.g. `bravos hook session-start --briefing` or `bravos hook replay preflight run <kit.js>` (versioned JSON, no kit execution): what plugin installs use where the repository has no .bravos/hooks/.')
633
+ .command('hook [name] [args...]')
634
+ .description('Run one of bravos\'s hook scripts from this install, e.g. `bravos hook session-start --briefing` or `bravos hook replay preflight run <kit.js>`: what a harness, a git hook, CI or a plugin skill runs when the repository has no .bravos/hooks/ copy. The same arguments, input, output and exit code as `node .bravos/hooks/<name>.mjs`. An unknown name does nothing and exits 0; with no name, lists the hooks.')
635
635
  .allowUnknownOption()
636
636
  .helpOption(false)
637
- .action((name, args) => guarded((lines) => {
638
- const known = ['session-start', 'pre-pr', 'autopilot', 'replay', 'context', 'principles'];
639
- if (!known.includes(name))
640
- throw new BravosError(`unknown hook '${name}'; use ${known.join(', ')}`);
641
- const script = name === 'replay' || name === 'context' || name === 'principles' ? `lib/${name}.mjs` : `${name}.mjs`;
642
- const r = spawnSync(process.execPath, [pathJoin(hooksDir(), script), ...args], { env: io.env, encoding: 'utf8', stdio: ['inherit', 'pipe', 'pipe'], maxBuffer: 16 * 1024 * 1024 });
637
+ .action((name, args) => guardedAsync(async (lines) => {
638
+ const { HOOKS, launcherHooksDir } = await import('./hook-launcher.js');
639
+ // No name, or a flag such as --help where the name goes: list the hooks.
640
+ if (name === undefined || name.startsWith('-')) {
641
+ lines.push(`bravos hook <name> [args…]: ${Object.keys(HOOKS).join(', ')}`);
642
+ return;
643
+ }
644
+ if (!Object.prototype.hasOwnProperty.call(HOOKS, name))
645
+ return;
646
+ if (!existsSync(pathJoin(launcherHooksDir(), HOOKS[name])))
647
+ return;
648
+ // Through the bin shim, so the script runs under the launcher as the repository's own hook, exactly as `bravos hook` does.
649
+ const r = spawnSync(process.execPath, [pathJoin(packageRoot(), 'dist', 'bin.js'), 'hook', name, ...args], { env: io.env, encoding: 'utf8', stdio: ['inherit', 'pipe', 'pipe'], maxBuffer: 16 * 1024 * 1024 });
643
650
  if (r.stdout)
644
651
  lines.push(r.stdout.replace(/\n$/, ''));
645
652
  if (r.stderr)
@@ -928,7 +935,7 @@ export function buildProgram(io, result) {
928
935
  // @comment -- "bravos prefs: what this person told Bravos once so no session asks again. `prefs get` shows it; `prefs set commits <commit|leave|ask> --by <name>` records the answer about committing Bravos's own files, `prefs set annotate <background|off> --by <name>` whether each session starts a background annotation pass. Kept under the git directory of this clone, never committed."
929
936
  program
930
937
  .command('prefs <action> [args...]')
931
- .description('Your standing answers for this clone, kept under its git directory and never committed: `prefs get` shows them; `prefs set commits <commit|leave|ask> --by "<your name>"` says whether your agent commits Bravos\'s own files (annotations, intent, definitions, tests) without asking, always leaves them for you, or asks each session; `prefs set annotate <background|off> --by "<your name>"` says whether each session starts one background annotation pass while coverage is incomplete (background is the default); `prefs set coach <on|off> --by "<your name>"` says whether the coach adds reminders before prompts (on is the default); `prefs set cards <on|off>` whether a threat card shows when an edit adds an untested critical or high threat (on), and `prefs set notify <on|off>` whether it also sends a desktop notification (off). Free; runs no model.')
938
+ .description('Your standing answers for this clone, kept under its git directory and never committed: `prefs get` shows them; `prefs set commits <commit|leave|ask> --by "<your name>"` says whether your agent commits Bravos\'s own files (annotations, intent, definitions, tests) without asking, always leaves them for you, or asks each session; `prefs set annotate <background|off> --by "<your name>"` says whether each session starts one background annotation pass while coverage is incomplete (background is the default); `prefs set coach <on|off> --by "<your name>"` says whether the coach adds reminders before prompts (on is the default); `prefs set cards <on|off>` whether a threat card shows when an edit adds an untested critical or high threat (on), `prefs set notify <on|off>` whether it also sends a desktop notification (off), `prefs set drafts <background|off>` whether one background pass each session drafts security decision records for the reviewed ledger\'s modules that need one (background, Team plan), and `prefs set nudge <on|off>` whether the first edit of a module the ledger says needs a security decision record, and has none, gets one line offering to draft one (on). Free; runs no model.')
932
939
  .option('-C, --dir <dir>', 'the repository (default: the current directory)')
933
940
  .option('--by <name>', 'set: whose answer this is')
934
941
  .option('--json', 'get: print JSON')
@@ -937,10 +944,10 @@ export function buildProgram(io, result) {
937
944
  const dir = dirArg(opts.dir);
938
945
  if (action === 'get' && args.length === 0)
939
946
  lines.push(...(await getPrefs(dir, io.env, !!opts.json)));
940
- else if (action === 'set' && ['commits', 'annotate', 'coach', 'cards', 'notify'].includes(args[0]) && args.length === 2)
947
+ else if (action === 'set' && ['commits', 'annotate', 'coach', 'cards', 'notify', 'nudge', 'drafts'].includes(args[0]) && args.length === 2)
941
948
  lines.push(...(await setPref(dir, args[0], args[1], opts.by, io.env)));
942
949
  else
943
- throw new BravosError('usage: bravos prefs get [--json] | bravos prefs set commits <commit|leave|ask> --by "<your name>" | bravos prefs set annotate <background|off> --by "<your name>" | bravos prefs set coach|cards|notify <on|off> --by "<your name>"');
950
+ throw new BravosError('usage: bravos prefs get [--json] | bravos prefs set commits <commit|leave|ask> --by "<your name>" | bravos prefs set annotate|drafts <background|off> --by "<your name>" | bravos prefs set coach|cards|notify|nudge <on|off> --by "<your name>"');
944
951
  }));
945
952
  // @comment -- "bravos rules: the design rules (INV-n in the intent, each a #inv- threat) with where the code enforces each and what testing has shown. Read-only and free; runs guardlink parse and hypothesis list, no model."
946
953
  program
@@ -1024,6 +1031,162 @@ export function buildProgram(io, result) {
1024
1031
  else
1025
1032
  throw new BravosError(`unknown principles action '${action}'; use check, list, write, except or copy`);
1026
1033
  }));
1034
+ // @comment -- "bravos records: the security decision records in this repository, one Markdown document per module under .guardlink/records/. list, show, for and check only read and are free; new writes the skeleton of a draft; adopt records a person's adoption of a record as it reads now, at an interactive terminal where they type their name and the record id. A draft binds nobody: only an adopted record is followed."
1035
+ program
1036
+ .command('records [action] [args...]')
1037
+ .description('Security decision records: one document per module or feature (.guardlink/records/SDR-n-<module>.md) saying what was decided there, the rules that follow, why, and what looks like a bug but is not. `records list` (the default); `records show SDR-n`; `records for <file>` says which record covers a file; `records check` verifies every record parses, that an adopted one still reads as it did when adopted and that the exceptions are sound (free; exit 1 on a problem); `records new "<module>" --paths "<glob>,<glob>"` writes the skeleton of a draft; `records adopt SDR-n` makes a record binding, approved by the person typing their name at a terminal (never by an agent), or adopt on the page with bravos review records; `records except SDR-n R1 --where "<glob>" --reason "<why>" --until YYYY-MM-DD` lets a break of one rule in one area through the pre-PR gate until that day, approved the same way; `records except --clear-expired`; `records gaps` lists modules with security claims no record covers; `records ledger` lists the module ledger (.guardlink/records/README.md: which modules make security decisions, their code, owner and record), `records ledger propose [--write]` proposes modules from the stored documents, the threat model and the folders, `records ledger add|remove|refresh` keep it (free; reviewed by a person in a pull request, never enforced); `records drafts` lists the modules of the reviewed ledger to draft a record for now (at most 2 a run, 3 waiting, one per module) and `records draft "<module>"` starts one on its own branch and worktree (Team plan; the agent drafts, pushes nothing, and opens the pull request only on the person\'s yes); `records codeowners --owner @<who>` shows the CODEOWNERS lines that make a record need that owner\'s review on GitHub (--yes writes them, after the person said so). A record is approved when its text is on the default branch (a code owner\'s review where GitHub requires one); adopting by typed name is the fallback, labelled not verified. Runs no model.')
1038
+ .option('-C, --dir <dir>', 'the repository (default: the current directory)')
1039
+ .option('--json', 'list/show/for/check: print JSON')
1040
+ .option('--paths <globs>', 'new: the code the record covers, as repository globs separated by commas (src/reports/**,app/api/reports/**)')
1041
+ .option('--where <glob>', 'except: the code the exception covers, as a repository glob (src/reports/legacy/**)')
1042
+ .option('--reason <why>', 'except: why this code may go against the rule for now')
1043
+ .option('--until <day>', 'except: the last day it holds (YYYY-MM-DD, within a year)')
1044
+ .option('--clear-expired', 'except: remove exceptions whose last day has passed')
1045
+ .option('--owner <who>', 'codeowners: the GitHub user or team that approves records (@security-leads, @org/team)')
1046
+ .option('--yes', 'codeowners: write the lines (only after the person said so)')
1047
+ .option('--offline', 'check: do not ask GitHub (gh) whether code-owner review is enforced')
1048
+ .option('--needs <yes|optional>', 'ledger add: whether the module makes security decisions and so needs a record')
1049
+ .option('--why <what>', 'ledger add: what the module decides (who can see or do what, outside connections, customer data, money)')
1050
+ .option('--evidence <where>', 'ledger add: where that comes from (SRC-n § section, an asset, routes)')
1051
+ .option('--write', 'ledger propose: add the proposed modules to the ledger')
1052
+ .option('--limit <n>', 'drafts: how many modules to draft in this run (default 2; at most 3 wait for review at once)')
1053
+ .option('--worktree <dir>', 'draft: where the draft\'s worktree goes (default: under the git directory)')
1054
+ .action((action, args, opts) => guardedAsync(async (lines) => {
1055
+ const R = await import('./records.js');
1056
+ const root = dirArg(opts.dir);
1057
+ const act = action ?? 'list';
1058
+ if (act === 'list') {
1059
+ const { result: checked, lines: said } = await R.checkRecordsAt(root, io.env);
1060
+ lines.push(...(opts.json ? [JSON.stringify({ schema: 'bravos.records/v1', ok: checked.ok, records: checked.records }, null, 2)] : said));
1061
+ }
1062
+ else if (act === 'check') {
1063
+ // Ask GitHub first (gh, as the person), so the approval the hooks and the gate read from the cache is current.
1064
+ if (!opts.offline) {
1065
+ const review = await (await import('./records-team.js')).refreshReview(root, io.env).catch(() => null);
1066
+ if (review && !opts.json)
1067
+ lines.push(`review: ${review.enforced === true ? 'enforced' : review.enforced === false ? 'not enforced' : 'unknown'} — ${review.reason}`);
1068
+ }
1069
+ const { result: checked, lines: said } = await R.checkRecordsAt(root, io.env);
1070
+ lines.push(...(opts.json ? [JSON.stringify(checked, null, 2)] : said));
1071
+ if (!checked.ok)
1072
+ result.code = 1;
1073
+ }
1074
+ else if (act === 'show') {
1075
+ if (args.length !== 1)
1076
+ throw new BravosError('usage: bravos records show SDR-n');
1077
+ const shown = await R.showRecord(root, args[0], io.env);
1078
+ lines.push(...(opts.json ? [JSON.stringify({ schema: 'bravos.record/v1', record: shown.record }, null, 2)] : shown.lines));
1079
+ }
1080
+ else if (act === 'for') {
1081
+ if (args.length !== 1)
1082
+ throw new BravosError('usage: bravos records for <file>');
1083
+ const found = await R.recordsFor(root, args[0], io.env);
1084
+ lines.push(...(opts.json ? [JSON.stringify({ schema: 'bravos.records-for/v1', file: found.file, records: found.records }, null, 2)] : found.lines));
1085
+ }
1086
+ else if (act === 'new') {
1087
+ await requireFeature(io.env, 'principles', 'Writing a security decision record');
1088
+ if (args.length !== 1 || !opts.paths)
1089
+ throw new BravosError('usage: bravos records new "<module>" --paths "<glob>,<glob>"');
1090
+ lines.push(...(await R.newRecord(root, args[0], opts.paths.split(',').map((p) => p.trim()).filter(Boolean))));
1091
+ }
1092
+ else if (act === 'adopt') {
1093
+ await requireFeature(io.env, 'principles', 'Adopting a security decision record');
1094
+ if (args.length !== 1)
1095
+ throw new BravosError('usage: bravos records adopt SDR-n');
1096
+ // @mitigates #records against #forged-record using #person-only-adoption -- "A record becomes binding only from an interactive terminal where the adopter types their own name and the record id; a coding agent's shell has no terminal, so it cannot adopt one"
1097
+ if (!process.stdin.isTTY || !process.stdout.isTTY)
1098
+ throw new BravosError('adopting a record is a person\'s decision: run this yourself in a terminal, where you type your name to adopt it. A coding agent cannot adopt one.');
1099
+ const shown = await R.showRecord(root, args[0], io.env);
1100
+ const rl = (await import('node:readline/promises')).createInterface({ input: process.stdin, output: process.stdout });
1101
+ try {
1102
+ for (const l of shown.lines)
1103
+ io.stdout(l);
1104
+ io.stdout('Adopting it makes these rules the standard for that code: every coding agent here reads and follows them.');
1105
+ const by = (await rl.question('Your name, adopting this record: ')).trim();
1106
+ const typed = (await rl.question(`Type ${args[0]} to confirm: `)).trim();
1107
+ if (typed !== args[0])
1108
+ throw new BravosError('not confirmed: the record id did not match, nothing was recorded');
1109
+ lines.push(...(await R.adoptRecord(root, args[0], by, io.env)));
1110
+ }
1111
+ finally {
1112
+ rl.close();
1113
+ }
1114
+ }
1115
+ else if (act === 'codeowners') {
1116
+ if (!opts.owner)
1117
+ throw new BravosError('usage: bravos records codeowners --owner @<user or org/team> [--yes]');
1118
+ lines.push(...(await (await import('./records-team.js')).codeownersLines(root, opts.owner, !!opts.yes)));
1119
+ }
1120
+ else if (act === 'drafts' || act === 'draft') {
1121
+ // @comment -- "Background drafting is on the Team plan, like writing a record: drafts lists what to draft now within the limits, draft starts one module's draft on its own branch and worktree. Neither pushes nor opens a pull request."
1122
+ await requireFeature(io.env, 'principles', 'Drafting security decision records');
1123
+ const Dr = await import('./records-drafts.js');
1124
+ if (act === 'drafts') {
1125
+ const n = opts.limit === undefined ? undefined : Number(opts.limit);
1126
+ if (n !== undefined && (!Number.isInteger(n) || n < 0 || n > 20))
1127
+ throw new BravosError('--limit takes a whole number from 0 to 20');
1128
+ const d = await Dr.draftsList(root, io.env, n);
1129
+ lines.push(...(opts.json ? [JSON.stringify(d.json, null, 2)] : d.lines));
1130
+ }
1131
+ else {
1132
+ if (!args.length)
1133
+ throw new BravosError('usage: bravos records draft "<module>" [--worktree <dir>]');
1134
+ lines.push(...(await Dr.draftStart(root, args.join(' '), io.env, { worktree: opts.worktree })));
1135
+ }
1136
+ }
1137
+ else if (act === 'ledger') {
1138
+ // @comment -- "The module ledger is Free on every plan and agent-run: it proposes and lists, and only a person's review of its pull request makes it reviewed. It is never enforced."
1139
+ const Lg = await import('./records-ledger.js');
1140
+ const sub = args[0] ?? 'list';
1141
+ if (sub === 'list') {
1142
+ const l = await Lg.ledgerList(root);
1143
+ lines.push(...(opts.json ? [JSON.stringify(l.json, null, 2)] : l.lines));
1144
+ }
1145
+ else if (sub === 'propose')
1146
+ lines.push(...(await Lg.ledgerPropose(root, !!opts.write)));
1147
+ else if (sub === 'add')
1148
+ lines.push(...(await Lg.ledgerAdd(root, args.slice(1).join(' '), opts)));
1149
+ else if (sub === 'remove')
1150
+ lines.push(...(await Lg.ledgerRemove(root, args.slice(1).join(' '))));
1151
+ else if (sub === 'refresh')
1152
+ lines.push(...(await Lg.ledgerRefresh(root)));
1153
+ else
1154
+ throw new BravosError('usage: bravos records ledger [list|propose [--write]|add "<module>" --paths … --needs yes|optional|remove "<module>"|refresh]');
1155
+ }
1156
+ else if (act === 'gaps') {
1157
+ await requireFeature(io.env, 'principles', 'The records gaps report');
1158
+ const T = await import('./records-team.js');
1159
+ const g = await T.recordGaps(root, io.env);
1160
+ lines.push(...(opts.json ? [JSON.stringify({ schema: 'bravos.records-gaps/v1', modules: g.modules }, null, 2)] : g.lines));
1161
+ }
1162
+ else if (act === 'except') {
1163
+ await requireFeature(io.env, 'principles', 'Exceptions to security decision records');
1164
+ const T = await import('./records-team.js');
1165
+ if (opts.clearExpired) {
1166
+ lines.push(...(await T.clearExpiredRecordExceptions(root)));
1167
+ return;
1168
+ }
1169
+ if (args.length !== 2 || !opts.where || !opts.reason || !opts.until)
1170
+ throw new BravosError('usage: bravos records except SDR-n R1 --where "<glob>" --reason "<why>" --until YYYY-MM-DD');
1171
+ // @mitigates #records against #forged-record using #person-only-adoption -- "An exception to a record rule needs an interactive terminal where the approver types their own name and the rule; a coding agent's shell has no terminal, so it cannot approve one"
1172
+ if (!process.stdin.isTTY || !process.stdout.isTTY)
1173
+ throw new BravosError('an exception is a person\'s decision: run this yourself in a terminal, where you type your name to approve it. A coding agent cannot approve one.');
1174
+ const rl = (await import('node:readline/promises')).createInterface({ input: process.stdin, output: process.stdout });
1175
+ try {
1176
+ io.stdout(`Exception to ${args[0]} ${args[1]} for ${opts.where} until ${opts.until}: ${opts.reason}`);
1177
+ const by = (await rl.question('Your name, approving this exception: ')).trim();
1178
+ const typed = (await rl.question(`Type ${args[0]} ${args[1]} to confirm: `)).trim();
1179
+ if (typed !== `${args[0]} ${args[1]}`)
1180
+ throw new BravosError('not confirmed: the rule did not match, nothing was recorded');
1181
+ lines.push(...(await T.addRecordException(root, { record: args[0], rule: args[1], where: opts.where, reason: opts.reason, until: opts.until, by }, io.env)));
1182
+ }
1183
+ finally {
1184
+ rl.close();
1185
+ }
1186
+ }
1187
+ else
1188
+ throw new BravosError(`unknown records action '${act}'; use list, show, for, check, new, adopt, except, gaps, codeowners, ledger, drafts or draft`);
1189
+ }));
1027
1190
  program
1028
1191
  .command('review <kind> [dir]')
1029
1192
  .description("Open bravos's questions (.guardlink/<kind>-draft.json, e.g. kind 'intent') as a branded page people answer in; answers are saved to .guardlink/<kind>-answers/<name>.json. Runs no model.")
@@ -1037,6 +1200,13 @@ export function buildProgram(io, result) {
1037
1200
  checkKind(kind);
1038
1201
  // Adopting principles is a Team feature, and it happens on the served page only: that is where the server
1039
1202
  // records each adoption with its fingerprint (src/principles.ts withAdoptions).
1203
+ // Records are adopted on the served page too (or at a terminal with bravos records adopt); bravos builds the draft from the record files.
1204
+ if (kind === 'records' && !opts.summary) {
1205
+ await requireFeature(io.env, 'principles', 'Adopting security decision records on the review page');
1206
+ if (opts.share || opts.serve === false)
1207
+ throw new BravosError('records are adopted on the served page only (bravos review records), so each adoption is recorded with the record\'s fingerprint; --share and --no-serve are for other reviews');
1208
+ await (await import('./records-team.js')).recordsDraft(root, io.env);
1209
+ }
1040
1210
  if (kind === 'principles' && !opts.summary) {
1041
1211
  await requireFeature(io.env, 'principles', 'Adopting security design principles');
1042
1212
  if (opts.share || opts.serve === false)
@@ -1044,7 +1214,8 @@ export function buildProgram(io, result) {
1044
1214
  }
1045
1215
  const draft = readDraft(root, kind);
1046
1216
  // A rewritten draft must not lose an answer somebody confirmed (review.ts lostAnswers).
1047
- if (!opts.summary) {
1217
+ // A records draft is rebuilt from the records each time; an adoption is kept by its fingerprint, not by the question.
1218
+ if (!opts.summary && kind !== 'records') {
1048
1219
  const lost = lostAnswers(draft, readAllAnswers(root, draft).files);
1049
1220
  if (lost.length) {
1050
1221
  throw new BravosError(`${draftPath(kind)} no longer asks ${lost.map((l) => `${l.id} (answered by ${l.by.join(', ')})`).join('; ')}. ` +
@@ -1574,8 +1745,11 @@ function isEntry() {
1574
1745
  return false;
1575
1746
  }
1576
1747
  }
1577
- if (isEntry()) {
1748
+ // @comment -- "Runs the CLI on this process's arguments; the bin shim (dist/bin.js) calls it, and so does running dist/cli.js directly."
1749
+ export function main() {
1578
1750
  run(process.argv.slice(2)).then((code) => {
1579
1751
  process.exitCode = code;
1580
1752
  });
1581
1753
  }
1754
+ if (isEntry())
1755
+ main();
package/dist/context.js CHANGED
@@ -450,8 +450,8 @@ export function removePrePush(root, env, dryRun = false) {
450
450
  }
451
451
  }
452
452
  // ============================ making the intake travel ============================
453
- /** The paths the team's context lives at, which must reach the team through git. */
454
- const MUST_TRAVEL = ['.bravos/context/sources.json', '.guardlink/intent.md', '.guardlink/intent-draft.json', '.guardlink/intent-answers/x.json'];
453
+ /** The paths the team's context lives at, which must reach the team through git: the design documents, the intent, and the security decision records with their adoptions. */
454
+ const MUST_TRAVEL = ['.bravos/context/sources.json', '.guardlink/intent.md', '.guardlink/intent-draft.json', '.guardlink/intent-answers/x.json', '.guardlink/records/x.md', '.guardlink/records-answers/x.json'];
455
455
  // @comment -- "Which of the files the team's context lives in (.bravos/context/, .guardlink/intent*) git would never commit, and the rule that hides each (git check-ignore -v, argv array). When the cause is the common blanket `.bravos/` line in the repository's own .gitignore, the narrowest repair is offered: ignore Bravos's folder except its context. Read-only; silent without git."
456
456
  export function contextIgnoreFix(root, env = process.env) {
457
457
  let out = '';
@@ -482,14 +482,14 @@ export function contextIgnoreWarning(fix) {
482
482
  const how = fix.fixable
483
483
  ? `run bravos context share --yes to change line ${fix.fixable.line} of .gitignore from "${fix.fixable.was}" to "${fix.fixable.becomes.join('" and "')}"`
484
484
  : `remove or narrow the rule at ${first.file}:${first.line} ("${first.pattern}")`;
485
- return `warning: ${first.file}:${first.line} ("${first.pattern}") hides ${[...new Set(fix.problems.map((p) => p.path.replace(/\/x\.json$/, '/')))].join(', ')} from git, so the intake and design documents will not reach your team; ${how}`;
485
+ return `warning: ${first.file}:${first.line} ("${first.pattern}") hides ${[...new Set(fix.problems.map((p) => p.path.replace(/\/x\.(?:json|md)$/, '/')))].join(', ')} from git, so the intake and design documents will not reach your team; ${how}`;
486
486
  }
487
487
  // @comment -- "bravos context share: says which rule keeps the team's context out of git and, with --yes, makes the narrowest repair to a blanket `.bravos/` line in the repository's own .gitignore (that one line becomes `.bravos/*` and `!.bravos/context/`; every other rule is left as the team wrote it). Without --yes it changes nothing and prints the exact edit, so a person decides."
488
488
  export function shareContext(root, yes, env = process.env) {
489
489
  const fix = contextIgnoreFix(root, env);
490
490
  if (!fix.problems.length)
491
491
  return ['context: nothing hides .bravos/context/ or .guardlink/intent* from git here; commit them and your team gets them on their next pull'];
492
- const lines = fix.problems.map((p) => `${p.path.replace(/\/x\.json$/, '/')} is ignored by ${p.file}:${p.line} ("${p.pattern}")`);
492
+ const lines = fix.problems.map((p) => `${p.path.replace(/\/x\.(?:json|md)$/, '/')} is ignored by ${p.file}:${p.line} ("${p.pattern}")`);
493
493
  if (!fix.fixable)
494
494
  return [...lines, 'bravos repairs only a blanket .bravos/ line in .gitignore; change the rule above by hand so these paths are committed'];
495
495
  const abs = join(root, '.gitignore');
package/dist/cursor.js CHANGED
@@ -3,6 +3,7 @@ import { dirname, join } from 'node:path';
3
3
  import { readLock, sha256, writeLock } from './lock.js';
4
4
  import { bravosBlock } from './instruction-blocks.js';
5
5
  import { MARKER, skillsRoot } from './skills.js';
6
+ import { editCardsCommand, editGuardCommand } from './hooks.js';
6
7
  // @comment -- "Where bravos's Cursor rule lives; Cursor reads project rules from .cursor/rules/*.mdc."
7
8
  export const CURSOR_RULE_PATH = '.cursor/rules/bravos.mdc';
8
9
  // @comment -- "The rule body for one skills root: a pointer to the bravos skills there, the two rules that hold everywhere, and the same Bravos block the other instruction files carry (so a session whose hook output did not arrive still runs the briefing); no method is copied here, so it cannot drift from the skills."
@@ -74,7 +75,9 @@ export function writeCursorPointer(root, harnesses, opts = {}) {
74
75
  export const CURSOR_HOOKS_PATH = '.cursor/hooks.json';
75
76
  // @comment -- "The session-start command Cursor runs: the repo's own hook script, found from any folder in the checkout, told it is Cursor so it prints Cursor's output shape."
76
77
  export const CURSOR_SESSION_COMMAND = 'node "$(git rev-parse --show-toplevel)/.bravos/hooks/session-start.mjs" --harness cursor';
77
- // @comment -- "Registers bravos's sessionStart hook in .cursor/hooks.json, so Cursor gives the agent the briefing (and the first-reply card) at session start. Written when the repo has a .cursor/ folder or the person chose --agent cursor. Merges with the file's other hooks and keeps them; an unreadable or non-object file is left alone and reported. Not lock-recorded: it is shared with the team's own hooks, so uninstall removes only bravos's entry."
78
+ export const CURSOR_GUARD_MATCHER = '^(Write|Delete)$';
79
+ export const CURSOR_CARDS_MATCHER = '^Write$';
80
+ // @comment -- "Registers bravos's hooks in .cursor/hooks.json: sessionStart, so Cursor gives the agent the briefing (and the first-reply card) at session start, and the record guard (preToolUse) and cards (postToolUse) around each edit. Written when the repo has a .cursor/ folder or the person chose --agent cursor. Merges with the file's other hooks and keeps them; an unreadable or non-object file is left alone and reported. Not lock-recorded: it is shared with the team's own hooks, so uninstall removes only bravos's entry."
78
81
  export function writeCursorHooks(root, opts = {}) {
79
82
  if (!opts.always && !existsSync(join(root, '.cursor')))
80
83
  return { status: 'absent' };
@@ -94,10 +97,15 @@ export function writeCursorHooks(root, opts = {}) {
94
97
  }
95
98
  }
96
99
  const hooks = typeof doc.hooks === 'object' && doc.hooks !== null && !Array.isArray(doc.hooks) ? { ...doc.hooks } : {};
97
- const ours = (e) => typeof e === 'object' && e !== null && /\.bravos\/hooks\/session-start\.mjs/.test(String(e.command ?? ''));
98
- const current = Array.isArray(hooks.sessionStart) ? hooks.sessionStart : [];
99
- const others = current.filter((e) => !ours(e));
100
- hooks.sessionStart = [...others, { command: CURSOR_SESSION_COMMAND }];
100
+ const mine = (re) => (e) => typeof e === 'object' && e !== null && re.test(String(e.command ?? ''));
101
+ const put = (event, re, entry) => {
102
+ const current = Array.isArray(hooks[event]) ? hooks[event] : [];
103
+ hooks[event] = [...current.filter((e) => !mine(re)(e)), entry];
104
+ };
105
+ put('sessionStart', /\.bravos\/hooks\/session-start\.mjs/, { command: CURSOR_SESSION_COMMAND });
106
+ // @comment -- "The record guard before an edit and the cards after one. Every agent edit reaches Cursor's hooks as Write (a delete as Delete), and its matcher is an unanchored regex, so both are anchored; postToolUse, not afterFileEdit, is the after-edit event whose additional_context reaches the model."
107
+ put('preToolUse', /\bbravos hook record-guard\b/, { command: editGuardCommand('cursor'), matcher: CURSOR_GUARD_MATCHER, timeout: 10 });
108
+ put('postToolUse', /\bbravos hook cards\b/, { command: editCardsCommand('cursor'), matcher: CURSOR_CARDS_MATCHER, timeout: 10 });
101
109
  const next = { version: typeof doc.version === 'number' ? doc.version : 1, ...doc, hooks };
102
110
  const text = JSON.stringify(next, null, 2) + '\n';
103
111
  if (had && readFileSync(abs, 'utf8') === text)
@@ -108,6 +116,17 @@ export function writeCursorHooks(root, opts = {}) {
108
116
  }
109
117
  return { status: had ? 'updated' : 'written', path };
110
118
  }
119
+ // @comment -- "Which of bravos's edit hooks .cursor/hooks.json registers; an absent or unreadable file reads as none."
120
+ export function cursorEditHooks(root) {
121
+ try {
122
+ const h = JSON.parse(readFileSync(join(root, CURSOR_HOOKS_PATH), 'utf8')).hooks ?? {};
123
+ const has = (event, re) => Array.isArray(h[event]) && h[event].some((e) => re.test(String(e?.command ?? '')));
124
+ return { guard: has('preToolUse', /\bbravos hook record-guard --harness cursor\b/), cards: has('postToolUse', /\bbravos hook cards --harness cursor\b/) };
125
+ }
126
+ catch {
127
+ return { guard: false, cards: false };
128
+ }
129
+ }
111
130
  // @comment -- "True when .cursor/hooks.json registers bravos's session-start hook; an absent or unreadable file reads as false."
112
131
  export function cursorHookRegistered(root) {
113
132
  try {
package/dist/dashboard.js CHANGED
@@ -265,6 +265,12 @@ export async function buildDashboard(root, env, opts = {}) {
265
265
  rulesPart = { state: rules.state === 'none' ? 'missing' : 'present', note: rules.note };
266
266
  // The Security design view is on the Team plan; on Free the principles stay followed (the instruction block) and
267
267
  // the view says what would show them.
268
+ // The decision records view is on the Team plan too; on Free the records stay followed (the briefing, the edit hooks).
269
+ if (rules.records?.length) {
270
+ const f = await featureState(env, 'principles', 'The Decision records view');
271
+ if (!f.entitled)
272
+ rules = { ...rules, records: [], recordsNote: `${rules.records.length} record rule${rules.records.length === 1 ? ' is' : 's are'} written down here, and coding agents follow the adopted ones on every plan. ${f.refusal}.` };
273
+ }
268
274
  if (rules.principles.length) {
269
275
  const f = await featureState(env, 'principles', 'The Security design view');
270
276
  if (!f.entitled)
package/dist/doctor.js CHANGED
@@ -4,9 +4,11 @@ import { join } from 'node:path';
4
4
  import { installedGuardlinkSkills, whichBin } from './guardlink.js';
5
5
  import { graphBin } from './codegraph.js';
6
6
  import { findAnalyzer, findLicence } from './graphbin.js';
7
- import { ALL_AUTOPILOT_COMMANDS, ALL_CARDS_COMMANDS, ALL_COACH_COMMANDS, ALL_PRE_PR_COMMANDS, HOOK_COMMANDS, LEGACY_HOOK_COMMAND, RELATIVE_HOOK_COMMANDS, hookRegistered } from './hooks.js';
7
+ import { ALL_AUTOPILOT_COMMANDS, ALL_CARDS_COMMANDS, ALL_COACH_COMMANDS, ALL_PRE_PR_COMMANDS, ALL_RECORD_GUARD_COMMANDS, HOOK_COMMANDS, LEGACY_HOOK_COMMAND, RELATIVE_HOOK_COMMANDS, agyRegistered, hookRegistered } from './hooks.js';
8
8
  import { skillsRoot } from './skills.js';
9
- import { cursorHookRegistered } from './cursor.js';
9
+ import { cursorEditHooks, cursorHookRegistered } from './cursor.js';
10
+ import { OMP_EXTENSION_PATH } from './omp.js';
11
+ import { OPENCODE_PLUGIN_PATH } from './opencode.js';
10
12
  import { contextIgnoreFix, contextIgnoreWarning } from './context.js';
11
13
  import { resolveTheme } from './palette.js';
12
14
  import { pathToFileURL } from 'node:url';
@@ -88,10 +90,34 @@ export function runDoctor(root, env = process.env) {
88
90
  claude: hookRegistered(join(root, '.claude', 'settings.json'), 'PreToolUse', ALL_PRE_PR_COMMANDS),
89
91
  codex: hookRegistered(join(root, '.codex', 'hooks.json'), 'PreToolUse', ALL_PRE_PR_COMMANDS),
90
92
  },
93
+ edit_hooks: editHooks(root),
91
94
  theme: resolveTheme(env),
92
95
  updates: readUpdates(env),
93
96
  };
94
97
  }
98
+ // @comment -- "Which agents get the record guard and the after-edit cards here, read from the files Bravos wrote for each: the Claude Code and Codex settings, .cursor/hooks.json, .agents/hooks.json, and the opencode and omp plugin files (whose tool hooks call bravos hook). An agent Bravos has not set up here reads as null, not as missing."
99
+ function editHooks(root) {
100
+ const claude = join(root, '.claude', 'settings.json');
101
+ const codex = join(root, '.codex', 'hooks.json');
102
+ const plugin = (rel) => {
103
+ try {
104
+ const t = readFileSync(join(root, rel), 'utf8');
105
+ return { guard: t.includes("askBravos('record-guard'"), cards: t.includes("askBravos('cards'") };
106
+ }
107
+ catch {
108
+ return null;
109
+ }
110
+ };
111
+ const agy = existsSync(join(root, '.agents', 'hooks.json')) ? agyRegistered(root) : null;
112
+ return {
113
+ claude: existsSync(claude) ? { guard: hookRegistered(claude, 'PreToolUse', ALL_RECORD_GUARD_COMMANDS), cards: hookRegistered(claude, 'PostToolUse', ALL_CARDS_COMMANDS) } : null,
114
+ codex: existsSync(codex) ? { guard: hookRegistered(codex, 'PreToolUse', ALL_RECORD_GUARD_COMMANDS), cards: hookRegistered(codex, 'PostToolUse', ALL_CARDS_COMMANDS) } : null,
115
+ cursor: existsSync(join(root, '.cursor', 'hooks.json')) ? cursorEditHooks(root) : null,
116
+ antigravity: agy ? { guard: agy.guard, cards: agy.cards } : null,
117
+ opencode: plugin(OPENCODE_PLUGIN_PATH),
118
+ omp: plugin(OMP_EXTENSION_PATH),
119
+ };
120
+ }
95
121
  // @comment -- "What the daily update check last saw (~/.bravos/update-check.json, written by hooks/lib/update-check.mjs): off, never checked, or the latest published version and when it was checked. Only a dotted version string is read from the file."
96
122
  function readUpdates(env) {
97
123
  const installed = packageVersion();
@@ -154,6 +180,7 @@ export function formatDoctor(r) {
154
180
  `pre-pr claude: ${yn(r.pre_pr.claude)} codex: ${yn(r.pre_pr.codex)}${r.pre_pr.claude || r.pre_pr.codex ? '' : ' (opt-in: bravos setup --pre-pr-hook)'}`,
155
181
  `autopilot claude: ${yn(r.autopilot.claude)} codex: ${yn(r.autopilot.codex)}${r.autopilot.claude || r.autopilot.codex ? '' : ' (opt-in: bravos setup --autopilot)'}`,
156
182
  `cards claude: ${yn(r.cards.claude)} codex: ${yn(r.cards.codex)}${r.cards.claude || r.cards.codex ? (process.env.BRAVOS_THREAT_CARDS === 'off' ? ' (off for this run: BRAVOS_THREAT_CARDS=off)' : '') : ' (bravos setup adds it)'}`,
183
+ `edit hooks (record guard / cards) ${Object.entries(r.edit_hooks ?? {}).filter(([, v]) => v).map(([k, v]) => `${k}: ${v.guard && v.cards ? 'yes' : v.guard || v.cards ? `partly (guard ${yn(v.guard)}, cards ${yn(v.cards)})` : 'no'}`).join(' ') || 'no agent set up here'}${Object.values(r.edit_hooks ?? {}).some((v) => v && !(v.guard && v.cards)) ? ' (bravos setup wires them)' : ''}`,
157
184
  `coach claude: ${yn(r.coach.claude)} codex: ${yn(r.coach.codex)}${r.coach.claude || r.coach.codex ? (process.env.BRAVOS_COACH === 'off' ? ' (off for this run: BRAVOS_COACH=off)' : '') : ' (bravos setup adds it)'}`,
158
185
  ...(r.dead_hooks?.length ? [`✘ dead user-level hooks ${r.dead_hooks.map((d) => `${d.file} ${d.event}: ${d.script} is gone`).join('; ')} — every session shows "hook error". Remove them (a backup is kept): bravos doctor --fix-hooks`] : r.dead_hooks ? ['✔ no dead user-level hooks'] : []),
159
186
  ...(r.legacy_skills?.length ? [`✘ old Python bravos skills ${r.legacy_skills.map((f) => `${f.root}: ${f.names.join(', ')}`).join('; ')} — your agent may load them instead of this repository's. Move them aside (reversible): ${r.legacy_command}`] : r.legacy_skills ? ['✔ no old Python bravos skills at user level'] : []),
package/dist/graphbin.js CHANGED
@@ -19,8 +19,8 @@ export function pythonBravos(env = process.env) {
19
19
  const real = realpathSync(file);
20
20
  if (real.startsWith(self + '/'))
21
21
  continue;
22
- // An npm shim (a shell script that execs node on this package's dist/cli.js) is not the Python CLI either.
23
- if (readFileSync(real, 'utf8').includes('dist/cli.js'))
22
+ // An npm shim (a shell script that execs node on this package's dist/bin.js, or dist/cli.js before 1.25) is not the Python CLI either.
23
+ if (/dist\/(?:bin|cli)\.js/.test(readFileSync(real, 'utf8')))
24
24
  continue;
25
25
  return file;
26
26
  }
package/dist/guide.js CHANGED
@@ -117,6 +117,7 @@ export const GUIDE_TOPICS = [
117
117
  { name: 'Teach bravos what the app is for', skills: ['bravos-context'], body: ['Writes .guardlink/intent.md: invariants (INV-n) that become threats, and intended-by-design items (INT-n) that get an "intended?" audit instead of a high rating.'] },
118
118
  { name: 'Start from your design documents', skills: ['bravos-context'], body: ['Give bravos-context your PRDs, design documents or an earlier threat model, as files or links. Each is kept in the repository as Markdown under .bravos/context/ (bravos context add; committed, so the team can keep it current) after a check for secrets and local paths; a link is kept beside its snapshot. Every rule then names the document it came from (INV-4, source: SRC-2), including who may do what: "sales may see every report except the revenue report" becomes a rule that can be tested, where a scan would see nothing wrong. bravos context list shows the documents, bravos context check re-checks them, and a pre-push check stops a push that would send a secret in one. Free; the CLI runs no model and fetches nothing: your agent converts and fetches with your own access.'] },
119
119
  { name: 'Write down your company\'s security design principles', skills: ['bravos-principles'], body: ['Ask for "our security design principles". bravos-principles proposes candidates only from your stored documents (cited by section, checked against the text), INV rules a person already confirmed in this or another repository, or an optional starter list mapped to OWASP ASVS 4.0.3, which is never pre-selected; bravos review principles refuses anything else. On the page each principle is its own decision (Agree, Change the wording, or No); there is no adopt-all. Confirm records your adoption with the exact wording and a fingerprint, and bravos writes .guardlink/principles.md from the adoptions: committed, so every developer who pulls gets it, and the Bravos block in AGENTS.md and CLAUDE.md tells every coding agent to read and follow it and never edit it. A principle is enforced (it becomes a threat with principle:SDP-n, is tested, and the pre-PR gate stops a change that breaks it, whatever the PR body says) or guidance (followed, not tested). bravos principles check (free; the pre-push hook and the gate run it) fails a hand-edited line, an adoption nobody made, or an exception past its date. An exception is approved by a person at their own terminal: bravos principles except SDP-n --where "<glob>" --reason "<why>" --until <date>, at most a year, never extended; a coding agent cannot run it. bravos principles copy --from <repository> takes the same set into another repository, and check says when the source changes. The dashboard\'s Security design view shows each principle, where it is enforced, its exceptions, and what it caught or stopped in the last 30 and 90 days. Team plan for authoring, the gate and the view; adopted principles are followed on every plan.'] },
120
+ { name: 'Write down what was decided for one module', skills: ['bravos-records'], body: ['Ask for "a security decision record for <module>". bravos-records drafts one document for that module (.guardlink/records/SDR-n-<module>.md) from what you tell it, your documents and confirmed rules: the decision, the rules that follow, why, and what looks like a bug but is not. It is a draft until its text reaches the default branch: approved when a code owner reviews the pull request that merges it (bravos records check asks GitHub with gh whether the branch requires that review, and offers CODEOWNERS lines for .guardlink/records/ that it writes only after you say yes: bravos records codeowners --owner @you). Without that review, a record on the default branch reads \'on main, review not enforced\'; the weaker fallback is a person running bravos records adopt SDR-n at their own terminal and typing their name, which shows who said so, not that anyone reviewed it. An agent cannot approve or adopt one. From then on every coding agent asks bravos records for <file> before changing covered code and follows the record; in Claude Code, Codex, Cursor, Antigravity, opencode and omp the first edit of a covered file in a session is refused once with the record in full (each in its own hook shape, through the installed CLI; any hook error lets the edit through), so it is read before anything changes. A change that goes against a rule is raised with you first and shows as a decision-record card after the edit, as does a removed check, and a record edited on a branch is a proposal: the default branch\'s text binds until the edit is approved, and only the branch that edits it waits (bravos records check). In CI, the PR gate checks with the workflow\'s GITHUB_TOKEN that a code owner approved the last change to each record and reports what it could not prove. A module ledger, .guardlink/records/README.md, lists which modules of the application make security decisions: the agent proposes it (bravos records ledger propose: features found from the stored documents, the threat model and the folders, with the code graph\'s routes on the Team plan; without the graph a feature split over folders with different names can show as two modules, so the boundaries are for a person to review), a person reviews it in its pull request, and Bravos keeps its Record and Owner columns (bravos records ledger refresh, owners from CODEOWNERS). It is never enforced. From the first session the briefing counts it ("9 modules, 2 with records"), and the first edit in a session to a module it says needs a record, and has none, gets one line offering to draft one, never a block; the company principles apply either way (bravos prefs set nudge off silences it). On the Team plan, once a person has reviewed the ledger, the agent drafts records for the modules that need one in the background: a subagent runs bravos records drafts (at most 2 a run, 3 waiting for review at once, never two for one module) and bravos records draft "<module>", which starts each draft on its own branch and worktree so your checkout is never touched. A draft states only what your documents (SRC-n § Section), confirmed intent rules or people said, cited on the line; what the code does today is marked observed and kept as guidance; Not a bug is never filled from code. bravos records check holds every citation to the repository. The agent pushes nothing and asks you before opening each draft\'s pull request; it binds nobody until a code owner approves it, and only that branch waits. bravos prefs set drafts off stops it. bravos rules lists each rule with its status. On the Team plan the pre-PR gate holds a change that breaks an adopted enforced rule whatever the PR body says, until the code is fixed, a person approves a dated exception (bravos records except SDR-n R1, at their own terminal), or the record is changed and the new text approved; people can adopt on a page with bravos review records (Agree, Change or No per rule); bravos records gaps lists modules no record covers; and the dashboard has a Decision records view. Reading and following records is free; writing, adopting, exceptions, the gate, gaps and the view are on the Team plan.'] },
120
121
  { name: 'See which design rules hold', skills: ['bravos', 'bravos-recheck'], body: ['bravos rules lists every rule your design states (INV-n in the intent) with its status: broken (a test got through), retest due (the code under it changed since it was tested), unguarded (it can break somewhere and nothing stops it), guarded but untested, not placed (no code is tied to it yet), or holds (a test tried and was refused everywhere it is enforced). Each line names the document the rule came from and the places it is enforced. bravos dashboard shows the same under Threat model, as Design rules in GuardLink\'s sidebar beside Exposures, worst first. Free, read-only, no model; --json prints bravos.rules/v1. On the Team plan the pre-PR check and the PR workflow hold a pull request that changes a file a holding rule is enforced in (the check, or the role table that grants the permission) after that rule was last tested, until its test is replayed or the PR body names the rule; the after-edit note says the same while you work.'] },
121
122
  { name: 'The intake asks, it never blocks', skills: ['bravos-context', 'bravos-annotate'], body: ['Annotation starts in the first session. With no confirmed intent, the agent drafts what the product is for from the README, docs and code (.guardlink/intent.md, every item marked draft), annotates against that draft, and opens the intake page without waiting. Each session asks once for a person to confirm it (bravos review intent, a few minutes) until someone confirms or declines; the agent never confirms for you. Rules drafted from the design are tested and can block a pull request right away; bravos rules and the block message label them draft until a person confirms them. When the answers arrive, the agent re-judges what they changed: an item you mark intended by design is annotated as intended, not as a finding. The intake page brings back the answers each person gave when they reopen it, and saves them as they go; only Confirm makes them count, and it records who and when. Design documents (a PRD, a design document, an earlier threat model) can be added on the page itself: Markdown and text are stored with the usual checks, and a PDF, Word file, slides or link waits for the agent to convert. Every rule cites the section of the document it came from, the page shows that passage under the question, and bravos context check refuses a section the document does not have. The intake and the documents are committed so the team gets them on their next pull; bravos doctor warns when a .gitignore rule keeps them on one machine, and bravos context share --yes narrows a blanket .bravos/ rule. A team that chooses to go without records that under a name, bravos context decline --by "<name>", which is committed like the intent and ends the asking; a coding agent is told never to decline for you. bravos context gate says which state a repository is in.'] },
122
123
  { name: 'Updates', skills: ['bravos'], body: ['Bravos tells you when it is updated. At most once a day a session start asks the npm registry, in a background process the session never waits on, for the latest published version: the same request npm install makes, with only the package name. A newer version shows in the banner and the briefing, and the coach tells a session that is already running, once. Installing it is yours to do (npm install -g @bugb-technologies/bravos); once it is installed the coach has the agent run bravos setup in the repository, which brings its Bravos files up to date. bravos doctor shows the last check. BRAVOS_UPDATE_CHECK=off stops the check, and it never runs in CI.'] },
@@ -146,7 +147,7 @@ export const GUIDE_TOPICS = [
146
147
  {
147
148
  id: 'skills',
148
149
  title: 'Every skill',
149
- summary: 'all seventeen skills, what each does and leaves for the next',
150
+ summary: 'all eighteen skills, what each does and leaves for the next',
150
151
  items: [
151
152
  { name: 'bravos', body: ['Front door: reads the security picture, explains the evidence loop, routes to the right skill.'] },
152
153
  { name: 'bravos-context', body: ['Learns what the product intends from the repo and a short interview; records invariants, intended behaviour, actors, assets and boundaries.'] },
@@ -161,6 +162,7 @@ export const GUIDE_TOPICS = [
161
162
  { name: 'bravos-sast', body: ['Licensed static analysis joined to guardlink claims and reachability; gates on findings new since the base.'] },
162
163
  { name: 'bravos-threat-hunt', body: ['"Identify all the threats": maps the attack surface with the code graph, runs SAST, records every finding in the threat model with bravos-annotate, rebuilds the dashboard and reports from what was recorded, then recommends confirming the top three.'] },
163
164
  { name: 'bravos-principles', body: ['Your company\'s security design principles, from your own documents and confirmed rules (or an optional starter list mapped to OWASP ASVS): proposed on the review page, adopted one by one by named people, written by bravos to .guardlink/principles.md, followed by every coding agent, and enforced ones tested and held to by the pre-PR gate.'] },
165
+ { name: 'bravos-records', body: ['Security decision records, one document per module or feature: what was decided there, the rules that follow, why, and what looks like a bug but is not. Drafted from what the team states, approved through a code owner\'s pull-request review (or, weaker, a name typed at a person\'s own terminal), read by every coding agent before it changes covered code, and listed rule by rule in bravos rules.'] },
164
166
  { name: 'bravos-campaign', body: ['A goal over many rounds: disjoint batches, one subagent each, a gate per batch, rests, a final before-and-after.'] },
165
167
  { name: 'bravos-schedule', body: ['Recurring upkeep with each harness\'s own mechanism; never live tests from a loop.'] },
166
168
  { name: 'bravos-cicd', body: ['Audits and writes the security workflows.'] },