agjan 0.0.3 → 0.0.5

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/docs/guide.md CHANGED
@@ -150,7 +150,7 @@ lists replace. The schema is `node_modules/agjan/schemas/config.schema.json`.
150
150
  "verify": { "cap": { "test": "npm test", "results": "reports/junit.xml" } },
151
151
  "fix": { "max_total": 80, "max_per_file": 50 },
152
152
  "review": { "build": "area" },
153
- "models": { "claude-code": { "balanced": "sonnet", "deep": "opus" } },
153
+ "models": { "claude-code": { "balanced": "session", "deep": "opus" }, "copilot": { "balanced": "session", "deep": "session" } },
154
154
  "mcp": { "servers": { "ui5": { "enabled": false } } },
155
155
  "ci": { "policy_changes": "warn", "untracked_changes": "fail" }
156
156
  }
@@ -173,7 +173,7 @@ lists replace. The schema is `node_modules/agjan/schemas/config.schema.json`.
173
173
  | `build.fix_attempts` | attempts for failing deterministic checks before the agent stops (default 3) |
174
174
  | `language` | language of the documents' text (default `en`); headings, ids and keywords stay English |
175
175
  | `limits.spec_kb`, `limits.design_kb` | soft size limits; `check` warns above them (defaults 12 and 20 KB; design covers `design.md` and `tasks.md`) |
176
- | `models.<host>.<tier>` | model of the reviewer agents per tier (`balanced`, `deep`) |
176
+ | `models.<host>.<tier>` | model of the reviewer agents per tier (`balanced`, `deep`); `"session"` (the default, written by `init` so you see it) runs the reviewer on the model of the session that starts it. Model names differ per host (Claude Code: `sonnet`, `opus`; Copilot: for example `claude-opus-5.5`). `doctor` shows what each reviewer runs on |
177
177
  | `mcp.servers.<name>` | documentation MCP servers: `command`, `args`, `env`, `areas`, `enabled` |
178
178
  | `ci.policy_changes`, `ci.untracked_changes` | `warn` or `fail` in `check --ci` |
179
179
 
@@ -214,6 +214,13 @@ settings remove the routine prompts without giving up control:
214
214
  edit prompt with "don't ask again for file operations in this repo". agjan's scope
215
215
  check, the pre-commit hook and the reviewer cover what the agent changes.
216
216
 
217
+ **Script edits are denied.** Agents sometimes edit files with small scripts
218
+ (`python3 - <<EOF … open(p, 'w')`, `sed -i`, `cat > file <<EOF`) instead of their edit
219
+ tool. Such an edit fails silently when the text it replaces does not match, and you do
220
+ not see the change. agjan's guard denies these commands and tells the agent to use its
221
+ edit tool; reading (`cat`, `sed -n`, `grep`) and running project scripts stay allowed.
222
+ Set `agent.script_edits` to `"allow"` in `agjan.config.json` to turn this off.
223
+
217
224
  Copilot keeps your own "don't ask again" answers per folder in
218
225
  `~/.copilot/permissions-config.json`; that file is personal and not part of the project.
219
226
 
@@ -5,6 +5,10 @@
5
5
  * `cd … &&`, `node …/agjan.mjs`). It is a guardrail in front of the terminal
6
6
  * confirmation, not a proof (design 9.4).
7
7
  *
8
+ * It denies file edits by shell or script commands (python/node scripts that write files,
9
+ * sed -i, cat > file, …) so that agents use their file edit tool, unless the project sets
10
+ * `agent.script_edits` to "allow" (design decision 63).
11
+ *
8
12
  * It also approves, without a prompt, shell commands the project lists in `agent.allow`
9
13
  * of agjan.config.json (opt-in, design decision 61): a single simple command that starts
10
14
  * with a listed command. Anything with `;`, `&&`, `|`, `$(…)`, backticks or redirections is
