agjan 0.0.25 → 0.0.27

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 CHANGED
@@ -88,6 +88,8 @@ Fiori or BTP, in general or about files you name: `/agjan-ask`.
88
88
 
89
89
  - [User guide](docs/guide.md): setup, workflow, commands, configuration, hosts, CI,
90
90
  troubleshooting
91
+ - [Workflows, teams, personas and skills](docs/workflows-and-teams.md): the terms and how
92
+ they fit together
91
93
  - [Design](docs/design.md): every decision and its reason
92
94
  - [Host experiments](docs/host-experiments.md): what was verified on each host, and how
93
95
  - [End-to-end run](docs/e2e-run.md): a guided trial on a sample CAP and Fiori app
package/dist/cli.js CHANGED
@@ -14,6 +14,7 @@ import * as fix from './commands/fix.js';
14
14
  import * as mapCommand from './commands/map.js';
15
15
  import * as discoverCommand from './commands/discover.js';
16
16
  import * as teamCommand from './commands/team.js';
17
+ import * as workflowCommand from './commands/workflow.js';
17
18
  import * as importCommand from './commands/import.js';
18
19
  import * as branch from './commands/branch.js';
19
20
  import * as progress from './commands/progress.js';
@@ -57,6 +58,7 @@ const COMMANDS = {
57
58
  map: mapCommand.map,
58
59
  discover: discoverCommand.discover,
59
60
  team: teamCommand.run,
61
+ workflow: workflowCommand.run,
60
62
  import: importCommand.run,
61
63
  baseline: mapCommand.baseline,
62
64
  mcp: review.mcp,
@@ -119,6 +121,10 @@ Agent and human:
119
121
  exact commit; shown first, confirmed in a terminal
120
122
  team list | team show <name> the teams a unit can start with (new, fix start, discover
121
123
  start take --team) and what their personas work with
124
+ workflow list [--json] | workflow show <feature|fix|map|discovery> [--team <name>] [--light] [--json]
125
+ the workflows, and one as this project runs it: each step,
126
+ the agent that does it, its persona's skills, the review
127
+ tiers and rounds, your gates
122
128
  baseline refresh record the watched files in baseline.json
123
129
  skill <spec|design|build|verify>
124
130
  print the workflow skill (auto mode: the next skill of the run)
@@ -13,22 +13,44 @@ import { acResults, loadResults } from '../test-results.js';
13
13
  import { testRunState } from '../test-run.js';
14
14
  import { workflowOf } from '../workflow.js';
15
15
  import { proposalProblems, proposalReview } from '../discovery.js';
16
- import { mainRole, unitTeam } from '../teams.js';
16
+ import { mainRole, personasFor, unitTeam } from '../teams.js';
17
17
  import { finalSteps, unitModel } from '../progress-view.js';
18
18
  import { splitNow } from '../story.js';
19
19
  import { verification } from '../readiness.js';
20
20
  import { readLog } from '../log.js';
21
21
  import { readAutoDefault } from '../auto.js';
22
22
  import { QA_STEP, qaState, qaTestFiles } from '../qa.js';
23
- /** The unit's team and the skills of the main agent's role in it (decision 92). */
23
+ /**
24
+ * The unit's team and what the main agent works with in it (decision 92): the skills of its
25
+ * role and the team's own roles for it, then each persona's instructions, which the workflow
26
+ * skills tell the main agent to follow (the reviewer and QA agent get theirs in their contexts).
27
+ */
24
28
  function teamRow(ctx, unit) {
25
29
  const team = unitTeam(ctx.config, unit.approvals.feature.team);
26
30
  if (!team)
27
31
  return;
28
32
  const role = mainRole(unit.kind);
29
- const skills = team.team?.personas[role]?.skills ?? [];
33
+ const skills = mainSkills(ctx, team.team, unit.kind);
30
34
  const changed = team.changed ? ctx.style.yellow(' (its definition changed since this unit started)') : '';
31
35
  row(ctx, 'team', `${team.name}${skills.length ? ctx.style.gray(` · ${role}: ${skills.join(', ')}`) : ''}${changed}`);
36
+ for (const p of mainPersonas(ctx, team.team, unit.kind)) {
37
+ if (p.instructions)
38
+ row(ctx, 'follow', `${p.role}: ${p.instructions}`);
39
+ }
40
+ }
41
+ /** The main agent's personas: role, skills and instructions (one line). */
42
+ function mainPersonas(ctx, team, kind) {
43
+ if (!team)
44
+ return [];
45
+ return personasFor(ctx.config, team, kind, 'main').map(({ role, persona }) => ({
46
+ role,
47
+ skills: persona.skills,
48
+ ...(persona.instructions?.trim() ? { instructions: persona.instructions.trim().replace(/\s+/g, ' ') } : {}),
49
+ }));
50
+ }
51
+ /** The skills the main agent works with: its role's, then those of the team's own roles for it. */
52
+ function mainSkills(ctx, team, kind) {
53
+ return team ? [...new Set(personasFor(ctx.config, team, kind, 'main').flatMap((p) => p.persona.skills))] : [];
32
54
  }
33
55
  /** One indented row: a label column, then the value. `next` and `blocks` stand out. */
34
56
  function row(ctx, label, value) {
@@ -392,7 +414,7 @@ function json(ctx, slugs) {
392
414
  ...((() => {
393
415
  const team = unitTeam(ctx.config, unit.approvals.feature.team);
394
416
  const role = mainRole(unit.kind);
395
- return team ? { team: { name: team.name, changed: team.changed, role, skills: team.team?.personas[role]?.skills ?? [] } } : {};
417
+ return team ? { team: { name: team.name, changed: team.changed, role, skills: mainSkills(ctx, team.team, unit.kind), personas: mainPersonas(ctx, team.team, unit.kind) } } : {};
396
418
  })()),
397
419
  ...(verified ? { verified: verified.problems.length === 0, accepted: verified.accepted, problems: verified.problems } : {}),
398
420
  };
@@ -422,7 +444,7 @@ export async function run(ctx, argv) {
422
444
  for (const line of markLine(ctx.style, ctx.kit, 'status'))
423
445
  ctx.out(line);
424
446
  const autoDefault = readAutoDefault(root) ? '; auto mode: on for new features (your default)' : '';
425
- ctx.out(ctx.style.gray(`settings: documents in '${c.language ?? 'en'}' (headings in English); reviews up to ${roundLimit(c)} rounds; ${fixAttempts(c)} attempts for failing checks; ${branches}${autoDefault}`));
447
+ ctx.out(ctx.style.gray(`settings: documents in '${c.language ?? 'en'}' (headings in English); reviews up to ${roundLimit(c)} rounds${Object.keys(c.review?.step_rounds ?? {}).length ? ` (${Object.entries(c.review.step_rounds).map(([k, n]) => `${k}: ${n}`).join(', ')})` : ''}; ${fixAttempts(c)} attempts for failing checks; ${branches}${autoDefault}`));
426
448
  if (slugs.length === 0) {
427
449
  ctx.out(values.all ? `no features in ${FEATURES_DIR}` : 'no changed feature on this branch (agjan status --all lists every feature)');
428
450
  return 0;
@@ -1,6 +1,6 @@
1
1
  import { parseArgs } from 'node:util';
2
2
  import { UsageError } from '../errors.js';
3
- import { BUILT_IN_TEAMS, ROLES, allTeams, defaultTeam, teamProblems } from '../teams.js';
3
+ import { BUILT_IN_TEAMS, ROLES, allTeams, defaultTeam, roleAgent, teamProblems } from '../teams.js';
4
4
  import { WORKFLOWS } from '../workflow.js';
5
5
  const USAGE = 'usage: agjan team list | agjan team show <name>';
6
6
  /**
@@ -27,14 +27,19 @@ export function run(ctx, argv) {
27
27
  const problems = teamProblems(ctx.root, ctx.config, name);
28
28
  if (!team)
29
29
  throw new UsageError(problems[0]);
30
- ctx.out(`${s.bold(name)}: ${team.description}`, ` workflows ${team.workflows.join(', ')}`);
31
- for (const role of ROLES) {
30
+ ctx.out(`${s.bold(name)}: ${team.description}`);
31
+ // The built-in roles first, then the team's own; a named persona says so.
32
+ const definition = ctx.config.teams?.[name] ?? BUILT_IN_TEAMS[name];
33
+ const roles = [...ROLES.filter((r) => team.personas[r]), ...Object.keys(team.personas).filter((r) => !ROLES.includes(r))];
34
+ const width = Math.max(12, ...roles.filter((r) => !ROLES.includes(r)).map((r) => r.length + 2));
35
+ ctx.out(` ${'workflows'.padEnd(width)}${team.workflows.join(', ')}`);
36
+ for (const role of roles) {
32
37
  const persona = team.personas[role];
33
- if (!persona)
34
- continue;
35
- ctx.out(` ${role.padEnd(12)}${persona.skills.join(', ')}`);
38
+ const ref = definition?.personas[role];
39
+ const notes = [typeof ref === 'string' ? `persona ${ref}` : '', ROLES.includes(role) ? '' : `reaches the ${roleAgent(ctx.config, role) ?? 'unknown'} agent`].filter(Boolean);
40
+ ctx.out(` ${role.padEnd(width)}${persona.skills.join(', ')}${notes.length ? s.gray(` (${notes.join('; ')})`) : ''}`);
36
41
  if (persona.instructions?.trim())
37
- ctx.out(` ${''.padEnd(12)}${s.gray(persona.instructions.trim().replace(/\s+/g, ' '))}`);
42
+ ctx.out(` ${''.padEnd(width)}${s.gray(persona.instructions.trim().replace(/\s+/g, ' '))}`);
38
43
  }
39
44
  ctx.out(s.gray(' The workflow decides the steps, reviews and gates; a team adds what its agents work with.'));
40
45
  for (const p of problems)
@@ -0,0 +1,77 @@
1
+ import { parseArgs } from 'node:util';
2
+ import { UsageError } from '../errors.js';
3
+ import { allTeams, defaultTeam } from '../teams.js';
4
+ import { WORKFLOWS } from '../workflow.js';
5
+ import { resolveWorkflow, teamSource } from '../workflow-view.js';
6
+ const USAGE = 'usage: agjan workflow list [--json] | agjan workflow show <feature|fix|map|discovery> [--team <name>] [--light] [--json]';
7
+ const SOURCE = { 'built-in': 'built in', imported: 'imported', project: 'agjan.config.json' };
8
+ /**
9
+ * agjan workflow list | show <kind> (decision 90): the workflows with their default teams, and
10
+ * one of them as this project runs it: each stage's steps, the agent that does each, the
11
+ * persona it works with, the review tiers and rounds, and the person's gates. `--json` is for
12
+ * tools; the list then also gives the teams, for choosing one.
13
+ */
14
+ export function run(ctx, argv) {
15
+ const { values, positionals } = parseArgs({ args: argv, allowPositionals: true, options: { team: { type: 'string' }, light: { type: 'boolean' }, json: { type: 'boolean' } } });
16
+ const s = ctx.style;
17
+ if (positionals[0] === 'list' && positionals.length === 1 && values.json) {
18
+ const workflows = Object.values(WORKFLOWS).map((w) => ({ kind: w.kind, name: w.name, skill: `/${w.skill}`, stages: w.stages, team: defaultTeam(ctx.config, w.kind) }));
19
+ const teams = Object.entries(allTeams(ctx.config)).map(([name, t]) => ({ name, description: t.description, workflows: t.workflows, source: teamSource(ctx.config, name) }));
20
+ ctx.out(JSON.stringify({ schema: 1, workflows, teams }, null, 2));
21
+ return 0;
22
+ }
23
+ if (positionals[0] === 'list' && positionals.length === 1) {
24
+ for (const w of Object.values(WORKFLOWS)) {
25
+ ctx.out(`${s.bold(w.kind.padEnd(11))} /${w.skill.padEnd(16)} ${w.stages.join(' → ').padEnd(30)} ${s.gray(`team ${defaultTeam(ctx.config, w.kind) ?? '-'}`)}`);
26
+ }
27
+ return 0;
28
+ }
29
+ if (positionals[0] !== 'show' || positionals.length !== 2)
30
+ throw new UsageError(USAGE);
31
+ const kind = positionals[1];
32
+ if (!WORKFLOWS[kind])
33
+ throw new UsageError(`no workflow '${positionals[1]}' (workflows: ${Object.keys(WORKFLOWS).join(', ')})`);
34
+ const view = resolveWorkflow(ctx.root, ctx.config, kind, { team: values.team, light: values.light });
35
+ if (values.json) {
36
+ // The team's problems are in the data; tools read them there.
37
+ ctx.out(JSON.stringify(view, null, 2));
38
+ return 0;
39
+ }
40
+ const mode = view.workflow.mode ? ` (${view.workflow.mode})` : '';
41
+ ctx.out(`${s.bold(`${view.workflow.name} workflow`)}${mode}, started with ${view.workflow.skill}`);
42
+ if (view.team) {
43
+ ctx.out(`team ${s.bold(view.team.name)} ${s.gray(`(${SOURCE[view.team.source]}${view.team.default ? ', the default' : ''})`)}`);
44
+ if (view.team.description)
45
+ ctx.out(` ${s.gray(view.team.description)}`);
46
+ }
47
+ for (const stage of view.stages) {
48
+ ctx.out('', s.bold(stage.name));
49
+ for (const step of stage.steps) {
50
+ const details = [
51
+ step.review ? `${step.review.tier}${step.review.per ? `, per ${step.review.per}` : ''}, up to ${step.review.rounds} rounds` : '',
52
+ step.gate ? step.gate.command : '',
53
+ step.off ? `skipped: ${step.off}` : '',
54
+ ].filter(Boolean);
55
+ const does = step.off ? s.gray(step.does) : step.does;
56
+ ctx.out(` ${step.agent.padEnd(21)} ${does}${details.length ? s.gray(` (${details.join('; ')})`) : ''}`);
57
+ }
58
+ }
59
+ // Each role once, with the agent it reaches: the built-in roles first, then the team's own.
60
+ const seen = new Map();
61
+ for (const step of view.stages.flatMap((st) => st.steps))
62
+ for (const p of step.personas)
63
+ if (!seen.has(p.role))
64
+ seen.set(p.role, { agent: step.actor === 'main' ? 'main agent' : step.actor === 'qa' ? 'QA agent' : 'reviewer', persona: p });
65
+ if (view.team && seen.size) {
66
+ ctx.out('', s.bold(`What the agents work with (team ${view.team.name})`));
67
+ for (const [role, { agent, persona }] of seen) {
68
+ ctx.out(` ${role.padEnd(21)} ${persona.skills.length ? persona.skills.join(', ') : s.gray('no skills')}${s.gray(` (${agent}${persona.description ? `: ${persona.description}` : ''})`)}`);
69
+ if (persona.instructions?.trim())
70
+ ctx.out(` ${''.padEnd(21)} ${s.gray(persona.instructions.trim().replace(/\s+/g, ' '))}`);
71
+ }
72
+ }
73
+ ctx.out('', s.gray(`Every workflow keeps: ${view.controls.join(', ')}. A team adds knowledge; it cannot remove a step.`));
74
+ for (const p of view.team?.problems ?? [])
75
+ ctx.out(`${s.red('problem')} ${p}`);
76
+ return view.team?.problems.length ? 1 : 0;
77
+ }
package/dist/imports.js CHANGED
@@ -6,6 +6,7 @@ import { dirname, join, relative } from 'node:path';
6
6
  import { readJson, writeJson } from './json-file.js';
7
7
  import { AgjanError } from './errors.js';
8
8
  import { loadSchema, validate } from './schema.js';
9
+ import { ROLES } from './teams.js';
9
10
  /**
10
11
  * Imports (decision 93): skills and teams from another repository, at an exact commit.
11
12
  *
@@ -50,6 +51,15 @@ function manifestProblems(data) {
50
51
  if (data.teams !== undefined) {
51
52
  for (const p of validate(loadSchema('config'), { teams: data.teams }))
52
53
  problems.push(`${MANIFEST}: ${p}`);
54
+ // A package brings no roles or named personas: its teams use the built-in roles, with their personas inline.
55
+ for (const [name, team] of Object.entries(data.teams ?? {})) {
56
+ for (const [role, persona] of Object.entries(team?.personas ?? {})) {
57
+ if (!ROLES.includes(role))
58
+ problems.push(`${MANIFEST}: teams.${name}: role '${role}' is not a built-in role (${ROLES.join(', ')})`);
59
+ if (typeof persona === 'string')
60
+ problems.push(`${MANIFEST}: teams.${name}.personas.${role}: a package's personas are written out, not named`);
61
+ }
62
+ }
53
63
  }
54
64
  return problems;
55
65
  }
@@ -320,7 +320,7 @@ export function unitModel(ctx, slug, { onBase = false, now = Date.now(), memo =
320
320
  decisions: shown,
321
321
  reviewers,
322
322
  humans,
323
- roundLimit: roundLimit(config),
323
+ roundLimits: Object.fromEntries([...new Set(reviews.map((r) => r.step))].map((step) => [step, roundLimit(config, step)])),
324
324
  stats: {
325
325
  activeMs: steps.reduce((t, s) => t + (s.to - s.from), 0),
326
326
  waitingMs: gates.reduce((t, s) => t + (s.to - s.from), 0),
@@ -441,7 +441,7 @@ export function unitMarkdown(model, { generatedAt }) {
441
441
  const course = rs
442
442
  .map((r, i) => `${i && r.round === 1 ? '↺ ' : i ? '→ ' : ''}${r.id} ${VERDICT_MD[r.verdict]}${r.findings.length ? ` (${severities(r.findings, model.findings)})` : ''}`)
443
443
  .join(' ');
444
- out.push(`| ${step} | ${rs.length} (limit ${model.roundLimit} per loop) | ${course} |`);
444
+ out.push(`| ${step} | ${rs.length} (limit ${model.roundLimits[step]} per loop) | ${course} |`);
445
445
  }
446
446
  out.push('');
447
447
  }
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Review settings from agjan.config.json (design 7.3, 7.4): which reviewer agent runs a
3
- * step (`review.tiers`), how many correction rounds a step gets (`review.rounds`), and
3
+ * step (`review.tiers`), how many correction rounds a step gets (`review.rounds`, or its
4
+ * kind's own under `review.step_rounds`), and
4
5
  * how many attempts the main agent has for failing deterministic checks
5
6
  * (`build.fix_attempts`). `agjan status` shows them; the skills follow `status`.
6
7
  */
@@ -28,8 +29,10 @@ export function reviewerFor(config, step) {
28
29
  const tier = config.review?.tiers?.[kind] ?? DEFAULT_TIERS[kind] ?? 'balanced';
29
30
  return tier === 'qa' ? 'agjan-qa' : tier === 'deep' ? 'agjan-reviewer-deep' : 'agjan-reviewer';
30
31
  }
31
- export function roundLimit(config) {
32
- return config.review?.rounds ?? 3;
32
+ /** The round limit of a review step: its kind's under `review.step_rounds`, else `review.rounds` (default 3). */
33
+ export function roundLimit(config, step) {
34
+ const own = step ? config.review?.step_rounds?.[stepKind(step)] : undefined;
35
+ return own ?? config.review?.rounds ?? 3;
33
36
  }
34
37
  export function fixAttempts(config) {
35
38
  return config.build?.fix_attempts ?? 3;
@@ -73,7 +76,7 @@ export function roundState(feature, config, step) {
73
76
  const records = feature.reviews.records.filter((r) => r.step === step);
74
77
  const last = records.at(-1) ?? null;
75
78
  const extra = extraRounds(feature, step);
76
- const limit = roundLimit(config) + extra;
79
+ const limit = roundLimit(config, step) + extra;
77
80
  const round = last?.round ?? 0;
78
81
  // Exhausted: still blocked, and the next round would pass the limit; a loop that an approval
79
82
  // or a passing verify review closed starts again at round 1 (nextRound).
package/dist/review.js CHANGED
@@ -15,7 +15,7 @@ import { acResults, loadResults, resultLabel } from './test-results.js';
15
15
  import { readTestRun, testRunProblem } from './test-run.js';
16
16
  import { WORKFLOWS, hasReviewStep, workflowOf } from './workflow.js';
17
17
  import { proposalProblems } from './discovery.js';
18
- import { personaText, unitTeam } from './teams.js';
18
+ import { personaText, personasFor, unitTeam } from './teams.js';
19
19
  import { LOG_FILE, appendLog } from './log.js';
20
20
  import { AgjanError } from './errors.js';
21
21
  import { nextRound, roundState } from './review-policy.js';
@@ -230,7 +230,7 @@ export function buildContextText(root, config, feature, parsed) {
230
230
  parts.push(section('Checklist', CHECKLISTS[parsed.kind]));
231
231
  // The unit's team adds what the reviewer works with; it never removes a check (decision 92).
232
232
  const team = unitTeam(config, feature.approvals.feature.team);
233
- const reviewer = team?.team ? personaText(team.name, 'reviewer', team.team.personas.reviewer) : null;
233
+ const reviewer = team?.team ? personaText(config, team.name, personasFor(config, team.team, feature.kind, 'reviewer')) : null;
234
234
  if (reviewer)
235
235
  parts.push(section('Your team', reviewer));
236
236
  const baseline = join(root, FEATURES_DIR, 'project.md');
@@ -554,7 +554,7 @@ export function createQaContext(root, config, { feature: slug }) {
554
554
  section('Run locally (from agjan-docs/project.md)', runLocally || '(not described: start the application as the project README or package.json says)'),
555
555
  ...((() => {
556
556
  const team = unitTeam(config, feature.approvals.feature.team);
557
- const tester = team?.team ? personaText(team.name, 'tester', team.team.personas.tester) : null;
557
+ const tester = team?.team ? personaText(config, team.name, personasFor(config, team.team, feature.kind, 'qa')) : null;
558
558
  return tester ? [section('Your team', tester)] : [];
559
559
  })()),
560
560
  section('Test conventions', `${commands}\n- UI tests: ${ui ? '`npx agjan ui-test` runs the Playwright tests (it skips them, with the reason, where no browser can start)' : 'the project has no Playwright setup (no `test:ui` script): write service tests only'}\n- How tests are written in this stack: \`.claude/skills/cap-developer/references/testing.md\` (cds.test) and \`.claude/skills/fiori-developer/references/testing.md\` (Playwright). Read those for the test mechanics only.`),
package/dist/teams.js CHANGED
@@ -4,7 +4,10 @@ import { hashText } from './hash.js';
4
4
  import { AgjanError } from './errors.js';
5
5
  import { WORKFLOWS } from './workflow.js';
6
6
  export const ROLES = ['implementer', 'reviewer', 'tester', 'analyst'];
7
- /** The roles a workflow uses, besides the reviewer every workflow has. */
7
+ export const ROLE_AGENTS = ['main', 'reviewer', 'qa'];
8
+ /** The agent each built-in role reaches; implementer and analyst are the main agent in different workflows. */
9
+ const BUILT_IN_AGENT = { implementer: 'main', analyst: 'main', reviewer: 'reviewer', tester: 'qa' };
10
+ /** The built-in roles a workflow needs. */
8
11
  const ROLES_OF = {
9
12
  feature: ['implementer', 'reviewer', 'tester'],
10
13
  fix: ['implementer', 'reviewer'],
@@ -40,9 +43,34 @@ export const BUILT_IN_TEAMS = {
40
43
  },
41
44
  },
42
45
  };
43
- /** The built-in teams with the imported ones (loadConfig puts them in) and the project's own on top. */
46
+ /** A team definition with every persona resolved; a name with no persona under `personas` gives no skills (`teamProblems` reports it). */
47
+ function resolveTeam(config, team) {
48
+ const personas = Object.fromEntries(Object.entries(team.personas ?? {}).map(([role, p]) => [role, typeof p === 'string' ? (config.personas?.[p] ?? { skills: [] }) : p]));
49
+ return { description: team.description, workflows: team.workflows, personas };
50
+ }
51
+ /** The built-in teams with the imported ones (loadConfig puts them in) and the project's own on top, resolved. */
44
52
  export function allTeams(config) {
45
- return { ...BUILT_IN_TEAMS, ...(config.teams ?? {}) };
53
+ const defined = { ...BUILT_IN_TEAMS, ...(config.teams ?? {}) };
54
+ return Object.fromEntries(Object.entries(defined).map(([name, team]) => [name, resolveTeam(config, team)]));
55
+ }
56
+ /** The agent a role's persona reaches: a built-in role's, or the one its definition under `roles` names. */
57
+ export function roleAgent(config, role) {
58
+ return BUILT_IN_AGENT[role] ?? config.roles?.[role]?.agent ?? null;
59
+ }
60
+ /**
61
+ * The personas an agent works with in a workflow: the built-in role's first (the implementer or
62
+ * analyst for the main agent, the reviewer, the tester), then the team's own roles for that agent.
63
+ */
64
+ export function personasFor(config, team, kind, agent) {
65
+ const builtIn = agent === 'main' ? mainRole(kind) : agent === 'reviewer' ? 'reviewer' : 'tester';
66
+ const out = [];
67
+ if (team.personas[builtIn])
68
+ out.push({ role: builtIn, persona: team.personas[builtIn] });
69
+ for (const [role, persona] of Object.entries(team.personas)) {
70
+ if (!ROLES.includes(role) && roleAgent(config, role) === agent)
71
+ out.push({ role, persona });
72
+ }
73
+ return out;
46
74
  }
47
75
  /** The default team of a workflow: the project's choice (`team.<kind>`), else the first that serves it. */
48
76
  export function defaultTeam(config, kind) {
@@ -66,8 +94,9 @@ export function teamHash(team) {
66
94
  }
67
95
  /** What is wrong with a team, for the workflow it would run (or all it serves). */
68
96
  export function teamProblems(root, config, name, kind) {
97
+ const definition = config.teams?.[name] ?? BUILT_IN_TEAMS[name];
69
98
  const team = allTeams(config)[name];
70
- if (!team)
99
+ if (!definition || !team)
71
100
  return [`no team '${name}' (built in: ${Object.keys(BUILT_IN_TEAMS).join(', ')}; or define it under "teams" in agjan.config.json)`];
72
101
  const problems = [];
73
102
  if (!team.workflows?.length)
@@ -77,14 +106,25 @@ export function teamProblems(root, config, name, kind) {
77
106
  problems.push(`team '${name}': unknown workflow '${w}'`);
78
107
  if (kind && !team.workflows?.includes(kind))
79
108
  problems.push(`team '${name}' does not serve the ${WORKFLOWS[kind].name} workflow (it serves: ${team.workflows.join(', ')})`);
80
- for (const [role, persona] of Object.entries(team.personas ?? {})) {
81
- if (!ROLES.includes(role))
82
- problems.push(`team '${name}': unknown role '${role}' (roles: ${ROLES.join(', ')})`);
83
- for (const skill of persona?.skills ?? []) {
109
+ const custom = Object.keys(config.roles ?? {});
110
+ for (const [role, ref] of Object.entries(definition.personas ?? {})) {
111
+ const agent = roleAgent(config, role);
112
+ if (!agent)
113
+ problems.push(`team '${name}': unknown role '${role}' (roles: ${[...ROLES, ...custom].join(', ')}; or define it under "roles")`);
114
+ if (typeof ref === 'string' && !config.personas?.[ref])
115
+ problems.push(`team '${name}', ${role}: no persona '${ref}' under "personas"`);
116
+ for (const skill of team.personas[role]?.skills ?? []) {
84
117
  if (!existsSync(join(root, '.claude', 'skills', skill, 'SKILL.md')))
85
118
  problems.push(`team '${name}', ${role}: no skill '${skill}' in .claude/skills/`);
86
119
  }
120
+ // 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)))) {
122
+ problems.push(`team '${name}', ${role}: its agent (${agent}) has no step in ${team.workflows.join(', ')}`);
123
+ }
87
124
  }
125
+ for (const role of custom)
126
+ if (ROLES.includes(role))
127
+ problems.push(`roles: '${role}' is a built-in role`);
88
128
  for (const w of team.workflows ?? []) {
89
129
  for (const role of ROLES_OF[w] ?? []) {
90
130
  if (!team.personas?.[role]?.skills?.length)
@@ -93,12 +133,17 @@ export function teamProblems(root, config, name, kind) {
93
133
  }
94
134
  return problems;
95
135
  }
96
- /** A persona as the agent in its role reads it: the skill files, then the instructions. */
97
- export function personaText(team, role, persona) {
98
- if (!persona)
136
+ /** The personas an agent works with, as it reads them: per role, the skill files, then the instructions. */
137
+ export function personaText(config, team, personas) {
138
+ if (!personas.length)
99
139
  return null;
100
- const skills = persona.skills.map((s) => `- \`.claude/skills/${s}/SKILL.md\` (and the references its table names for your topic)`).join('\n');
101
- return [`Team ${team}, ${role}. Work with these skills:`, skills, persona.instructions?.trim() ? `\n${persona.instructions.trim()}` : ''].join('\n').trim();
140
+ return personas
141
+ .map(({ role, persona }) => {
142
+ const what = config.roles?.[role]?.description;
143
+ const skills = persona.skills.map((s) => `- \`.claude/skills/${s}/SKILL.md\` (and the references its table names for your topic)`).join('\n');
144
+ return [`Team ${team}, ${role}${what ? ` (${what})` : ''}. Work with these skills:`, skills, persona.instructions?.trim() ? `\n${persona.instructions.trim()}` : ''].join('\n').trim();
145
+ })
146
+ .join('\n\n');
102
147
  }
103
148
  /** The role of the main agent in a workflow: it implements, or (map run, discovery) it analyses. */
104
149
  export function mainRole(kind) {
@@ -0,0 +1,73 @@
1
+ import { BUILT_IN_TEAMS, allTeams, defaultTeam, mainRole, personasFor, teamProblems } from './teams.js';
2
+ import { DEFAULT_TIERS, reviewerFor, roundLimit, stepKind } from './review-policy.js';
3
+ import { WORKFLOWS } from './workflow.js';
4
+ /** Where a team comes from: agjan, an imported package (`<package>/<team>`), or the project's configuration. */
5
+ export function teamSource(config, name) {
6
+ if (name.includes('/'))
7
+ return 'imported';
8
+ return BUILT_IN_TEAMS[name] && !config.teams?.[name] ? 'built-in' : 'project';
9
+ }
10
+ /**
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).
13
+ */
14
+ export function resolveWorkflow(root, config, kind, options = {}) {
15
+ const workflow = WORKFLOWS[kind];
16
+ const mode = kind === 'feature' ? (options.light ? 'light' : 'full') : null;
17
+ const fallback = defaultTeam(config, kind);
18
+ const name = options.team ?? fallback;
19
+ const team = name ? (allTeams(config)[name] ?? null) : null;
20
+ const qaOff = config.review?.qa === 'off';
21
+ const stages = workflow.track.map((stage) => ({
22
+ name: stage.name,
23
+ steps: stage.steps
24
+ .filter((step) => !step.mode || step.mode === mode)
25
+ .map((step) => {
26
+ const personas = team && step.actor !== 'human' ? personasFor(config, team, kind, step.actor) : [];
27
+ const builtIn = step.actor === 'main' ? mainRole(kind) : step.actor === 'reviewer' ? 'reviewer' : step.actor === 'qa' ? 'tester' : null;
28
+ const resolved = {
29
+ actor: step.actor,
30
+ agent: step.actor === 'main' ? 'main agent' : 'you',
31
+ does: step.does,
32
+ role: builtIn,
33
+ 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
+ })),
40
+ };
41
+ if (step.review) {
42
+ const kindOfStep = stepKind(step.review);
43
+ resolved.agent = reviewerFor(config, step.review);
44
+ resolved.review = {
45
+ 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' } : {}),
49
+ };
50
+ if (step.review === 'qa' && qaOff)
51
+ resolved.off = 'review.qa is off';
52
+ }
53
+ if (step.gate)
54
+ resolved.gate = { name: step.gate, command: `npx agjan approve ${step.gate}` };
55
+ return resolved;
56
+ }),
57
+ }));
58
+ return {
59
+ schema: 1,
60
+ workflow: { kind, name: workflow.name, skill: `/${workflow.skill}`, end: workflow.end, mode },
61
+ team: name
62
+ ? {
63
+ name,
64
+ description: team?.description ?? '',
65
+ source: teamSource(config, name),
66
+ default: name === fallback,
67
+ problems: teamProblems(root, config, name, kind),
68
+ }
69
+ : null,
70
+ stages,
71
+ controls: workflow.controls,
72
+ };
73
+ }
package/dist/workflow.js CHANGED
@@ -13,6 +13,42 @@ export const WORKFLOWS = {
13
13
  endGate: 'verify',
14
14
  writes: 'tasks',
15
15
  controls: ['independent-review', 'stamped-approvals', 'scope-check', 'human-decision'],
16
+ track: [
17
+ {
18
+ name: 'Spec',
19
+ steps: [
20
+ { actor: 'main', does: 'writes the spec: what and why, with testable acceptance criteria' },
21
+ { actor: 'reviewer', does: 'reviews the spec', review: 'spec', mode: 'full' },
22
+ { actor: 'human', does: 'approve the spec', gate: 'spec', mode: 'full' },
23
+ ],
24
+ },
25
+ {
26
+ name: 'Design',
27
+ steps: [
28
+ { actor: 'main', does: 'writes the design: how, split into build tasks with file paths' },
29
+ { actor: 'reviewer', does: 'reviews the design', review: 'design', mode: 'full' },
30
+ { actor: 'reviewer', does: 'reviews the spec and the design together', review: 'design:light', mode: 'light' },
31
+ { actor: 'human', does: 'approve the design', gate: 'design', mode: 'full' },
32
+ { actor: 'human', does: 'approve the spec and the design together', gate: 'spec design', mode: 'light' },
33
+ ],
34
+ },
35
+ {
36
+ name: 'Build',
37
+ steps: [
38
+ { actor: 'main', does: 'builds each task, one commit per task, within the approved paths' },
39
+ { actor: 'reviewer', does: 'reviews the build', review: 'build:' },
40
+ ],
41
+ },
42
+ {
43
+ name: 'Verify',
44
+ steps: [
45
+ { actor: 'main', does: 'runs the full checks and records the test run' },
46
+ { actor: 'qa', does: "writes and runs tests from the spec's acceptance criteria", review: 'qa', mode: 'full' },
47
+ { actor: 'reviewer', does: 'reviews the whole change', review: 'verify' },
48
+ { actor: 'human', does: 'accept the feature, then merge the pull request', gate: 'verify' },
49
+ ],
50
+ },
51
+ ],
16
52
  },
17
53
  fix: {
18
54
  kind: 'fix',
@@ -26,6 +62,23 @@ export const WORKFLOWS = {
26
62
  end: 'merge',
27
63
  writes: 'fix-rules',
28
64
  controls: ['independent-review', 'stamped-approvals', 'scope-check', 'human-decision'],
65
+ track: [
66
+ {
67
+ name: 'Fix',
68
+ steps: [
69
+ { actor: 'main', does: 'fixes the defect in existing files, within the fix limits' },
70
+ { actor: 'main', does: 'checks the fix against the limits and protected paths' },
71
+ ],
72
+ },
73
+ {
74
+ name: 'Review',
75
+ steps: [
76
+ { actor: 'reviewer', does: 'reviews the fix', review: 'fix' },
77
+ { actor: 'main', does: 'records the fix' },
78
+ { actor: 'human', does: 'review and merge the pull request' },
79
+ ],
80
+ },
81
+ ],
29
82
  },
30
83
  map: {
31
84
  kind: 'map',
@@ -39,6 +92,22 @@ export const WORKFLOWS = {
39
92
  end: 'merge',
40
93
  writes: 'project-map',
41
94
  controls: ['independent-review', 'stamped-approvals', 'scope-check', 'human-decision'],
95
+ track: [
96
+ {
97
+ name: 'Map',
98
+ steps: [
99
+ { actor: 'main', does: 'describes the application in project.md, with pointers to real files' },
100
+ { actor: 'main', does: 'records the watched files in baseline.json' },
101
+ ],
102
+ },
103
+ {
104
+ name: 'Review',
105
+ steps: [
106
+ { actor: 'reviewer', does: 'reviews the map', review: 'map' },
107
+ { actor: 'human', does: 'review and merge the pull request' },
108
+ ],
109
+ },
110
+ ],
42
111
  },
43
112
  discovery: {
44
113
  kind: 'discovery',
@@ -53,6 +122,20 @@ export const WORKFLOWS = {
53
122
  endGate: 'proposal',
54
123
  writes: 'own-folder',
55
124
  controls: ['independent-review', 'stamped-approvals', 'scope-check', 'human-decision'],
125
+ track: [
126
+ {
127
+ name: 'Proposal',
128
+ steps: [{ actor: 'main', does: 'prepares the proposal: context, options, a recommendation; changes no code' }],
129
+ },
130
+ {
131
+ name: 'Review',
132
+ steps: [{ actor: 'reviewer', does: 'reviews the proposal', review: 'proposal' }],
133
+ },
134
+ {
135
+ name: 'Approval',
136
+ steps: [{ actor: 'human', does: 'approve the proposal', gate: 'proposal' }],
137
+ },
138
+ ],
56
139
  },
57
140
  };
58
141
  export function workflowOf(kind) {
@@ -79,5 +162,16 @@ export function workflowProblems(workflow) {
79
162
  problems.push(`${workflow.kind}: ends with an acceptance but names no gate of its own for it`);
80
163
  if (!workflow.stages.length)
81
164
  problems.push(`${workflow.kind}: no stages`);
165
+ const names = workflow.track.map((t) => t.name);
166
+ if (names.join() !== workflow.stages.join())
167
+ problems.push(`${workflow.kind}: the track's stages (${names.join(', ')}) are not the workflow's (${workflow.stages.join(', ')})`);
168
+ for (const step of workflow.track.flatMap((t) => t.steps)) {
169
+ if (step.review && !workflow.reviewSteps.includes(step.review))
170
+ problems.push(`${workflow.kind}: the track names an unknown review step '${step.review}'`);
171
+ if (step.gate && !workflow.gates.includes(step.gate))
172
+ problems.push(`${workflow.kind}: the track names an unknown gate '${step.gate}'`);
173
+ }
174
+ if (!workflow.track.some((t) => t.steps.some((step) => step.actor === 'human')))
175
+ problems.push(`${workflow.kind}: no step of the track is the person's`);
82
176
  return problems;
83
177
  }
package/docs/guide.md CHANGED
@@ -408,7 +408,8 @@ and CI waits for your approval. To build the recommendation, start a feature wit
408
408
  ## Teams
409
409
 
410
410
  A team decides what knowledge the agents bring to a unit of work; the workflow decides the
411
- steps, reviews and gates, and a team cannot remove any of them. Three are built in:
411
+ steps, reviews and gates, and a team cannot remove any of them. [Workflows, teams, personas and
412
+ skills](workflows-and-teams.md) defines the terms. Three teams are built in:
412
413
 
413
414
  | Team | Workflows | Implementer or analyst | Reviewer | Tester |
414
415
  |---|---|---|---|---|
@@ -436,12 +437,50 @@ included), and make it the default for a workflow:
436
437
  }
437
438
  ```
438
439
 
440
+ **Your own roles and shared personas.** Next to implementer, reviewer, tester and analyst you can
441
+ define roles under `roles`; each reaches one of the agents that already run (`main`, `reviewer`,
442
+ `qa`), which then works with that role's persona as well. A persona used by several teams can be
443
+ defined once under `personas` and named in each team:
444
+
445
+ ```json
446
+ {
447
+ "roles": {
448
+ "security-reviewer": { "agent": "reviewer", "description": "checks our security standard" }
449
+ },
450
+ "personas": {
451
+ "company-reviewer": { "skills": ["solution-reviewer"], "instructions": "Cite file and line." }
452
+ },
453
+ "teams": {
454
+ "company-delivery": {
455
+ "description": "Delivery with our security standard",
456
+ "workflows": ["feature"],
457
+ "personas": {
458
+ "implementer": { "skills": ["cap-developer", "fiori-developer"] },
459
+ "reviewer": "company-reviewer",
460
+ "security-reviewer": { "skills": ["company-security"] },
461
+ "tester": { "skills": ["qa-tester"] }
462
+ }
463
+ }
464
+ },
465
+ "review": { "step_rounds": { "design": 5 } }
466
+ }
467
+ ```
468
+
469
+ Here every review of a company-delivery unit works with both the reviewer's and the security
470
+ reviewer's skills, and the design review gets up to 5 rounds. A role adds knowledge to an agent's
471
+ existing steps; it starts no agent and adds no step. Imported packages use the built-in roles,
472
+ with their personas written out.
473
+
439
474
  A unit starts with the workflow's default team, or the one you name (`--team` on `new`,
440
475
  `fix start`, `discover start`), and records it with a hash of its definition. A persona
441
- starts no agent of its own: the implementer's skills reach the main agent through `status`,
476
+ starts no agent of its own: the implementer's or analyst's skills and instructions reach the main agent through `status` (its `team` and `follow` rows),
442
477
  the reviewer's and the tester's through their review and QA contexts. If the team's
443
478
  definition changes while a unit is under way, `status` and `check` say so.
444
479
  `npx agjan team list` lists the teams, `npx agjan team show <name>` their personas.
480
+ `npx agjan workflow show feature` shows the whole workflow as your project runs it: each
481
+ step, the agent that does it and the skills it works with, the review tier and rounds from
482
+ your configuration, and your gates (`--team <name>` for another team, `--light` for a light
483
+ feature).
445
484
 
446
485
  ### Importing skills and teams
447
486
 
@@ -522,6 +561,7 @@ Run `npx agjan --help` for the full list.
522
561
  | `approve proposal` | you, in a terminal | decide on a discovery's recommendation |
523
562
  | `import <git url> --commit <id> [--dry-run]` · `import list` · `import remove <name>` | you, in a terminal | skills and teams from another repository at an exact commit, shown before they are written |
524
563
  | `team list` · `team show <name>` | anyone | the teams, the default per workflow, and what a team's personas work with |
564
+ | `workflow list [--json]` · `workflow show <workflow> [--team <name>] [--light] [--json]` | anyone, tools | the workflows, and one as this project runs it: each step, the agent that does it, the skills it works with, review tiers and rounds, your gates |
525
565
  | `status --json` | tools | per unit: its workflow, stage, whose turn, what is next and the command or skill for it, and for a feature in Build whether it is verified and what blocks it |
526
566
  | `progress [--open]` | anyone | regenerate the progress pages, print the overview, open the HTML page |
527
567
  | `branch <name>` · `--list` · `--use <name>` | agent (after asking you with `git.branches: "ask"`) | create the branch of a unit, list the existing branches, or switch to one |
@@ -581,6 +621,7 @@ is wrong, so a typo is never a silent default.
581
621
  | `fix` | `max_total`, `max_per_file`, `protected`, `ignored`, `new_file_paths` |
582
622
  | `review.build` | `area` (default: one build review per completed area) or `task` |
583
623
  | `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
+ | `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 }` |
584
625
  | `review.qa` | `on` (default) or `off`: the QA step in Verify for full-mode features |
585
626
  | `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 |
586
627
  | `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 |
@@ -589,6 +630,8 @@ is wrong, so a typo is never a silent default.
589
630
  | `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`) |
590
631
  | `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. Set it with `npx agjan models set deep <model>` in your terminal (`npx agjan models` lists the settings and, for Copilot, the models it offers). A deep reviewer on another model family than the main agent (for example `gpt-6-sol` while the main agent runs on Claude) misses other things than the main agent. Model names differ per host (Claude Code: `sonnet`, `opus` or a full id; Copilot: for example `claude-opus-5.5`). Copilot uses the agent file's model unless the session was started with `--model`, which overrides it. `doctor` shows what each reviewer runs on |
591
632
  | `mcp.servers.<name>` | documentation MCP servers: `command`, `args`, `env`, `areas`, `enabled` |
633
+ | `teams`, `team` | your own teams, and the default team per workflow ([Teams](#teams)) |
634
+ | `roles`, `personas` | your own roles, each reaching the main agent, the reviewer or the QA agent, and named personas teams refer to ([Teams](#teams)) |
592
635
  | `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 |
593
636
 
594
637
  `npx agjan status` prints the language, the round limit and the attempts in its first
@@ -0,0 +1,120 @@
1
+ # Workflows, teams, personas and skills
2
+
3
+ agjan separates **how** work is done from **who** does it. A workflow fixes the steps,
4
+ reviews and approvals. A team decides what knowledge the agents bring to those steps. This
5
+ page defines the four terms and how they fit together; the [user guide](guide.md#teams)
6
+ shows how to use them.
7
+
8
+ - [The four terms](#the-four-terms)
9
+ - [How they fit together](#how-they-fit-together)
10
+ - [The workflows](#the-workflows)
11
+ - [Which roles each workflow needs](#which-roles-each-workflow-needs)
12
+ - [Example: the built-in teams](#example-the-built-in-teams)
13
+
14
+ ## The four terms
15
+
16
+ | Term | What it is | Examples | Where it is defined |
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. |
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
+ | **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
+ | **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. |
22
+
23
+ There are four built-in **roles**, and a persona fills one of them:
24
+
25
+ | Role | What it does |
26
+ |---|---|
27
+ | implementer | Builds a feature or a fix (the main agent). |
28
+ | analyst | Maps an existing application or prepares a decision (the main agent). |
29
+ | reviewer | Reviews every step independently, read-only (the reviewer agents). |
30
+ | tester | Tests the built feature against its acceptance criteria (the QA agent). |
31
+
32
+ A project can add its own roles under `roles`, such as a `security-reviewer`. Each one reaches an
33
+ agent that already runs (the main agent, the reviewer or the QA agent), which then works with that
34
+ role's persona as well. A role adds knowledge; it never adds an agent or a step.
35
+
36
+ A **unit** is one piece of work that runs a workflow: one feature, one fix, one map run or
37
+ one discovery.
38
+
39
+ ## How they fit together
40
+
41
+ ```text
42
+ WORKFLOW feature · fix · map · discovery
43
+ │ built into agjan; the steps every team follows
44
+ │
45
+ │ many-to-many: a team serves one or more workflows, a workflow has one or more teams
46
+ │ one default team per workflow; exactly one team per unit
47
+ ▼
48
+ TEAM sap-delivery · sap-maintenance · sap-discovery · your own
49
+ │
50
+ │ one persona per role the workflow needs
51
+ ▼
52
+ PERSONA implementer · analyst · reviewer · tester
53
+ │
54
+ │ many-to-many: a persona lists its skills; a skill is reused by many personas
55
+ ▼
56
+ SKILL cap-developer · fiori-developer · btp-architect · solution-reviewer · qa-tester · ...
57
+ ```
58
+
59
+ The rules behind the arrows:
60
+
61
+ - A team lists the workflows it serves (`sap-maintenance` serves both fix and map), and
62
+ several teams may serve the same workflow.
63
+ - Each workflow has one **default** team: the one `team.<workflow>` names in
64
+ `agjan.config.json`, otherwise the first team that serves it.
65
+ - Each unit runs with **exactly one** team: the default, or the one named with `--team`
66
+ when the unit starts. The unit records the team and a hash of its definition, so a later
67
+ change to the team is reported.
68
+ - A team has one persona per role, and must fill every built-in role its workflows need with
69
+ at least one skill. Its own roles are optional extras for the same agents.
70
+ - A persona starts no agent of its own. Its skills and instructions go to the agent that
71
+ already does that job: the main agent, the reviewer or the QA agent.
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).
74
+ - A team cannot remove a step. Every workflow keeps an independent review, approvals
75
+ stamped by a script, scope checks, and a person who decides at the end.
76
+
77
+ ## The workflows
78
+
79
+ | Workflow | Use it for | Started with | Stages | Your decision |
80
+ |---|---|---|---|---|
81
+ | feature | New or changed behaviour, spec-driven | `/agjan-spec` | Spec, Design, Build, Verify | Approve spec and design, accept the result, merge |
82
+ | fix | A small fix within limits, existing files only | `/agjan-fix` | Fix, Review | Review and merge the pull request |
83
+ | map | Describing an existing application in `project.md` | `/agjan-map` | Map, Review | Review and merge the pull request |
84
+ | discovery | A decision before any spec: options and a recommendation, no code | `/agjan-discover` | Proposal, Review, Approval | Approve the proposal |
85
+
86
+ ## Which roles each workflow needs
87
+
88
+ | Workflow | implementer | analyst | reviewer | tester |
89
+ |---|---|---|---|---|
90
+ | feature | the main agent builds | | reviews every stage | the QA agent tests |
91
+ | fix | the main agent fixes | | reviews the fix | |
92
+ | map | | the main agent maps | reviews the map | |
93
+ | discovery | | the main agent proposes | reviews the proposal | |
94
+
95
+ ## Example: the built-in teams
96
+
97
+ agjan ships three teams for SAP CAP, Fiori and BTP projects. The same skills appear in
98
+ several personas: that is the many-to-many link between personas and skills.
99
+
100
+ ```text
101
+ feature ────► sap-delivery
102
+ implementer: cap-developer, fiori-developer, btp-architect
103
+ reviewer: solution-reviewer, cap-developer, fiori-developer, btp-architect
104
+ tester: qa-tester
105
+
106
+ fix ──┐
107
+ map ──┴─────► sap-maintenance
108
+ implementer: cap-developer, fiori-developer (fix)
109
+ analyst: cap-developer, fiori-developer, btp-architect (map)
110
+ reviewer: solution-reviewer, cap-developer, fiori-developer
111
+
112
+ discovery ──► sap-discovery
113
+ analyst: btp-architect, cap-developer, fiori-developer
114
+ reviewer: solution-reviewer, btp-architect
115
+ ```
116
+
117
+ To define your own team, import one, or make it a workflow's default, see
118
+ [Teams](guide.md#teams) in the user guide. `npx agjan team list` lists the teams of a
119
+ project, `npx agjan team show <name>` their personas, and `npx agjan workflow show <workflow>`
120
+ every step of a workflow with the agent and the skills that do it in your project.
@@ -8,6 +8,13 @@ description: Build an approved agjan design task by task, within the approved pa
8
8
  Implement `tasks.md` in order. The approved design is the contract: build what it says,
9
9
  where it says.
10
10
 
11
+ ## Your team
12
+
13
+ Once the unit exists, `npx agjan status` shows its team: the `team` row lists the skills
14
+ your role works with (read them next to the ones this skill names), and each `follow` row is
15
+ an instruction of your team for you. Follow those instructions; where one conflicts with this
16
+ skill or with the user, this skill and the user win.
17
+
11
18
  ## Arriving in auto mode
12
19
 
13
20
  In auto mode you reach this skill from the previous one within one run, through `npx agjan skill build`.
@@ -8,6 +8,13 @@ description: Full-mode agjan design. After the spec is approved, the role skills
8
8
  Answer the approved spec technically: areas, decisions, tasks. Light changes are
9
9
  designed by `/agjan-spec`; this skill is for full mode.
10
10
 
11
+ ## Your team
12
+
13
+ Once the unit exists, `npx agjan status` shows its team: the `team` row lists the skills
14
+ your role works with (read them next to the ones this skill names), and each `follow` row is
15
+ an instruction of your team for you. Follow those instructions; where one conflicts with this
16
+ skill or with the user, this skill and the user win.
17
+
11
18
  ## Arriving in auto mode
12
19
 
13
20
  In auto mode you reach this skill from the previous one within one run, through `npx agjan skill design`.
@@ -11,6 +11,13 @@ You answer it like an SAP consultant preparing a workshop: options, trade-offs a
11
11
  recommendation the user can approve. You change no code; building the recommendation is a
12
12
  feature afterwards (`/agjan-spec`).
13
13
 
14
+ ## Your team
15
+
16
+ Once the unit exists, `npx agjan status` shows its team: the `team` row lists the skills
17
+ your role works with (read them next to the ones this skill names), and each `follow` row is
18
+ an instruction of your team for you. Follow those instructions; where one conflicts with this
19
+ skill or with the user, this skill and the user win.
20
+
14
21
  ## 1. Start
15
22
 
16
23
  - If you are on the base branch, the work needs a branch of its own. `npx agjan status`
@@ -34,7 +41,7 @@ Otherwise do not ask: state your assumptions in the Context.
34
41
  - The application: `agjan-docs/project.md`, then the files that matter for the question
35
42
  (models, services, `mta.yaml`, `xs-security.json`, app manifests). Read; never change.
36
43
  - agjan's knowledge: the skills of your role in the discovery's team (`npx agjan status`,
37
- `team` row; by default btp-architect, cap-developer, fiori-developer; read their tables and
44
+ `team` row, see Your team; by default btp-architect, cap-developer, fiori-developer; read their tables and
38
45
  only the matching references) and the source list
39
46
  `.claude/skills/agjan-ask/references/sources.md`.
40
47
  - The documentation servers configured for the project and, where your host can and the
@@ -8,6 +8,13 @@ description: Fast path for a small agjan change (a bug fix, a label, a small cor
8
8
  A small change to existing files, checked by script and reviewed, without Spec and
9
9
  Design. A human still reviews and merges the pull request.
10
10
 
11
+ ## Your team
12
+
13
+ Once the unit exists, `npx agjan status` shows its team: the `team` row lists the skills
14
+ your role works with (read them next to the ones this skill names), and each `follow` row is
15
+ an instruction of your team for you. Follow those instructions; where one conflicts with this
16
+ skill or with the user, this skill and the user win.
17
+
11
18
  ## 1. Is it a fix?
12
19
 
13
20
  A fix changes existing files only (new files only for tests), stays within the
@@ -8,6 +8,13 @@ description: Map an existing application for agjan. Writes the short architectur
8
8
  Give later specs and designs the picture of the application: what exists and where.
9
9
  The merge of this branch is its approval.
10
10
 
11
+ ## Your team
12
+
13
+ Once the unit exists, `npx agjan status` shows its team: the `team` row lists the skills
14
+ your role works with (read them next to the ones this skill names), and each `follow` row is
15
+ an instruction of your team for you. Follow those instructions; where one conflicts with this
16
+ skill or with the user, this skill and the user win.
17
+
11
18
  ## 1. Start
12
19
 
13
20
  On a branch of its own, without features or fixes. If you are on the base branch:
@@ -9,6 +9,13 @@ argument-hint: <what the user wants>
9
9
  Turn the user's request into an approved-ready `spec.md`, then decide light or full
10
10
  design. You write; the agjan reviewer checks; the human approves.
11
11
 
12
+ ## Your team
13
+
14
+ Once the unit exists, `npx agjan status` shows its team: the `team` row lists the skills
15
+ your role works with (read them next to the ones this skill names), and each `follow` row is
16
+ an instruction of your team for you. Follow those instructions; where one conflicts with this
17
+ skill or with the user, this skill and the user win.
18
+
12
19
  ## 1. Start, continue or revise
13
20
 
14
21
  Run `npx agjan status`. It shows the features this branch carries:
@@ -8,6 +8,13 @@ description: Verify a built agjan feature. Full build, tests and lint, the basel
8
8
  Prove that the feature is complete and consistent, and hand it to the human, who
9
9
  accepts it (Gate 3, `npx agjan approve verify`).
10
10
 
11
+ ## Your team
12
+
13
+ Once the unit exists, `npx agjan status` shows its team: the `team` row lists the skills
14
+ your role works with (read them next to the ones this skill names), and each `follow` row is
15
+ an instruction of your team for you. Follow those instructions; where one conflicts with this
16
+ skill or with the user, this skill and the user win.
17
+
11
18
  ## Arriving in auto mode
12
19
 
13
20
  In auto mode you reach this skill from the previous one within one run, through `npx agjan skill verify`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agjan",
3
- "version": "0.0.25",
3
+ "version": "0.0.27",
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",
@@ -38,6 +38,7 @@
38
38
  "kit/",
39
39
  "schemas/",
40
40
  "docs/guide.md",
41
+ "docs/workflows-and-teams.md",
41
42
  "docs/brand/",
42
43
  "NOTICE"
43
44
  ],
@@ -36,19 +36,37 @@
36
36
  "description": { "type": "string" },
37
37
  "workflows": { "type": "array", "items": { "enum": ["feature", "fix", "map", "discovery"] }, "minItems": 1 },
38
38
  "personas": {
39
+ "description": "A persona per role (implementer, reviewer, tester, analyst, or one under \"roles\"): inline, or the name of one under \"personas\".",
39
40
  "type": "object",
40
- "propertyNames": { "enum": ["implementer", "reviewer", "tester", "analyst"] },
41
41
  "additionalProperties": {
42
- "type": "object",
43
- "required": ["skills"],
44
- "properties": { "skills": { "type": "array", "items": { "type": "string" } }, "instructions": { "type": "string" } },
45
- "additionalProperties": false
42
+ "oneOf": [
43
+ { "$ref": "#/definitions/persona" },
44
+ { "type": "string", "minLength": 1 }
45
+ ]
46
46
  }
47
47
  }
48
48
  },
49
49
  "additionalProperties": false
50
50
  }
51
51
  },
52
+ "roles": {
53
+ "description": "The project's own roles next to implementer, reviewer, tester and analyst (decision 94): each reaches one agent, which works with its persona too.",
54
+ "type": "object",
55
+ "additionalProperties": {
56
+ "type": "object",
57
+ "required": ["agent"],
58
+ "properties": {
59
+ "agent": { "enum": ["main", "reviewer", "qa"], "description": "main: the main agent; reviewer: the reviewer agents; qa: the QA agent." },
60
+ "description": { "type": "string" }
61
+ },
62
+ "additionalProperties": false
63
+ }
64
+ },
65
+ "personas": {
66
+ "description": "Named personas teams refer to by name (decision 94).",
67
+ "type": "object",
68
+ "additionalProperties": { "$ref": "#/definitions/persona" }
69
+ },
52
70
  "team": {
53
71
  "description": "The default team per workflow.",
54
72
  "type": "object",
@@ -96,6 +114,12 @@
96
114
  "properties": {
97
115
  "build": { "enum": ["area", "task"] },
98
116
  "rounds": { "type": "integer", "minimum": 1 },
117
+ "step_rounds": {
118
+ "description": "The round limit of a kind of review step, over rounds.",
119
+ "type": "object",
120
+ "propertyNames": { "enum": ["spec", "design:light", "design", "build", "qa", "verify", "fix", "map", "proposal"] },
121
+ "additionalProperties": { "type": "integer", "minimum": 1 }
122
+ },
99
123
  "tiers": { "type": "object", "additionalProperties": { "enum": ["fast", "balanced", "deep"] } },
100
124
  "qa": { "enum": ["on", "off"], "description": "The QA step in Verify for full-mode features (default on): the agjan-qa agent writes and runs tests from the spec alone." }
101
125
  },
@@ -143,5 +167,17 @@
143
167
  "additionalProperties": false
144
168
  }
145
169
  },
170
+ "definitions": {
171
+ "persona": {
172
+ "type": "object",
173
+ "required": ["skills"],
174
+ "properties": {
175
+ "skills": { "type": "array", "items": { "type": "string" } },
176
+ "instructions": { "type": "string" },
177
+ "description": { "type": "string" }
178
+ },
179
+ "additionalProperties": false
180
+ }
181
+ },
146
182
  "additionalProperties": false
147
183
  }