@bugb-technologies/bravos 1.8.0 → 1.9.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/README.md +11 -7
- package/dist/ci.js +1 -1
- package/dist/cli.js +195 -100
- package/dist/context.js +1 -1
- package/dist/doctor.js +20 -11
- package/dist/global.js +3 -3
- package/dist/guardlink.js +1 -1
- package/dist/guide.js +9 -9
- package/dist/help.js +23 -16
- package/dist/hooks.js +44 -21
- package/dist/mcp.js +3 -2
- package/dist/palette.js +2 -2
- package/dist/plugin-release.js +2 -2
- package/dist/plugin.js +3 -3
- package/dist/prefs.js +20 -1
- package/dist/setup-route.js +37 -0
- package/dist/setup.js +3 -2
- package/dist/skills.js +1 -1
- package/dist/start/answers.js +4 -4
- package/dist/start/index.js +69 -29
- package/dist/start/repos.js +1 -1
- package/dist/start/ui.js +2 -2
- package/dist/upkeep.js +6 -6
- package/dist/watch-frame.js +1 -1
- package/dist/watch.js +1 -1
- package/docs/GUIDE.md +10 -10
- package/docs/UPGRADING.md +24 -1
- package/hooks/lib/briefing.mjs +28 -7
- package/hooks/lib/legacy-skills.mjs +68 -0
- package/hooks/lib/palette.mjs +4 -4
- package/hooks/lib/prefs.mjs +2 -2
- package/hooks/lib/setup.mjs +7 -7
- package/hooks/session-start.mjs +2 -2
- package/package.json +1 -1
- package/skills/bravos/SKILL.md +2 -2
- package/skills/bravos-annotate/SKILL.md +2 -2
- package/skills/bravos-cicd/SKILL.md +1 -1
- package/skills/bravos-codegraph/SKILL.md +1 -1
- package/skills/bravos-schedule/SKILL.md +1 -1
- package/skills/bravos-ship/SKILL.md +2 -2
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// @comment -- "Finds skills the retired Python bravos (siete's `bravos skills install`) left at user level, in ~/.claude/skills, ~/.agents/skills and ~/.codex/skills. A harness lists them beside the repository's own skills, and some share a name with this package's (bravos-annotate, bravos-codegraph, bravos-sast), so an agent can load one and follow it: they describe commands this bravos does not have (bravos auto, bravos intake, a bravos annotate that starts a second agent on the person's credentials). A skill counts as old when the Python CLI's own lock in that folder lists it, or, with no lock, when its SKILL.md carries none of this package's marker and names one of those commands. Read-only; dependency-free, so the session hook can use it."
|
|
2
|
+
import { existsSync, readdirSync, readFileSync } from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
|
|
5
|
+
/** The marker this package writes into every SKILL.md it installs (src/skills.ts MARKER). */
|
|
6
|
+
const OWN_MARKER = '<!-- bravos:generated -->';
|
|
7
|
+
/** The Python CLI's skills lock, written beside the skills it installed. */
|
|
8
|
+
const PY_LOCK = '.bravos-skills.lock';
|
|
9
|
+
/** Commands and tools only the Python CLI had. */
|
|
10
|
+
const PY_SIGNS = /\bbravos (?:auto|intake|loop|round|retest|push|run)\b|request_verification|list_needs_you|answer_needs_you/;
|
|
11
|
+
const ROOTS = ['.claude/skills', '.agents/skills', '.codex/skills'];
|
|
12
|
+
const NAME = /^bravos(?:-[a-z0-9]+)*$/;
|
|
13
|
+
|
|
14
|
+
const readHead = (file, max = 256 * 1024) => {
|
|
15
|
+
try {
|
|
16
|
+
return readFileSync(file, 'utf8').slice(0, max);
|
|
17
|
+
} catch {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// @comment -- "The old skills per user-level folder: [{ root: '~/.claude/skills', names: [...] }], folders with none left out. Only names of the form bravos or bravos-<word>... are ever reported, so nothing else from those folders reaches the briefing."
|
|
23
|
+
export function legacySkills(env = process.env) {
|
|
24
|
+
const home = env?.HOME;
|
|
25
|
+
if (!home) return [];
|
|
26
|
+
const out = [];
|
|
27
|
+
for (const rel of ROOTS) {
|
|
28
|
+
const dir = join(home, rel);
|
|
29
|
+
let entries;
|
|
30
|
+
try {
|
|
31
|
+
entries = readdirSync(dir, { withFileTypes: true }).filter((e) => (e.isDirectory() || e.isSymbolicLink()) && NAME.test(e.name)).map((e) => e.name);
|
|
32
|
+
} catch {
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
let locked = new Set();
|
|
36
|
+
try {
|
|
37
|
+
const lock = JSON.parse(readFileSync(join(dir, PY_LOCK), 'utf8'));
|
|
38
|
+
if (lock && typeof lock.skills === 'object' && lock.skills) locked = new Set(Object.keys(lock.skills));
|
|
39
|
+
} catch {
|
|
40
|
+
/* no Python lock here */
|
|
41
|
+
}
|
|
42
|
+
const names = entries.filter((name) => {
|
|
43
|
+
const text = readHead(join(dir, name, 'SKILL.md'));
|
|
44
|
+
if (text === null || text.includes(OWN_MARKER)) return false;
|
|
45
|
+
return locked.has(name) || PY_SIGNS.test(text);
|
|
46
|
+
}).sort();
|
|
47
|
+
if (names.length) out.push({ root: `~/${rel}`, names });
|
|
48
|
+
}
|
|
49
|
+
return out;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** The command that moves them out of the way, reversibly: into ~/.bravos/retired-skills/<folder>/, never deleted. */
|
|
53
|
+
export function retireCommand(found) {
|
|
54
|
+
return found
|
|
55
|
+
.map(({ root, names }) => {
|
|
56
|
+
const to = `~/.bravos/retired-skills/${root.split('/')[1].replace(/^\./, '')}`;
|
|
57
|
+
return `mkdir -p ${to} && mv ${names.map((n) => `${root}/${n}`).join(' ')} ${to}/`;
|
|
58
|
+
})
|
|
59
|
+
.join(' && ');
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// @comment -- "The briefing's line about old skills: which ones, that the agent must not follow them, and the one command the person can run to move them aside. The agent is told to leave the moving to the person: they are the person's files, outside the repository."
|
|
63
|
+
export function legacySkillsLine(found) {
|
|
64
|
+
if (!Array.isArray(found) || !found.length) return null;
|
|
65
|
+
const list = found.map(({ root, names }) => `${root}: ${names.join(', ')}`).join('; ');
|
|
66
|
+
const count = found.reduce((n, f) => n + f.names.length, 0);
|
|
67
|
+
return `Old skills: ${count} skill${count === 1 ? '' : 's'} from the retired Python bravos ${count === 1 ? 'is' : 'are'} installed for this person (${list}), and your harness may list ${count === 1 ? 'it' : 'them'} beside this repository's. Never load or follow ${count === 1 ? 'it' : 'them'}: ${count === 1 ? 'it describes' : 'they describe'} commands this bravos does not have (bravos auto, bravos intake, a bravos annotate that starts a second agent), and where a name is also this repository's, use the repository's copy. Tell the person once that these can be moved aside, reversibly, from their own terminal: ${retireCommand(found)}`;
|
|
68
|
+
}
|
package/hooks/lib/palette.mjs
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// in near-white #f0f0f0 and bright green/amber accents, which all but vanish on a
|
|
5
5
|
// white background (contrast 1.1:1 to 1.9:1). Nothing can tell a hook which
|
|
6
6
|
// background its message will be drawn on, so the theme is chosen by what the
|
|
7
|
-
// person said (BRAVOS_THEME, or bravos
|
|
7
|
+
// person said (BRAVOS_THEME, or bravos setup), what the terminal says (COLORFGBG),
|
|
8
8
|
// or, failing both, `neutral`: text in the terminal's own default colour and
|
|
9
9
|
// mid-tone accents that keep at least 3:1 against white AND black.
|
|
10
10
|
//
|
|
@@ -56,7 +56,7 @@ export function bravosHome(env = process.env) {
|
|
|
56
56
|
return env.BRAVOS_HOME || join(env.HOME || homedir(), '.bravos');
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
/** The theme saved by `bravos
|
|
59
|
+
/** The theme saved by `bravos setup` (config.json in $BRAVOS_HOME), or null. Never throws. */
|
|
60
60
|
export function savedTheme(env = process.env) {
|
|
61
61
|
try {
|
|
62
62
|
const file = join(bravosHome(env), 'config.json');
|
|
@@ -100,7 +100,7 @@ export function themeFromBackground(answer) {
|
|
|
100
100
|
/**
|
|
101
101
|
* Which theme to draw in, and why. In order: BRAVOS_THEME (light, dark or neutral;
|
|
102
102
|
* auto or unset falls through), what the terminal answered (`detected`, watch only),
|
|
103
|
-
* COLORFGBG, the choice saved by `bravos
|
|
103
|
+
* COLORFGBG, the choice saved by `bravos setup`, then neutral.
|
|
104
104
|
*/
|
|
105
105
|
// @comment -- "Theme choice in a fixed order: BRAVOS_THEME, the terminal's own answer (watch), COLORFGBG, the saved choice, then neutral; returns the theme and the reason so bravos doctor can say why"
|
|
106
106
|
export function resolveTheme(env = process.env, detected = null) {
|
|
@@ -110,6 +110,6 @@ export function resolveTheme(env = process.env, detected = null) {
|
|
|
110
110
|
const fgbg = themeFromColorFgBg(env.COLORFGBG);
|
|
111
111
|
if (fgbg) return { theme: fgbg, source: 'COLORFGBG' };
|
|
112
112
|
const saved = savedTheme(env);
|
|
113
|
-
if (saved) return { theme: saved, source: 'saved by bravos
|
|
113
|
+
if (saved) return { theme: saved, source: 'saved by bravos setup' };
|
|
114
114
|
return { theme: 'neutral', source: 'default (background unknown)' };
|
|
115
115
|
}
|
package/hooks/lib/prefs.mjs
CHANGED
|
@@ -82,7 +82,7 @@ export function commitsLine(prefs) {
|
|
|
82
82
|
: `Commits: leave Bravos's own files uncommitted and list them; do not ask (${whose}).`;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
// @comment -- "The hand-off from bravos
|
|
85
|
+
// @comment -- "The hand-off from bravos setup to the first agent session: a dated marker in this clone's git directory saying setup just finished here and the person expects Bravos to begin. While it is fresh and the context gate is still closed, the briefing tells the agent to start the context step in its first reply; without it, or after a few days, the briefing only offers, so a session opened for something else is never taken over. Like the preferences, nothing in a repository's tree can write it."
|
|
86
86
|
export const HANDOFF_DAYS = 3;
|
|
87
87
|
export const handoffFile = (commonDir) => join(commonDir, 'bravos', 'handoff.json');
|
|
88
88
|
|
|
@@ -94,7 +94,7 @@ export function writeHandoff(commonDir, at) {
|
|
|
94
94
|
return file;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
/** True while a hand-off written by bravos
|
|
97
|
+
/** True while a hand-off written by bravos setup is at most HANDOFF_DAYS old. */
|
|
98
98
|
export function readHandoff(commonDir, now = Date.now()) {
|
|
99
99
|
if (!commonDir) return false;
|
|
100
100
|
try {
|
package/hooks/lib/setup.mjs
CHANGED
|
@@ -69,32 +69,32 @@ export function readSetup(root, i = {}, harness = 'other') {
|
|
|
69
69
|
label: 'set up a test target',
|
|
70
70
|
cta: skill('bravos-env', harness),
|
|
71
71
|
unlocks: 'exposures can be tested for real instead of argued about',
|
|
72
|
-
how: `ask "bring up a test target" (${skill('bravos-env', harness)}); bravos
|
|
72
|
+
how: `ask "bring up a test target" (${skill('bravos-env', harness)}); bravos setup --scope writes the loopback-only starter`,
|
|
73
73
|
},
|
|
74
74
|
{
|
|
75
75
|
id: 'autopilot',
|
|
76
76
|
// Registered in the repo is not on for this person: without a licence the hook answers nothing.
|
|
77
77
|
on: !!i.autopilot && !hooksLocked(i),
|
|
78
78
|
label: 'turn on autopilot',
|
|
79
|
-
cta: i.autopilot && hooksLocked(i) ? 'bravos account activate' : 'bravos
|
|
79
|
+
cta: i.autopilot && hooksLocked(i) ? 'bravos account activate' : 'bravos setup --autopilot',
|
|
80
80
|
unlocks: 'annotations and rechecks happen at the end of each turn without being asked',
|
|
81
|
-
how: i.autopilot && hooksLocked(i) ? `installed in this repo, but on the Team plan for you: ${TRIAL}` : 'bravos
|
|
81
|
+
how: i.autopilot && hooksLocked(i) ? `installed in this repo, but on the Team plan for you: ${TRIAL}` : 'bravos setup --autopilot (cheap; fine to switch on early)',
|
|
82
82
|
},
|
|
83
83
|
{
|
|
84
84
|
id: 'prepr',
|
|
85
85
|
on: !!i.prePr && !hooksLocked(i),
|
|
86
86
|
label: 'turn on the pre-PR gate',
|
|
87
|
-
cta: i.prePr && hooksLocked(i) ? 'bravos account activate' : 'bravos
|
|
87
|
+
cta: i.prePr && hooksLocked(i) ? 'bravos account activate' : 'bravos setup --pre-pr-hook',
|
|
88
88
|
unlocks: 'no pull request goes out with undisclosed exposure or a confirmed exploit',
|
|
89
|
-
how: i.prePr && hooksLocked(i) ? `installed in this repo, but on the Team plan for you: ${TRIAL}` : 'bravos
|
|
89
|
+
how: i.prePr && hooksLocked(i) ? `installed in this repo, but on the Team plan for you: ${TRIAL}` : 'bravos setup --pre-pr-hook (autopilot turns it on too)',
|
|
90
90
|
},
|
|
91
91
|
{
|
|
92
92
|
id: 'ci',
|
|
93
93
|
on: existsSync(join(root, '.github', 'workflows', 'bravos-pr-gate.yml')),
|
|
94
94
|
label: 'add the CI gate and nightly',
|
|
95
|
-
cta: 'bravos
|
|
95
|
+
cta: 'bravos setup --ci',
|
|
96
96
|
unlocks: 'the whole team is gated, and upkeep runs while laptops are closed',
|
|
97
|
-
how: 'bravos
|
|
97
|
+
how: 'bravos setup --ci, then commit .github/workflows/',
|
|
98
98
|
},
|
|
99
99
|
].map((x) => ({ ...x, on: !!x.on }));
|
|
100
100
|
// Paid steps on an unlicensed machine say so in their `how` and are never the next step: the score
|
package/hooks/session-start.mjs
CHANGED
|
@@ -86,7 +86,7 @@ async function main() {
|
|
|
86
86
|
// Antigravity sends the workspace in the payload; Claude Code sets CLAUDE_PROJECT_DIR; others run in the repo.
|
|
87
87
|
const ws = Array.isArray(payload.workspacePaths) && typeof payload.workspacePaths[0] === 'string' ? payload.workspacePaths[0] : null;
|
|
88
88
|
const root = env.CLAUDE_PROJECT_DIR || ws || (typeof payload.cwd === 'string' ? payload.cwd : null) || process.cwd();
|
|
89
|
-
// User-level hook (bravos
|
|
89
|
+
// User-level hook (bravos setup --global): a repo's own bravos hook wins, and a repo with no
|
|
90
90
|
// threat model gets nothing, so the user hook never doubles the briefing or adds noise.
|
|
91
91
|
if (process.argv.includes('--global') && (existsSync(join(root, '.bravos', 'hooks', 'session-start.mjs')) || !existsSync(join(root, '.guardlink')))) {
|
|
92
92
|
process.exit(0);
|
|
@@ -106,7 +106,7 @@ async function main() {
|
|
|
106
106
|
if (env.BRAVOS_BANNER !== 'off' && (source === null || source === 'startup') && harness !== 'agy') {
|
|
107
107
|
const version = readVersion(dirname(fileURLToPath(import.meta.url)));
|
|
108
108
|
const color = !env.NO_COLOR && env.BRAVOS_BANNER_COLOR !== 'off';
|
|
109
|
-
// Which palette: BRAVOS_THEME, COLORFGBG, the choice saved by bravos
|
|
109
|
+
// Which palette: BRAVOS_THEME, COLORFGBG, the choice saved by bravos setup, else neutral (hooks/lib/palette.mjs).
|
|
110
110
|
const { theme } = resolveTheme(env);
|
|
111
111
|
// Codex lists a hook's message as a warning, so it gets a three-line summary, not the art.
|
|
112
112
|
// The leading newline puts the logo on its own lines: Claude Code prefixes the first line with "SessionStart:startup says:".
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bugb-technologies/bravos",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.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",
|
package/skills/bravos/SKILL.md
CHANGED
|
@@ -40,7 +40,7 @@ description: "Start here in any repo bravos is installed in: reads the security
|
|
|
40
40
|
|
|
41
41
|
## Never
|
|
42
42
|
|
|
43
|
-
- Run a setup command for the person (bravos
|
|
43
|
+
- Run a setup command for the person (`bravos setup` with any flag, such as --autopilot, --ci, --pre-pr-hook, --tools, --codegraph or --yes; bravos graph build with --scip auto) without their go-ahead. The one exception is upkeep the briefing's `Upkeep:` line names: a plain `bravos setup` with no flags. Run from your shell it asks nothing and only brings what is already installed up to date: this repository's Bravos files, and Bravos's own signed bundles. Run it without asking and say what changed. (An older bravos names the same upkeep as a plain `bravos sync` and a plain `bravos setup`; follow the line as written.) A first install, `bravos setup --tools` (other people's installers) and every flag above still need the go-ahead.
|
|
44
44
|
- Run `guardlink annotate` or guardlink translate with an agent flag. Those launch a second agent outside this session; you are the agent, so do the work here.
|
|
45
45
|
- Write `@accepts`, `@entitles` or `@confirmed`. Acceptance and entitlement are a human's decision; confirmation needs a reproduced run, and reading code is not one.
|
|
46
46
|
- Call anything clean, safe or fixed unless a gate said so with exit 0.
|
|
@@ -59,7 +59,7 @@ description: "Start here in any repo bravos is installed in: reads the security
|
|
|
59
59
|
|
|
60
60
|
## Go deeper
|
|
61
61
|
|
|
62
|
-
- Autopilot (`bravos
|
|
62
|
+
- Autopilot (`bravos setup --autopilot`): an end-of-turn check points you to changed code and affected claims, including untested controls and claims due for retest; the briefing's `Autopilot:` and `Proving:` lines say whether it is on and how the person wants proving handled.
|
|
63
63
|
- `bravos guide` (in a shell; no model) explains bravos by role, by task and skill by skill, with the safety rules; `docs/GUIDE.md` in the bravos package is the same text. Point a person there when they ask how to use bravos.
|
|
64
64
|
- `docs/GUARDLINK_REFERENCE.md` — annotation syntax and verbs.
|
|
65
65
|
- `.guardlink/README.md` — where annotations go in this repo.
|
|
@@ -18,7 +18,7 @@ description: "Keep the GuardLink threat model correct and growing, in this sessi
|
|
|
18
18
|
3. Read the effort: the user's words ("at high"), else a `bravos effort: <level>` line in `AGENTS.md` / `CLAUDE.md`, else medium. Starting budgets — low: the changed files only; medium: changed plus 5 from the worklist; high: 25 per round, then the `chains` playbook; max: rounds until the worklist is empty (bravos-campaign runs those with subagents). These are defaults, not limits: take more or fewer when the code calls for it, and say why in one line ("12 files, not 5: the auth path spans them"). For a large pick, tell the user the files and rounds before you start.
|
|
19
19
|
4. Run `node {{SKILL_DIR}}/scripts/slice.mjs --base origin/<base> --n <budget>` (`--deep` for no limit, `--batches <k>` to split the pick for parallel work, `--prefer <file>` for entry points `codegraph_entry_points` found). It prints one JSON object: `diff` (files changed from the merge base to disk, including staged, unstaged and untracked source), `coverage` (unannotated files to cover, entry points and trust code first, generated, test and CI files last), `coverage_detail` (`{path, tier, why}`), `batches`, `skipped` (`{path, reason}`), `coverage_before`, `notes`. The order is advice: if your reading of the code says a different file matters more, take it and say why. Tell the user which `skipped` files teammates have in flight. Report every `notes` entry to the user; if one says gh was unavailable, say in-flight PRs were not checked before you take the `coverage` files. Exit 1 means `guardlink unannotated --json` failed: report it and stop. Exit 3 means the context gate is closed (its JSON carries `gate` and nothing to pick): report its note, run bravos-context, and annotate nothing until it is done or the person has declined. When the briefing's `SAST:` line shows a run, `bravos sast candidates` lists reachable findings not in the threat model yet: add their files to the pick as leads, open each, and annotate only what meets the evidence bar, as `@exposes` + `@audit` citing the rule and route, or an `@audit` naming a false positive. A static finding is never `@confirmed`. With SAST unavailable or no report, pick as usual.
|
|
20
20
|
5. When a Stop hook names files or lines, review those changes first, including already annotated files. Read the actual patch and both sides of a move or deletion. Open each affected handler, guard and caller. With a current graph, ask `codegraph_annotation_gaps` with explicit new-side file ranges for working edits or the merge base for committed changes. Inspect stale and unindexed files and read unsupported routes from source. An existing annotation in the file does not establish that it describes the new behavior. Record the changed threat, guard, or flow, recheck an affected existing claim, or finish the review quietly when the change has no security consequence. Keep ordinary turn-end review to the changed code. Pick the playbook: `diff` files → `diff`; `coverage` files → `coverage`. Deep rounds run `exploitable`, then `chains`, then `coverage`, then `verify`. Add a logic pass when intent.md lists invariants (always at high and max, or when guardlink offers a `logic` playbook use it): walk each user journey that touches an invariant — signup, invite, role change, checkout, refund, export — and at each step ask what it assumes about the caller and the step before: ownership, tenant, state, amount, rate. The sink of a logic claim is the state change (the write, the transfer, the grant); the absent control is the missing ownership or state check. Claim it against the invariant's threat, and make a rule that holds testable. At each place a rule is enforced write the pair: `@exposes <Asset> to #inv-…` and `@mitigates <Asset> against #inv-… using #<control>`. A replay kit binds to an `@exposes`, so a check recorded only as `@mitigates` can never be tested or shown to hold; the pair says where the rule could break and what stops it there (for an `#inv-` rule this is the one `@exposes` written beside a check that is present). Where the permission itself is granted in another file (a role table, a policy file), write a `@mitigates` there too, so a change to it is noticed. A check that is missing and meets the evidence bar is an `@exposes` with an `@audit` and no `@mitigates`; a doubt is an `@audit`. Keep `intent:` and `design:` references on the `@threat` definition only.
|
|
21
|
-
6. Open `{{SKILLS_ROOT}}/guardlink-annotate-<id>/SKILL.md` (guardlink writes it under `.claude/skills/`, and `bravos
|
|
21
|
+
6. Open `{{SKILLS_ROOT}}/guardlink-annotate-<id>/SKILL.md` (guardlink writes it under `.claude/skills/`, and `bravos setup` mirrors it into `.agents/skills/` for Codex) and follow it. Otherwise call the MCP tool `guardlink_annotate` (server `guardlink`) with `prompt: "<scope>"` and `playbook: "<id>"`, or run `guardlink annotate --stdout --playbook <id> "<scope>"` (for the `diff` playbook, `guardlink annotate --stdout --playbook diff --since origin/<base> "<scope>"`, since `--since` defaults to HEAD and would list no changed files), and follow the prompt it returns.
|
|
22
22
|
7. Read the repository's annotation mode in `.guardlink/README.md` and its configuration. In inline mode write annotations in the file's comment syntax directly above the code. In external mode update its `.guardlink/annotations/<source-path>.gal` sidecar and anchor the block to the logical source line and symbol using the local GuardLink playbook. Couple the claims: every `@exposes` with its `@mitigates` or `@audit`, the `@flows` the data takes, and a `@comment` on what the code does. Each claim meets the evidence bar: it names the code, the threat and the control by id, and you could point at the line that makes it true.
|
|
23
23
|
Rate each `@exposes` by impact × reach × ease, within its threat's band, under intent.md's `## Assumptions` when it has them (the configuration baseline, deployment and attackers in scope; an exposure only an out-of-scope attacker reaches gets an `@audit`, not a severity): impact from the asset's `@handles` class and intent.md's crown jewels; reach from the boundary in front of it (public, then signed-in, then admin-only, then internal; with the code graph (its MCP tools, or `bravos graph <question> --json` — same answers; see bravos-codegraph), `codegraph_auth_boundary` for the route and `codegraph_reachable_sinks` for what the handler reaches; code `codegraph_entry_reach` or `codegraph_dead_code` shows no entry point reaches gets an `@audit` "not reachable per code graph", not a severity; without the graph, judge reach by reading the code and say the graph was unavailable); ease from its preconditions. Write the severity inline and the reason in the description ("high: reachable unauthenticated, touches payment records").
|
|
24
24
|
Intended? When the code does what an intent.md `INT-n` item says the product does on purpose, write no `@exposes`: write an `@audit` citing it ("by design per intent.md INT-2; check only admins reach it") and annotate the guard that should hold. When it looks intended but intent.md is silent, write an `@audit` asking "intended?" with your reason, and list it for the user. They answer with a fix, an intent.md line or their own `@accepts`; you never accept it. In a bravos workspace (the briefing's `Workspace:` line, or `.bravos/workspace/workspace.json`), define only this service's own assets, with ids prefixed by the service (`#orders-create`), never another service's; declare each call to another service as `@flows #<this>-<x> -> #<other>-<y> via http|grpc|queue -- "..."` with the other service's own id. Do not write the dotted `#repo.tag` form that guardlink's Workspace Context block suggests: cxg cannot chain it, so the cross-service attack is never tested.
|
|
@@ -55,6 +55,6 @@ description: "Keep the GuardLink threat model correct and growing, in this sessi
|
|
|
55
55
|
|
|
56
56
|
## Go deeper
|
|
57
57
|
|
|
58
|
-
- `{{SKILLS_ROOT}}/guardlink-annotate-exploitable/SKILL.md` — the evidence bar (guardlink writes it under `.claude/skills/`, and `bravos
|
|
58
|
+
- `{{SKILLS_ROOT}}/guardlink-annotate-exploitable/SKILL.md` — the evidence bar (guardlink writes it under `.claude/skills/`, and `bravos setup` mirrors it into `.agents/skills/` for Codex; otherwise `guardlink annotate --stdout --playbook exploitable "<scope>"` prints the same method).
|
|
59
59
|
- `docs/GUARDLINK_REFERENCE.md` — verbs and syntax.
|
|
60
60
|
- `.guardlink/README.md` — placement rules for this repo.
|
|
@@ -15,7 +15,7 @@ description: "Audit and write the repo's security CI: the bravos PR gate (valida
|
|
|
15
15
|
**Plan check first.** CI and nightly workflows are on the Team plan. Run `bravos licence --json` once per session (the briefing's `Plan:` line says the same); if `licensed` is false, tell the person in two sentences what this skill would do here and that it needs a Team licence — `bravos account activate` starts a 30-day trial with no card, or https://account.bugb.io/pricing — then stop, and do nothing else from this skill. A licence in grace still counts.
|
|
16
16
|
|
|
17
17
|
1. Audit `.github/workflows/*.yml`. For each guardlink or cxg call, check every flag against that command's `--help`; a `guardlink diff` call with `--from`/`--to` flags is the known broken pattern, since diff takes one positional ref. Flag any `github.event.pull_request`, issue or comment field, or `github.head_ref`, expanded straight into a `run:` line: that text is attacker-controlled and runs as shell.
|
|
18
|
-
2. Write bravos's workflows with `bravos
|
|
18
|
+
2. Write bravos's workflows with `bravos setup --ci`: `bravos-pr-gate.yml` plus the nightly variants. Delete the nightly variant for the harness the team does not use. A workflow someone edited by hand is kept and reported; never overwrite it.
|
|
19
19
|
3. Check the PR gate does what bravos-ship does: `guardlink validate .`, `guardlink lint . --since <base>` against the merge base, `guardlink diff <base> --fail-on-new --markdown` (passing when the PR body discloses new exposure in a Security gate section), a block on confirmed claims in changed files, and `guardlink sarif . --profile github -o guardlink.sarif` uploaded to code scanning.
|
|
20
20
|
4. Fix what the audit found in workflows bravos did not write: replace a broken guardlink call with the form above, and pass event text through `env:` and quote it in the shell. Show each change to the user before committing it.
|
|
21
21
|
5. SAST in CI, only when the team has a bravos licence: add a step running `bravos-cli analyze . --ci --fail-on error -f sarif,json -o sast` with the licence from a repo secret, and upload `sast.sarif` under its own code-scanning category.
|
|
@@ -16,7 +16,7 @@ description: "Ask the repo's code graph (codegraph-mcp) one bounded question —
|
|
|
16
16
|
**Plan check first.** The code graph is on the Team plan. Run `bravos licence --json` once per session (the briefing's `Plan:` line says the same); if `licensed` is false, tell the person in two sentences what this skill would do here and that it needs a Team licence — `bravos account activate` starts a 30-day trial with no card, or https://account.bugb.io/pricing — then stop, and do nothing else from this skill. A licence in grace still counts.
|
|
17
17
|
|
|
18
18
|
1. Ask the graph one bounded question per call; a graph answer replaces reading or grepping the tree. There are two ways in, with the same answers: the MCP tools (`codegraph_attack_surface` …) when the `codegraph` server is connected, or `bravos graph <question> --json` in the shell, where the question is the tool name without `codegraph_` and with hyphens (`codegraph_attack_surface` → `bravos graph attack-surface --json`, `codegraph_callers` → `bravos graph callers '<file>::<symbol>' --json`; `bravos graph --json` lists every question and its arguments). The shell route needs no MCP reconnect and works in every harness. The briefing's `Code graph:` line says which route is there. If neither is (no codegraph-mcp), set it up yourself: `bravos setup --check` reports what is missing without changing anything; show the person `bravos setup --dry-run --codegraph` and with their go-ahead run `bravos setup --codegraph` (it fetches the signed bundle through the account portal and verifies it before anything lands). If an install fails, quote its error and give the exact command for their own terminal; until then say "code graph unavailable; the other skills read the code instead" and answer by reading. Read the effort: the user's words ("at high"), else a `bravos effort: <level>` line in `AGENTS.md` / `CLAUDE.md`, else medium. It sets a starting budget, not a limit; go beyond it when the work needs it and say why in one line. Starting budget — low: the one question asked; medium: whatever questions the task needs; high: start from `codegraph_attack_surface`; max: the full attack surface plus `codegraph_impact` on every changed symbol.
|
|
19
|
-
2. Build or refresh the graph when an answer says there is none for this repository, or its `graph_currency` is `diverged`: `bravos graph build . --scip no-exec` indexes without running the repository's build scripts (`--scip auto` and `--isolate` run them; use those only on a repo the user trusts and only when they say so). A build that reports `semantic <language>: off` lacks that language's type checker; say that calls through interfaces may not connect and
|
|
19
|
+
2. Build or refresh the graph when an answer says there is none for this repository, or its `graph_currency` is `diverged`: `bravos graph build . --scip no-exec` indexes without running the repository's build scripts (`--scip auto` and `--isolate` run them; use those only on a repo the user trusts and only when they say so). A build that reports `semantic <language>: off` lacks that language's type checker; say that calls through interfaces may not connect, and give the fix the build printed for that language (installing it is the person's call). For the MCP route, `bravos setup` registers the server from the bravos install; the person reconnects MCP (`/mcp` in Claude Code) to load it. In a bravos workspace, build one graph over the app folder (`bravos graph build <app folder> --scip no-exec`, the folder the briefing's `Workspace:` line names) and ask cross-service questions there: only a graph that holds both services links one service's HTTP, gRPC, GraphQL or OpenAPI client call to the other's handler (`callees` shows `via_framework`). A graph built inside one member stops at its own repository. An answer of `graph_busy` ("the code graph … is busy") means the graph is there and another session or a build is using it: ask again in a moment and never rebuild for it. An older graph server (code graph 0.1.0) says "No CodeGraph for project" in that case instead, and keeps saying it for that session: when a graph answered moments ago, ask once more before rebuilding, and offer `bravos setup` (it fetches the newer server). A graph belongs to the commit it was built at: after a commit it answers nothing until it is rebuilt, so rebuild before the next graph question and carry on with other work while it builds. `bravos dashboard` rebuilds a missing or behind graph itself and draws it as the Code graph tab (the map, owners and history, coupling, the attack surface, entry points), which is the view to offer a person who wants to see the graph.
|
|
20
20
|
3. Pick the one tool that answers the question:
|
|
21
21
|
find a symbol → `codegraph_search`
|
|
22
22
|
routes → `codegraph_routes`
|
|
@@ -16,7 +16,7 @@ description: "Set up recurring security upkeep with each harness's own mechanism
|
|
|
16
16
|
|
|
17
17
|
1. If the user wants a goal reached in rounds with rests ("100% coverage", "every exposure", subagents per round), that is bravos-campaign; hand it over. Otherwise map the intent to one mechanism and say which: while this session is open → an in-session loop; while the laptop is closed, any harness → the nightly GitHub Actions workflow; while the laptop is closed, Claude Code with a cloud account → a cloud scheduled task the user creates.
|
|
18
18
|
2. In-session loop (Claude Code only): copy `{{SKILL_DIR}}/loop.md` to `.claude/loop.md`, adjust the steps to the user's request, and commit it. Tell the user to start it with a bare `/loop`, which reads that file; it runs only while the session is open, stops when it exits, and expires after seven days. Codex has no equivalent; offer the nightly workflow instead.
|
|
19
|
-
3. Nightly workflow: run `bravos
|
|
19
|
+
3. Nightly workflow: run `bravos setup --ci`, keep the variant for the team's harness (`bravos-nightly-claude.yml` or `bravos-nightly-codex.yml`) and delete the other. A team on GitHub Copilot uses `bravos setup --workflows nightly-copilot` instead: it opens an issue each night and assigns it to Copilot's cloud agent, which needs the secret `COPILOT_ASSIGN_TOKEN` (a Copilot user's personal access token) and `BRAVOS_LICENCE` as an Agents secret. Tell the user the secret it needs (`CLAUDE_CODE_OAUTH_TOKEN` for Claude Code, made once with `claude setup-token` so the run uses their Claude plan, or `OPENAI_API_KEY` for Codex) and to allow GitHub Actions to create pull requests in the repo settings.
|
|
20
20
|
4. Cloud scheduled task: a skill cannot create one. Give the user the prompt to paste into `/schedule`: follow bravos-annotate in slice mode on the next unannotated files, run its lint gate, and open one pull request whose body carries bravos-ship's Security gate section. Tell them the task clones the default branch and runs at most hourly.
|
|
21
21
|
5. State the spend before the user starts any of them: files per run (the default slice is five) times runs per day, and that each run spends model tokens.
|
|
22
22
|
6. For the Claude Code and Codex nightlies, select scheduled proving in the committed human policy and review the scope and exact target. Only checked-in, bound JavaScript kits are eligible. Configure BRAVOS_SCAN_TARGET and BRAVOS_APP_START for the disposable local build and the identities each kit requires. Keep session state in CI secrets. A disabled or ask-only policy skips the scan. Report missing prerequisites, partial executions and unrecorded results separately. Copilot schedules annotation only.
|
|
@@ -30,7 +30,7 @@ description: "The no-mistakes security gate before a pull request: validate the
|
|
|
30
30
|
design rules touched: <each INV id and threat id whose file this branch changed, with its status from `bravos rules --json`, or "none">
|
|
31
31
|
Not tested: <what no tool exercised, e.g. no live run, SAST not run>
|
|
32
32
|
If the user asked for a PR, open it with this section in the body; otherwise print the section and stop.
|
|
33
|
-
12. When the opt-in pre-PR hook is installed (`bravos
|
|
33
|
+
12. When the opt-in pre-PR hook is installed (`bravos setup --pre-pr-hook`), it reruns these gates on `gh pr create` and `gh pr ready` and blocks on lint errors, on a new exposure whose threat and asset ids are not both named in the PR body, on a confirmed claim on a changed file with no `@ticket` for it in that file, on a design rule that was holding when the branch changed a file it is enforced in after its last test and the PR body does not name it (its INV id or threat id; replaying its test with bravos-recheck clears it), and on any gate that fails to run (unknown); let it run. Before the PR exists, `node .bravos/hooks/pre-pr.mjs --check` runs the same gates by hand and lists the new exposures the body must disclose.
|
|
34
34
|
|
|
35
35
|
## Never
|
|
36
36
|
|
|
@@ -57,4 +57,4 @@ description: "The no-mistakes security gate before a pull request: validate the
|
|
|
57
57
|
|
|
58
58
|
- `docs/GUARDLINK_REFERENCE.md` — verbs, including `@ticket`.
|
|
59
59
|
- `.guardlink/README.md` — placement rules for this repo.
|
|
60
|
-
- `{{SKILLS_ROOT}}/guardlink-annotate-diff/SKILL.md` — the playbook for a change's gaps; `{{SKILLS_ROOT}}/guardlink-annotate-exploitable/SKILL.md` for the evidence bar. guardlink writes both under `.claude/skills/`, and `bravos
|
|
60
|
+
- `{{SKILLS_ROOT}}/guardlink-annotate-diff/SKILL.md` — the playbook for a change's gaps; `{{SKILLS_ROOT}}/guardlink-annotate-exploitable/SKILL.md` for the evidence bar. guardlink writes both under `.claude/skills/`, and `bravos setup` mirrors them into `.agents/skills/` for Codex; otherwise `guardlink annotate --stdout --playbook <id> "<scope>"` prints the same method.
|