guild-agents 0.3.0 → 0.3.1-snapshot.20260225.2

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 (41) hide show
  1. package/README.md +68 -102
  2. package/bin/guild.js +28 -2
  3. package/package.json +22 -12
  4. package/src/commands/doctor.js +76 -1
  5. package/src/commands/init.js +8 -8
  6. package/src/commands/list.js +3 -1
  7. package/src/commands/new-agent.js +3 -0
  8. package/src/commands/reset-learnings.js +44 -0
  9. package/src/commands/status.js +2 -3
  10. package/src/templates/agents/advisor.md +1 -0
  11. package/src/templates/agents/bugfix.md +1 -0
  12. package/src/templates/agents/code-reviewer.md +1 -0
  13. package/src/templates/agents/db-migration.md +1 -0
  14. package/src/templates/agents/developer.md +1 -0
  15. package/src/templates/agents/learnings-extractor.md +49 -0
  16. package/src/templates/agents/platform-expert.md +1 -0
  17. package/src/templates/agents/product-owner.md +1 -0
  18. package/src/templates/agents/qa.md +1 -0
  19. package/src/templates/agents/tech-lead.md +1 -0
  20. package/src/templates/skills/build-feature/SKILL.md +219 -4
  21. package/src/templates/skills/council/SKILL.md +74 -0
  22. package/src/templates/skills/create-pr/SKILL.md +32 -0
  23. package/src/templates/skills/dev-flow/SKILL.md +14 -0
  24. package/src/templates/skills/guild-specialize/SKILL.md +38 -0
  25. package/src/templates/skills/new-feature/SKILL.md +33 -0
  26. package/src/templates/skills/qa-cycle/SKILL.md +32 -0
  27. package/src/templates/skills/review/SKILL.md +20 -0
  28. package/src/templates/skills/session-end/SKILL.md +27 -0
  29. package/src/templates/skills/session-start/SKILL.md +32 -0
  30. package/src/templates/skills/status/SKILL.md +19 -0
  31. package/src/templates/specs/SPEC_TEMPLATE.md +46 -0
  32. package/src/utils/dispatch-protocol.js +74 -0
  33. package/src/utils/dispatch.js +172 -0
  34. package/src/utils/files.js +23 -1
  35. package/src/utils/generators.js +6 -2
  36. package/src/utils/learnings-io.js +76 -0
  37. package/src/utils/learnings.js +204 -0
  38. package/src/utils/skill-loader.js +83 -0
  39. package/src/utils/trace.js +400 -0
  40. package/src/utils/version.js +90 -0
  41. package/src/utils/workflow-parser.js +225 -0
