agjan 0.0.29 → 0.0.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +4 -3
  2. package/dist/adapters/claude-code.js +39 -1
  3. package/dist/adapters/copilot.js +34 -1
  4. package/dist/baseline.js +3 -4
  5. package/dist/cli.js +7 -3
  6. package/dist/commands/areas.js +47 -0
  7. package/dist/commands/lint.js +2 -2
  8. package/dist/commands/map.js +6 -1
  9. package/dist/commands/review.js +3 -3
  10. package/dist/commands/setup.js +19 -16
  11. package/dist/commands/status.js +26 -10
  12. package/dist/commands/team.js +16 -12
  13. package/dist/commands/workflow.js +10 -9
  14. package/dist/config.js +55 -49
  15. package/dist/defaults-file.js +5 -3
  16. package/dist/imports.js +4 -6
  17. package/dist/mcp-config.js +1 -1
  18. package/dist/mcp.js +31 -3
  19. package/dist/review.js +12 -7
  20. package/dist/schema.js +4 -0
  21. package/dist/teams.js +141 -37
  22. package/dist/terminal.js +3 -0
  23. package/dist/validate.js +3 -3
  24. package/dist/worker.js +120 -0
  25. package/dist/workflow-view.js +25 -15
  26. package/docs/guide.md +76 -30
  27. package/docs/workflows-and-teams.md +53 -18
  28. package/kit/hooks/guard.mjs +55 -2
  29. package/kit/presets/generic.json +26 -0
  30. package/kit/presets/sap-btp.json +34 -0
  31. package/kit/skills/agjan-build/SKILL.md +9 -3
  32. package/kit/skills/agjan-design/SKILL.md +14 -11
  33. package/kit/skills/agjan-discover/SKILL.md +6 -0
  34. package/kit/skills/agjan-fix/SKILL.md +6 -0
  35. package/kit/skills/agjan-map/SKILL.md +14 -5
  36. package/kit/skills/agjan-spec/SKILL.md +6 -0
  37. package/kit/skills/agjan-worker/SKILL.md +36 -0
  38. package/kit/skills/agjan-worker/references/hand-off.md +32 -0
  39. package/kit/skills/backend-developer/SKILL.md +50 -0
  40. package/kit/skills/solution-architect/SKILL.md +54 -0
  41. package/kit/skills/technical-architect/SKILL.md +50 -0
  42. package/kit/skills/ui-developer/SKILL.md +48 -0
  43. package/kit/templates/project.md +3 -14
  44. package/package.json +1 -1
  45. package/schemas/config.defaults.json +8 -10
  46. package/schemas/config.schema.json +53 -53
  47. package/kit/domains/btp/domain.json +0 -29
package/dist/validate.js CHANGED
@@ -10,8 +10,8 @@ export function documentProblems(feature) {
10
10
  return problems;
11
11
  }
12
12
  /**
13
- * Consistency between design, tasks, spec and configuration: areas exist and are
14
- * enabled, every task belongs to an approved area, every `covers` id is a spec AC, and
13
+ * Consistency between design, tasks, spec and configuration: areas exist in the
14
+ * project, every task belongs to an approved area, every `covers` id is a spec AC, and
15
15
  * every AC is covered by at least one task.
16
16
  */
