agjan 0.0.27 → 0.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/teams.js CHANGED
@@ -3,6 +3,7 @@ import { join } from 'node:path';
3
3
  import { hashText } from './hash.js';
4
4
  import { AgjanError } from './errors.js';
5
5
  import { WORKFLOWS } from './workflow.js';
6
+ import { baseOf } from './customization.js';
6
7
  export const ROLES = ['implementer', 'reviewer', 'tester', 'analyst'];
7
8
  export const ROLE_AGENTS = ['main', 'reviewer', 'qa'];
8
9
  /** The agent each built-in role reaches; implementer and analyst are the main agent in different workflows. */
@@ -72,12 +73,26 @@ export function personasFor(config, team, kind, agent) {
72
73
  }
73
74
  return out;
74
75
  }
75
- /** The default team of a workflow: the project's choice (`team.<kind>`), else the first that serves it. */
76
- export function defaultTeam(config, kind) {
77
- const chosen = config.team?.[kind];
76
+ /**
77
+ * The default team of a workflow: the project's choice (`team.<workflow>`), else the first
78
+ * that serves it; a workflow of the project's own falls back to its base's default.
79
+ */
80
+ export function defaultTeam(config, workflow) {
81
+ const chosen = config.team?.[workflow];
78
82
  if (chosen)
79
83
  return chosen;
80
- return Object.entries(allTeams(config)).find(([, t]) => t.workflows.includes(kind))?.[0] ?? null;
84
+ const serving = Object.entries(allTeams(config)).find(([, t]) => t.workflows.includes(workflow))?.[0];
85
+ if (serving)
86
+ return serving;
87
+ const base = baseOf(config, workflow);
88
+ return base && base !== workflow ? defaultTeam(config, base) : null;
89
+ }
90
+ /** Whether a team serves a workflow: by name, or, for a workflow of the project's own, its base. */
91
+ export function serves(config, team, workflow) {
92
+ if (team.workflows.includes(workflow))
93
+ return true;
94
+ const base = baseOf(config, workflow);
95
+ return Boolean(base && base !== workflow && team.workflows.includes(base));
81
96
  }
82
97
  /** JSON with the keys of every object sorted: the same definition always gives the same text. */
83
98
  function canonical(value) {
@@ -102,10 +117,10 @@ export function teamProblems(root, config, name, kind) {
102
117
  if (!team.workflows?.length)
103
118
  problems.push(`team '${name}' serves no workflow`);
104
119
  for (const w of team.workflows ?? [])
105
- if (!WORKFLOWS[w])
120
+ if (!baseOf(config, w))
106
121
  problems.push(`team '${name}': unknown workflow '${w}'`);
107
- if (kind && !team.workflows?.includes(kind))
108
- problems.push(`team '${name}' does not serve the ${WORKFLOWS[kind].name} workflow (it serves: ${team.workflows.join(', ')})`);
122
+ if (kind && !serves(config, team, kind))
123
+ problems.push(`team '${name}' does not serve the ${WORKFLOWS[kind]?.name ?? kind} workflow (it serves: ${team.workflows.join(', ')})`);
109
124
  const custom = Object.keys(config.roles ?? {});
110
125
  for (const [role, ref] of Object.entries(definition.personas ?? {})) {
111
126
  const agent = roleAgent(config, role);
@@ -118,7 +133,7 @@ export function teamProblems(root, config, name, kind) {
118
133
  problems.push(`team '${name}', ${role}: no skill '${skill}' in .claude/skills/`);
119
134
  }
120
135
  // A role whose agent has no step in any of the team's workflows would never be used.
121
- if (agent && !ROLES.includes(role) && !(team.workflows ?? []).some((w) => WORKFLOWS[w]?.track.some((t) => t.steps.some((s) => s.actor === agent)))) {
136
+ if (agent && !ROLES.includes(role) && !(team.workflows ?? []).some((w) => WORKFLOWS[baseOf(config, w) ?? '']?.track.some((t) => t.steps.some((s) => s.actor === agent)))) {
122
137
  problems.push(`team '${name}', ${role}: its agent (${agent}) has no step in ${team.workflows.join(', ')}`);
123
138
  }
124
139
  }
@@ -126,7 +141,7 @@ export function teamProblems(root, config, name, kind) {
126
141
  if (ROLES.includes(role))
127
142
  problems.push(`roles: '${role}' is a built-in role`);
128
143
  for (const w of team.workflows ?? []) {
129
- for (const role of ROLES_OF[w] ?? []) {
144
+ for (const role of ROLES_OF[baseOf(config, w) ?? ''] ?? []) {
130
145
  if (!team.personas?.[role]?.skills?.length)
131
146
  problems.push(`team '${name}' serves ${w} but has no ${role} with skills`);
132
147
  }
@@ -161,11 +176,11 @@ export function unitTeam(config, recorded) {
161
176
  * it does not exist or does not serve the workflow; missing skills are `check`'s to report
162
177
  * (`agjan sync` installs the built-in ones).
163
178
  */
164
- export function chooseTeam(root, config, kind, explicit) {
165
- const name = explicit ?? defaultTeam(config, kind);
179
+ export function chooseTeam(root, config, workflow, explicit) {
180
+ const name = explicit ?? defaultTeam(config, workflow);
166
181
  if (!name)
167
182
  return null;
168
- const problems = teamProblems(root, config, name, kind).filter((p) => !p.includes('in .claude/skills/'));
183
+ const problems = teamProblems(root, config, name, workflow).filter((p) => !p.includes('in .claude/skills/'));
169
184
  if (problems.length)
170
185
  throw new AgjanError(problems.join('; '));
171
186
  return { name, hash: teamHash(allTeams(config)[name]) };
@@ -0,0 +1,65 @@
1
+ import { START, extrasOf, workflowNames, baseOf } from './customization.js';
2
+ import { WORKFLOWS } from './workflow.js';
3
+ /**
4
+ * The skill of a workflow of the project's own (decision 95): `agjan sync` writes it to
5
+ * `.claude/skills/agjan-<name>/SKILL.md`, generated from the configuration, so nobody writes
6
+ * agent instructions for it by hand. It follows the base workflow's skill, starts the unit
7
+ * with `--workflow`, and names the workflow's extra review steps and gates and its own review settings.
8
+ */
9
+ export function workflowSkill(config, name) {
10
+ const base = baseOf(config, name);
11
+ if (!base || base === name)
12
+ return null;
13
+ const definition = config.workflows?.[name] ?? {};
14
+ const workflow = WORKFLOWS[base];
15
+ const { reviews, gates } = extrasOf(config, name);
16
+ const what = (definition.description ?? `The ${name} workflow`).replace(/\s+/g, ' ').trim();
17
+ const start = `${START[base]} --workflow ${name}`;
18
+ const lines = [
19
+ '---',
20
+ `name: agjan-${name}`,
21
+ `description: ${what.replace(/[\r\n]/g, ' ')} (the project's own agjan workflow, based on ${workflow.name}).`,
22
+ '---',
23
+ '',
24
+ `# /agjan-${name}`,
25
+ '',
26
+ what,
27
+ '',
28
+ `This is the project's own workflow \`${name}\`, based on agjan's ${workflow.name} workflow. It is generated from \`workflows.${name}\` in \`agjan.config.json\` by \`agjan sync\`; change it there, not here.`,
29
+ '',
30
+ '## How to run it',
31
+ '',
32
+ `Follow the skill of the ${workflow.name} workflow, \`.claude/skills/${workflow.skill}/SKILL.md\` (read it now), step by step, with these changes:`,
33
+ '',
34
+ `1. Start the unit with \`--workflow ${name}\`: \`${start}\`. Everything else it says about starting (the branch, the key, asking the user) stays.`,
35
+ `2. The extra review steps and gates below belong to this workflow. \`npx agjan status\` names each when it is due (\`next\`), and the stage's gate or the acceptance waits for them. \`npx agjan workflow show ${name}\` shows the whole workflow.`,
36
+ ];
37
+ const review = Object.entries(definition.review ?? {}).map(([key, value]) => (typeof value === 'object' ? Object.entries(value).map(([k, v]) => `${key}.${k} ${v}`).join(', ') : `${key} ${value}`));
38
+ if (review.length) {
39
+ lines.push(`3. This workflow has review settings of its own (\`workflows.${name}.review\`: ${review.join(', ')}). Where the ${workflow.name} skill speaks of the project's \`review\` settings (round limits, tiers, QA), its units use these instead; follow the reviewer agent and the round limit that \`npx agjan status\` names for each review.`);
40
+ }
41
+ lines.push('');
42
+ if (reviews.length) {
43
+ lines.push('## Extra review steps', '');
44
+ for (const r of reviews)
45
+ lines.push(`- \`${r.id}\`, in the ${r.stage} stage: ${r.description.replace(/\s+/g, ' ')}`);
46
+ lines.push('', `Run an extra review step like the stage's own review: when all your edits are saved (and, after Build, committed), delegate, on its own, to the reviewer agent that \`npx agjan status\` names for it, with the prompt \`Review step <step> of <the unit's kind> <slug>.\`; read the result with \`npx agjan review show\`, show the user \`npx agjan review report\`, and fix its blockers within the round limit, as for the stage's own review.`, '');
47
+ }
48
+ if (gates.length) {
49
+ lines.push('## Extra gates', '');
50
+ for (const g of gates)
51
+ lines.push(`- \`${g.id}\`, in the ${g.stage} stage: ${g.description.replace(/\s+/g, ' ')}`);
52
+ lines.push('', 'An extra gate is the user\'s decision. When `npx agjan status` names it, request it (`npx agjan log --gate-requested <gate> --message "<commit message>"`) and ask the user to run `npx agjan approve <gate>` in a terminal; never run it yourself. Continue after the approval.', '');
53
+ }
54
+ return `${lines.join('\n').trimEnd()}\n`;
55
+ }
56
+ /** The generated skills of the project's own workflows, as { 'agjan-<name>/SKILL.md': content }. */
57
+ export function workflowSkillFiles(config) {
58
+ const out = {};
59
+ for (const name of workflowNames(config)) {
60
+ const text = workflowSkill(config, name);
61
+ if (text)
62
+ out[`agjan-${name}/SKILL.md`] = text;
63
+ }
64
+ return out;
65
+ }
@@ -1,5 +1,7 @@
1
1
  import { BUILT_IN_TEAMS, allTeams, defaultTeam, mainRole, personasFor, teamProblems } from './teams.js';
2
- import { DEFAULT_TIERS, reviewerFor, roundLimit, stepKind } from './review-policy.js';
2
+ import { resolveBuild, resolveQa, resolveRounds, resolveTier, reviewerFor } from './review-policy.js';
3
+ import { baseOf, extrasOf } from './customization.js';
4
+ import { AgjanError } from './errors.js';
3
5
  import { WORKFLOWS } from './workflow.js';
4
6
  /** Where a team comes from: agjan, an imported package (`<package>/<team>`), or the project's configuration. */
5
7
  export function teamSource(config, name) {
@@ -7,17 +9,40 @@ export function teamSource(config, name) {
7
9
  return 'imported';
8
10
  return BUILT_IN_TEAMS[name] && !config.teams?.[name] ? 'built-in' : 'project';
9
11
  }
12
+ /** The track stage an extra of `stage` shows in: the stage itself for a feature; the review (or approval) stage otherwise. */
13
+ function trackStage(kind, stage, gate) {
14
+ if (kind === 'feature')
15
+ return stage.charAt(0).toUpperCase() + stage.slice(1);
16
+ return kind === 'discovery' && gate ? 'Approval' : 'Review';
17
+ }
18
+ /** Persona entries of a role list as the JSON gives them. */
19
+ function personaEntries(config, personas) {
20
+ return personas.map(({ role, persona }) => ({
21
+ role,
22
+ ...(config.roles?.[role]?.description ? { description: config.roles[role].description } : {}),
23
+ skills: persona.skills,
24
+ ...(persona.instructions ? { instructions: persona.instructions } : {}),
25
+ }));
26
+ }
10
27
  /**
11
- * The workflow `kind` with the team named (else its default) and, for a feature, the full or
12
- * the light track (full by default).
28
+ * A workflow (built-in, or the project's own on a built-in base, decision 95) with the team
29
+ * named (else its default) and, for a feature, the full or the light track (full by
30
+ * default). The workflow's extra reviews follow the stage's own reviews; its extra gates come
31
+ * before the stage's own gate.
13
32
  */
14
- export function resolveWorkflow(root, config, kind, options = {}) {
33
+ export function resolveWorkflow(root, config, workflowName, options = {}) {
34
+ const kind = baseOf(config, workflowName);
35
+ if (!kind)
36
+ throw new AgjanError(`no workflow '${workflowName}'`);
15
37
  const workflow = WORKFLOWS[kind];
38
+ const own = workflowName !== kind;
16
39
  const mode = kind === 'feature' ? (options.light ? 'light' : 'full') : null;
17
- const fallback = defaultTeam(config, kind);
40
+ const fallback = defaultTeam(config, workflowName);
18
41
  const name = options.team ?? fallback;
19
42
  const team = name ? (allTeams(config)[name] ?? null) : null;
20
- const qaOff = config.review?.qa === 'off';
43
+ const qa = resolveQa(config, workflowName);
44
+ const build = resolveBuild(config, workflowName);
45
+ const extras = extrasOf(config, workflowName);
21
46
  const stages = workflow.track.map((stage) => ({
22
47
  name: stage.name,
23
48
  steps: stage.steps
@@ -31,42 +56,83 @@ export function resolveWorkflow(root, config, kind, options = {}) {
31
56
  does: step.does,
32
57
  role: builtIn,
33
58
  persona: builtIn ? (team?.personas[builtIn] ?? null) : null,
34
- personas: personas.map(({ role, persona }) => ({
35
- role,
36
- ...(config.roles?.[role]?.description ? { description: config.roles[role].description } : {}),
37
- skills: persona.skills,
38
- ...(persona.instructions ? { instructions: persona.instructions } : {}),
39
- })),
59
+ personas: personaEntries(config, personas),
40
60
  };
41
61
  if (step.review) {
42
- const kindOfStep = stepKind(step.review);
43
- resolved.agent = reviewerFor(config, step.review);
62
+ resolved.agent = reviewerFor(config, step.review, workflowName);
63
+ const tier = step.review === 'qa' ? { value: 'qa', source: 'default' } : resolveTier(config, step.review, workflowName);
64
+ const rounds = resolveRounds(config, step.review, workflowName);
65
+ const per = step.review === 'build:' ? build : null;
44
66
  resolved.review = {
45
67
  step: step.review,
46
- tier: step.review === 'qa' ? 'qa' : (config.review?.tiers?.[kindOfStep] ?? DEFAULT_TIERS[kindOfStep] ?? 'balanced'),
47
- rounds: roundLimit(config, step.review),
48
- ...(step.review === 'build:' ? { per: config.review?.build === 'task' ? 'task' : 'area' } : {}),
68
+ tier: tier.value,
69
+ rounds: rounds.value,
70
+ ...(per ? { per: per.value } : {}),
71
+ source: { tier: tier.source, rounds: rounds.source, ...(per ? { per: per.source } : {}) },
49
72
  };
50
- if (step.review === 'qa' && qaOff)
51
- resolved.off = 'review.qa is off';
73
+ if (step.review === 'qa' && qa.value === 'off')
74
+ resolved.off = `${qa.source === 'workflow' ? `workflows.${workflowName}.review.qa` : 'review.qa'} is off`;
52
75
  }
53
76
  if (step.gate)
54
77
  resolved.gate = { name: step.gate, command: `npx agjan approve ${step.gate}` };
55
78
  return resolved;
56
79
  }),
57
80
  }));
81
+ // The workflow's extras (decision 95): reviews after the stage's own, gates before its gate.
82
+ for (const r of extras.reviews) {
83
+ const stage = stages.find((st) => st.name === trackStage(kind, r.stage, false));
84
+ if (!stage)
85
+ continue;
86
+ const role = r.role ?? 'reviewer';
87
+ const persona = team?.personas[role] ?? null;
88
+ const step = {
89
+ actor: 'reviewer',
90
+ agent: reviewerFor(config, r.id, workflowName),
91
+ does: r.description,
92
+ role,
93
+ persona,
94
+ personas: role === 'reviewer' && team ? personaEntries(config, personasFor(config, team, kind, 'reviewer')) : persona ? personaEntries(config, [{ role, persona }]) : [],
95
+ review: ((tier, rounds) => ({ step: r.id, tier: tier.value, rounds: rounds.value, source: { tier: tier.source, rounds: rounds.source } }))(resolveTier(config, r.id, workflowName), resolveRounds(config, r.id, workflowName)),
96
+ extra: true,
97
+ };
98
+ // Right after the stage's reviews (its own, then earlier extras); else before its gate.
99
+ const lastReview = stage.steps.findLastIndex((x) => x.actor === 'reviewer' || x.actor === 'qa');
100
+ const human = stage.steps.findIndex((x) => x.actor === 'human');
101
+ stage.steps.splice(lastReview !== -1 ? lastReview + 1 : human === -1 ? stage.steps.length : human, 0, step);
102
+ }
103
+ for (const g of extras.gates) {
104
+ const stage = stages.find((st) => st.name === trackStage(kind, g.stage, true));
105
+ if (!stage)
106
+ continue;
107
+ const step = { actor: 'human', agent: 'you', does: g.description, role: null, persona: null, personas: [], gate: { name: g.id, command: `npx agjan approve ${g.id}` }, extra: true };
108
+ const human = stage.steps.findIndex((x) => x.actor === 'human' && !x.extra);
109
+ stage.steps.splice(human === -1 ? stage.steps.length : human, 0, step);
110
+ }
58
111
  return {
59
112
  schema: 1,
60
- workflow: { kind, name: workflow.name, skill: `/${workflow.skill}`, end: workflow.end, mode },
113
+ workflow: {
114
+ kind: workflowName,
115
+ base: kind,
116
+ name: own ? workflowName : workflow.name,
117
+ ...(own && config.workflows?.[workflowName]?.description ? { description: config.workflows[workflowName].description } : {}),
118
+ skill: `/agjan-${own ? workflowName : workflow.skill.replace(/^agjan-/, '')}`,
119
+ end: workflow.end,
120
+ mode,
121
+ },
61
122
  team: name
62
123
  ? {
63
124
  name,
64
125
  description: team?.description ?? '',
65
126
  source: teamSource(config, name),
66
127
  default: name === fallback,
67
- problems: teamProblems(root, config, name, kind),
128
+ problems: teamProblems(root, config, name, workflowName),
68
129
  }
69
130
  : null,
131
+ review: {
132
+ rounds: resolveRounds(config, undefined, workflowName),
133
+ ...(kind === 'feature' ? { qa, build } : {}),
134
+ override: { ...(config.workflows?.[workflowName]?.review ?? {}) },
135
+ },
70
136
  stages,
71
137
  controls: workflow.controls,
72
138
  };
package/docs/guide.md CHANGED
@@ -14,6 +14,7 @@ structure around the agents you already use (Claude Code, GitHub Copilot).
14
14
  - [Small changes and existing applications](#small-changes-and-existing-applications)
15
15
  - [Exploring a decision first](#exploring-a-decision-first)
16
16
  - [Teams](#teams)
17
+ - [Your own workflows](#your-own-workflows)
17
18
  - [Asking questions](#asking-questions)
18
19
  - [Commands](#commands)
19
20
  - [Configuration](#configuration)
@@ -520,6 +521,81 @@ fails when an imported file was changed by hand, and CI reports `agjan.imports.j
520
521
  `npx agjan import remove acme` takes everything out, `npx agjan import list` shows what is
521
522
  imported. Agents cannot run `import`.
522
523
 
524
+ ## Your own workflows
525
+
526
+ The built-in workflows keep their steps, but a project can add to them and define workflows of
527
+ its own, under `workflows` in `agjan.config.json`:
528
+
529
+ - **Extra review steps** review what a stage produced (the spec, the design, the build, the whole
530
+ change, the fix, the map, the proposal) with a focus of their own, by the reviewer agent at
531
+ their own tier and round limit, optionally with the persona of one of your roles.
532
+ - **Extra gates** are a person's approval in a terminal (`npx agjan approve <gate>`), stamped like
533
+ the built-in gates: a later change to the stage's documents, or to the files in Build, Verify,
534
+ a fix or a map run, makes the approval stale.
535
+ - **Workflows of your own** run on a built-in one (`base`) with extras of their own: a `hotfix`
536
+ based on `fix`, an `adr` based on `discovery`, a `secure-feature` based on `feature`.
537
+
538
+ ```json
539
+ {
540
+ "workflows": {
541
+ "feature": {
542
+ "gates": [{ "id": "po-signoff", "stage": "spec", "description": "The product owner signs off the spec" }],
543
+ "reviews": [{ "id": "security", "stage": "build", "description": "Check the change against our security standard", "role": "security-reviewer", "tier": "deep" }]
544
+ },
545
+ "hotfix": {
546
+ "base": "fix",
547
+ "description": "An urgent production fix, signed off by the on-call lead",
548
+ "reviews": [{ "id": "ops-check", "stage": "fix", "description": "Check rollback and monitoring" }],
549
+ "gates": [{ "id": "lead-signoff", "stage": "fix", "description": "The on-call lead signs off" }]
550
+ }
551
+ },
552
+ "team": { "hotfix": "ops-team" }
553
+ }
554
+ ```
555
+
556
+ Extras are required where the stage's own requirements are: an extra review or gate of Spec,
557
+ Design or a discovery's proposal before that stage's gate, of Build and Verify before the
558
+ acceptance (`approve verify`), of a fix or a map run in CI. `npx agjan status` names each one when
559
+ it is due; the workflow skills tell the agent to run an extra review like the stage's own and to
560
+ hand an extra gate to you. A workflow of your own is started by name (`npx agjan new <slug> --key
561
+ <KEY> --workflow secure-feature`, `fix start … --workflow hotfix`, `map start --workflow …`,
562
+ `discover start … --workflow adr`); the unit records it. `agjan sync` writes its skill,
563
+ `/agjan-<name>`, generated from the configuration; remove the folder yourself when you remove the
564
+ workflow. Teams serve it by name, else its base's default team works for it.
565
+
566
+ Extras add to a workflow; nothing can remove a built-in step, review, gate or control. Names are
567
+ lowercase letters, digits and `-`, unique across all workflows, and not one of agjan's own
568
+ (`check` reports mistakes). `npx agjan workflow list` and `npx agjan workflow show <workflow>`
569
+ show the result, extras marked.
570
+
571
+ ### Review settings per workflow
572
+
573
+ `workflows.<name>.review` gives one workflow review settings of its own, in the shapes of the
574
+ project's `review`: `rounds`, `step_rounds`, `tiers`, and for a feature-based workflow `qa` and
575
+ `build`. Each one it does not set falls back to the project's `review`, then to agjan's default,
576
+ so a `hotfix` can have fewer rounds and a cheaper reviewer than `fix`:
577
+
578
+ ```json
579
+ {
580
+ "review": { "rounds": 3 },
581
+ "workflows": {
582
+ "hotfix": { "base": "fix", "review": { "rounds": 1, "tiers": { "fix": "fast" } } },
583
+ "feature": { "review": { "qa": "off", "step_rounds": { "design": 5 } } }
584
+ }
585
+ }
586
+ ```
587
+
588
+ A unit uses the settings of the workflow it recorded at its start: `status` names its reviewer
589
+ agent and round limit, and the skills follow `status`. The workflow's settings come before the
590
+ project's: its `step_rounds` for the step, then its `rounds` (an extra review's own `rounds` still
591
+ comes first), then the project's `step_rounds` and `rounds`. Tiers: the workflow's, the project's,
592
+ an extra review's own, the default. A workflow of your own does not take its base's settings
593
+ (`workflows.fix.review` is not `hotfix`'s). Keys of `step_rounds` and `tiers` are the base's
594
+ review steps (`tiers.spec` on a fix-based workflow is a mistake `check` reports), and `qa` and
595
+ `build` exist only on a feature-based one. `npx agjan workflow show <workflow> --json` gives each
596
+ review's resolved tier and rounds with where each comes from (`workflow`, `project` or `default`);
597
+ `models` (per host and tier) stays project-wide.
598
+
523
599
  ## Asking questions
524
600
 
525
601
  **`/agjan-ask`** answers a general question about SAP CAP, Fiori and UI5, SAP BTP,
@@ -623,6 +699,7 @@ is wrong, so a typo is never a silent default.
623
699
  | `review.rounds` | correction rounds per review step (default 3); if blockers remain, the agent asks you whether to run another round (one more per yes, recorded with `npx agjan review extend <step>`) or to stop |
624
700
  | `review.step_rounds.<step>` | the round limit of one kind of review step (`spec`, `design:light`, `design`, `build`, `qa`, `verify`, `fix`, `map`, `proposal`) over `review.rounds`, for example `{ "design": 5 }` |
625
701
  | `review.qa` | `on` (default) or `off`: the QA step in Verify for full-mode features |
702
+ | `workflows.<name>.review` | review settings of one workflow (`rounds`, `step_rounds`, `tiers`, `qa`, `build`) over the project's `review` ([Review settings per workflow](#review-settings-per-workflow)) |
626
703
  | `test_evidence` | `run` (default): CI and the acceptance need a passing `agjan test` run on the change; `names`: a test whose name contains the AC id is enough |
627
704
  | `review.tiers.<step>` | `balanced` or `deep` per step kind (`spec`, `design:light`, `design`, `build`, `verify`, `fix`, `map`); decides which reviewer agent runs it. Defaults: `deep` for `design` and `verify`, else `balanced`; `fast` uses the balanced agent |
628
705
  | `build.fix_attempts` | attempts for failing deterministic checks before the agent stops (default 3) |
@@ -632,6 +709,7 @@ is wrong, so a typo is never a silent default.
632
709
  | `mcp.servers.<name>` | documentation MCP servers: `command`, `args`, `env`, `areas`, `enabled` |
633
710
  | `teams`, `team` | your own teams, and the default team per workflow ([Teams](#teams)) |
634
711
  | `roles`, `personas` | your own roles, each reaching the main agent, the reviewer or the QA agent, and named personas teams refer to ([Teams](#teams)) |
712
+ | `workflows` | extra review steps and gates for the built-in workflows, and workflows of your own based on them ([Your own workflows](#your-own-workflows)) |
635
713
  | `ci.policy_changes`, `ci.untracked_changes` | `warn` or `fail` in `check --ci`; CI reads them from the base branch, so a pull request cannot lower them for itself |
636
714
 
637
715
  `npx agjan status` prints the language, the round limit and the attempts in its first
@@ -15,7 +15,7 @@ shows how to use them.
15
15
 
16
16
  | Term | What it is | Examples | Where it is defined |
17
17
  |---|---|---|---|
18
- | **Workflow** | A kind of work and its fixed steps: stages, independent reviews, the approvals you give, and what it may change. | feature, fix, map, discovery | Built into agjan; a project cannot change it. |
18
+ | **Workflow** | A kind of work and its steps: stages, independent reviews, the approvals you give, and what it may change. | feature, fix, map, discovery; your own, such as a hotfix | Built into agjan; a project adds review steps and gates under `workflows`, and workflows of its own based on a built-in one. |
19
19
  | **Team** | A named group of personas for one or more workflows. It decides the knowledge, never the steps. | sap-delivery, sap-maintenance, sap-discovery | Built into agjan, imported from a package, or in the project's `agjan.config.json`. |
20
20
  | **Persona** | A role inside a team, with the skills (and optional instructions) that role works with. | the reviewer of sap-delivery | Inside its team, or defined once under `personas` in `agjan.config.json` and named by several teams. |
21
21
  | **Skill** | A folder of instructions and references an agent reads for a specialty. | cap-developer, solution-reviewer, qa-tester | `.claude/skills/<name>/SKILL.md`: agjan's own, the project's own, or imported. |
@@ -70,9 +70,13 @@ The rules behind the arrows:
70
70
  - A persona starts no agent of its own. Its skills and instructions go to the agent that
71
71
  already does that job: the main agent, the reviewer or the QA agent.
72
72
  - How many rounds each review gets is a setting: `review.rounds` for all, and
73
- `review.step_rounds` for one kind of step (for example 5 for the design review).
73
+ `review.step_rounds` for one kind of step (for example 5 for the design review). A workflow
74
+ can have its own under `workflows.<name>.review` (rounds, tiers, QA), over the project's.
74
75
  - A team cannot remove a step. Every workflow keeps an independent review, approvals
75
76
  stamped by a script, scope checks, and a person who decides at the end.
77
+ - A project can add extra review steps and gates to a workflow, and define workflows of its
78
+ own on a built-in base (a `hotfix` on `fix`): see [Your own workflows](guide.md#your-own-workflows).
79
+ They add steps; they never remove one.
76
80
 
77
81
  ## The workflows
78
82
 
@@ -15,6 +15,15 @@ your role works with (read them next to the ones this skill names), and each `fo
15
15
  an instruction of your team for you. Follow those instructions; where one conflicts with this
16
16
  skill or with the user, this skill and the user win.
17
17
 
18
+ ## Your workflow's extras
19
+
20
+ The project can add review steps and gates to this workflow (`npx agjan workflow show
21
+ <workflow>` lists them). When `npx agjan status` names a due review step this skill does not
22
+ name, run it like this skill's own reviews: delegate it, on its own, to the reviewer agent
23
+ `status` names, with the prompt `Review step <step> of <the unit's kind> <slug>.`, and fix its
24
+ blockers within the round limit. A gate it names is the user's: request it (`npx agjan log
25
+ --gate-requested <gate>`) and ask them to run `npx agjan approve <gate>` in a terminal.
26
+
18
27
  ## Arriving in auto mode
19
28
 
20
29
  In auto mode you reach this skill from the previous one within one run, through `npx agjan skill build`.
@@ -15,6 +15,15 @@ your role works with (read them next to the ones this skill names), and each `fo
15
15
  an instruction of your team for you. Follow those instructions; where one conflicts with this
16
16
  skill or with the user, this skill and the user win.
17
17
 
18
+ ## Your workflow's extras
19
+
20
+ The project can add review steps and gates to this workflow (`npx agjan workflow show
21
+ <workflow>` lists them). When `npx agjan status` names a due review step this skill does not
22
+ name, run it like this skill's own reviews: delegate it, on its own, to the reviewer agent
23
+ `status` names, with the prompt `Review step <step> of <the unit's kind> <slug>.`, and fix its
24
+ blockers within the round limit. A gate it names is the user's: request it (`npx agjan log
25
+ --gate-requested <gate>`) and ask them to run `npx agjan approve <gate>` in a terminal.
26
+
18
27
  ## Arriving in auto mode
19
28
 
20
29
  In auto mode you reach this skill from the previous one within one run, through `npx agjan skill design`.
@@ -18,6 +18,15 @@ your role works with (read them next to the ones this skill names), and each `fo
18
18
  an instruction of your team for you. Follow those instructions; where one conflicts with this
19
19
  skill or with the user, this skill and the user win.
20
20
 
21
+ ## Your workflow's extras
22
+
23
+ The project can add review steps and gates to this workflow (`npx agjan workflow show
24
+ <workflow>` lists them). When `npx agjan status` names a due review step this skill does not
25
+ name, run it like this skill's own reviews: delegate it, on its own, to the reviewer agent
26
+ `status` names, with the prompt `Review step <step> of <the unit's kind> <slug>.`, and fix its
27
+ blockers within the round limit. A gate it names is the user's: request it (`npx agjan log
28
+ --gate-requested <gate>`) and ask them to run `npx agjan approve <gate>` in a terminal.
29
+
21
30
  ## 1. Start
22
31
 
23
32
  - If you are on the base branch, the work needs a branch of its own. `npx agjan status`
@@ -15,6 +15,15 @@ your role works with (read them next to the ones this skill names), and each `fo
15
15
  an instruction of your team for you. Follow those instructions; where one conflicts with this
16
16
  skill or with the user, this skill and the user win.
17
17
 
18
+ ## Your workflow's extras
19
+
20
+ The project can add review steps and gates to this workflow (`npx agjan workflow show
21
+ <workflow>` lists them). When `npx agjan status` names a due review step this skill does not
22
+ name, run it like this skill's own reviews: delegate it, on its own, to the reviewer agent
23
+ `status` names, with the prompt `Review step <step> of <the unit's kind> <slug>.`, and fix its
24
+ blockers within the round limit. A gate it names is the user's: request it (`npx agjan log
25
+ --gate-requested <gate>`) and ask them to run `npx agjan approve <gate>` in a terminal.
26
+
18
27
  ## 1. Is it a fix?
19
28
 
20
29
  A fix changes existing files only (new files only for tests), stays within the
@@ -15,6 +15,15 @@ your role works with (read them next to the ones this skill names), and each `fo
15
15
  an instruction of your team for you. Follow those instructions; where one conflicts with this
16
16
  skill or with the user, this skill and the user win.
17
17
 
18
+ ## Your workflow's extras
19
+
20
+ The project can add review steps and gates to this workflow (`npx agjan workflow show
21
+ <workflow>` lists them). When `npx agjan status` names a due review step this skill does not
22
+ name, run it like this skill's own reviews: delegate it, on its own, to the reviewer agent
23
+ `status` names, with the prompt `Review step <step> of <the unit's kind> <slug>.`, and fix its
24
+ blockers within the round limit. A gate it names is the user's: request it (`npx agjan log
25
+ --gate-requested <gate>`) and ask them to run `npx agjan approve <gate>` in a terminal.
26
+
18
27
  ## 1. Start
19
28
 
20
29
  On a branch of its own, without features or fixes. If you are on the base branch:
@@ -16,6 +16,15 @@ your role works with (read them next to the ones this skill names), and each `fo
16
16
  an instruction of your team for you. Follow those instructions; where one conflicts with this
17
17
  skill or with the user, this skill and the user win.
18
18
 
19
+ ## Your workflow's extras
20
+
21
+ The project can add review steps and gates to this workflow (`npx agjan workflow show
22
+ <workflow>` lists them). When `npx agjan status` names a due review step this skill does not
23
+ name, run it like this skill's own reviews: delegate it, on its own, to the reviewer agent
24
+ `status` names, with the prompt `Review step <step> of <the unit's kind> <slug>.`, and fix its
25
+ blockers within the round limit. A gate it names is the user's: request it (`npx agjan log
26
+ --gate-requested <gate>`) and ask them to run `npx agjan approve <gate>` in a terminal.
27
+
19
28
  ## 1. Start, continue or revise
20
29
 
21
30
  Run `npx agjan status`. It shows the features this branch carries:
@@ -15,6 +15,15 @@ your role works with (read them next to the ones this skill names), and each `fo
15
15
  an instruction of your team for you. Follow those instructions; where one conflicts with this
16
16
  skill or with the user, this skill and the user win.
17
17
 
18
+ ## Your workflow's extras
19
+
20
+ The project can add review steps and gates to this workflow (`npx agjan workflow show
21
+ <workflow>` lists them). When `npx agjan status` names a due review step this skill does not
22
+ name, run it like this skill's own reviews: delegate it, on its own, to the reviewer agent
23
+ `status` names, with the prompt `Review step <step> of <the unit's kind> <slug>.`, and fix its
24
+ blockers within the round limit. A gate it names is the user's: request it (`npx agjan log
25
+ --gate-requested <gate>`) and ask them to run `npx agjan approve <gate>` in a terminal.
26
+
18
27
  ## Arriving in auto mode
19
28
 
20
29
  In auto mode you reach this skill from the previous one within one run, through `npx agjan skill verify`.
@@ -65,7 +74,7 @@ since the baseline, and commit both.
65
74
 
66
75
  ## 5. QA (step `qa`)
67
76
 
68
- For full-mode features (unless `review.qa` is `off`; `npx agjan status` shows a `qa`
77
+ For full-mode features (unless `review.qa`, the workflow's or the project's, is `off`; `npx agjan status` shows a `qa`
69
78
  row), a tester checks the feature from the spec alone before the final review: the
70
79
  `agjan-qa` agent writes tests into `test/qa/<slug>/` (and `test/ui/qa/<slug>/`), runs
71
80
  them and records the result. Its tests stay in the project as regression tests.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agjan",
3
- "version": "0.0.27",
3
+ "version": "0.0.29",
4
4
  "description": "Agentic engineering harness for AI coding agents: role agents, human approval gates, independent review and CI-enforced checks. SAP BTP first.",
5
5
  "keywords": [
6
6
  "agentic-engineering",
@@ -33,6 +33,7 @@
33
33
  "kit": { "type": "string" },
34
34
  "created_at_utc": { "$ref": "#/$defs/utc" },
35
35
  "kind": { "enum": ["fix", "map", "discovery"] },
36
+ "workflow": { "type": "string", "pattern": "^[a-z][a-z0-9-]{1,31}$", "description": "A workflow of the project's own the unit runs (decision 95)." },
36
37
  "team": {
37
38
  "description": "The team the unit started with, and the hash of its definition then (decision 92).",
38
39
  "type": "object",
@@ -63,7 +64,7 @@
63
64
  "additionalProperties": false
64
65
  }
65
66
  },
66
- "additionalProperties": false
67
+ "additionalProperties": { "$ref": "#/$defs/stamp", "description": "An extra gate of the unit's workflow, approved by a person (decision 95)." }
67
68
  },
68
69
  "amendments": {
69
70
  "type": "array",