package/README.md CHANGED
@@ -5,37 +5,25 @@
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
6
6
  [![Node.js >= 20](https://img.shields.io/badge/node-%3E%3D20-brightgreen)](https://nodejs.org)
7
7
 
8
- Claude Code is powerful but chaotic. Guild gives it structure.
8
+ **Guild makes Claude Code think before it builds.**
9
9
 
10
- Guild is an npm CLI that sets up 9 specialized agents and 10 skill-based workflows as `.claude/` files in any project. Agents define **who** does the work. Skills define **how** it gets done. Everything is markdown, tracked by git, works offline.
10
+ Guild is a spec-driven development CLI for Claude Code. It installs structured design and development workflows as `.claude/` markdown files in any project. Before code is written, features are evaluated, debated by independent AI perspectives, and specified in a design doc. Everything is markdown, tracked by git, works offline, zero infrastructure.
11
11
 
12
- ## Why Guild?
12
+ ## The Problem
13
13
 
14
- - **Structure over chaos.** Claude Code without guidance produces inconsistent results. Guild gives every task a clear owner and a repeatable process.
15
- - **Agents = WHO, Skills = HOW.** Agents are flat `.md` files with identity and expertise. Skills are workflow definitions invoked as slash commands. Clean separation, no magic.
16
- - **State that persists.** Context lives in `CLAUDE.md`, `PROJECT.md`, and `SESSION.md` -- tracked by git, readable by humans, never lost between sessions.
17
- - **Zero infrastructure.** No servers, no APIs, no config files. Just markdown files that Claude Code reads natively.
14
+ Without structure, Claude Code:
18
15
 
19
- ## How It Works
16
+ - Writes code before understanding the problem
17
+ - Has no design phase and no review gate
18
+ - Loses decisions between sessions
19
+ - Produces results that vary with every conversation
20
20
 
21
- ```
22
- You ──> /build-feature "Add JWT auth"
23
-
24
-
25
- ┌─────────┐ ┌───────────────┐ ┌───────────────┐
26
- │ Advisor │────>│ Tech Lead │────>│ Developer │
27
- │ evaluate │ │ plan │ │ implement │
28
- └─────────┘ └───────────────┘ └───────┬───────┘
29
-
30
- ┌─────────────┼─────────────┐
31
- ▼ ▼ ▼
32
- ┌──────────┐ ┌──────────┐ ┌──────────┐
33
- │ Reviewer │ │ QA │ │ Bugfix │
34
- │ review │ │ test │ │ fix │
35
- └──────────┘ └──────────┘ └──────────┘
36
- ```
21
+ ## How Guild Solves It
37
22
 
38
- Skills orchestrate agents through structured pipelines. You invoke a skill as a slash command, and it coordinates the right agents in the right order.
23
+ - **Spec before code**: every feature starts with a design doc
24
+ - **Structured deliberation**: `/council` runs parallel independent analysis -- multiple perspectives evaluate independently, then synthesize
25
+ - **Decisions that persist**: design docs, session state, and project context live in git-tracked markdown
26
+ - **Zero infrastructure**: no servers, no APIs, just markdown files and Claude Code
39
27
 
40
28
  ## Quick Start
41
29
 
@@ -44,28 +32,68 @@ npm install -g guild-agents
44
32
  guild init
45
33
  ```
46
34
 
47
- The interactive onboarding asks for project name, type, stack, and repo details, then generates the full structure: 9 agents, 10 skills, and 3 state files.
48
-
49
- Next, let Guild learn your codebase:
35
+ Then use skills as slash commands in Claude Code:
50
36
 
37
+ ```text
38
+ /guild-specialize # Learn your codebase, enrich CLAUDE.md
39
+ /council "Add JWT auth" # Spec a feature through structured deliberation
40
+ /build-feature # Implement from spec through the full pipeline
51
41
  ```
52
- /guild-specialize
42
+
43
+ ## The Pipeline
44
+
45
+ ```text
46
+ You ──> /council "Add JWT auth"
47
+
48
+
49
+ ┌──────────┐ ┌──────────────┐ ┌──────────┐
50
+ │ Evaluate │────>│ Design Doc │────>│ Build │
51
+ │ debate │ │ spec │ │ implement│
52
+ └──────────┘ └──────────────┘ └────┬─────┘
53
+
54
+ ┌─────┴─────┐
55
+ ▼ ▼
56
+ ┌──────────┐┌──────────┐
57
+ │ Review ││ QA │
58
+ └──────────┘└──────────┘
53
59
  ```
54
60
 
55
- This explores your actual code and enriches `CLAUDE.md` with real conventions, patterns, and stack details. Every agent now understands your project.
61
+ Six phases: **evaluate**, **specify**, **plan**, **implement**, **review**, **validate**. Phases 1-3 happen before any code is written.
56
62
 
57
- Then build something:
63
+ ## Skills Reference
58
64
 
59
- ```
60
- /build-feature Add user authentication with JWT
65
+ All 11 skills, grouped by function:
66
+
67
+ | Skill | Group | Description |
68
+ | --- | --- | --- |
69
+ | `/build-feature` | Pipeline | Full pipeline: evaluate, spec, implement, review, QA |
70
+ | `/new-feature` | Pipeline | Create branch and scaffold for a new feature |
71
+ | `/create-pr` | Pipeline | Create a structured pull request from current branch |
72
+ | `/council` | Decision | Multi-perspective deliberation on a decision or feature |
73
+ | `/review` | Quality | Code review on the current diff |
74
+ | `/qa-cycle` | Quality | QA and bugfix loop until clean |
75
+ | `/guild-specialize` | Context | Explore codebase, enrich CLAUDE.md with real conventions |
76
+ | `/session-start` | Context | Load context and resume work |
77
+ | `/session-end` | Context | Save state to SESSION.md |
78
+ | `/status` | Context | Project and session state overview |
79
+ | `/dev-flow` | Context | Show current pipeline phase and next step |
80
+
81
+ ## CLI Commands
82
+
83
+ ```bash
84
+ guild init # Interactive project onboarding
85
+ guild new-agent <name> # Create a custom agent
86
+ guild status # Show project status
87
+ guild doctor # Diagnose setup
88
+ guild list # List agents and skills
61
89
  ```
62
90
 
63
- This runs the full pipeline -- advisor evaluation, tech lead planning, developer implementation, code review, and QA -- all coordinated automatically.
91
+ ## Under the Hood
64
92
 
65
- ## Agents
93
+ Guild coordinates 9 specialized agents through the pipeline. Each agent handles one phase.
66
94
 
67
95
  | Agent | Role |
68
- |---|---|
96
+ | --- | --- |
69
97
  | advisor | Evaluates ideas and provides strategic direction |
70
98
  | product-owner | Turns approved ideas into concrete tasks |
71
99
  | tech-lead | Defines technical approach and architecture |
@@ -74,70 +102,13 @@ This runs the full pipeline -- advisor evaluation, tech lead planning, developer
74
102
  | qa | Testing, edge cases, regression validation |
75
103
  | bugfix | Bug diagnosis and resolution |
76
104
  | db-migration | Schema changes and safe migrations |
77
- | platform-expert | Diagnoses and resolves Claude Code integration issues |
78
-
79
- ## Skills
80
-
81
- | Skill | Description |
82
- |---|---|
83
- | `/guild-specialize` | Explores codebase, enriches CLAUDE.md with real stack and conventions |
84
- | `/build-feature` | Full pipeline: evaluation, spec, implementation, review, QA |
85
- | `/new-feature` | Creates branch and scaffold for a new feature |
86
- | `/council` | Convenes multiple agents to debate a decision |
87
- | `/qa-cycle` | QA and bugfix loop until clean |
88
- | `/review` | Code review on the current diff |
89
- | `/dev-flow` | Shows current pipeline phase and next step |
90
- | `/status` | Project and session state overview |
91
- | `/session-start` | Loads context and resumes work |
92
- | `/session-end` | Saves state to SESSION.md |
93
-
94
- ## CLI Commands
95
-
96
- ```bash
97
- guild init # Interactive project onboarding
98
- guild new-agent <name> # Create a custom agent
99
- guild status # Show project status
100
- guild doctor # Diagnose installation state
101
- guild list # List installed agents and skills
102
- ```
103
-
104
- ## Generated Structure
105
+ | platform-expert | Diagnoses Claude Code integration issues |
105
106
 
106
- Running `guild init` creates the following in your project root:
107
-
108
- ```
109
- CLAUDE.md
110
- PROJECT.md
111
- SESSION.md
112
- .claude/
113
- agents/
114
- advisor.md
115
- product-owner.md
116
- tech-lead.md
117
- developer.md
118
- code-reviewer.md
119
- qa.md
120
- bugfix.md
121
- db-migration.md
122
- platform-expert.md
123
- skills/
124
- guild-specialize/SKILL.md
125
- build-feature/SKILL.md
126
- new-feature/SKILL.md
127
- council/SKILL.md
128
- qa-cycle/SKILL.md
129
- review/SKILL.md
130
- dev-flow/SKILL.md
131
- status/SKILL.md
132
- session-start/SKILL.md
133
- session-end/SKILL.md
134
- ```
135
-
136
- All files are markdown, tracked by git, and work fully offline.
107
+ Agents are flat `.md` files with identity and expertise. Skills orchestrate agents through structured pipelines. Everything lives in `.claude/`, readable by humans, tracked by git.
137
108
 
138
109
  ## Guild Builds Itself
139
110
 
140
- This project uses its own agents and skills to develop itself. Every feature, review, and bugfix goes through the same pipelines that Guild installs in your project.
111
+ Every feature in Guild goes through the same spec-first pipeline that Guild installs in your project. Guild's own design decisions live in `docs/specs/`.
141
112
 
142
113
  ## Requirements
143
114
 
@@ -147,12 +118,7 @@ This project uses its own agents and skills to develop itself. Every feature, re
147
118
 
148
119
  ## Contributing
149
120
 
150
- Two types of contributions:
151
-
152
- - **Agent and skill templates** (`src/templates/`) -- improve agent definitions or skill workflows.
153
- - **CLI code** (`src/`, `bin/`) -- bug fixes, new commands, onboarding improvements.
154
-
155
- See [CONTRIBUTING.md](.github/CONTRIBUTING.md) for details.
121
+ See [CONTRIBUTING.md](.github/CONTRIBUTING.md) for setup, branching, and contribution guidelines.
156
122
 
157
123
  ## License
158
124
 
package/bin/guild.js CHANGED
@@ -14,14 +14,25 @@ import { program } from 'commander';
14
14
  import { readFileSync } from 'fs';
15
15
  import { fileURLToPath } from 'url';
16
16
  import { dirname, join } from 'path';
17
+ import chalk from 'chalk';
18
+ import { parseVersion, getPreReleaseWarning } from '../src/utils/version.js';
17
19
 
18
20
  const __dirname = dirname(fileURLToPath(import.meta.url));
19
21
  const pkg = JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf8'));
20
22
 
23
+ const { channel } = parseVersion(pkg.version);
24
+ const prereleaseWarning = getPreReleaseWarning(pkg.version);
25
+ if (prereleaseWarning) {
26
+ const color = channel === 'snapshot' ? chalk.red : chalk.yellow;
27
+ console.error(color(`Guild v${pkg.version} -- ${prereleaseWarning}`));
28
+ }
29
+
21
30
  program
22
31
  .name('guild')
23
- .description('Multi-agent framework for Claude Code')
24
- .version(pkg.version);
32
+ .description('Specification-driven development CLI for Claude Code')
33
+ .version(pkg.version)
34
+ .option('--verbose', 'Enable verbose logging (records decision trail)')
35
+ .option('--debug', 'Enable debug logging (records full prompts and responses)');
25
36
 
26
37
  // guild init
27
38
  program
@@ -94,4 +105,19 @@ program
94
105
  }
95
106
  });