@@ -44,6 +48,33 @@ const BRANCH_CREATE = new RegExp(
44
48
  String.raw`|worktree\s+add\s+(?:\S+\s+)*?-[bB]\b)`,
45
49
  );
46
50
 
51
+ const EDIT_REASON =
52
+ 'Edit files with your file edit tool, not with shell or script commands: the edit tool shows the change to the user and fails visibly when the text to replace does not match. If you have no edit tool, ask the user.';
53
+
54
+ /**
55
+ * Shell commands that write files as a script (design decision 63): interpreter scripts
56
+ * that open files for writing, in-place stream edits, and cat/echo/printf/tee into a file.
57
+ * Reading (cat file, sed -n, grep, running a project script) is not matched.
58
+ */
59
+ const SCRIPT_EDITS = [
60
+ // python3 - <<EOF … / python -c "…" that writes a file (the script is inside quotes or a heredoc)
61
+ (c) => /\bpython[0-9.]*\b/.test(c) && /(<<|\s-c\s)/.test(c) && /open\([^,)]*,\s*(?:mode\s*=\s*)?['"][wax]b?\+?['"]|\.write_(text|bytes)\(/.test(c),
62
+ // node -e / node <<EOF that writes a file
63
+ (c) => /\bnode\b/.test(c) && /(<<|\s(-e|--eval|-p|--print)\s)/.test(c) && /\b(writeFileSync|appendFileSync|writeFile|appendFile|createWriteStream)\b/.test(c),
64
+ // The rest looks at the command line itself, with quoted text (messages, patterns) masked.
65
+ (c) => /\bsed\s+(?:[^|;&]*\s)?(?:-[a-zA-Z]*i\b|--in-place)/.test(unquoted(c)),
66
+ (c) => /\bperl\s+(?:[^|;&]*\s)?-[a-zA-Z]*i/.test(unquoted(c)),
67
+ // cat / echo / printf redirected into a file (not /dev/null, not 2>&1)
68
+ (c) => /\b(cat|echo|printf)\b[^|;&]*?(?<![0-9&])>>?\s*(?!&|\/dev\/null\b)[\w./~-]/.test(unquoted(c)),
69
+ // tee into a file
70
+ (c) => /\btee\s+(?:-a\s+)?(?!\/dev\/)[\w./~]/.test(unquoted(c)),
71
+ ];
72
+
73
+ /** The command with every quoted string replaced by Q, so quoted text is not read as syntax. */
74
+ function unquoted(command) {
75
+ return command.replace(/'[^']*'|"(?:[^"\\]|\\.)*"/g, 'Q');
76
+ }
77
+
47
78
  /** Characters that chain, substitute or redirect: such commands are never auto-approved. */
48
79
  const COMPOUND = /[;&|`$<>(){}\n\r]/;
49
80
 
@@ -74,6 +105,7 @@ export function decide(payload, config = {}) {
74
105
  if (typeof command !== 'string') return null;
75
106
  if (HUMAN_ONLY.test(command)) return answer(payload, 'deny', REASON);
76
107
  if (config?.git?.branch?.create === 'confirm' && BRANCH_CREATE.test(command)) return answer(payload, 'deny', BRANCH_REASON);
108
+ if (config?.agent?.script_edits !== 'allow' && SCRIPT_EDITS.some((matches) => matches(command))) return answer(payload, 'deny', EDIT_REASON);
77
109
  const allow = config?.agent?.allow ?? [];
78
110
  const shell = /^(bash|powershell|shell)$/i.test(payload.toolName ?? payload.tool_name ?? '');
79
111
  if (shell && allowed(command, allow)) return answer(payload, 'allow', 'listed in agent.allow of agjan.config.json');
@@ -28,6 +28,10 @@ Default messages use the codes `ASSERT_MANDATORY`, `ASSERT_RANGE`, `ASSERT_ENUM`
28
28
 
29
29
  ## Authorization
30
30
 
31
+ - A service, entity or operation without `@requires` or `@restrict` is open to every
32
+ user, anonymous requests included (CAP does not restrict services by default). Every
33
+ entity and operation the spec's roles cover needs one, and tests for a user without
34
+ the role (403) and an anonymous request (401).
31
35
  - `@requires: 'Role'` (or a list, meaning any of them) on a service, entity or
32
36
  operation. Pseudo roles: `authenticated-user`, `system-user`, `any`. A service with
33
37
  `@requires` also protects its `$metadata` and service root.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agjan",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "Spec-driven workflow kit for AI coding agents, with human approval gates and a read-only reviewer at every step.",
5
5
  "keywords": [
6
6
  "ai",
@@ -67,7 +67,11 @@
67
67
  },
68
68
  "additionalProperties": false
69
69
  },
70
- "models": { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "string" } } },
70
+ "models": {
71
+ "description": "Reviewer agent models per host and tier (balanced, deep). 'session' runs the reviewer on the model of the session that starts it.",
72
+ "type": "object",
73
+ "additionalProperties": { "type": "object", "additionalProperties": { "type": "string" } }
74
+ },
71
75
  "mcp": {
72
76
  "type": "object",
73
77
  "properties": {
@@ -96,6 +100,10 @@
96
100
  "description": "Shell commands agents may run without a prompt (the agjan guard hook approves a single simple command starting with an entry). agjan approve, accept and reject are always denied.",
97
101
  "type": "array",
98
102
  "items": { "type": "string", "minLength": 1 }
103
+ },
104
+ "script_edits": {
105
+ "description": "Whether agents may edit files with shell or script commands (python/node scripts that write files, sed -i, cat > file, tee). Default 'deny': the agjan guard hook sends them to their file edit tool.",
106
+ "enum": ["deny", "allow"]
99
107
  }
100
108
  },
101
109
  "additionalProperties": false
@@ -1,5 +1,6 @@
1
1
  import { stringify as toYaml } from 'yaml';
2
2
  import { skillBody } from '../managed.mjs';
3
+ import { agentModel } from '../config.mjs';
3
4
 
4
5
  /**
5
6
  * Claude Code adapter (design 13): the generated reviewer agents and the deny rules for
@@ -8,7 +9,8 @@ import { skillBody } from '../managed.mjs';
8
9
  */
9
10
 
10
11
  export const HOST = 'claude-code';
11
- export const DEFAULT_MODELS = { fast: 'haiku', balanced: 'sonnet', deep: 'opus' };
12
+ /** The models earlier versions used when none were configured; `sync` writes them for such projects. */
13
+ export const LEGACY_MODELS = { balanced: 'sonnet', deep: 'opus' };
12
14
 
13
15
  /** One agent per reviewer tier; workflow skills pick the tier per step (design 7.3). */
14
16
  const REVIEWERS = [
@@ -65,7 +67,7 @@ function reviewerAgent(name, tier, model, skill) {
65
67
  `agjan's read-only reviewer (${tier} tier). Use only when an agjan workflow skill asks for the ` +
66
68
  'review of a step; it records its result itself.',
67
69
  tools: 'Read, Grep, Glob, mcp__agjan__review_context, mcp__agjan__review_record',
68
- model,
70
+ ...(model ? { model } : {}),
69
71
  // Scoped to this agent only: the writer session must not have review_record.
70
72
  mcpServers: [
71
73
  {
@@ -89,12 +91,12 @@ function reviewerAgent(name, tier, model, skill) {
89
91
 
90
92
  /** The plan items this adapter contributes. */
91
93
  export function plan(config, skills) {
92
- const models = { ...DEFAULT_MODELS, ...(config.models?.[HOST] ?? {}) };
94
+
93
95
  const skill = skills['solution-reviewer/SKILL.md'];
94
96
  const items = REVIEWERS.map(({ name, tier }) => ({
95
97
  kind: 'file',
96
98
  path: `.claude/agents/${name}.md`,
97
- content: reviewerAgent(name, tier, models[tier], skill),
99
+ content: reviewerAgent(name, tier, agentModel(config, HOST, tier), skill),
98
100
  }));
99
101
  items.push({
100
102
  kind: 'json',
@@ -1,5 +1,6 @@
1
1
  import { stringify as toYaml } from 'yaml';
2
2
  import { skillBody } from '../managed.mjs';
3
+ import { agentModel } from '../config.mjs';
3
4
 
4
5
  /**
5
6
  * GitHub Copilot adapter (design 13), verified with the Copilot CLI
@@ -16,8 +17,8 @@ export const HOST = 'copilot';
16
17
  export const HOOK_FILE = '.github/hooks/agjan-guard.json';
17
18
  export const GUARD = 'node_modules/agjan/kit/hooks/guard.mjs';
18
19
 
19
- /** Copilot model names differ from Claude Code's; unset means the session's model. */
20
- export const DEFAULT_MODELS = {};
20
+ /** The models earlier versions used when none were configured: the session's model. */
21
+ export const LEGACY_MODELS = {};
21
22
 
22
23
  const REVIEWERS = [
23
24
  { name: 'agjan-reviewer', tier: 'balanced' },
@@ -76,12 +77,12 @@ export function hookConfig() {
76
77
 
77
78
  /** The plan items this adapter contributes. */
78
79
  export function plan(config, skills) {
79
- const models = { ...DEFAULT_MODELS, ...(config.models?.[HOST] ?? {}) };
80
+
80
81
  const skill = skills['solution-reviewer/SKILL.md'];
81
82
  const items = REVIEWERS.map(({ name, tier }) => ({
82
83
  kind: 'file',
83
84
  path: `.github/agents/${name}.agent.md`,
84
- content: reviewerAgent(name, tier, models[tier], skill),
85
+ content: reviewerAgent(name, tier, agentModel(config, HOST, tier), skill),
85
86
  }));
86
87
  items.push({ kind: 'file', path: HOOK_FILE, content: hookConfig() });
87
88
  return items;
@@ -4,7 +4,9 @@ import { homedir } from 'node:os';
4
4
  import { join } from 'node:path';
5
5
  import { fileURLToPath } from 'node:url';
6
6
  import { parseArgs } from 'node:util';
7
- import { CONFIG_FILE, RECOMMENDED_ALLOW, loadConfig, loadDomain } from '../config.mjs';
7
+ import { CONFIG_FILE, MODEL_TIERS, RECOMMENDED_ALLOW, SESSION_MODEL, agentModel, loadConfig, loadDomain } from '../config.mjs';
8
+ import { LEGACY_MODELS as CLAUDE_LEGACY } from '../adapters/claude-code.mjs';
9
+ import { LEGACY_MODELS as COPILOT_LEGACY } from '../adapters/copilot.mjs';
8
10
  import { readJson, writeJson } from '../json-file.mjs';
9
11
  import { applyPlan, planStatus } from '../managed.mjs';
10
12
  import { ADAPTERS, buildPlan, unsupportedHosts } from '../plan.mjs';
@@ -44,16 +46,42 @@ function printResults(ctx, results) {
44
46
  if (unchanged) ctx.out(s.gray(` ${unchanged} file(s) unchanged`));
45
47
  }
46
48
 
49
+ const ADAPTER_LEGACY_MODELS = { 'claude-code': CLAUDE_LEGACY, copilot: COPILOT_LEGACY };
50
+
51
+ /**
52
+ * Missing `models.<host>` entries for the configured hosts, so the reviewer models are
53
+ * visible in agjan.config.json. New projects get "session"; a project from an earlier
54
+ * version gets what it used implicitly (Claude Code: sonnet and opus), so nothing changes.
55
+ */
56
+ function missingModels(raw, hosts, { existing }) {
57
+ const added = {};
58
+ for (const host of hosts) {
59
+ if (raw.models?.[host]) continue;
60
+ const legacy = existing ? ADAPTER_LEGACY_MODELS[host] ?? {} : {};
61
+ added[host] = Object.fromEntries(MODEL_TIERS.map((tier) => [tier, legacy[tier] ?? SESSION_MODEL]));
62
+ }
63
+ return added;
64
+ }
65
+
47
66
  /** Writes the managed files for the current configuration and updates the recorded kit version. */
48
67
  function doSync(ctx, { force }) {
49
68
  const config = loadConfig(ctx.root);
50
69
  for (const host of unsupportedHosts(config)) ctx.err(`agjan: host '${host}' has no adapter in this version; skipped`);
51
- const results = applyPlan(ctx.root, buildPlan(config), { kit: ctx.kit, force });
52
70
  const file = join(ctx.root, CONFIG_FILE);
53
71
  const raw = readJson(file) ?? {};
54
- if (raw.kit !== ctx.kit) {
55
- writeJson(file, { ...raw, kit: ctx.kit });
56
- results.push({ path: CONFIG_FILE, action: raw.kit ? `kit ${raw.kit} -> ${ctx.kit}` : `kit ${ctx.kit}` });
72
+ const added = missingModels(raw, config.hosts, { existing: Boolean(raw.models) || raw.kit !== ctx.kit });
73
+ if (Object.keys(added).length) {
74
+ writeJson(file, { ...raw, models: { ...(raw.models ?? {}), ...added } });
75
+ config.models = { ...(config.models ?? {}), ...added };
76
+ }
77
+ const results = applyPlan(ctx.root, buildPlan(config), { kit: ctx.kit, force });
78
+ for (const [host, tiers] of Object.entries(added)) {
79
+ results.push({ path: CONFIG_FILE, action: `models.${host}: ${MODEL_TIERS.map((t) => `${t}=${tiers[t]}`).join(', ')}` });
80
+ }
81
+ const current = readJson(file) ?? {};
82
+ if (current.kit !== ctx.kit) {
83
+ writeJson(file, { ...current, kit: ctx.kit });
84
+ results.push({ path: CONFIG_FILE, action: current.kit ? `kit ${current.kit} -> ${ctx.kit}` : `kit ${ctx.kit}` });
57
85
  }
58
86
  return results;
59
87
  }
@@ -90,6 +118,7 @@ export async function init(ctx, argv) {
90
118
  domains,
91
119
  hosts,
92
120
  language: values.language ?? 'en',
121
+ models: missingModels({}, hosts, { existing: false }),
93
122
  };
94
123
  if (values.base) config.git = { base: values.base };
95
124
  // Opt-in (design decision 61): asked once; without a terminal, nothing is allowed.
@@ -267,6 +296,8 @@ export function doctor(ctx) {
267
296
  }
268
297
  const allow = config.agent?.allow ?? [];
269
298
  ok('agent allow list', allow.length ? `${allow.length} command(s) without a prompt: ${allow.join(', ')}` : 'none (the hosts ask for every command)');
299
+ ok('reviewer models', config.hosts.map((h) => `${h}: ${MODEL_TIERS.map((t) => `${t} ${agentModel(config, h, t) ?? 'session model'}`).join(', ')}`).join('; '));
300
+ ok('script edits', config.agent?.script_edits === 'allow' ? 'allowed (agent.script_edits)' : 'denied by the guard: agents edit files with their edit tool');
270
301
  const ignored = git(root, ['check-ignore', '-q', '.agjan/x'], { allowFail: true }) !== null;
271
302
  if (!ignored) warn('.gitignore', '.agjan/ is not ignored; run: npx agjan sync');
272
303
  }
@@ -28,7 +28,7 @@ function reviewNext(ctx, feature, step) {
28
28
  if (state.exhausted) {
29
29
  return `the ${step} review is still blocked after ${state.round} of ${state.limit} rounds: stop and hand over to the human (fix with them, accept findings, or change the documents)`;
30
30
  }
31
- const round = state.round ? `, round ${state.round + 1} of ${state.limit}` : '';
31
+ const round = state.round ? `, round ${state.next} of ${state.limit}` : '';
32
32
  return `review step ${step} with ${reviewerFor(ctx.config, step)}${round}`;
33
33
  }
34
34
 
package/src/config.mjs CHANGED
@@ -12,6 +12,20 @@ const KIT_DIR = new URL('../kit/', import.meta.url);
12
12
  */
13
13
  export const RECOMMENDED_ALLOW = ['npx agjan', 'npm test', 'git status', 'git diff', 'git log', 'git add', 'git commit'];
14
14
 
15
+ /**
16
+ * Reviewer models (`models.<host>.<tier>`). "session" means the reviewer agent runs on the
17
+ * model of the session that starts it: no model is written into the agent file. `init`
18
+ * writes this default visibly for every host, so users notice it and can change it.
19
+ */
20
+ export const SESSION_MODEL = 'session';
21
+ export const MODEL_TIERS = ['balanced', 'deep'];
22
+
23
+ /** The model to write into an agent file, or undefined for the session's model. */
24
+ export function agentModel(config, host, tier) {
25
+ const value = config.models?.[host]?.[tier] ?? config.models?.[host]?.balanced;
26
+ return value && value !== SESSION_MODEL ? value : undefined;
27
+ }
28
+
15
29
  /** Package defaults. Domain defaults and project overrides are layered on top. */
16
30
  const DEFAULTS = {
17
31
  domains: ['btp'],
@@ -38,6 +38,32 @@ export function fixAttempts(config) {
38
38
  return config.build?.fix_attempts ?? 3;
39
39
  }
40
40
 
41
+ /** The gate approvals that close a correction loop of a review step. */
42
+ const CLOSING_APPROVALS = { spec: ['spec'], design: ['design'], 'design:light': ['spec', 'design'] };
43
+
44
+ /**
45
+ * The round the next review of `step` gets (design 7.4). Rounds count within one
46
+ * correction loop: a loop ends with a review without findings (`pass`), with the gate's
47
+ * approval after its last review, or, for build steps, with a passing verify review after
48
+ * it. A later change, for example after the human's Gate 3 review, starts a new loop at
49
+ * round 1.
50
+ */
51
+ export function nextRound(feature, step) {
52
+ const records = feature.reviews.records.filter((r) => r.step === step);
53
+ const approvals = (CLOSING_APPROVALS[step] ?? []).map((gate) => feature.approvals.approvals[gate]?.at_utc).filter(Boolean);
54
+ if (step.startsWith('build:')) {
55
+ const verified = feature.reviews.records.filter((r) => r.step === 'verify' && !stillBlocked(feature, r));
56
+ approvals.push(...verified.map((r) => r.at_utc));
57
+ }
58
+ let round = 1;
59
+ for (let i = records.length - 1; i >= 0; i--) {
60
+ const r = records[i];
61
+ if (r.verdict === 'pass' || approvals.some((at) => at >= r.at_utc)) break;
62
+ round += 1;
63
+ }
64
+ return round;
65
+ }
66
+
41
67
  /**
42
68
  * The state of one review step: its latest round and verdict, and whether the round limit
43
69
  * is reached with the step still blocked (design 7.4: stop and hand over to the human).
@@ -47,5 +73,5 @@ export function roundState(feature, config, step) {
47
73
  const last = records.at(-1) ?? null;
48
74
  const limit = roundLimit(config);
49
75
  const round = last?.round ?? 0;
50
- return { last, round, limit, exhausted: stillBlocked(feature, last) && round >= limit };
76
+ return { last, round, next: nextRound(feature, step), limit, exhausted: stillBlocked(feature, last) && round >= limit };
51
77
  }
package/src/review.mjs CHANGED
@@ -13,6 +13,7 @@ import { watchedHashes } from './baseline.mjs';
13
13
  import { acResults, loadResults, resultLabel } from './test-results.mjs';
14
14
  import { LOG_FILE, appendLog } from './log.mjs';
15
15
  import { AgjanError } from './errors.mjs';
16
+ import { nextRound } from './review-policy.mjs';
16
17
  import { designProblems, documentProblems } from './validate.mjs';
17
18
 
18
19
  export const REVIEW_MD = 'review.md';
@@ -138,11 +139,11 @@ function openFindings(feature, steps) {
138
139
  const CHECKLISTS = {
139
140
  spec: 'No unrequested technical decisions. Technical questions listed under Open technical questions are expected and are not decisions: never ask to remove that section; Design answers them. Every AC testable and complete; an AC without a Verification line is automated, which is the default and not a finding; flag only ACs that cannot be tested automatically but are not marked manual. Non-functional and authorization requirements considered. Scope consistent.',
140
141
  'design:light': 'The spec checks, plus: light mode is justified (nothing new: no new service, application, BTP service, authorization or deployment change). Tasks: paths plausible, every AC covered.',
141
- design: 'Every AC covered by tasks. Areas and app types justified with alternatives. Open technical questions answered. Nothing beyond the spec.',
142
- build: 'Each covered AC is met by the diff. Tests exist and carry the AC id in their names. Project conventions. Security basics (authorization, input validation, no secrets; test or mocked users and other development settings only in a development profile, never active in production). Scope is checked by agjan: a file under the allowed paths (task, implicit or amended) is in scope; do not report it as out of scope.',
142
+ design: 'Every AC covered by tasks. Areas and app types justified with alternatives. Open technical questions answered. Every rule of the spec\'s Authorization section has a decision on how it is enforced. Nothing beyond the spec.',
143
+ build: 'Each covered AC is met by the diff. Tests exist and carry the AC id in their names. Project conventions. The spec\'s Authorization section, rule by rule: each role and permission is enforced in the code (for example @requires or @restrict on every entity and operation it covers; anything without them is open to every user, anonymous requests included) and covered by tests, including a negative test for a user without the role and for an anonymous request. Security basics (authorization, input validation, no secrets; test or mocked users and other development settings only in a development profile, never active in production). Scope is checked by agjan: a file under the allowed paths (task, implicit or amended) is in scope; do not report it as out of scope.',
143
144
  fix: 'The change does exactly what the fix description says and nothing else. It is correct and complete. A test covers it where practical. No hidden scope: anything that changes behaviour beyond the description, or needs a business decision, is a blocker (it belongs in /agjan-spec).',
144
145
  map: 'Every claim in project.md is traceable to the files it points to. Services, applications and BTP services are complete. The do-not-touch list is plausible and uses real paths. Short: one to two pages, pointers instead of copies.',
145
- verify: 'Cross-task consistency. Every AC covered by a passing test or marked manual. Scope is checked by agjan: a file under the allowed paths (task, implicit or amended) is in scope; do not report it as out of scope. The baseline (project.md) updated if a service, application or BTP service was added. Do not re-review each task.',
146
+ verify: 'Cross-task consistency. Every AC covered by a passing test or marked manual. The spec\'s Authorization section, rule by rule: each role and permission is enforced in the code (for example @requires or @restrict on every entity and operation it covers; anything without them is open to every user, anonymous requests included) and covered by tests, including a negative test for a user without the role and for an anonymous request. Scope is checked by agjan: a file under the allowed paths (task, implicit or amended) is in scope; do not report it as out of scope. The baseline (project.md) updated if a service, application or BTP service was added. Do not re-review each task.',
146
147
  };
147
148
 
148
149
  /**
@@ -350,7 +351,7 @@ export function recordReview(root, config, { context_id: contextId, verdict, fin
350
351
  const record = {
351
352
  id: `${feature.key}-R${records.length + 1}`,
352
353
  step: meta.step,
353
- round: records.filter((r) => r.step === meta.step).length + 1,
354
+ round: nextRound(feature, meta.step),
354
355
  at_utc: now(),
355
356
  reviewer: { host, model: null, isolation },
356
357
  context: contextId,