attacca-forge 0.5.0

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 (48) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +159 -0
  3. package/bin/cli.js +79 -0
  4. package/docs/architecture.md +132 -0
  5. package/docs/getting-started.md +137 -0
  6. package/docs/methodology/factorial-stress-testing.md +64 -0
  7. package/docs/methodology/failure-modes.md +82 -0
  8. package/docs/methodology/intent-engineering.md +78 -0
  9. package/docs/methodology/progressive-autonomy.md +92 -0
  10. package/docs/methodology/spec-driven-development.md +52 -0
  11. package/docs/methodology/trust-tiers.md +52 -0
  12. package/examples/stress-test-matrix.md +98 -0
  13. package/examples/tier-2-saas-spec.md +142 -0
  14. package/package.json +44 -0
  15. package/plugins/attacca-forge/.claude-plugin/plugin.json +7 -0
  16. package/plugins/attacca-forge/skills/agent-economics-analyzer/SKILL.md +90 -0
  17. package/plugins/attacca-forge/skills/agent-readiness-audit/SKILL.md +90 -0
  18. package/plugins/attacca-forge/skills/agent-stack-opportunity-mapper/SKILL.md +93 -0
  19. package/plugins/attacca-forge/skills/ai-dev-level-assessment/SKILL.md +112 -0
  20. package/plugins/attacca-forge/skills/ai-dev-talent-strategy/SKILL.md +154 -0
  21. package/plugins/attacca-forge/skills/ai-difficulty-rapid-audit/SKILL.md +121 -0
  22. package/plugins/attacca-forge/skills/ai-native-org-redesign/SKILL.md +114 -0
  23. package/plugins/attacca-forge/skills/ai-output-taste-builder/SKILL.md +116 -0
  24. package/plugins/attacca-forge/skills/ai-workflow-capability-map/SKILL.md +98 -0
  25. package/plugins/attacca-forge/skills/ai-workflow-optimizer/SKILL.md +131 -0
  26. package/plugins/attacca-forge/skills/build-orchestrator/SKILL.md +320 -0
  27. package/plugins/attacca-forge/skills/codebase-discovery/SKILL.md +286 -0
  28. package/plugins/attacca-forge/skills/forge-help/SKILL.md +100 -0
  29. package/plugins/attacca-forge/skills/forge-start/SKILL.md +110 -0
  30. package/plugins/attacca-forge/skills/harness-simulator/SKILL.md +137 -0
  31. package/plugins/attacca-forge/skills/insight-to-action-compression-map/SKILL.md +134 -0
  32. package/plugins/attacca-forge/skills/intent-audit/SKILL.md +144 -0
  33. package/plugins/attacca-forge/skills/intent-gap-diagnostic/SKILL.md +63 -0
  34. package/plugins/attacca-forge/skills/intent-spec/SKILL.md +170 -0
  35. package/plugins/attacca-forge/skills/legacy-migration-roadmap/SKILL.md +126 -0
  36. package/plugins/attacca-forge/skills/personal-intent-layer-builder/SKILL.md +80 -0
  37. package/plugins/attacca-forge/skills/problem-difficulty-decomposition/SKILL.md +128 -0
  38. package/plugins/attacca-forge/skills/spec-architect/SKILL.md +210 -0
  39. package/plugins/attacca-forge/skills/spec-writer/SKILL.md +145 -0
  40. package/plugins/attacca-forge/skills/stress-test/SKILL.md +283 -0
  41. package/plugins/attacca-forge/skills/web-fork-strategic-briefing/SKILL.md +66 -0
  42. package/src/commands/help.js +44 -0
  43. package/src/commands/init.js +121 -0
  44. package/src/commands/install.js +77 -0
  45. package/src/commands/status.js +87 -0
  46. package/src/utils/context.js +141 -0
  47. package/src/utils/detect-claude.js +23 -0
  48. package/src/utils/prompt.js +44 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Attacca
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,159 @@
1
+ # Attacca Forge
2
+
3
+ **Spec-driven AI development toolkit. Your spec is the source of truth — not the model, not the prompt, not the vibes.**
4
+
5
+ ```bash
6
+ npx attacca-forge init
7
+ npx attacca-forge install
8
+ ```
9
+
10
+ AI agents don't ask clarifying questions — they make assumptions. The quality gap between Level 3 and Level 5 AI-assisted development isn't model intelligence. It's specification quality.
11
+
12
+ Attacca Forge gives you an 8-phase pipeline from idea to production, 26 skills for Claude Code, and a methodology that scales evaluation rigor to the stakes of what you're building.
13
+
14
+ ## Quick Start
15
+
16
+ ### Option A: npx (recommended)
17
+
18
+ ```bash
19
+ # Initialize your project (interactive setup)
20
+ npx attacca-forge init
21
+
22
+ # Install skills into Claude Code
23
+ npx attacca-forge install
24
+ ```
25
+
26
+ Restart Claude Code. Then say what you want to build:
27
+
28
+ ```
29
+ I want to build a notification system that alerts users when their subscription is about to expire
30
+ ```
31
+
32
+ ### Option B: Manual install
33
+
34
+ ```bash
35
+ git clone https://github.com/attacca-ai/attacca-forge.git
36
+ cd attacca-forge
37
+ ./install.sh # macOS / Linux / WSL
38
+ # or
39
+ ./install.ps1 # Windows PowerShell
40
+ ```
41
+
42
+ ## The Pipeline
43
+
44
+ ```
45
+ IDEA → DISCOVER → SPEC → BUILD → TEST → CERTIFY → DEPLOY → MAINTAIN
46
+ ```
47
+
48
+ Every project starts at IDEA. The pipeline guides you phase by phase. Trust tiers (1-4) scale the rigor at every step — a hobby project moves fast, a safety-critical system gets full evaluation.
49
+
50
+ ```bash
51
+ npx attacca-forge status # See where you are
52
+ ```
53
+
54
+ ```
55
+ Pipeline:
56
+
57
+ ✓ IDEA Capture your idea and classify risk
58
+ ✓ SPEC Write behavioral specification with intent contract
59
+ ▸ BUILD Execute implementation on deterministic rails
60
+ TEST Run factorial stress testing against scenarios
61
+ CERTIFY Human sign-off (tier-appropriate review)
62
+ DEPLOY Production deployment with gates
63
+ MAINTAIN Continuous flywheel + drift detection
64
+ ```
65
+
66
+ ## Skills
67
+
68
+ ### Core Pipeline (9 skills)
69
+
70
+ | Skill | Phase | What It Does |
71
+ |-------|-------|-------------|
72
+ | `forge-start` | IDEA | Capture intent, classify trust tier, route to next phase |
73
+ | `forge-help` | Any | "What should I do next?" — phase-aware navigation |
74
+ | `codebase-discovery` | DISCOVER | Brownfield behavioral snapshot (6-layer exploration) |
75
+ | `spec-architect` | SPEC | Full spec with intent contracts, eval scenarios, trust tier classification |
76
+ | `spec-writer` | SPEC | Streamlined spec — no intent layer, faster for Tier 1-2 |
77
+ | `stress-test` | TEST | Factorial stress testing — 22 variation types, 4 failure modes |
78
+ | `intent-spec` | SPEC | Agent intent specification — value hierarchies, decision boundaries, drift detection |
79
+ | `intent-audit` | Any | Organizational AI maturity audit — three-layer assessment |
80
+ | `build-orchestrator` | BUILD | Spec-tests-code pipeline with 4-layer eval stack |
81
+
82
+ ### Extended Skills (17 skills)
83
+
84
+ | Skill | Category | What It Does |
85
+ |-------|----------|-------------|
86
+ | `intent-gap-diagnostic` | Intent | 10-min rapid diagnostic — find your biggest AI intent gap |
87
+ | `personal-intent-layer-builder` | Intent | Build a reusable personal intent document for AI collaboration |
88
+ | `ai-workflow-capability-map` | Intent | Map team workflows into agent-ready / augmented / human-only |
89
+ | `insight-to-action-compression-map` | Analysis | Map bottlenecks, redesign compressed workflows |
90
+ | `harness-simulator` | Analysis | Planner-Worker-Judge multi-pass decomposition with self-critique |
91
+ | `ai-difficulty-rapid-audit` | Analysis | 10-min audit — map work across difficulty axes |
92
+ | `problem-difficulty-decomposition` | Analysis | Deep decomposition into 7 difficulty axes |
93
+ | `ai-workflow-optimizer` | Analysis | Evaluate AI usage against difficulty profile |
94
+ | `agent-stack-opportunity-mapper` | Analysis | Map business against 5-layer agent infrastructure stack |
95
+ | `agent-readiness-audit` | Analysis | Technical audit of agent-readiness (content, discovery, API, security) |
96
+ | `agent-economics-analyzer` | Analysis | Evaluate task viability for agent automation |
97
+ | `ai-dev-level-assessment` | Organization | Diagnose team's AI-assisted dev maturity (Level 0-5) |
98
+ | `ai-native-org-redesign` | Organization | Redesign engineering org for AI-native development |
99
+ | `legacy-migration-roadmap` | Organization | Phased brownfield modernization plan |
100
+ | `ai-dev-talent-strategy` | Organization | Career/talent strategy for the AI-native era |
101
+ | `web-fork-strategic-briefing` | Strategy | Strategic briefing on agent web fork impact |
102
+ | `ai-output-taste-builder` | Quality | Build domain-specific "taste" for evaluating AI output |
103
+
104
+ **26 skills total.** Each loads only when invoked — zero context window bloat.
105
+
106
+ ## Trust Tiers
107
+
108
+ Every project gets a trust tier. The tier scales everything downstream.
109
+
110
+ | Tier | Risk Level | Example | Eval Rigor |
111
+ |------|-----------|---------|------------|
112
+ | 1 | Nothing bad happens | Hobby project, prototype | Base scenarios only |
113
+ | 2 | Time or money lost | SaaS, client work | 2 variations/scenario + intent recommended |
114
+ | 3 | Legal/financial/reputation risk | Compliance, finance | 3 variations + intent required + domain review |
115
+ | 4 | Irreversible harm | Healthcare, safety-critical | 5 variations + all eval layers + expert sign-off |
116
+
117
+ ## The Methodology
118
+
119
+ Attacca Forge encodes a development methodology, not just prompts:
120
+
121
+ - **[Spec-Driven Development](docs/methodology/spec-driven-development.md)** — The Spec-Tests-Code triangle
122
+ - **[Trust Tiers](docs/methodology/trust-tiers.md)** — Classify by risk, scale evaluation to stakes
123
+ - **[Factorial Stress Testing](docs/methodology/factorial-stress-testing.md)** — 22 variation types expose hidden failures
124
+ - **[The Four Failure Modes](docs/methodology/failure-modes.md)** — Inverted U, reasoning-output disconnect, anchoring bias, guardrail inversion
125
+ - **[Intent Engineering](docs/methodology/intent-engineering.md)** — Encode organizational judgment into machine-actionable specs
126
+ - **[Progressive Autonomy](docs/methodology/progressive-autonomy.md)** — Shadow mode to full autonomy, earned through evaluation
127
+
128
+ ## Example Output
129
+
130
+ - [Tier 2 SaaS Notification System](examples/tier-2-saas-spec.md) — Complete spec with behavioral scenarios, variations, and intent contract
131
+ - [Stress Test Matrix](examples/stress-test-matrix.md) — Factorial test with 16 variations across 3 scenarios
132
+
133
+ ## CLI Commands
134
+
135
+ ```bash
136
+ npx attacca-forge init # Interactive project setup
137
+ npx attacca-forge install # Install skills to Claude Code
138
+ npx attacca-forge status # Pipeline phase + next steps
139
+ npx attacca-forge help # Full command reference
140
+ ```
141
+
142
+ ## The Attacca Ecosystem
143
+
144
+ **Attacca Forge** designs and evaluates agents. *What should this agent do? How do we know it works?*
145
+
146
+ **[Attacca Claw](https://github.com/attacca-ai/attacca-claw-desktop)** executes agents. *How does a non-technical user interact with an autonomous agent safely?*
147
+
148
+ Independent tools that work together.
149
+
150
+ ## Attribution
151
+
152
+ Built on frameworks by:
153
+ - **Nate Jones** — Spec-driven development methodology and intent engineering
154
+ - **Drew Breunig** — Spec-Tests-Code triangle
155
+ - **Mount Sinai Health System** — Failure mode taxonomy from factorial design study (Nature Medicine, 2026)
156
+
157
+ ## License
158
+
159
+ MIT — see [LICENSE](LICENSE)
package/bin/cli.js ADDED
@@ -0,0 +1,79 @@
1
+ #!/usr/bin/env node
2
+
3
+ // =============================================================================
4
+ // Attacca Forge CLI
5
+ // Spec-driven AI development toolkit
6
+ // Usage: npx attacca-forge <command> [options]
7
+ // =============================================================================
8
+
9
+ import { resolve, dirname } from 'node:path';
10
+ import { fileURLToPath } from 'node:url';
11
+ import { existsSync } from 'node:fs';
12
+
13
+ const __dirname = dirname(fileURLToPath(import.meta.url));
14
+
15
+ // npx runs from a temp directory — resolve back to the user's CWD
16
+ const userCwd = process.env.INIT_CWD || process.cwd();
17
+
18
+ const COMMANDS = {
19
+ init: () => import('../src/commands/init.js'),
20
+ install: () => import('../src/commands/install.js'),
21
+ status: () => import('../src/commands/status.js'),
22
+ help: () => import('../src/commands/help.js'),
23
+ };
24
+
25
+ const HELP = `
26
+ attacca-forge — Spec-driven AI development toolkit
27
+
28
+ Usage:
29
+ npx attacca-forge <command> [options]
30
+
31
+ Commands:
32
+ init Initialize a new project with Attacca Forge
33
+ install Install skills into Claude Code plugin directory
34
+ status Show current pipeline phase and next steps
35
+ help Show this help message
36
+
37
+ Examples:
38
+ npx attacca-forge init
39
+ npx attacca-forge init my-project
40
+ npx attacca-forge install
41
+ npx attacca-forge status
42
+
43
+ Documentation:
44
+ https://github.com/attacca-ai/attacca-forge
45
+ `;
46
+
47
+ async function main() {
48
+ const args = process.argv.slice(2);
49
+ const command = args[0];
50
+
51
+ if (!command || command === 'help' || command === '--help' || command === '-h') {
52
+ console.log(HELP);
53
+ process.exit(0);
54
+ }
55
+
56
+ if (command === '--version' || command === '-v') {
57
+ const pkg = JSON.parse(
58
+ (await import('node:fs')).readFileSync(resolve(__dirname, '..', 'package.json'), 'utf-8')
59
+ );
60
+ console.log(`attacca-forge v${pkg.version}`);
61
+ process.exit(0);
62
+ }
63
+
64
+ if (!COMMANDS[command]) {
65
+ console.error(`\n Unknown command: ${command}\n`);
66
+ console.log(HELP);
67
+ process.exit(1);
68
+ }
69
+
70
+ try {
71
+ const mod = await COMMANDS[command]();
72
+ await mod.default({ args: args.slice(1), cwd: userCwd, rootDir: resolve(__dirname, '..') });
73
+ } catch (err) {
74
+ console.error(`\n Error: ${err.message}\n`);
75
+ process.exit(1);
76
+ }
77
+ }
78
+
79
+ main();
@@ -0,0 +1,132 @@
1
+ # Architecture — How the Layers Fit Together
2
+
3
+ > Design → Evaluate → Align → Orchestrate
4
+
5
+ ## The Full Pipeline
6
+
7
+ ```
8
+ Raw Idea
9
+
10
+
11
+ ┌──────────────────┐
12
+ │ SPEC STUDIO │ spec-architect / spec-writer
13
+ │ │ "What should this system do?"
14
+ │ Trust tier │
15
+ │ Behavioral │
16
+ │ contract │
17
+ │ Scenarios with │
18
+ │ variations │
19
+ └────────┬──────────┘
20
+
21
+
22
+ ┌──────────────────┐
23
+ │ EVAL GATE │ stress-test
24
+ │ │ "Does it work under pressure?"
25
+ │ Factorial matrix │
26
+ │ Failure mode │
27
+ │ coverage │
28
+ │ Aggregate │
29
+ │ metrics │
30
+ └────────┬──────────┘
31
+
32
+
33
+ ┌──────────────────┐
34
+ │ INTENT LAYER │ intent-spec / intent-audit
35
+ │ │ "What should it optimize for?"
36
+ │ Value hierarchy │
37
+ │ Decision │
38
+ │ boundaries │
39
+ │ Drift detection │
40
+ └────────┬──────────┘
41
+
42
+
43
+ ┌──────────────────┐
44
+ │ BUILD FLOOR │ build-orchestrator
45
+ │ │ "How does it earn autonomy?"
46
+ │ Progressive │
47
+ │ autonomy │
48
+ │ Deterministic │
49
+ │ validation │
50
+ │ Continuous │
51
+ │ flywheel │
52
+ │ Quality gates │
53
+ └────────┬──────────┘
54
+
55
+
56
+ DELIVERY
57
+ ```
58
+
59
+ ## The Spec-Tests-Code Triangle
60
+
61
+ At the core of everything is the triangle. Changes in any node must propagate to the others:
62
+
63
+ ```
64
+ SPEC
65
+ / \
66
+ TESTS ── CODE
67
+ ```
68
+
69
+ - **Spec changes** → tests must be updated → code must be re-verified
70
+ - **Test failures** → either the code is wrong or the spec has a gap
71
+ - **Code changes** → must be validated against spec and tests
72
+
73
+ The `spec-architect` skill generates the spec. The `stress-test` skill generates the tests (with factorial variations). The coding agent generates the code. The `build-orchestrator` keeps the triangle in sync.
74
+
75
+ ## Layer Dependencies
76
+
77
+ Each layer builds on the previous:
78
+
79
+ ```
80
+ Layer 1: Spec → Defines WHAT the system does
81
+ Layer 2: Eval → Validates HOW it handles pressure
82
+ Layer 3: Intent → Encodes WHY it exists (and what to optimize for)
83
+ Layer 4: Orchestrate → Governs the full lifecycle (design → deploy → monitor)
84
+ ```
85
+
86
+ You can adopt layers incrementally:
87
+ - **Layer 1 alone** = better specs, fewer agent assumptions
88
+ - **Layers 1+2** = specs validated under contextual stress
89
+ - **Layers 1+2+3** = specs + eval + organizational alignment
90
+ - **All four layers** = production-grade agent deployment pipeline
91
+
92
+ ## The Ecosystem
93
+
94
+ ```
95
+ DESIGN (Forge) EXECUTE (Claw) OPERATE (???)
96
+ ┌────────────────────┐ ┌────────────────────┐ ┌────────────────────┐
97
+ │ Spec Studio │─────→│ Agent Runtime │─────→│ │
98
+ │ Eval Gate │ │ Trust Tiers │ │ │
99
+ │ Intent Layer │ │ Task Execution │ │ │
100
+ │ Build Floor │ │ Human Supervision │ │ │
101
+ └────────────────────┘ └────────────────────┘ └────────────────────┘
102
+
103
+ attacca-forge attacca-claw-desktop ???
104
+ (methodology) (runtime) (coming)
105
+ ```
106
+
107
+ **Attacca Forge** designs and evaluates agents — the methodology.
108
+ **[Attacca Claw](https://github.com/attacca-ai/attacca-claw-desktop)** executes agents — the runtime.
109
+ The operate layer completes the cycle.
110
+
111
+ ## What This Architecture Handles
112
+
113
+ | Challenge | Which Layer Solves It |
114
+ |-----------|---------------------|
115
+ | Agent makes assumptions | Layer 1 (Spec) — explicit behavioral contracts |
116
+ | Agent fails on edge cases | Layer 2 (Eval) — factorial stress testing on distribution tails |
117
+ | Agent optimizes for wrong thing | Layer 3 (Intent) — value hierarchy + Klarna checklist |
118
+ | Agent's reasoning doesn't match its output | Layer 4 (Orchestrate) — deterministic validation rules |
119
+ | Agent degrades after model update | Layer 4 (Orchestrate) — model change protocol |
120
+ | New failure pattern in production | Layer 4 (Orchestrate) — continuous flywheel catches and encodes it |
121
+ | Agent needs more/less autonomy | Layer 4 (Orchestrate) — progressive autonomy with promotion/demotion |
122
+
123
+ ## What This Architecture Does NOT Handle
124
+
125
+ This is a methodology toolkit for designing, evaluating, and deploying agents. It does not include:
126
+
127
+ - **Multi-project orchestration** — managing many agents across many projects simultaneously
128
+ - **Client delivery workflows** — intake, billing, handoff, maintenance cycles
129
+ - **Team coordination** — assigning work to humans and agents across an organization
130
+ - **Knowledge compounding** — learning from one project to improve the next systematically
131
+
132
+ These are operational challenges that emerge when you run the methodology at scale.
@@ -0,0 +1,137 @@
1
+ # Getting Started with Attacca Forge
2
+
3
+ ## Installation
4
+
5
+ ### Option A: npx (recommended)
6
+
7
+ ```bash
8
+ # Set up your project
9
+ npx attacca-forge init
10
+
11
+ # Install skills into Claude Code
12
+ npx attacca-forge install
13
+ ```
14
+
15
+ Restart Claude Code after installation.
16
+
17
+ ### Option B: Manual install
18
+
19
+ ```bash
20
+ git clone https://github.com/attacca-ai/attacca-forge.git
21
+ cd attacca-forge
22
+ ./install.sh # macOS/Linux/WSL
23
+ # or
24
+ ./install.ps1 # Windows PowerShell
25
+ ```
26
+
27
+ Restart Claude Code after installation.
28
+
29
+ ## Your First Project
30
+
31
+ ### 1. Initialize
32
+
33
+ ```bash
34
+ npx attacca-forge init
35
+ ```
36
+
37
+ The setup wizard asks 4 questions:
38
+ - **Project name** — what you're building
39
+ - **Greenfield or brownfield** — new code or modifying existing
40
+ - **Trust tier** — what happens if it's wrong (1=nothing, 4=irreversible harm)
41
+ - **Experience level** — calibrates how much the skills explain
42
+
43
+ This creates `.attacca/config.yaml` and `.attacca/context.md` in your project root.
44
+
45
+ ### 2. Start the Pipeline
46
+
47
+ In Claude Code, say:
48
+
49
+ ```
50
+ help me start
51
+ ```
52
+
53
+ The `forge-start` skill captures your idea and routes you to the next phase:
54
+ - **Greenfield** → SPEC phase (write behavioral specification)
55
+ - **Brownfield** → DISCOVER phase (map existing codebase first)
56
+
57
+ ### 3. Follow the Pipeline
58
+
59
+ ```bash
60
+ npx attacca-forge status
61
+ ```
62
+
63
+ Shows where you are and what to do next:
64
+
65
+ ```
66
+ Pipeline:
67
+
68
+ ✓ IDEA Capture your idea and classify risk
69
+ ▸ SPEC Write behavioral specification with intent contract
70
+ BUILD Execute implementation on deterministic rails
71
+ TEST Run factorial stress testing against scenarios
72
+ CERTIFY Human sign-off (tier-appropriate review)
73
+ DEPLOY Production deployment with gates
74
+ MAINTAIN Continuous flywheel + drift detection
75
+
76
+ Next: /spec-architect
77
+ Write behavioral specification with intent contract
78
+ ```
79
+
80
+ At any point, say "what should I do next" in Claude Code to invoke `forge-help`.
81
+
82
+ ## Choosing Between Spec Skills
83
+
84
+ | Skill | When to Use | Output |
85
+ |-------|------------|--------|
86
+ | `spec-architect` | Full spec with organizational alignment + eval (17 questions) | Behavioral Contract + Intent Contract + Eval Thresholds |
87
+ | `spec-writer` | Quick implementation spec (13 questions) | Behavioral Contract + Ambiguity Warnings |
88
+
89
+ **Rule of thumb**: Use `spec-architect` for anything Tier 2+ or any system involving autonomous decisions. Use `spec-writer` for Tier 1 features where you just need a clean spec fast.
90
+
91
+ ## Trust Tiers
92
+
93
+ Your trust tier (set during init) scales everything automatically:
94
+
95
+ | Tier | What It Means | Spec Rigor | Stress Test | Intent | Sign-Off |
96
+ |------|--------------|-----------|-------------|--------|----------|
97
+ | 1 | Nothing bad happens | 7 scenarios | Skip | Skip | Deploy only |
98
+ | 2 | Time/money lost | 7 scenarios + 2 variations each | Required | Recommended | Spec + deploy |
99
+ | 3 | Legal/financial risk | 7+ scenarios + 3 variations | Required | Required | Spec + intent + test + deploy |
100
+ | 4 | Irreversible harm | 7+ scenarios + 5 variations | Required | Required | Full review + domain expert |
101
+
102
+ ## All Skills
103
+
104
+ ### Core Pipeline
105
+ - `/forge-start` — IDEA phase onboarding
106
+ - `/forge-help` — Phase-aware "what's next?"
107
+ - `/codebase-discovery` — Brownfield behavioral snapshot
108
+ - `/spec-architect` — Full behavioral spec with intent
109
+ - `/spec-writer` — Streamlined spec (no intent)
110
+ - `/stress-test` — Factorial stress testing
111
+ - `/intent-spec` — Agent intent specification
112
+ - `/intent-audit` — Organizational AI maturity audit
113
+ - `/build-orchestrator` — Build pipeline with eval stack
114
+
115
+ ### Extended (17 skills)
116
+ Intent engineering, analysis, organizational design, and quality evaluation skills. Run `/forge-help` or `npx attacca-forge help` for the full list.
117
+
118
+ ## Trigger Keywords
119
+
120
+ Skills activate on natural language. Just say what you need:
121
+
122
+ - "spec this out" → `spec-architect`
123
+ - "quick spec" → `spec-writer`
124
+ - "stress test my scenarios" → `stress-test`
125
+ - "what should I do next" → `forge-help`
126
+ - "discover this codebase" → `codebase-discovery`
127
+ - "help me start" → `forge-start`
128
+
129
+ ## CLI Reference
130
+
131
+ ```bash
132
+ npx attacca-forge init # Interactive project setup
133
+ npx attacca-forge install # Install skills to Claude Code
134
+ npx attacca-forge status # Pipeline phase + next steps
135
+ npx attacca-forge help # Full command reference
136
+ npx attacca-forge --version # Show version
137
+ ```
@@ -0,0 +1,64 @@
1
+ # Factorial Stress Testing
2
+
3
+ > Your agent's accuracy dashboard might say 87%. The inverted U means that number is masking silent failures on the tails of the distribution — precisely where consequential decisions live.
4
+
5
+ ## The Problem
6
+
7
+ Standard evaluations test each scenario once under clean conditions. This misses three categories of failure that only surface when context varies:
8
+
9
+ 1. **Anchoring bias** — social context shifts the output without changing the facts
10
+ 2. **Guardrail inversion** — safety mechanisms fire on surface patterns, not actual risk
11
+ 3. **Inverted U** — performance degrades at extremes where stakes are highest
12
+
13
+ ## The Solution: Factorial Design
14
+
15
+ Take each behavioral scenario and systematically apply controlled contextual stressors — one at a time. Measure whether the output shifts. If it shifts when it shouldn't, you've found a hidden failure.
16
+
17
+ This approach was validated in a landmark study where researchers tested an AI health system across 960 variations (60 scenarios × 16 conditions). Standard testing said the system worked. Factorial testing revealed it under-triaged 52% of emergencies and was 12x more likely to inappropriately de-escalate when social pressure was present.
18
+
19
+ ## The Five Stressor Categories
20
+
21
+ | Category | What It Tests | Example |
22
+ |----------|--------------|---------|
23
+ | **A: Social/Authority Pressure** | Does someone's opinion shift the output? | "The VP says it's low risk" |
24
+ | **B: Framing/Anchoring** | Does language tone shift risk assessment? | Optimistic vs. pessimistic framing of same data |
25
+ | **C: Temporal/Access Pressure** | Does urgency or scarcity bypass quality? | "Budget is extremely tight this quarter" |
26
+ | **D: Structural Edge Cases** | Does the system handle distribution tails? | Near-miss to extreme, disguised severity |
27
+ | **E: Reasoning-Output Alignment** | Does the reasoning match the recommendation? | Agent identifies risk in analysis, recommends ignoring it |
28
+
29
+ Each category contains 3-6 specific variation types. See the `stress-test` skill for the full library.
30
+
31
+ ## How to Apply
32
+
33
+ 1. Start with your behavioral scenarios (from a spec)
34
+ 2. Select applicable stressor categories based on trust tier
35
+ 3. Inject one stressor per variation (never combine — makes failures undiagnosable)
36
+ 4. For each variation, define whether the correct output should change or remain stable
37
+ 5. Run the matrix and score with aggregate metrics
38
+
39
+ ## Key Metrics
40
+
41
+ | Metric | What It Catches |
42
+ |--------|----------------|
43
+ | **Variation stability** | Overall robustness to contextual pressure |
44
+ | **Anchoring susceptibility** | Vulnerability to social/authority influence |
45
+ | **Reasoning alignment** | Gap between what the agent thinks and what it does |
46
+ | **Guardrail reliability** | Whether safety mechanisms fire on actual risk |
47
+ | **Inverted U index** | Performance gap between routine and extreme cases |
48
+
49
+ ## The Continuous Flywheel
50
+
51
+ Factorial stress testing isn't a one-time event. In production:
52
+
53
+ 1. **LLM-as-judge** evaluates every agent run against the scenario rulebook
54
+ 2. **Bias toward false positives** — flag more, miss less
55
+ 3. **Review flagged runs** — true positive → fix; false positive → refine rules
56
+ 4. **Audit PASSED runs** — the step nobody does. Sample 5-10%. Find what the judge missed.
57
+ 5. **Feed back** — every real failure becomes a new scenario in the library
58
+
59
+ The library grows organically from production. Every failure encoded makes the system harder to break.
60
+
61
+ ## Attribution
62
+
63
+ - **Mount Sinai Health System** — Factorial design methodology (Ramaswamy et al., Nature Medicine, 2026)
64
+ - **Nate Jones** — Failure mode analysis and evaluation architecture
@@ -0,0 +1,82 @@
1
+ # The Four Failure Modes
2
+
3
+ > Your agent knows the answer and sometimes it recommends the opposite thing.
4
+
5
+ These four failure modes were identified through a factorial design study that tested an AI health system across 960 controlled variations. They are domain-general — they apply to any agent system, not just healthcare.
6
+
7
+ ## FM-1: The Inverted U
8
+
9
+ **Pattern**: The agent performs best on routine, middle-of-distribution cases and worst at the extremes — where stakes are highest.
10
+
11
+ **Why it happens**: LLMs are trained on distributions where the middle is densely represented and the extremes are sparse. They perform best exactly where performance matters least.
12
+
13
+ **How to detect**: Compare accuracy on extreme cases vs. mid-range cases (the Inverted U Index). If the ratio is below 0.8, your agent has blind spots at the tails.
14
+
15
+ **Examples**:
16
+ - Accounts payable agent processes routine invoices perfectly, misses the slightly-modified duplicate
17
+ - Claims agent handles fender benders but can't detect the third claim from the same address in 14 months
18
+ - The health study: 93% accuracy on semi-urgent cases, 48% on emergencies
19
+
20
+ **Stressors that expose it**: SE-01 (near-miss to extreme), SE-06 (routine packaging of extreme)
21
+
22
+ ## FM-2: Knows But Doesn't Act
23
+
24
+ **Pattern**: The agent's reasoning correctly identifies a finding, but the output recommendation contradicts it.
25
+
26
+ **Why it happens**: Research on chain-of-thought faithfulness reveals that reasoning traces and final outputs operate as semi-independent processes. Studies show models fail to update answers after logically significant changes in reasoning more than 50% of the time. The Oxford AI Governance Initiative has argued that chain of thought is "fundamentally unreliable as an explanation of a model's decision process."
27
+
28
+ **How to detect**: Deterministic validation rules that compare reasoning to output. If the reasoning contains "enhanced due diligence flag" and the output says "standard risk," escalate.
29
+
30
+ **Examples**:
31
+ - Compliance agent identifies elevated risk in analysis, outputs "standard risk" classification
32
+ - Customer service agent identifies known billing error pattern, recommends generic 5-7 day review
33
+ - The health study: reasoning said "early respiratory failure," output said "wait 24-48 hours"
34
+
35
+ **Key insight**: If chain-of-thought faithfulness can't be fixed at the model level, the solution must be architectural. External validation, not self-correction.
36
+
37
+ **Stressors that expose it**: RO-01 (reasoning contradicts output), RO-02 (early-chain anchoring), RO-03 (confidence without basis)
38
+
39
+ ## FM-3: Social Context Hijacks Judgment
40
+
41
+ **Pattern**: When a stakeholder minimizes severity or applies social pressure, the agent shifts its recommendation — individually defensible but systematically biased.
42
+
43
+ **Why it happens**: Any agent that processes inputs combining structured data with unstructured human language is vulnerable. The structured data should drive the decision. The unstructured language creates a framing effect that anchors the response.
44
+
45
+ **How to detect**: Run the same scenario with and without the social context cue. If the output shifts, measure the magnitude. The health study found an odds ratio of 11.7 — roughly 12x more likely to inappropriately de-escalate.
46
+
47
+ **Examples**:
48
+ - Vendor selection shifts when a VP note says "I'm confident this is the right choice"
49
+ - Lending risk assessment shifts when employer letter describes applicant as "valued longtime employee"
50
+ - The health study: when a family member said "the patient looks fine," triage de-escalated dramatically
51
+
52
+ **Key insight**: Without controlled variation testing (same scenario ± anchoring input), this bias is invisible on standard evaluations.
53
+
54
+ **Stressors that expose it**: SP-01 through SP-04 (authority, peer, client, expert), FA-01 through FA-04 (positive, negative, hedging, numerical)
55
+
56
+ ## FM-4: Guardrails Fire on Vibes, Not Risk
57
+
58
+ **Pattern**: Safety mechanisms match surface-level language patterns (emotional keywords, alarming phrases) rather than actual risk taxonomy. Alerts are inverted relative to actual risk.
59
+
60
+ **Why it happens**: Guardrails are often trained on surface features (keyword density, emotional tone) rather than structured risk assessment. They test for the appearance of safety, not actual safety.
61
+
62
+ **How to detect**: Test with disguised severity (critical issue in calm packaging) and surface alarm (benign issue with alarming language). If guardrails fire on the surface alarm but miss the disguised severity, they're inverted.
63
+
64
+ **Examples**:
65
+ - Security agent flags email labeled "confidential financial data" (actually a public press release) but passes 50K customer records exported to personal Dropbox described as "backup"
66
+ - The health study: crisis alerts fired more reliably for vague emotional distress than for concrete, detailed self-harm plans
67
+
68
+ **Key insight**: The system will tell you it's doing well and have grounds for that assessment. You need domain knowledge to override.
69
+
70
+ **Stressors that expose it**: SE-05 (disguised severity), SE-06 (routine packaging of extreme)
71
+
72
+ ## Using Failure Modes in Practice
73
+
74
+ Every behavioral scenario in a spec should target at least one failure mode. For Tier 4 systems, all four failure modes must be covered across the scenario set.
75
+
76
+ The `stress-test` skill generates a complete variation matrix with failure mode mapping for any set of behavioral scenarios.
77
+
78
+ ## Attribution
79
+
80
+ - **Mount Sinai Health System** — Failure mode identification from their factorial design study (Ramaswamy et al., Nature Medicine, 2026)
81
+ - **Nate Jones** — Failure mode generalization to enterprise agent systems
82
+ - **Oxford AI Governance Initiative** — Chain-of-thought faithfulness research (FM-2)