96
107
 
108
+ // guild reset-learnings
109
+ program
110
+ .command('reset-learnings')
111
+ .description('Reset the compound learnings file')
112
+ .option('-f, --force', 'Skip confirmation prompt')
113
+ .action(async (options) => {
114
+ try {
115
+ const { runResetLearnings } = await import('../src/commands/reset-learnings.js');
116
+ await runResetLearnings(options);
117
+ } catch (err) {
118
+ console.error(err.message);
119
+ process.exit(1);
120
+ }
121
+ });
122
+
97
123
  program.parse();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "guild-agents",
3
- "version": "0.3.0",
4
- "description": "A multi-agent framework for Claude Code — specialized AI teams for every project",
3
+ "version": "0.3.1-snapshot.20260225.2",
4
+ "description": "Specification-driven development CLI for Claude Code — think before you build",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "bin/",
@@ -17,24 +17,32 @@
17
17
  "test": "vitest run",
18
18
  "test:watch": "vitest",
19
19
  "test:coverage": "vitest run --coverage",
20
- "lint": "eslint src/ && markdownlint-cli2 'src/templates/**/*.md'",
21
- "lint:js": "eslint src/",
20
+ "lint": "eslint src/ scripts/ && markdownlint-cli2 'src/templates/**/*.md'",
21
+ "lint:js": "eslint src/ scripts/",
22
22
  "lint:md": "markdownlint-cli2 'src/templates/**/*.md'",