17
17
  export function designProblems(feature, config) {
@@ -22,7 +22,7 @@ export function designProblems(feature, config) {
22
22
  for (const id of feature.design.parsed.areas) {
23
23
  const area = resolveArea(config, id);
24
24
  if (!area)
25
- problems.push(`design.md: area '${id}' is not an area of the enabled domains (${config.domains.join(', ')})`);
25
+ problems.push(`design.md: area '${id}' is not an area of this project (${Object.keys(config.areas).join(', ')})`);
26
26
  else
27
27
  designAreas.add(area.id);
28
28
  }
package/dist/worker.js ADDED
@@ -0,0 +1,120 @@
1
+ import { mkdirSync, writeFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { AgjanError } from './errors.js';
4
+ import { FEATURES_DIR } from './feature.js';
5
+ import { PROJECT_MD } from './fix.js';
6
+ import { resolveArea } from './config.js';
7
+ import { readFix } from './commands/fix.js';
8
+ import { STAGE_KEYS, roleDefinition, stageOwner, unitTeam } from './teams.js';
9
+ /**
10
+ * Worker agents (decision 100). A team gives a stage (spec, design, build, fix, map,
11
+ * proposal) to a role whose agent is a worker: the main agent starts `agjan-worker` or
12
+ * `agjan-worker-deep`, which calls `role_context` for its role, its skills, its inputs and the
13
+ * paths it may write, does the stage's writing and hands back a summary or its questions. The
14
+ * main agent keeps the conversation with the user, the reviews, the gates and the commits.
15
+ *
16
+ * `role_context` writes `.agjan/worker-guard.json`: the guard hook denies a worker's file edits
17
+ * outside those paths where the host names the calling agent (Claude Code).
18
+ */
19
+ export const WORKER_GUARD = '.agjan/worker-guard.json';
20
+ /** What each stage asks of the worker, in plain words. */
21
+ const JOB = {
22
+ spec: 'Write `spec.md` from the request below: what and why, the users and roles, the scope, and testable acceptance criteria with their unhappy paths. Keep the template\'s headings.',
23
+ design: 'Write `design.md` (areas, decisions with what, why and the alternative, answers to the open technical questions) and `tasks.md` (tasks with their area, the ACs they cover and every path needed to implement and test them). Keep the templates\' headings and the YAML block of tasks.md.',
24
+ build: 'Build the task below: change only its paths and the implicit files of its area, write a test per AC named with the AC id, and run the area\'s test command until it passes.',
25
+ fix: 'Fix the defect below in the existing files, within the fix limits: the smallest change that fixes it, with a test where the project has tests.',
26
+ map: 'Describe the application in `agjan-docs/project.md`: one to two pages under the template\'s headings, with pointers to real files instead of copies.',
27
+ proposal: 'Write `proposal.md` for the question it states: context, at least two real options with their costs and risks, a recommendation, open questions and the sources you used.',
28
+ };
29
+ /** The paths a stage may write and those it never may. */
30
+ function scope(config, unit, stage, taskId) {
31
+ const dir = `${FEATURES_DIR}/${unit.slug}`;
32
+ if (stage === 'spec')
33
+ return { allow: [`${dir}/spec.md`], deny: [] };
34
+ if (stage === 'design')
35
+ return { allow: [`${dir}/design.md`, `${dir}/tasks.md`], deny: [] };
36
+ if (stage === 'map')
37
+ return { allow: [PROJECT_MD], deny: [] };
38
+ if (stage === 'proposal')
39
+ return { allow: [`${dir}/proposal.md`], deny: [] };
40
+ if (stage === 'fix')
41
+ return { allow: ['**'], deny: [`${FEATURES_DIR}/**`, ...config.fix.protected, ...config.risk_paths] };
42
+ // build: one task's paths, its area's implicit files and the approved amendments.
43
+ if (!taskId)
44
+ throw new AgjanError('role_context: the build stage needs a task (task: "T1")');
45
+ const task = unit.tasks?.parsed.tasks.find((t) => t.id === taskId);
46
+ if (!task)
47
+ throw new AgjanError(`role_context: no task '${taskId}' in tasks.md (tasks: ${(unit.tasks?.parsed.tasks ?? []).map((t) => t.id).join(', ') || 'none'})`);
48
+ const area = resolveArea(config, task.area ?? '');
49
+ const amended = unit.amendments.filter((a) => a.status === 'approved').flatMap((a) => a.paths);
50
+ return { allow: [...task.paths, ...(area ? config.scope.implicit[area.name] ?? [] : []), ...amended], deny: [`${FEATURES_DIR}/**`], task };
51
+ }
52
+ /**
53
+ * The skills of a build task's worker: the role's, without the skills of the project's other
54
+ * areas, plus the task area's own. A role's general skills (a company standard) stay.
55
+ */
56
+ export function taskSkills(config, owner, areaName) {
57
+ const area = areaName ? resolveArea(config, areaName) : null;
58
+ if (!area)
59
+ return owner.skills;
60
+ const others = new Set(Object.values(config.areas).filter((a) => a.name !== area.name).flatMap((a) => a.skills));
61
+ return [...new Set([...owner.skills.filter((s) => !others.has(s) || area.skills.includes(s)), ...area.skills])];
62
+ }
63
+ function section(title, body) {
64
+ return `## ${title}\n\n${body.trim()}\n`;
65
+ }
66
+ /**
67
+ * The worker's input for one stage of a unit (`role_context`): its role and skills, what to
68
+ * do, what to read, what it may write and how to hand back. Writes the worker guard.
69
+ */
70
+ export function createWorkerContext(root, config, unit, { stage, task: taskId }) {
71
+ const stages = STAGE_KEYS[unit.kind];
72
+ if (!stages.includes(stage))
73
+ throw new AgjanError(`role_context: a ${unit.kind} has no stage '${stage}' for a worker (stages: ${stages.join(', ')})`);
74
+ // A feature's stages come in order: no design before the spec is approved, no build before the design.
75
+ if (unit.kind === 'feature' && unit.stage !== stage) {
76
+ throw new AgjanError(`role_context: ${unit.key} is at the ${unit.stage} stage, not ${stage}`);
77
+ }
78
+ const team = unitTeam(config, unit.approvals.feature.team);
79
+ const owner = stageOwner(config, team?.team ?? null, stage);
80
+ if (!team || !owner || owner.agent !== 'worker') {
81
+ throw new AgjanError(`role_context: the team of ${unit.key} (${team?.name ?? 'none'}) gives the ${stage} stage to no worker; the main agent does it`);
82
+ }
83
+ const { allow, deny, task } = scope(config, unit, stage, taskId);
84
+ const skills = task ? taskSkills(config, owner, task.area) : owner.skills;
85
+ const dir = `${FEATURES_DIR}/${unit.slug}`;
86
+ const description = roleDefinition(config, owner.role)?.description;
87
+ const reading = [];
88
+ if (unit.spec && stage !== 'spec')
89
+ reading.push(`- \`${dir}/spec.md\` (approved)`);
90
+ if (stage === 'spec' && unit.spec)
91
+ reading.push(`- \`${dir}/spec.md\` (the draft so far)`);
92
+ if (stage === 'build')
93
+ reading.push(`- \`${dir}/design.md\` and \`${dir}/tasks.md\` (approved)`);
94
+ if (stage === 'design' && unit.design)
95
+ reading.push(`- \`${dir}/design.md\` and \`${dir}/tasks.md\` (the draft so far)`);
96
+ if (stage === 'proposal')
97
+ reading.push(`- \`${dir}/proposal.md\` (the question and the draft so far)`);
98
+ reading.push(`- \`${PROJECT_MD}\` (the application), when it exists`);
99
+ reading.push('- `npx agjan areas`: the project\'s areas and their skills');
100
+ const request = stage === 'fix' ? readFix(unit)?.what : undefined;
101
+ const parts = [
102
+ `# agjan worker: ${stage} of ${unit.key}${task ? `, task ${task.id}` : ''}\n`,
103
+ section('Your role', `${owner.role}${description ? `: ${description}` : ''}, in team ${team.name}.${owner.instructions ? `\n\n${owner.instructions}` : ''}`),
104
+ section('Your skills', skills.length ? skills.map((s) => `- \`.claude/skills/${s}/SKILL.md\` (and the references its table names for your topic)`).join('\n') : '(none: follow the project\'s conventions)'),
105
+ section('Your job', JOB[stage]),
106
+ ...(task ? [section(`Task ${task.id}: ${task.title}`, `- area: ${task.area}\n- covers: ${task.covers.join(', ')}\n- paths: ${task.paths.map((p) => `\`${p}\``).join(', ')}${task.verify ? `\n- verify: \`${task.verify}\`` : ''}\n- the area's test command: \`${config.verify[task.area]?.test ?? 'npm test'}\``)] : []),
107
+ ...(request ? [section('The defect', request)] : []),
108
+ section('Read', reading.join('\n')),
109
+ section('You may write', `${allow.map((p) => `- \`${p}\``).join('\n')}${deny.length ? `\n\nNever: ${deny.map((p) => `\`${p}\``).join(', ')}.` : ''}\n\nAnything else is out of your scope: if the work needs another file, stop and say which and why.`),
110
+ section('Hand back', [
111
+ 'You work alone: you cannot ask the user. When you need a decision you cannot take from the material above, stop and end your answer with a section `QUESTIONS:` that lists each question with the options you see. The main agent asks the user and starts you again with the answers.',
112
+ 'Otherwise end with a short summary: what you wrote or changed (files), what you ran and its result, and anything the reviewer should know.',
113
+ 'Never run `agjan approve`, `review`, `log`, `amend`, `new` or other commands that record; never commit, push or switch branches: the main agent does that after you.',
114
+ ].join('\n\n')),
115
+ ];
116
+ const guard = { unit: unit.slug, stage, ...(task ? { task: task.id } : {}), allow, deny };
117
+ mkdirSync(join(root, '.agjan'), { recursive: true });
118
+ writeFileSync(join(root, WORKER_GUARD), `${JSON.stringify(guard, null, 2)}\n`);
119
+ return { text: parts.join('\n'), guard };
120
+ }
@@ -1,4 +1,4 @@
1
- import { BUILT_IN_TEAMS, allTeams, defaultTeam, mainRole, personasFor, teamProblems } from './teams.js';
1
+ import { BUILT_IN_TEAMS, allTeams, defaultTeam, mainRole, roleDefinition, rolesFor, stageOwner, teamProblems } from './teams.js';
2
2
  import { resolveBuild, resolveQa, resolveRounds, resolveTier, reviewerFor } from './review-policy.js';
3
3
  import { baseOf, extrasOf } from './customization.js';
4
4
  import { AgjanError } from './errors.js';
@@ -15,13 +15,13 @@ function trackStage(kind, stage, gate) {
15
15
  return stage.charAt(0).toUpperCase() + stage.slice(1);
16
16
  return kind === 'discovery' && gate ? 'Approval' : 'Review';
17
17
  }
18
- /** Persona entries of a role list as the JSON gives them. */
19
- function personaEntries(config, personas) {
20
- return personas.map(({ role, persona }) => ({
18
+ /** A step's roles as the JSON gives them, with each project role's description. */
19
+ function roleEntries(config, roles) {
20
+ return roles.map(({ role, skills, instructions }) => ({
21
21
  role,
22
- ...(config.roles?.[role]?.description ? { description: config.roles[role].description } : {}),
23
- skills: persona.skills,
24
- ...(persona.instructions ? { instructions: persona.instructions } : {}),
22
+ ...(roleDefinition(config, role)?.description ? { description: roleDefinition(config, role).description } : {}),
23
+ skills,
24
+ ...(instructions ? { instructions } : {}),
25
25
  }));
26
26
  }
27
27
  /**
@@ -47,16 +47,27 @@ export function resolveWorkflow(root, config, workflowName, options = {}) {
47
47
  name: stage.name,
48
48
  steps: stage.steps
49
49
  .filter((step) => !step.mode || step.mode === mode)
50
- .map((step) => {
51
- const personas = team && step.actor !== 'human' ? personasFor(config, team, kind, step.actor) : [];
50
+ .map((step, index, steps) => {
51
+ // The stage's writing step, when the team gives the stage to a role (decision 100).
52
+ const owner = step.actor === 'main' && steps.findIndex((x) => x.actor === 'main') === index ? stageOwner(config, team, stage.name) : null;
53
+ if (owner) {
54
+ return {
55
+ actor: step.actor,
56
+ agent: owner.worker ?? 'main agent',
57
+ does: step.does,
58
+ role: owner.role,
59
+ roles: roleEntries(config, [{ role: owner.role, skills: owner.skills, ...(owner.instructions ? { instructions: owner.instructions } : {}) }]),
60
+ ...(owner.worker ? { handoff: true } : {}),
61
+ };
62
+ }
63
+ const roles = team && step.actor !== 'human' ? rolesFor(config, team, kind, step.actor) : [];
52
64
  const builtIn = step.actor === 'main' ? mainRole(kind) : step.actor === 'reviewer' ? 'reviewer' : step.actor === 'qa' ? 'tester' : null;
53
65
  const resolved = {
54
66
  actor: step.actor,
55
67
  agent: step.actor === 'main' ? 'main agent' : 'you',
56
68
  does: step.does,
57
69
  role: builtIn,
58
- persona: builtIn ? (team?.personas[builtIn] ?? null) : null,
59
- personas: personaEntries(config, personas),
70
+ roles: roleEntries(config, roles),
60
71
  };
61
72
  if (step.review) {
62
73
  resolved.agent = reviewerFor(config, step.review, workflowName);
@@ -84,14 +95,13 @@ export function resolveWorkflow(root, config, workflowName, options = {}) {
84
95
  if (!stage)
85
96
  continue;
86
97
  const role = r.role ?? 'reviewer';
87
- const persona = team?.personas[role] ?? null;
98
+ const own = team?.roles[role];
88
99
  const step = {
89
100
  actor: 'reviewer',
90
101
  agent: reviewerFor(config, r.id, workflowName),
91
102
  does: r.description,
92
103
  role,
93
- persona,
94
- personas: role === 'reviewer' && team ? personaEntries(config, personasFor(config, team, kind, 'reviewer')) : persona ? personaEntries(config, [{ role, persona }]) : [],
104
+ roles: role === 'reviewer' && team ? roleEntries(config, rolesFor(config, team, kind, 'reviewer')) : own ? roleEntries(config, [{ role, ...own }]) : [],
95
105
  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
106
  extra: true,
97
107
  };
@@ -104,7 +114,7 @@ export function resolveWorkflow(root, config, workflowName, options = {}) {
104
114
  const stage = stages.find((st) => st.name === trackStage(kind, g.stage, true));
105
115
  if (!stage)
106
116
  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 };
117
+ const step = { actor: 'human', agent: 'you', does: g.description, role: null, roles: [], gate: { name: g.id, command: `npx agjan approve ${g.id}` }, extra: true };
108
118
  const human = stage.steps.findIndex((x) => x.actor === 'human' && !x.extra);
109
119
  stage.steps.splice(human === -1 ? stage.steps.length : human, 0, step);
110
120
  }
package/docs/guide.md CHANGED
@@ -43,7 +43,7 @@ Requirements: Node.js 22 or later, git, and Claude Code and/or GitHub Copilot.
43
43
 
44
44
  ```sh
45
45
  npm install --global agjan
46
- agjan init my-project # asks which hosts to set up (or: --hosts claude-code,copilot), whether to choose the reviewer models, then to commit the setup
46
+ agjan init my-project # asks which hosts to set up (or: --hosts claude-code,copilot), the preset (or: --preset generic|sap-btp), whether to choose the reviewer models, then to commit the setup
47
47
  cd my-project # a command cannot move your shell: init prints this as its first next step
48
48
  npx agjan doctor # from here on, npx runs the project's pinned agjan
49
49
  ```
@@ -409,11 +409,16 @@ and CI waits for your approval. To build the recommendation, start a feature wit
409
409
  ## Teams
410
410
 
411
411
  A team decides what knowledge the agents bring to a unit of work; the workflow decides the
412
- steps, reviews and gates, and a team cannot remove any of them. [Workflows, teams, personas and
413
- skills](workflows-and-teams.md) defines the terms. Three teams are built in:
412
+ steps, reviews and gates, and a team cannot remove any of them. [Workflows, teams, roles and
413
+ skills](workflows-and-teams.md) defines the terms. Six teams are built in: three for any
414
+ stack, the defaults of a project without a `team` setting, and three for SAP BTP, the
415
+ defaults the `sap-btp` preset writes:
414
416
 
415
417
  | Team | Workflows | Implementer or analyst | Reviewer | Tester |
416
418
  |---|---|---|---|---|
419
+ | `delivery` | feature | technical-architect, backend-developer, ui-developer | solution-reviewer, technical-architect, backend-developer, ui-developer | qa-tester |
420
+ | `maintenance` | fix, map | backend-developer, ui-developer (fix); technical-architect and both developers (map) | solution-reviewer, backend-developer, ui-developer | - |
421
+ | `advisory` | discovery | solution-architect, technical-architect | solution-reviewer, solution-architect | - |
417
422
  | `sap-delivery` | feature | cap-developer, fiori-developer, btp-architect | solution-reviewer and the three role skills | qa-tester |
418
423
  | `sap-maintenance` | fix, map | cap-developer, fiori-developer (fix); the three role skills (map) | solution-reviewer, cap-developer, fiori-developer | - |
419
424
  | `sap-discovery` | discovery | btp-architect, cap-developer, fiori-developer | solution-reviewer, btp-architect | - |
@@ -427,7 +432,7 @@ included), and make it the default for a workflow:
427
432
  "company-delivery": {
428
433
  "description": "Delivery with our security standard",
429
434
  "workflows": ["feature"],
430
- "personas": {
435
+ "roles": {
431
436
  "implementer": { "skills": ["cap-developer", "fiori-developer"] },
432
437
  "reviewer": { "skills": ["solution-reviewer", "company-security"], "instructions": "Name the rule of the standard in every finding." },
433
438
  "tester": { "skills": ["qa-tester"] }
@@ -438,26 +443,22 @@ included), and make it the default for a workflow:
438
443
  }
439
444
  ```
440
445
 
441
- **Your own roles and shared personas.** Next to implementer, reviewer, tester and analyst you can
442
- define roles under `roles`; each reaches one of the agents that already run (`main`, `reviewer`,
443
- `qa`), which then works with that role's persona as well. A persona used by several teams can be
444
- defined once under `personas` and named in each team:
446
+ **Your own roles.** Next to implementer, reviewer, tester and analyst you can define roles
447
+ under `roles`; each reaches one of the agents that already run (`main`, `reviewer`, `qa`), which
448
+ then works with the skills a team gives that role as well:
445
449
 
446
450
  ```json
447
451
  {
448
452
  "roles": {
449
453
  "security-reviewer": { "agent": "reviewer", "description": "checks our security standard" }
450
454
  },
451
- "personas": {
452
- "company-reviewer": { "skills": ["solution-reviewer"], "instructions": "Cite file and line." }
453
- },
454
455
  "teams": {
455
456
  "company-delivery": {
456
457
  "description": "Delivery with our security standard",
457
458
  "workflows": ["feature"],
458
- "personas": {
459
+ "roles": {
459
460
  "implementer": { "skills": ["cap-developer", "fiori-developer"] },
460
- "reviewer": "company-reviewer",
461
+ "reviewer": { "skills": ["solution-reviewer", "company-review"] },
461
462
  "security-reviewer": { "skills": ["company-security"] },
462
463
  "tester": { "skills": ["qa-tester"] }
463
464
  }
@@ -469,15 +470,55 @@ defined once under `personas` and named in each team:
469
470
 
470
471
  Here every review of a company-delivery unit works with both the reviewer's and the security
471
472
  reviewer's skills, and the design review gets up to 5 rounds. A role adds knowledge to an agent's
472
- existing steps; it starts no agent and adds no step. Imported packages use the built-in roles,
473
- with their personas written out.
473
+ existing steps; it adds no step. Imported packages use the built-in roles.
474
+
475
+ **Roles that write a stage, and worker agents.** `stages` gives a stage (spec, design, build,
476
+ fix, map, proposal) to a role. A role of the main agent makes the main agent work as that role
477
+ there. A worker role runs as an agent of its own, with its own context and model: the built-in
478
+ `architect` (agent `agjan-worker-deep`) and `developer` (`agjan-worker`), or your own with
479
+ `"agent": "worker"` and a `tier`:
480
+
481
+ ```json
482
+ {
483
+ "roles": { "data-engineer": { "agent": "worker", "tier": "deep", "description": "builds the data model and migrations" } },
484
+ "teams": {
485
+ "company-delivery": {
486
+ "description": "Architect and developer agents",
487
+ "workflows": ["feature"],
488
+ "stages": { "design": "architect", "build": "developer" },
489
+ "roles": {
490
+ "implementer": { "skills": ["solution-architect"] },
491
+ "architect": { "skills": ["technical-architect", "company-architecture"] },
492
+ "developer": { "skills": ["backend-developer", "ui-developer"] },
493
+ "reviewer": { "skills": ["solution-reviewer"] },
494
+ "tester": { "skills": ["qa-tester"] }
495
+ }
496
+ }
497
+ },
498
+ "models": { "claude-code": { "worker-deep": "opus" } }
499
+ }
500
+ ```
501
+
502
+ `npx agjan status` then shows `hand off design → architect (agent agjan-worker-deep)`, and the
503
+ main agent starts that agent instead of writing the design itself (for build, one request per
504
+ task). The worker reads its role, skills, job and the paths it may write from its own agjan tool
505
+ (`role_context`), writes, and hands back a summary or questions, which the main agent asks you.
506
+ The main agent keeps talking to you, runs the checks and reviews, asks for your approvals and
507
+ commits. On Claude Code the guard keeps a worker to its paths and away from recording,
508
+ committing and branches. Worker models are `models.<host>.worker` and `worker-deep` (set them in
509
+ `agjan.config.json`; default: the session's model). The built-in `delivery` team works this way.
510
+
511
+ **Knowledge several teams share** is a skill: write it once as a skill of your own
512
+ (`.claude/skills/company-review/SKILL.md`, with the instructions and references your reviewers
513
+ follow) and list it in each team. A role's `instructions` are for a few lines that belong to one
514
+ team only.
474
515
 
475
516
  A unit starts with the workflow's default team, or the one you name (`--team` on `new`,
476
- `fix start`, `discover start`), and records it with a hash of its definition. A persona
517
+ `fix start`, `discover start`), and records it with a hash of its definition. A team
477
518
  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),
478
519
  the reviewer's and the tester's through their review and QA contexts. If the team's
479
520
  definition changes while a unit is under way, `status` and `check` say so.
480
- `npx agjan team list` lists the teams, `npx agjan team show <name>` their personas.
521
+ `npx agjan team list` lists the teams, `npx agjan team show <name>` the skills of each role.
481
522
  `npx agjan workflow show feature` shows the whole workflow as your project runs it: each
482
523
  step, the agent that does it and the skills it works with, the review tier and rounds from
483
524
  your configuration, and your gates (`--team <name>` for another team, `--light` for a light
@@ -498,7 +539,7 @@ Another team's skills and teams can come from a git repository that declares the
498
539
  "delivery": {
499
540
  "description": "Delivery with the ACME security review",
500
541
  "workflows": ["feature"],
501
- "personas": { "reviewer": { "skills": ["solution-reviewer", "security-review"] } }
542
+ "roles": { "reviewer": { "skills": ["solution-reviewer", "security-review"] } }
502
543
  }
503
544
  }
504
545
  }
@@ -528,7 +569,7 @@ its own, under `workflows` in `agjan.config.json`:
528
569
 
529
570
  - **Extra review steps** review what a stage produced (the spec, the design, the build, the whole
530
571
  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.
572
+ their own tier and round limit, optionally with the skills the team gives one of your roles.
532
573
  - **Extra gates** are a person's approval in a terminal (`npx agjan approve <gate>`), stamped like
533
574
  the built-in gates: a later change to the stage's documents, or to the files in Build, Verify,
534
575
  a fix or a map run, makes the approval stale.
@@ -636,7 +677,7 @@ Run `npx agjan --help` for the full list.
636
677
  | `discover start <slug> --key <KEY> --question "<text>"` | agent | start a discovery: its folder and `proposal.md` from the template |
637
678
  | `approve proposal` | you, in a terminal | decide on a discovery's recommendation |
638
679
  | `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 |
639
- | `team list` · `team show <name>` | anyone | the teams, the default per workflow, and what a team's personas work with |
680
+ | `team list` · `team show <name>` | anyone | the teams, the default per workflow, and the skills each role works with in a team |
640
681
  | `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 |
641
682
  | `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 |
642
683
  | `progress [--open]` | anyone | regenerate the progress pages, print the overview, open the HTML page |
@@ -663,18 +704,23 @@ it is plain text. `NO_COLOR=1` turns colors off, `FORCE_COLOR=1` turns them on.
663
704
 
664
705
  ## Configuration
665
706
 
666
- `agjan.config.json` is layered over the package and domain defaults: objects merge,
667
- lists replace. The schema is `node_modules/agjan/schemas/config.schema.json`; every command
707
+ `agjan.config.json` is layered over agjan's defaults: objects merge, lists replace.
708
+ `agjan init --preset <id>` writes a preset into it (`generic` for any stack, `sap-btp` for
709
+ CAP, Fiori and BTP; asked for on a terminal): the areas and paths below, which the project
710
+ owns from then on. The schema is `node_modules/agjan/schemas/config.schema.json`; every command
668
711
  checks the file against it and stops with the reasons when a setting is unknown or a value
669
712
  is wrong, so a typo is never a silent default.
670
713
 
671
714
  ```json
672
715
  {
673
716
  "kit": "0.1.0",
674
- "domains": ["btp"],
675
717
  "hosts": ["claude-code", "copilot"],
676
718
  "git": { "base": "origin/main" },
677
- "verify": { "cap": { "test": "npm test", "results": "reports/junit.xml" } },
719
+ "areas": {
720
+ "cap": { "title": "CAP", "skills": ["cap-developer"], "tests": ["test/**"],
721
+ "verify": { "test": "npm test", "results": "reports/junit.xml" } },
722
+ "fiori": { "title": "Fiori", "skills": ["fiori-developer"], "lint": null }
723
+ },
678
724
  "fix": { "max_total": 80, "max_per_file": 50 },
679
725
  "review": { "build": "area" },
680
726
  "models": { "claude-code": { "balanced": "session", "deep": "opus" }, "copilot": { "balanced": "session", "deep": "session" } },
@@ -685,15 +731,15 @@ is wrong, so a typo is never a silent default.
685
731
 
686
732
  | Key | Effect |
687
733
  |---|---|
688
- | `domains` | enabled domains; phase 1 has `btp` (areas `cap`, `fiori`, `btp`) |
734
+ | `areas.<area>` | the project's technical areas; every task belongs to one. `title` and `description`: its heading in `project.md`; `skills`: the skills in `.claude/skills/` that know it; `tests`: its test file globs; `implicit`: files every task of the area may change (i18n, lockfiles, fixtures). Without areas the project has one, `app`. `npx agjan areas` lists them |
689
735
  | `hosts` | `claude-code`, `copilot`; decides which files `sync` generates |
690
736
  | `git.base` | the branch features merge into; default: the remote's default branch |
691
737
  | `git.branches` | `new` (default): on the base branch the agent creates a branch with its proposed name; `ask`: it asks you first |
692
- | `verify.<area>` | `build`, `test`, `lint` commands for the skills; `results`: a JUnit XML, Jest or Mocha JSON file that `check` reads to require a passing test per AC |
693
- | `lint.<area>` | the linter `npx agjan lint` runs in each folder `in` (for example `app/*`) on the changed files matching `files`; the btp domain sets the UI5 linter for `fiori`; `null` turns it off |
694
- | `tests.<area>`, `scope.implicit.<area>` | test file globs; files every task of the area may change (i18n, lockfiles, fixtures) |
738
+ | `areas.<area>.verify` | `build`, `test`, `lint` commands for the skills; `results`: a JUnit XML, Jest or Mocha JSON file that `check` reads to require a passing test per AC |
739
+ | `areas.<area>.lint` | the linter `npx agjan lint` runs in each folder `in` (for example `app/*`) on the changed files matching `files`; the sap-btp preset sets the UI5 linter for `fiori`; `null` turns it off |
740
+ | `watched` | files whose change makes `project.md` stale (`agjan baseline refresh` records their hashes) |
695
741
  | `risk_paths` | paths whose change needs a review per task and are never a fix |
696
- | `application` | the application's code, which the QA agent may not read (the btp domain: `srv/**`, `db/**`, `app/**`) |
742
+ | `application` | the application's code, which the QA agent may not read (the sap-btp preset: `srv/**`, `db/**`, `app/**`) |
697
743
  | `fix` | `max_total`, `max_per_file`, `protected`, `ignored`, `new_file_paths` |
698
744
  | `review.build` | `area` (default: one build review per completed area) or `task` |
699
745
  | `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 |
@@ -708,7 +754,7 @@ is wrong, so a typo is never a silent default.
708
754
  | `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 |
709
755
  | `mcp.servers.<name>` | documentation MCP servers: `command`, `args`, `env`, `areas`, `enabled` |
710
756
  | `teams`, `team` | your own teams, and the default team per workflow ([Teams](#teams)) |
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)) |
757
+ | `roles` | your own roles, each reaching the main agent, the reviewer or the QA agent ([Teams](#teams)) |
712
758
  | `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)) |
713
759
  | `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 |
714
760
 
@@ -1,4 +1,4 @@
1
- # Workflows, teams, personas and skills
1
+ # Workflows, teams, roles and skills
2
2
 
3
3
  agjan separates **how** work is done from **who** does it. A workflow fixes the steps,
4
4
  reviews and approvals. A team decides what knowledge the agents bring to those steps. This
@@ -16,11 +16,11 @@ shows how to use them.
16
16
  | Term | What it is | Examples | Where it is defined |
17
17
  |---|---|---|---|
18
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
- | **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. |
19
+ | **Team** | Serves one or more workflows and gives each role its skills (and optional instructions). It decides the knowledge, never the steps. | delivery, maintenance, advisory; sap-delivery, sap-maintenance, sap-discovery | Built into agjan, imported from a package, or in the project's `agjan.config.json`. |
20
+ | **Skill** | A folder of instructions and references an agent reads for a specialty. | technical-architect, backend-developer, cap-developer, solution-reviewer, qa-tester | `.claude/skills/<name>/SKILL.md`: agjan's own, the project's own, or imported. |
22
21
 
23
- There are four built-in **roles**, and a persona fills one of them:
22
+ A **role** is the part an agent plays in a workflow. There are four built-in roles; a team says
23
+ which skills each works with:
24
24
 
25
25
  | Role | What it does |
26
26
  |---|---|
@@ -29,9 +29,17 @@ There are four built-in **roles**, and a persona fills one of them:
29
29
  | reviewer | Reviews every step independently, read-only (the reviewer agents). |
30
30
  | tester | Tests the built feature against its acceptance criteria (the QA agent). |
31
31
 
32
+ Two built-in **worker roles** run as agents of their own (design decision 100): `architect`
33
+ (the `agjan-worker-deep` agent) and `developer` (`agjan-worker`). A team gives them a stage under
34
+ `stages`, for example `"stages": { "design": "architect", "build": "developer" }`: the main agent
35
+ then hands that stage's writing to the worker agent (for build, one task per request) and keeps
36
+ the user, the checks, the reviews, the gates and the commits.
37
+
32
38
  A project can add its own roles under `roles`, such as a `security-reviewer`. Each one reaches an
33
39
  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.
40
+ role's skills in the team as well, or is a worker of its own (`"agent": "worker"`, with a `tier`)
41
+ for the stage a team gives it. A role never adds a step: a worker writes a stage the workflow
42
+ already has.
35
43
 
36
44
  A **unit** is one piece of work that runs a workflow: one feature, one fix, one map run or
37
45
  one discovery.
@@ -45,15 +53,15 @@ WORKFLOW feature · fix · map · discovery
45
53
  │ many-to-many: a team serves one or more workflows, a workflow has one or more teams
46
54
  │ one default team per workflow; exactly one team per unit
47
55
  ▼
48
- TEAM sap-delivery · sap-maintenance · sap-discovery · your own
56
+ TEAM delivery · maintenance · advisory · sap-delivery · … · your own
49
57
  │
50
- │ one persona per role the workflow needs
58
+ │ per role the workflow needs: the skills (and instructions) it works with in this team
51
59
  ▼
52
- PERSONA implementer · analyst · reviewer · tester
60
+ ROLE implementer · analyst · reviewer · tester · your own
53
61
  │
54
- │ many-to-many: a persona lists its skills; a skill is reused by many personas
62
+ │ many-to-many: a role lists its skills in each team; a skill is reused by many teams and roles
55
63
  ▼
56
- SKILL cap-developer · fiori-developer · btp-architect · solution-reviewer · qa-tester · ...
64
+ SKILL technical-architect · backend-developer · ui-developer · cap-developer · solution-reviewer · ...
57
65
  ```
58
66
 
59
67
  The rules behind the arrows:
@@ -65,10 +73,15 @@ The rules behind the arrows:
65
73
  - Each unit runs with **exactly one** team: the default, or the one named with `--team`
66
74
  when the unit starts. The unit records the team and a hash of its definition, so a later
67
75
  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.
76
+ - A team lists skills per role, and must give every built-in role its workflows need at least
77
+ one skill. Its own roles are optional extras for the same agents.
78
+ - A role of the main agent, the reviewer or the QA agent starts no agent of its own: its
79
+ skills and instructions go to the agent that already does that job. A worker role is an
80
+ agent of its own, but only for the stage a team gives it under `stages`; the main agent
81
+ starts it and gets its result.
82
+ - `stages` can give spec, design, build (feature), fix, map and proposal to a role. Without an
83
+ entry, the workflow's own role does the stage.
84
+ - Knowledge several teams share is a skill of the project's own, listed in each team.
72
85
  - How many rounds each review gets is a setting: `review.rounds` for all, and
73
86
  `review.step_rounds` for one kind of step (for example 5 for the design review). A workflow
74
87
  can have its own under `workflows.<name>.review` (rounds, tiers, QA), over the project's.
@@ -98,8 +111,30 @@ The rules behind the arrows:
98
111
 
99
112
  ## Example: the built-in teams
100
113
 
101
- agjan ships three teams for SAP CAP, Fiori and BTP projects. The same skills appear in
102
- several personas: that is the many-to-many link between personas and skills.
114
+ agjan ships three teams for any stack, the defaults of a project without a `team` setting:
115
+
116
+ ```text
117
+ feature ────► delivery stages: design → architect, build → developer
118
+ implementer: solution-architect, technical-architect, backend-developer, ui-developer
119
+ architect: technical-architect (agent agjan-worker-deep)
120
+ developer: backend-developer, ui-developer (agent agjan-worker, one per task)
121
+ reviewer: solution-reviewer, technical-architect, backend-developer, ui-developer
122
+ tester: qa-tester
123
+
124
+ fix ──┐
125
+ map ──┴─────► maintenance
126
+ implementer: backend-developer, ui-developer (fix)
127
+ analyst: technical-architect, backend-developer, ui-developer (map)
128
+ reviewer: solution-reviewer, backend-developer, ui-developer
129
+
130
+ discovery ──► advisory
131
+ analyst: solution-architect, technical-architect
132
+ reviewer: solution-reviewer, solution-architect
133
+ ```
134
+
135
+ And three for SAP CAP, Fiori and BTP projects, which the `sap-btp` preset makes the defaults.
136
+ The same skills appear in several teams and roles: that is the many-to-many link between roles
137
+ and skills.
103
138
 
104
139
  ```text
105
140
  feature ────► sap-delivery
@@ -120,5 +155,5 @@ discovery ──► sap-discovery
120
155
 
121
156
  To define your own team, import one, or make it a workflow's default, see
122
157
  [Teams](guide.md#teams) in the user guide. `npx agjan team list` lists the teams of a
123
- project, `npx agjan team show <name>` their personas, and `npx agjan workflow show <workflow>`
158
+ project, `npx agjan team show <name>` the skills of each role, and `npx agjan workflow show <workflow>`
124
159
  every step of a workflow with the agent and the skills that do it in your project.