23
23
  "dev": "node bin/guild.js",
24
- "prepublishOnly": "npm test && npm run lint"
24
+ "prepublishOnly": "npm test && npm run lint",
25
+ "version:snapshot": "node scripts/version-snapshot.js",
26
+ "version:beta": "node scripts/version-beta.js",
27
+ "version:stable": "node scripts/version-stable.js",
28
+ "publish:snapshot": "npm run version:snapshot && npm publish --tag snapshot",
29
+ "publish:beta": "npm run version:beta && npm publish --tag beta",
30
+ "publish:stable": "npm run version:stable && npm publish --tag latest",
31
+ "publish:promote-beta": "npm dist-tag add guild-agents@$(node --input-type=commonjs -p \"require('./package.json').version\") beta"
25
32
  },
26
33
  "keywords": [
27
34
  "claude",
28
35
  "claude-code",
36
+ "anthropic",
37
+ "specification-driven",
38
+ "spec-driven",
39
+ "spec-first",
40
+ "design-docs",
41
+ "developer-tools",
42
+ "cli",
29
43
  "agents",
30
44
  "ai",
31
45
  "workflow",
32
- "multi-agent",
33
- "developer-tools",
34
- "cli",
35
- "framework",
36
- "anthropic",
37
- "ai-agents",
38
46
  "automation",
39
47
  "code-review",
40
48
  "nodejs"
@@ -52,7 +60,9 @@
52
60
  "dependencies": {
53
61
  "@clack/prompts": "^1.0.1",
54
62
  "chalk": "^5.3.0",
55
- "commander": "^14.0.3"
63
+ "commander": "^14.0.3",
64
+ "guild-agents": "0.3.1-snapshot.20260225.1",
65
+ "yaml": "^2.8.2"
56
66
  },
57
67
  "engines": {
58
68
  "node": ">=20.0.0"
@@ -6,8 +6,15 @@ import * as p from '@clack/prompts';
6
6
  import chalk from 'chalk';
7
7
  import { existsSync, readdirSync } from 'fs';
8
8
  import { join } from 'path';
9
+ import { resolveProjectRoot } from '../utils/files.js';
10
+ import { loadAllSkills } from '../utils/skill-loader.js';
9
11
 
10
12
  export async function runDoctor() {
13
+ const root = resolveProjectRoot();
14
+ if (root) {
15
+ process.chdir(root);
16
+ }
17
+
11
18
  p.intro(chalk.bold.cyan('Guild — Doctor'));
12
19
 
13
20
  const checks = [];
@@ -77,9 +84,77 @@ export async function runDoctor() {
77
84
  healthy = false;
78
85
  }
79
86
 
87
+ // Check workflow validation in skills
88
+ if (existsSync(skillsDir)) {
89
+ const skills = loadAllSkills(skillsDir);
90
+ let workflowCount = 0;
91
+ let workflowErrors = 0;
92
+ const errorDetails = [];
93
+
94
+ for (const [name, skill] of skills) {
95
+ if (skill.workflow) {
96
+ workflowCount++;
97
+ if (skill.errors.length > 0) {
98
+ workflowErrors++;
99
+ errorDetails.push(`${name}: ${skill.errors.join('; ')}`);
100
+ }
101
+ }
102
+
103
+ // Check that agent references exist
104
+ if (skill.workflow) {
105
+ for (const step of skill.workflow.steps) {
106
+ if (step.role !== 'system' && step.role !== 'dynamic') {
107
+ const agentPath = join(agentsDir, `${step.role}.md`);
108
+ if (!existsSync(agentPath)) {
109
+ errorDetails.push(`${name}: step "${step.id}" references agent "${step.role}" — agent not found`);
110
+ workflowErrors++;
111
+ }
112
+ }
113
+ }
114
+ }
115
+ }
116
+
117
+ if (workflowCount > 0 && workflowErrors === 0) {
118
+ checks.push({ name: `Workflows (${workflowCount} valid)`, pass: true });
119
+ } else if (workflowCount > 0 && workflowErrors > 0) {
120
+ checks.push({
121
+ name: `Workflows (${workflowErrors} issue(s))`,
122
+ pass: false,
123
+ fix: errorDetails.join('\n '),
124
+ });
125
+ healthy = false;
126
+ }
127
+ // If workflowCount === 0, don't add a check (no workflows to validate)
128
+
129
+ // Check for dual-format skills (workflow frontmatter + body step/phase headings)
130
+ // Matches "### Step 1", "## Phase 2", etc. — requires digit after Step/Phase
131
+ const STEP_PHASE_RE = /^#{1,3}\s+(Step|Phase)\s+\d/im;
132
+ const dualFormatWarnings = [];
133
+
134
+ for (const [name, skill] of skills) {
135
+ if (skill.workflow && skill.body && STEP_PHASE_RE.test(skill.body)) {
136
+ dualFormatWarnings.push(name);
137
+ }
138
+ }
139
+
140
+ if (dualFormatWarnings.length > 0) {
141
+ checks.push({
142
+ name: `Dual-format skills (${dualFormatWarnings.length} warning(s))`,
143
+ pass: true,
144
+ warn: true,
145
+ detail: `Skills with both workflow frontmatter and body step/phase headings: ${dualFormatWarnings.join(', ')}. Workflow steps take precedence — consider removing prose steps from body.`,
146
+ });
147
+ }
148
+ }
149
+
80
150
  // Display results
81
151
  for (const check of checks) {
82
- if (check.pass) {
152
+ if (check.warn) {
153
+ p.log.warn(`${chalk.yellow('⚠')} ${check.name}`);
154
+ if (check.detail) {
155
+ p.log.info(chalk.gray(` ${check.detail}`));
156
+ }
157
+ } else if (check.pass) {
83
158
  p.log.success(`${chalk.green('✓')} ${check.name}`);
84
159
  } else {
85
160
  p.log.error(`${chalk.red('✗')} ${check.name}`);
@@ -127,19 +127,19 @@ export async function runInit() {
127
127
  p.log.success(`Created: CLAUDE.md, PROJECT.md, SESSION.md, ${agentCount} agents, ${skillCount} skills`);
128
128
 
129
129
  const relevantSkills = projectData.hasExistingCode
130
- ? ['/guild-specialize', '/build-feature', '/review']
131
- : ['/build-feature', '/new-feature', '/council'];
130
+ ? ['/guild-specialize', '/council', '/build-feature']
131
+ : ['/council', '/build-feature', '/new-feature'];
132
132
  p.log.info(`Start with: ${relevantSkills.join(' ')}`);
133
133
 
134
134
  const quickStart = projectData.hasExistingCode
135
- ? '1. Open Claude Code in this directory\n' +
136
- '2. Run /guild-specialize to analyze your codebase\n' +
137
- '3. Start building with /build-feature'
138
- : '1. Open Claude Code in this directory\n' +
139
- '2. Start building with /build-feature\n' +
135
+ ? '1. Run /guild-specialize to analyze your codebase\n' +
136
+ '2. Run /council to spec your first feature\n' +
137
+ '3. Build it with /build-feature'
138
+ : '1. Run /council to spec your first feature\n' +
139
+ '2. Build it with /build-feature\n' +
140
140
  '3. Run /guild-specialize once you have code';
141
141
 
142
142
  p.note(quickStart, 'Quick start');
143
143
 
144
- p.outro(chalk.bold.cyan('Guild v1 ready.'));
144
+ p.outro(chalk.bold.cyan('Guild ready — spec before you build.'));
145
145
  }
@@ -6,9 +6,11 @@ import * as p from '@clack/prompts';
6
6
  import chalk from 'chalk';
7
7
  import { existsSync, readdirSync, readFileSync } from 'fs';
8
8
  import { join } from 'path';
9
- import { parseFrontmatter } from '../utils/files.js';
9
+ import { ensureProjectRoot, parseFrontmatter } from '../utils/files.js';
10
10
 
11
11
  export async function runList() {
12
+ ensureProjectRoot();
13
+
12
14
  p.intro(chalk.bold.cyan('Guild — Agents & Skills'));
13
15
 
14
16
  // List agents
@@ -13,10 +13,13 @@ import * as p from '@clack/prompts';
13
13
  import chalk from 'chalk';
14
14
  import { existsSync, writeFileSync } from 'fs';
15
15
  import { join } from 'path';
16
+ import { ensureProjectRoot } from '../utils/files.js';
16
17
 
17
18
  const AGENTS_DIR = join('.claude', 'agents');
18
19
 
19
20
  export async function runNewAgent(agentName) {
21
+ ensureProjectRoot();
22
+
20
23
  p.intro(chalk.bold.cyan('Guild — New agent'));
21
24
 
22
25
  // Validate name
@@ -0,0 +1,44 @@
1
+ /**
2
+ * reset-learnings.js — Resets the compound learnings file
3
+ */
4
+
5
+ import * as p from '@clack/prompts';
6
+ import chalk from 'chalk';
7
+ import { join } from 'path';
8
+ import { ensureProjectRoot } from '../utils/files.js';
9
+ import { learningsExist, deleteLearnings } from '../utils/learnings-io.js';
10
+ import { GUILD_LEARNINGS_PATH } from '../utils/learnings.js';
11
+
12
+ /**
13
+ * Runs the `guild reset-learnings` command.
14
+ * @param {object} [options]
15
+ * @param {boolean} [options.force] - Skip confirmation prompt
16
+ */
17
+ export async function runResetLearnings(options = {}) {
18
+ const root = ensureProjectRoot();
19
+ const filePath = join(root, GUILD_LEARNINGS_PATH);
20
+
21
+ p.intro(chalk.bold.cyan('Guild — Reset Learnings'));
22
+
23
+ if (!learningsExist(filePath)) {
24
+ p.log.info('No learnings file found. Nothing to reset.');
25
+ p.outro('Done.');
26
+ return;
27
+ }
28
+
29
+ if (!options.force) {
30
+ const confirmed = await p.confirm({
31
+ message: 'This will delete all accumulated learnings. Continue?',
32
+ initialValue: false,
33
+ });
34
+
35
+ if (p.isCancel(confirmed) || !confirmed) {
36
+ p.cancel('Reset cancelled.');
37
+ return;
38
+ }
39
+ }
40
+
41
+ deleteLearnings(filePath);
42
+ p.log.success(`${chalk.green('✓')} Learnings file deleted.`);
43
+ p.outro('Learnings have been reset. They will be regenerated on the next workflow execution.');
44
+ }
@@ -6,11 +6,10 @@ import * as p from '@clack/prompts';
6
6
  import chalk from 'chalk';
7
7
  import { existsSync, readdirSync, readFileSync } from 'fs';
8
8
  import { join } from 'path';
9
+ import { ensureProjectRoot } from '../utils/files.js';
9
10
 
10
11
  export async function runStatus() {
11
- if (!existsSync('PROJECT.md')) {
12
- throw new Error('Guild is not installed. Run: guild init');
13
- }
12
+ ensureProjectRoot();
14
13
 
15
14
  const projectMd = readFileSync('PROJECT.md', 'utf8');
16
15
  const nameMatch = projectMd.match(/\*\*Name:\*\*\s*(.+)/);
@@ -3,6 +3,7 @@ name: advisor
3
3
  description: "Evaluates ideas and provides strategic direction before committing work"
4
4
  tools: Read, Glob, Grep
5
5
  permissionMode: plan
6
+ default-tier: reasoning
6
7
  ---
7
8
 
8
9
  # Advisor
@@ -3,6 +3,7 @@ name: bugfix
3
3
  description: "Bug diagnosis and resolution"
4
4
  tools: Read, Write, Edit, Bash, Glob, Grep
5
5
  permissionMode: bypassPermissions
6
+ default-tier: execution
6
7
  ---
7
8
 
8
9
  # Bugfix
@@ -3,6 +3,7 @@ name: code-reviewer
3
3
  description: "Reviews quality, patterns, and technical debt"
4
4
  tools: Read, Glob, Grep
5
5
  permissionMode: plan
6
+ default-tier: reasoning
6
7
  ---
7
8
 
8
9
  # Code Reviewer
@@ -3,6 +3,7 @@ name: db-migration
3
3
  description: "Schema changes and safe migrations"
4
4
  tools: Read, Write, Edit, Bash, Glob, Grep
5
5
  permissionMode: bypassPermissions
6
+ default-tier: execution
6
7
  ---
7
8
 
8
9
  # DB Migration
@@ -3,6 +3,7 @@ name: developer
3
3
  description: "Implements features following the project conventions"
4
4
  tools: Read, Write, Edit, Bash, Glob, Grep
5
5
  permissionMode: bypassPermissions
6
+ default-tier: execution
6
7
  ---
7
8
 
8
9
  # Developer
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: learnings-extractor
3
+ description: "Extracts compound learnings from pipeline executions"
4
+ tools: Read, Glob, Grep
5
+ permissionMode: plan
6
+ default-tier: routine
7
+ ---
8
+
9
+ # Learnings Extractor
10
+
11
+ You are the Learnings Extractor for [PROJECT]. Your job is to analyze completed pipeline traces and extract reusable patterns, recurring issues, and optimization opportunities that improve future executions.
12
+
13
+ ## Responsibilities
14
+
15
+ - Read pipeline trace files from `.claude/guild/traces/`
16
+ - Identify patterns across multiple executions (recurring review loops, common failures)
17
+ - Extract actionable learnings that reduce future iteration count
18
+ - Update `.claude/guild/learnings.md` with new findings
19
+ - Prioritize learnings by impact (reduces tokens, reduces loops, improves quality)
20
+
21
+ ## What you do NOT do
22
+
23
+ - You do not implement features — that is the Developer's role
24
+ - You do not evaluate strategy — that is the Advisor's role
25
+ - You do not modify source code — you only read traces and write learnings
26
+
27
+ ## Process
28
+
29
+ 1. Read the pipeline trace provided as input
30
+ 2. Analyze step results, loop counts, and failure patterns
31
+ 3. Compare with existing learnings in `.claude/guild/learnings.md`
32
+ 4. Extract new learnings or reinforce existing ones
33
+ 5. Write updated learnings in a structured format
34
+
35
+ ## Output format
36
+
37
+ Each learning should include:
38
+
39
+ - **Pattern**: What was observed
40
+ - **Frequency**: How often it occurs (first-seen or recurring)
41
+ - **Recommendation**: What to do differently next time
42
+ - **Impact**: Expected reduction in loops, tokens, or failures
43
+
44
+ ## Behavior rules
45
+
46
+ - Never duplicate an existing learning — update its frequency instead
47
+ - Focus on actionable recommendations, not observations
48
+ - Keep learnings concise — one paragraph maximum per entry
49
+ - Tag learnings with the workflow they came from
@@ -3,6 +3,7 @@ name: platform-expert
3
3
  description: "Diagnoses and resolves Claude Code integration issues -- permissions, subagents, hooks, settings"
4
4
  tools: Read, Write, Edit, Bash, Glob, Grep
5
5
  permissionMode: bypassPermissions
6
+ default-tier: execution
6
7
  ---
7
8
 
8
9
  # Platform Expert
@@ -3,6 +3,7 @@ name: product-owner
3
3
  description: "Converts approved ideas into concrete, implementable tasks"
4
4
  tools: Read, Glob, Grep
5
5
  permissionMode: plan
6
+ default-tier: reasoning
6
7
  ---
7
8
 
8
9
  # Product Owner
@@ -3,6 +3,7 @@ name: qa
3
3
  description: "Testing, edge cases, regression"
4
4
  tools: Read, Write, Edit, Bash, Glob, Grep
5
5
  permissionMode: bypassPermissions
6
+ default-tier: execution
6
7
  ---
7
8
 
8
9
  # QA