trinity-method-sdk 2.2.1 → 2.2.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.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.2.2] - 2026-02-25
11
+
12
+ ### Changed
13
+
14
+ - **Simplified gitignore patterns** - Deploy and update commands now add `.claude/` and
15
+ `*CLAUDE.md` to `.gitignore` instead of granular `.claude/trinity/archive/` and
16
+ `.claude/trinity/templates/` patterns. Migration handles cleanup of old patterns. (Issue #18)
17
+
18
+ ### Fixed
19
+
20
+ - **Work order numbering scans archive directory** - Added explicit WO numbering instructions to
21
+ `/utility:trinity-workorder` template. Numbers now derived only from `work-orders/` and
22
+ `sessions/` directories, ignoring archives. New sessions start fresh at WO-001. (Issue #19)
23
+ - **trinity-end command not archiving all session files** - Updated STRICT ARCHIVING PROTOCOL
24
+ in `/session:trinity-end` template to archive from all `.claude/trinity/` subdirectories
25
+ (Issue #17)
26
+ - Added archiving of completed work orders from `work-orders/` directory
27
+ - Added archiving of completed investigations and plans from `investigations/` directory
28
+ - Added archiving of Claude Code plan mode files from `plans/` directory
29
+ - Added loose archive file organization into YYYY-MM-DD date folders
30
+ - Expanded clean slate verification to cover `plans/` directory
31
+
10
32
  ## [2.2.1] - 2026-02-24
11
33
 
12
34
  ### Added
package/README.md CHANGED
@@ -1,550 +1,550 @@
1
- # Trinity Method SDK
2
-
3
- [![npm version](https://img.shields.io/npm/v/trinity-method-sdk?color=success)](https://www.npmjs.com/package/trinity-method-sdk)
4
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
- [![Node.js Version](https://img.shields.io/badge/node-%3E%3D16.9.0-brightgreen)](https://nodejs.org/)
6
- [![AI Agents](https://img.shields.io/badge/AI%20Agent-Claude%20Code-blue)](https://github.com/lukadfagundes/trinity-method-sdk)
7
-
8
- > Investigation-first development methodology for Claude Code
9
-
10
- ---
11
-
12
- ## Why Trinity Method Exists
13
-
14
- ### The Problem with Traditional AI-Assisted Development
15
-
16
- AI coding assistants are powerful, but without structure they become expensive guessing machines:
17
-
18
- **❌ Jump-to-Code Anti-Pattern:**
19
-
20
- - AI generates code without understanding the problem
21
- - No investigation phase → immediate implementation
22
- - Context lost between sessions → repeated mistakes
23
- - No institutional knowledge → every session starts from zero
24
- - Inconsistent quality → success depends on prompt luck
25
- - Manual quality setup → 50 minutes configuring linters per project
26
-
27
- **The Cost:**
28
-
29
- - Developers waste time debugging AI-generated code that solves the wrong problem
30
- - Teams lose hard-won lessons when developers leave
31
- - Technical debt accumulates invisibly
32
- - Code quality varies wildly across sessions
33
-
34
- ### Our Philosophy: Investigation-First Development
35
-
36
- Trinity Method rejects "prompt and pray" development. Instead, we enforce **systematic investigation before implementation**:
37
-
38
- #### 1. Investigation-First Principle
39
-
40
- ```text
41
- WRONG: "Build authentication" → AI generates code → Debug for hours
42
- RIGHT: "Investigate authentication requirements" → Understand problem → Design solution → Implement correctly
43
- ```
44
-
45
- #### 2. Evidence-Based Decisions
46
-
47
- Every decision backed by documentation, codebase metrics, and historical patterns. No guessing.
48
-
49
- **3. Knowledge Preservation**
50
- Lessons learned persist across sessions through institutional memory. Agents get smarter over time.
51
-
52
- **4. Systematic Quality Assurance**
53
- Quality isn't aspirational—it's systematically enforced through automated gates (BAS 6-phase validation).
54
-
55
- ### The Trinity Transformation
56
-
57
- **✅ With Trinity Method:**
58
-
59
- - **Investigation before coding** → Understand the problem first
60
- - **Persistent knowledge base** → Learn from every session
61
- - **Automated quality enforcement** → BAS gates ensure standards
62
- - **18-agent team coordination** → Right specialist for each task
63
- - **Institutional memory** → Patterns, strategies, and lessons preserved
64
- - **90-second deployment** → Complete development environment instantly
65
-
66
- ---
67
-
68
- ## What is Trinity Method SDK
69
-
70
- Trinity Method SDK is a **production-ready development methodology** that transforms AI-assisted coding
71
- from random generation into systematic engineering.
72
-
73
- ### Core Philosophy
74
-
75
- **Trinity Method enforces three pillars:**
76
-
77
- 1. **Investigation-First Development**
78
- - Systematic investigation using MON (Requirements), ROR (Design), TRA (Planning)
79
- - Evidence-based decisions backed by documentation and metrics
80
- - Scale-based workflows: SMALL (0 stop points) → MEDIUM (2 stop points) → LARGE (4 stop points)
81
-
82
- 2. **Knowledge Preservation**
83
- - Learning system captures patterns from every investigation
84
- - Cross-session persistence through filesystem storage
85
- - Agent knowledge sharing via pub/sub bus (≥0.8 confidence threshold)
86
-
87
- 3. **Systematic Quality Assurance**
88
- - BAS 6-phase quality gate: Lint → Structure → Build → Test → Coverage (≥80%) → Review
89
- - Crisis management system for 5 crisis types (build, test, error, performance, security)
90
- - Automated codebase metrics collection and technical debt tracking
91
-
92
- ### The 18-Agent Team
93
-
94
- Trinity SDK includes **18 specialized agents** organized across 5 functional teams:
95
-
96
- **Planning Layer:**
97
-
98
- - **MON** - Requirements Analyst (functional & non-functional requirements)
99
- - **ROR** - Design Architect (technical design, ADRs)
100
- - **TRA** - Work Planner (implementation sequencing, BAS integration)
101
- - **EUS** - Task Decomposer (atomic task breakdown)
102
-
103
- **Execution Layer:**
104
-
105
- - **KIL** - Task Executor (TDD implementation: RED → GREEN → REFACTOR)
106
- - **BAS** - Quality Gate (6-phase validation enforcer)
107
- - **DRA** - Code Reviewer (design doc compliance, quality escalation)
108
-
109
- **Support Layer:**
110
-
111
- - **APO** - Documentation Specialist (API docs, inline comments)
112
- - **BON** - Dependency Manager (package security, version management)
113
- - **CAP** - Configuration Specialist (env vars, config files)
114
- - **URO** - Refactoring Specialist (technical debt reduction)
115
-
116
- **Leadership:**
117
-
118
- - **ALY** - Chief Technology Officer (investigation orchestration, strategic coordination)
119
- - **AJ MAESTRO** - Orchestrator (multi-agent workflow orchestration, task delegation)
120
-
121
- **Deployment:**
122
-
123
- - **TAN** - Structure Specialist (directory structure validation)
124
- - **ZEN** - Knowledge Base Specialist (comprehensive documentation)
125
- - **INO** - Context Specialist (CLAUDE.md hierarchy management)
126
- - **EIN** - CI/CD Specialist (continuous integration/deployment automation)
127
-
128
- **Audit:**
129
-
130
- - **JUNO** - Quality Auditor (comprehensive codebase audits, deployment verification)
131
-
132
- ### What Gets Deployed
133
-
134
- Trinity deploys **88 production-ready components** in 90 seconds:
135
-
136
- **Methodology Infrastructure:**
137
-
138
- - `.claude/trinity/knowledge-base/` - 9 living documentation files
139
- - ARCHITECTURE.md (codebase metrics, architecture documentation)
140
- - ISSUES.md (known issues and bug tracking)
141
- - To-do.md (task management and priorities)
142
- - Technical-Debt.md (technical debt tracking)
143
- - Trinity.md (project-specific Trinity guide)
144
- - TESTING-PRINCIPLES.md (testing standards)
145
- - CODING-PRINCIPLES.md (code quality standards)
146
- - DOCUMENTATION-CRITERIA.md (documentation standards)
147
- - AI-DEVELOPMENT-GUIDE.md (AI-assisted development best practices)
148
- - `.claude/trinity/templates/` - Reusable templates
149
- - `documentation/` - Documentation templates (2 README templates + 23 report templates)
150
- - `investigations/` - 5 investigation templates (bug, feature, performance, security, technical)
151
- - `work-orders/` - 6 work order templates
152
- - `.claude/trinity/investigations/` - Active investigations with execution plans
153
- - `.claude/trinity/sessions/` - Session archives
154
- - `.claude/trinity/reports/` - Audit and integration reports
155
- - `.claude/trinity/work-orders/` - Active work orders
156
- - `.claude/trinity/archive/` - Archived sessions, reports, and investigations
157
-
158
- **Agent System:**
159
-
160
- - `.claude/agents/` - 18 specialized agents organized by category:
161
- - `aj-team/` - 7 execution agents (APO, BAS, BON, CAP, DRA, KIL, URO)
162
- - `audit/` - 1 quality auditor (JUNO)
163
- - `deployment/` - 4 infrastructure agents (EIN, INO, TAN, ZEN)
164
- - `leadership/` - 2 orchestration agents (ALY, AJ MAESTRO)
165
- - `planning/` - 4 planning agents (MON, ROR, EUS, TRA)
166
- - `.claude/commands/` - 21 slash commands organized in 7 categories:
167
- - `execution/` - 3 commands (orchestrate, audit, breakdown)
168
- - `infrastructure/` - 1 command (init)
169
- - `investigation/` - 3 commands (create-investigation, plan-investigation, investigate-templates)
170
- - `maintenance/` - 4 commands (readme, docs, docs-update, changelog)
171
- - `planning/` - 4 commands (requirements, design, decompose, plan)
172
- - `session/` - 3 commands (start, continue, end)
173
- - `utility/` - 3 commands (verify, agents, workorder)
174
- - `.claude/EMPLOYEE-DIRECTORY.md` - Complete 18-agent team guide
175
-
176
- **Context Hierarchy:**
177
-
178
- - Root `CLAUDE.md` - Global project context
179
- - `.claude/trinity/CLAUDE.md` - Trinity Method enforcement
180
- - `src/CLAUDE.md` - Technology-specific rules
181
-
182
- **Quality Automation:**
183
-
184
- - Linting tools (ESLint, Prettier, Black, Flake8, Clippy, Rustfmt)
185
- - Pre-commit hooks (Husky + lint-staged for Node.js; Python's pre-commit framework for Python, Flutter, Rust)
186
- - Automatic dependency injection to package.json/requirements.txt
187
- - Real codebase metrics: TODO counts, console statements, file complexity, git metrics
188
-
189
- ---
190
-
191
- ## How Trinity Works
192
-
193
- ### Installation
194
-
195
- #### Option 1: Use npx (Recommended - No installation needed)
196
-
197
- ```bash
198
- # Runs latest version without installing
199
- npx trinity-method-sdk deploy
200
- ```
201
-
202
- #### Option 2: Global Installation
203
-
204
- ```bash
205
- # Install once globally
206
- npm install -g trinity-method-sdk
207
-
208
- # Then use anywhere
209
- trinity deploy
210
- ```
211
-
212
- ### Quick Start (90 Seconds to Production)
213
-
214
- ```bash
215
- # Navigate to your project
216
- cd your-project
217
-
218
- # Deploy Trinity Method (using npx)
219
- npx trinity-method-sdk deploy
220
- ```
221
-
222
- **Interactive Wizard:**
223
-
224
- 1. ✅ **Stack Detection**: Automatically detects framework (Node.js, Python, Rust, Flutter, Go)
225
- 2. ✅ **Linting Setup**: Choose "Recommended" for one-click best practices
226
- 3. ✅ **Deploy**: 90-second deployment with full infrastructure
227
- 4. ✅ **Install Dependencies**: `npm install` (or `pip install -r requirements-dev.txt`)
228
- 5. ✅ **Setup Hooks**: Automatic for Node.js (Husky via `npm install`);
229
- for Python/Flutter/Rust: `pip install pre-commit && pre-commit install`
230
-
231
- **Result:** Production-ready development environment with 18 agents, 21 slash commands, quality gates, and documentation.
232
-
233
- ### Available Commands
234
-
235
- ```bash
236
- # Deploy Trinity to your project
237
- npx trinity-method-sdk deploy
238
-
239
- # Update Trinity to latest version
240
- npx trinity-method-sdk update
241
- ```
242
-
243
- ### Using Trinity Method (Slash Commands)
244
-
245
- After deployment, access Trinity functionality through Claude Code slash commands:
246
-
247
- **Session Management:**
248
-
249
- - `/trinity-start` - Start workflow guide
250
- - `/trinity-continue` - Resume after interruption
251
- - `/trinity-end` - End session and archive
252
-
253
- **Planning:**
254
-
255
- - `/trinity-requirements` - Analyze requirements (MON)
256
- - `/trinity-design` - Create technical design (ROR)
257
- - `/trinity-decompose` - Break down tasks (EUS)
258
- - `/trinity-plan` - Create implementation plan (TRA)
259
-
260
- **Execution:**
261
-
262
- - `/trinity-orchestrate` - Execute with ALY orchestration
263
- - `/trinity-audit` - Run codebase audit (JUNO)
264
- - `/trinity-breakdown` - Guided step-by-step implementation walkthrough
265
-
266
- **Maintenance:**
267
-
268
- - `/trinity-readme` - Update README coverage (APO)
269
- - `/trinity-docs` - Generate new documentation (JUNO + 3 parallel APOs)
270
- - `/trinity-docs-update` - Update existing documentation (JUNO audit → 3 APOs → verification loop)
271
- - `/trinity-changelog` - Maintain CHANGELOG.md (APO)
272
-
273
- **Investigation:**
274
-
275
- - `/trinity-create-investigation` - Create structured investigation
276
- - `/trinity-plan-investigation` - Generate investigation plan
277
- - `/trinity-investigate-templates` - View investigation templates
278
-
279
- **Infrastructure:**
280
-
281
- - `/trinity-init` - Initialize Trinity configuration
282
-
283
- **Utility:**
284
-
285
- - `/trinity-verify` - Verify Trinity deployment
286
- - `/trinity-agents` - View agent directory
287
- - `/trinity-workorder` - Create work orders
288
-
289
- ### Linting & Code Quality (85-90% Time Savings)
290
-
291
- #### Before Trinity (Manual Setup): ~50 minutes per project
292
-
293
- 1. Research tools for your framework
294
- 2. Install dependencies
295
- 3. Create configuration files
296
- 4. Configure pre-commit hooks
297
- 5. Test and debug configuration
298
-
299
- #### With Trinity (Automated): ~6 minutes per project
300
-
301
- 1. Select "Recommended" during deployment (30 seconds)
302
- 2. Run `npm install` (3-5 minutes, automatically sets up Husky hooks for Node.js)
303
- 3. For Python/Flutter/Rust only: `pip install pre-commit && pre-commit install` (30 seconds)
304
-
305
- **Supported Frameworks:**
306
-
307
- - **Node.js/React**: ESLint + Prettier + Husky + lint-staged
308
- - **Python**: Black + Flake8 + isort + Pre-commit
309
- - **Flutter**: Dart Analyzer + Pre-commit
310
- - **Rust**: Clippy + Rustfmt + Pre-commit
311
-
312
- ---
313
-
314
- ## Designed for Claude Code
315
-
316
- Trinity Method SDK is built exclusively for
317
- [Claude Code](https://claude.com/claude-code), Anthropic's AI pair programming environment.
318
-
319
- ### Why Claude Code
320
-
321
- - **Deep Integration**: Trinity's 18-agent team leverages Claude Code's agent architecture
322
- - **Slash Commands**: Built-in `/trinity-*` commands for instant workflow access
323
- - **Context System**: Layered CLAUDE.md hierarchy for persistent project knowledge
324
- - **Quality Focus**: Exceptional single-agent experience optimized for Claude
325
-
326
- ### Other AI Assistants
327
-
328
- The Trinity Method **philosophy** is agent-agnostic, but this SDK is optimized for Claude Code's
329
- capabilities. Want to use Trinity with Cursor, Copilot, or others? We welcome contributions!
330
- See [CONTRIBUTING.md](./CONTRIBUTING.md).
331
-
332
- ---
333
-
334
- ## Examples & Documentation
335
-
336
- ### Real-World Deployments
337
-
338
- ```bash
339
- # Node.js/Express API
340
- cd my-api && npx trinity-method-sdk deploy
341
- # Result: API with ESLint, Prettier, Husky, 18 agents, quality gates
342
-
343
- # Python/Django Project
344
- cd my-django && npx trinity-method-sdk deploy
345
- # Result: Django with Black, Flake8, isort, pre-commit, full Trinity infrastructure
346
-
347
- # Flutter Mobile App
348
- cd my-flutter-app && npx trinity-method-sdk deploy
349
- # Result: Flutter with Dart Analyzer, pre-commit, investigation templates
350
-
351
- # Rust CLI Tool
352
- cd my-rust-cli && npx trinity-method-sdk deploy
353
- # Result: Rust with Clippy, Rustfmt, pre-commit, crisis management
354
- ```
355
-
356
- ### Documentation
357
-
358
- After deploying Trinity to your project, comprehensive documentation is available in your project:
359
-
360
- **Trinity Knowledge Base:**
361
-
362
- - `.claude/trinity/knowledge-base/ARCHITECTURE.md` - System architecture with codebase metrics
363
- - `.claude/trinity/knowledge-base/ISSUES.md` - Known issues and bug tracking
364
- - `.claude/trinity/knowledge-base/To-do.md` - Task management and priorities
365
- - `.claude/trinity/knowledge-base/Technical-Debt.md` - Technical debt tracking
366
- - `.claude/trinity/knowledge-base/Trinity.md` - Project-specific Trinity guide
367
- - `.claude/trinity/knowledge-base/TESTING-PRINCIPLES.md` - Testing standards
368
- - `.claude/trinity/knowledge-base/CODING-PRINCIPLES.md` - Code quality standards
369
-
370
- **Agent System:**
371
-
372
- - `.claude/EMPLOYEE-DIRECTORY.md` - Complete agent reference and selection guide
373
- - `.claude/agents/` - 18 specialized agent markdown files
374
-
375
- **SDK Documentation:**
376
-
377
- - [API Documentation](docs/) - TypeDoc-generated API reference
378
- - [CONTRIBUTING.md](CONTRIBUTING.md) - Development setup, workflow, and standards
379
- - [CHANGELOG.md](CHANGELOG.md) - Version history and release notes
380
-
381
- ### After Deployment
382
-
383
- Your project contains:
384
-
385
- - **88 production-ready components** deployed in 90 seconds
386
- - **18 specialized agents** in `.claude/agents/` (7 execution + 1 audit + 4 deployment + 2 leadership + 4 planning)
387
- - **21 slash commands** in `.claude/commands/`
388
- (3 execution + 1 infrastructure + 3 investigation + 4 maintenance + 4 planning + 3 session + 3 utility)
389
- - **Complete knowledge base** in `.claude/trinity/knowledge-base/` (ARCHITECTURE.md, ISSUES.md, To-do.md, Technical-Debt.md)
390
- - **Investigation templates** in `.claude/trinity/templates/investigations/` (bug, feature, performance, security, technical)
391
- - **Work order templates** in `.claude/trinity/templates/work-orders/`
392
- - **Session archives** in `.claude/trinity/sessions/`
393
- - **Audit reports** in `.claude/trinity/reports/`
394
- - **Linting tools** configured for your framework
395
-
396
- **Complete Deployed Structure:**
397
-
398
- ```text
399
- your-project/
400
- ├── .claude/
401
- │ ├── agents/
402
- │ │ ├── aj-team/ # 7 execution agents (APO, BAS, BON, CAP, DRA, KIL, URO)
403
- │ │ ├── audit/ # 1 quality auditor (JUNO)
404
- │ │ ├── deployment/ # 4 infrastructure agents (EIN, INO, TAN, ZEN)
405
- │ │ ├── leadership/ # 2 orchestration agents (ALY, AJ MAESTRO)
406
- │ │ └── planning/ # 4 planning agents (MON, ROR, EUS, TRA)
407
- │ ├── commands/
408
- │ │ ├── execution/ # trinity-orchestrate, trinity-audit, trinity-breakdown
409
- │ │ ├── infrastructure/ # trinity-init
410
- │ │ ├── investigation/ # trinity-create-investigation, trinity-plan-investigation, trinity-investigate-templates
411
- │ │ ├── maintenance/ # trinity-readme, trinity-docs, trinity-docs-update, trinity-changelog
412
- │ │ ├── planning/ # trinity-requirements, trinity-design, trinity-decompose, trinity-plan
413
- │ │ ├── session/ # trinity-start, trinity-continue, trinity-end
414
- │ │ └── utility/ # trinity-verify, trinity-agents, trinity-workorder
415
- │ ├── trinity/
416
- │ │ ├── knowledge-base/ # ARCHITECTURE.md, ISSUES.md, To-do.md, Technical-Debt.md, Trinity.md
417
- │ │ ├── templates/
418
- │ │ │ ├── documentation/ # 2 README templates + 23 report templates
419
- │ │ │ ├── investigations/ # 5 investigation templates (bug, feature, performance, security, technical)
420
- │ │ │ └── work-orders/ # 6 work order templates
421
- │ │ ├── investigations/ # Active investigations
422
- │ │ │ └── plans/ # Investigation execution plans
423
- │ │ ├── sessions/ # Session archives
424
- │ │ ├── reports/ # Audit and integration reports
425
- │ │ ├── work-orders/ # Active work orders
426
- │ │ └── archive/ # Archived sessions, reports, investigations
427
- │ └── EMPLOYEE-DIRECTORY.md # 18-agent team guide
428
- ├── CLAUDE.md # Root context file
429
- └── src/CLAUDE.md # Framework-specific context
430
- ```
431
-
432
- - **Pre-commit hooks** automatically enforcing quality standards
433
-
434
- ---
435
-
436
- ## Contributing
437
-
438
- Trinity Method SDK is open source and welcomes contributions!
439
-
440
- **Ways to Contribute:**
441
-
442
- - 🐛 Report bugs and issues
443
- - 💡 Suggest new features or agent improvements
444
- - 📝 Improve documentation
445
- - 🔧 Submit pull requests
446
- - ⭐ Star the repository if you find it useful
447
-
448
- **Development Setup:**
449
-
450
- ```bash
451
- # Clone repository
452
- git clone https://github.com/lukadfagundes/trinity-method-sdk.git
453
- cd trinity-method-sdk
454
-
455
- # Install dependencies
456
- npm install
457
-
458
- # Build SDK
459
- npm run build
460
-
461
- # Test locally
462
- npm link
463
- trinity deploy
464
- ```
465
-
466
- See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines.
467
-
468
- ---
469
-
470
- ## Development & Publishing
471
-
472
- ### CI/CD Pipeline
473
-
474
- Trinity uses GitHub Actions for comprehensive continuous integration and deployment with BAS 6-phase quality gates.
475
-
476
- #### Continuous Integration (CI)
477
-
478
- **Automated Quality Checks on Every Push:**
479
-
480
- - ✅ Multi-platform testing (Ubuntu, Windows, macOS)
481
- - ✅ Multi-version testing (Node.js 18.x, 20.x, 22.x)
482
- - ✅ Trinity component validation (18 agents, 21 slash commands, knowledge base, CI/CD templates)
483
- - ✅ Test suite execution (unit, integration, e2e, performance)
484
- - ✅ Code coverage validation (80%+ threshold enforced)
485
- - ✅ Linting and type checking
486
- - ✅ Security scanning (npm audit, dependency checks)
487
- - ✅ Build verification with artifact validation
488
- - ✅ Documentation validation
489
-
490
- **BAS 6-Phase Quality Gates:**
491
-
492
- 1. **Phase 1**: Code Quality (Linting, type checking, formatting)
493
- 2. **Phase 2**: Structure Validation (Trinity template validation)
494
- 3. **Phase 3**: Build Validation (TypeScript compilation, artifact verification)
495
- 4. **Phase 4**: Testing (All test suites across platforms)
496
- 5. **Phase 5**: Coverage Check (≥80% threshold)
497
- 6. **Phase 6**: Documentation (API docs, README validation)
498
-
499
- **CI Workflow Location:** [.github/workflows/ci.yml](.github/workflows/ci.yml)
500
-
501
- #### Publishing to npm
502
-
503
- **Manual Publishing Workflow:**
504
-
505
- ```bash
506
- # 1. Update version and changelog
507
- npm version patch # or minor, major
508
-
509
- # 2. Build and publish
510
- npm run build
511
- npm publish --access public
512
-
513
- # 3. Create git tag and push
514
- git tag -a vX.Y.Z -m "Release vX.Y.Z"
515
- git push origin main --follow-tags
516
- ```
517
-
518
- **Automated Checks Before Publishing:**
519
-
520
- The `prepublishOnly` script runs automatically before every publish:
521
-
522
- 1. TypeScript compilation (`npm run build`)
523
- 2. Template copying to dist/
524
- 3. Full test suite execution (`npm run test`)
525
- 4. Only publishes if all checks pass
526
-
527
- ---
528
-
529
- ## License
530
-
531
- MIT License - see [LICENSE](LICENSE) for details
532
-
533
- ---
534
-
535
- ## Links
536
-
537
- ### Project Resources
538
-
539
- - **npm Package**: [trinity-method-sdk](https://www.npmjs.com/package/trinity-method-sdk)
540
- - **GitHub**: [lukadfagundes/trinity-method-sdk](https://github.com/lukadfagundes/trinity-method-sdk)
541
- - **Issues**: [GitHub Issues](https://github.com/lukadfagundes/trinity-method-sdk/issues)
542
- - **Discussions**: [GitHub Discussions](https://github.com/lukadfagundes/trinity-method-sdk/discussions)
543
-
544
- ### Documentation
545
-
546
- - **API Documentation**: [docs/](docs/) - Generated TypeDoc API reference
547
- - **Contributing Guide**: [CONTRIBUTING.md](CONTRIBUTING.md) - Development setup, workflow, and standards
548
- - **Changelog**: [CHANGELOG.md](CHANGELOG.md) - Version history and release notes
549
-
550
- ---
1
+ # Trinity Method SDK
2
+
3
+ [![npm version](https://img.shields.io/npm/v/trinity-method-sdk?color=success)](https://www.npmjs.com/package/trinity-method-sdk)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![Node.js Version](https://img.shields.io/badge/node-%3E%3D16.9.0-brightgreen)](https://nodejs.org/)
6
+ [![AI Agents](https://img.shields.io/badge/AI%20Agent-Claude%20Code-blue)](https://github.com/lukadfagundes/trinity-method-sdk)
7
+
8
+ > Investigation-first development methodology for Claude Code
9
+
10
+ ---
11
+
12
+ ## Why Trinity Method Exists
13
+
14
+ ### The Problem with Traditional AI-Assisted Development
15
+
16
+ AI coding assistants are powerful, but without structure they become expensive guessing machines:
17
+
18
+ **❌ Jump-to-Code Anti-Pattern:**
19
+
20
+ - AI generates code without understanding the problem
21
+ - No investigation phase → immediate implementation
22
+ - Context lost between sessions → repeated mistakes
23
+ - No institutional knowledge → every session starts from zero
24
+ - Inconsistent quality → success depends on prompt luck
25
+ - Manual quality setup → 50 minutes configuring linters per project
26
+
27
+ **The Cost:**
28
+
29
+ - Developers waste time debugging AI-generated code that solves the wrong problem
30
+ - Teams lose hard-won lessons when developers leave
31
+ - Technical debt accumulates invisibly
32
+ - Code quality varies wildly across sessions
33
+
34
+ ### Our Philosophy: Investigation-First Development
35
+
36
+ Trinity Method rejects "prompt and pray" development. Instead, we enforce **systematic investigation before implementation**:
37
+
38
+ #### 1. Investigation-First Principle
39
+
40
+ ```text
41
+ WRONG: "Build authentication" → AI generates code → Debug for hours
42
+ RIGHT: "Investigate authentication requirements" → Understand problem → Design solution → Implement correctly
43
+ ```
44
+
45
+ #### 2. Evidence-Based Decisions
46
+
47
+ Every decision backed by documentation, codebase metrics, and historical patterns. No guessing.
48
+
49
+ **3. Knowledge Preservation**
50
+ Lessons learned persist across sessions through institutional memory. Agents get smarter over time.
51
+
52
+ **4. Systematic Quality Assurance**
53
+ Quality isn't aspirational—it's systematically enforced through automated gates (BAS 6-phase validation).
54
+
55
+ ### The Trinity Transformation
56
+
57
+ **✅ With Trinity Method:**
58
+
59
+ - **Investigation before coding** → Understand the problem first
60
+ - **Persistent knowledge base** → Learn from every session
61
+ - **Automated quality enforcement** → BAS gates ensure standards
62
+ - **18-agent team coordination** → Right specialist for each task
63
+ - **Institutional memory** → Patterns, strategies, and lessons preserved
64
+ - **90-second deployment** → Complete development environment instantly
65
+
66
+ ---
67
+
68
+ ## What is Trinity Method SDK
69
+
70
+ Trinity Method SDK is a **production-ready development methodology** that transforms AI-assisted coding
71
+ from random generation into systematic engineering.
72
+
73
+ ### Core Philosophy
74
+
75
+ **Trinity Method enforces three pillars:**
76
+
77
+ 1. **Investigation-First Development**
78
+ - Systematic investigation using MON (Requirements), ROR (Design), TRA (Planning)
79
+ - Evidence-based decisions backed by documentation and metrics
80
+ - Scale-based workflows: SMALL (0 stop points) → MEDIUM (2 stop points) → LARGE (4 stop points)
81
+
82
+ 2. **Knowledge Preservation**
83
+ - Learning system captures patterns from every investigation
84
+ - Cross-session persistence through filesystem storage
85
+ - Agent knowledge sharing via pub/sub bus (≥0.8 confidence threshold)
86
+
87
+ 3. **Systematic Quality Assurance**
88
+ - BAS 6-phase quality gate: Lint → Structure → Build → Test → Coverage (≥80%) → Review
89
+ - Crisis management system for 5 crisis types (build, test, error, performance, security)
90
+ - Automated codebase metrics collection and technical debt tracking
91
+
92
+ ### The 18-Agent Team
93
+
94
+ Trinity SDK includes **18 specialized agents** organized across 5 functional teams:
95
+
96
+ **Planning Layer:**
97
+
98
+ - **MON** - Requirements Analyst (functional & non-functional requirements)
99
+ - **ROR** - Design Architect (technical design, ADRs)
100
+ - **TRA** - Work Planner (implementation sequencing, BAS integration)
101
+ - **EUS** - Task Decomposer (atomic task breakdown)
102
+
103
+ **Execution Layer:**
104
+
105
+ - **KIL** - Task Executor (TDD implementation: RED → GREEN → REFACTOR)
106
+ - **BAS** - Quality Gate (6-phase validation enforcer)
107
+ - **DRA** - Code Reviewer (design doc compliance, quality escalation)
108
+
109
+ **Support Layer:**
110
+
111
+ - **APO** - Documentation Specialist (API docs, inline comments)
112
+ - **BON** - Dependency Manager (package security, version management)
113
+ - **CAP** - Configuration Specialist (env vars, config files)
114
+ - **URO** - Refactoring Specialist (technical debt reduction)
115
+
116
+ **Leadership:**
117
+
118
+ - **ALY** - Chief Technology Officer (investigation orchestration, strategic coordination)
119
+ - **AJ MAESTRO** - Orchestrator (multi-agent workflow orchestration, task delegation)
120
+
121
+ **Deployment:**
122
+
123
+ - **TAN** - Structure Specialist (directory structure validation)
124
+ - **ZEN** - Knowledge Base Specialist (comprehensive documentation)
125
+ - **INO** - Context Specialist (CLAUDE.md hierarchy management)
126
+ - **EIN** - CI/CD Specialist (continuous integration/deployment automation)
127
+
128
+ **Audit:**
129
+
130
+ - **JUNO** - Quality Auditor (comprehensive codebase audits, deployment verification)
131
+
132
+ ### What Gets Deployed
133
+
134
+ Trinity deploys **88 production-ready components** in 90 seconds:
135
+
136
+ **Methodology Infrastructure:**
137
+
138
+ - `.claude/trinity/knowledge-base/` - 9 living documentation files
139
+ - ARCHITECTURE.md (codebase metrics, architecture documentation)
140
+ - ISSUES.md (known issues and bug tracking)
141
+ - To-do.md (task management and priorities)
142
+ - Technical-Debt.md (technical debt tracking)
143
+ - Trinity.md (project-specific Trinity guide)
144
+ - TESTING-PRINCIPLES.md (testing standards)
145
+ - CODING-PRINCIPLES.md (code quality standards)
146
+ - DOCUMENTATION-CRITERIA.md (documentation standards)
147
+ - AI-DEVELOPMENT-GUIDE.md (AI-assisted development best practices)
148
+ - `.claude/trinity/templates/` - Reusable templates
149
+ - `documentation/` - Documentation templates (2 README templates + 23 report templates)
150
+ - `investigations/` - 5 investigation templates (bug, feature, performance, security, technical)
151
+ - `work-orders/` - 6 work order templates
152
+ - `.claude/trinity/investigations/` - Active investigations with execution plans
153
+ - `.claude/trinity/sessions/` - Session archives
154
+ - `.claude/trinity/reports/` - Audit and integration reports
155
+ - `.claude/trinity/work-orders/` - Active work orders
156
+ - `.claude/trinity/archive/` - Archived sessions, reports, and investigations
157
+
158
+ **Agent System:**
159
+
160
+ - `.claude/agents/` - 18 specialized agents organized by category:
161
+ - `aj-team/` - 7 execution agents (APO, BAS, BON, CAP, DRA, KIL, URO)
162
+ - `audit/` - 1 quality auditor (JUNO)
163
+ - `deployment/` - 4 infrastructure agents (EIN, INO, TAN, ZEN)
164
+ - `leadership/` - 2 orchestration agents (ALY, AJ MAESTRO)
165
+ - `planning/` - 4 planning agents (MON, ROR, EUS, TRA)
166
+ - `.claude/commands/` - 21 slash commands organized in 7 categories:
167
+ - `execution/` - 3 commands (orchestrate, audit, breakdown)
168
+ - `infrastructure/` - 1 command (init)
169
+ - `investigation/` - 3 commands (create-investigation, plan-investigation, investigate-templates)
170
+ - `maintenance/` - 4 commands (readme, docs, docs-update, changelog)
171
+ - `planning/` - 4 commands (requirements, design, decompose, plan)
172
+ - `session/` - 3 commands (start, continue, end)
173
+ - `utility/` - 3 commands (verify, agents, workorder)
174
+ - `.claude/EMPLOYEE-DIRECTORY.md` - Complete 18-agent team guide
175
+
176
+ **Context Hierarchy:**
177
+
178
+ - Root `CLAUDE.md` - Global project context
179
+ - `.claude/trinity/CLAUDE.md` - Trinity Method enforcement
180
+ - `src/CLAUDE.md` - Technology-specific rules
181
+
182
+ **Quality Automation:**
183
+
184
+ - Linting tools (ESLint, Prettier, Black, Flake8, Clippy, Rustfmt)
185
+ - Pre-commit hooks (Husky + lint-staged for Node.js; Python's pre-commit framework for Python, Flutter, Rust)
186
+ - Automatic dependency injection to package.json/requirements.txt
187
+ - Real codebase metrics: TODO counts, console statements, file complexity, git metrics
188
+
189
+ ---
190
+
191
+ ## How Trinity Works
192
+
193
+ ### Installation
194
+
195
+ #### Option 1: Use npx (Recommended - No installation needed)
196
+
197
+ ```bash
198
+ # Runs latest version without installing
199
+ npx trinity-method-sdk deploy
200
+ ```
201
+
202
+ #### Option 2: Global Installation
203
+
204
+ ```bash
205
+ # Install once globally
206
+ npm install -g trinity-method-sdk
207
+
208
+ # Then use anywhere
209
+ trinity deploy
210
+ ```
211
+
212
+ ### Quick Start (90 Seconds to Production)
213
+
214
+ ```bash
215
+ # Navigate to your project
216
+ cd your-project
217
+
218
+ # Deploy Trinity Method (using npx)
219
+ npx trinity-method-sdk deploy
220
+ ```
221
+
222
+ **Interactive Wizard:**
223
+
224
+ 1. ✅ **Stack Detection**: Automatically detects framework (Node.js, Python, Rust, Flutter, Go)
225
+ 2. ✅ **Linting Setup**: Choose "Recommended" for one-click best practices
226
+ 3. ✅ **Deploy**: 90-second deployment with full infrastructure
227
+ 4. ✅ **Install Dependencies**: `npm install` (or `pip install -r requirements-dev.txt`)
228
+ 5. ✅ **Setup Hooks**: Automatic for Node.js (Husky via `npm install`);
229
+ for Python/Flutter/Rust: `pip install pre-commit && pre-commit install`
230
+
231
+ **Result:** Production-ready development environment with 18 agents, 21 slash commands, quality gates, and documentation.
232
+
233
+ ### Available Commands
234
+
235
+ ```bash
236
+ # Deploy Trinity to your project
237
+ npx trinity-method-sdk deploy
238
+
239
+ # Update Trinity to latest version
240
+ npx trinity-method-sdk update
241
+ ```
242
+
243
+ ### Using Trinity Method (Slash Commands)
244
+
245
+ After deployment, access Trinity functionality through Claude Code slash commands:
246
+
247
+ **Session Management:**
248
+
249
+ - `/trinity-start` - Start workflow guide
250
+ - `/trinity-continue` - Resume after interruption
251
+ - `/trinity-end` - End session and archive
252
+
253
+ **Planning:**
254
+
255
+ - `/trinity-requirements` - Analyze requirements (MON)
256
+ - `/trinity-design` - Create technical design (ROR)
257
+ - `/trinity-decompose` - Break down tasks (EUS)
258
+ - `/trinity-plan` - Create implementation plan (TRA)
259
+
260
+ **Execution:**
261
+
262
+ - `/trinity-orchestrate` - Execute with ALY orchestration
263
+ - `/trinity-audit` - Run codebase audit (JUNO)
264
+ - `/trinity-breakdown` - Guided step-by-step implementation walkthrough
265
+
266
+ **Maintenance:**
267
+
268
+ - `/trinity-readme` - Update README coverage (APO)
269
+ - `/trinity-docs` - Generate new documentation (JUNO + 3 parallel APOs)
270
+ - `/trinity-docs-update` - Update existing documentation (JUNO audit → 3 APOs → verification loop)
271
+ - `/trinity-changelog` - Maintain CHANGELOG.md (APO)
272
+
273
+ **Investigation:**
274
+
275
+ - `/trinity-create-investigation` - Create structured investigation
276
+ - `/trinity-plan-investigation` - Generate investigation plan
277
+ - `/trinity-investigate-templates` - View investigation templates
278
+
279
+ **Infrastructure:**
280
+
281
+ - `/trinity-init` - Initialize Trinity configuration
282
+
283
+ **Utility:**
284
+
285
+ - `/trinity-verify` - Verify Trinity deployment
286
+ - `/trinity-agents` - View agent directory
287
+ - `/trinity-workorder` - Create work orders
288
+
289
+ ### Linting & Code Quality (85-90% Time Savings)
290
+
291
+ #### Before Trinity (Manual Setup): ~50 minutes per project
292
+
293
+ 1. Research tools for your framework
294
+ 2. Install dependencies
295
+ 3. Create configuration files
296
+ 4. Configure pre-commit hooks
297
+ 5. Test and debug configuration
298
+
299
+ #### With Trinity (Automated): ~6 minutes per project
300
+
301
+ 1. Select "Recommended" during deployment (30 seconds)
302
+ 2. Run `npm install` (3-5 minutes, automatically sets up Husky hooks for Node.js)
303
+ 3. For Python/Flutter/Rust only: `pip install pre-commit && pre-commit install` (30 seconds)
304
+
305
+ **Supported Frameworks:**
306
+
307
+ - **Node.js/React**: ESLint + Prettier + Husky + lint-staged
308
+ - **Python**: Black + Flake8 + isort + Pre-commit
309
+ - **Flutter**: Dart Analyzer + Pre-commit
310
+ - **Rust**: Clippy + Rustfmt + Pre-commit
311
+
312
+ ---
313
+
314
+ ## Designed for Claude Code
315
+
316
+ Trinity Method SDK is built exclusively for
317
+ [Claude Code](https://claude.com/claude-code), Anthropic's AI pair programming environment.
318
+
319
+ ### Why Claude Code
320
+
321
+ - **Deep Integration**: Trinity's 18-agent team leverages Claude Code's agent architecture
322
+ - **Slash Commands**: Built-in `/trinity-*` commands for instant workflow access
323
+ - **Context System**: Layered CLAUDE.md hierarchy for persistent project knowledge
324
+ - **Quality Focus**: Exceptional single-agent experience optimized for Claude
325
+
326
+ ### Other AI Assistants
327
+
328
+ The Trinity Method **philosophy** is agent-agnostic, but this SDK is optimized for Claude Code's
329
+ capabilities. Want to use Trinity with Cursor, Copilot, or others? We welcome contributions!
330
+ See [CONTRIBUTING.md](./CONTRIBUTING.md).
331
+
332
+ ---
333
+
334
+ ## Examples & Documentation
335
+
336
+ ### Real-World Deployments
337
+
338
+ ```bash
339
+ # Node.js/Express API
340
+ cd my-api && npx trinity-method-sdk deploy
341
+ # Result: API with ESLint, Prettier, Husky, 18 agents, quality gates
342
+
343
+ # Python/Django Project
344
+ cd my-django && npx trinity-method-sdk deploy
345
+ # Result: Django with Black, Flake8, isort, pre-commit, full Trinity infrastructure
346
+
347
+ # Flutter Mobile App
348
+ cd my-flutter-app && npx trinity-method-sdk deploy
349
+ # Result: Flutter with Dart Analyzer, pre-commit, investigation templates
350
+
351
+ # Rust CLI Tool
352
+ cd my-rust-cli && npx trinity-method-sdk deploy
353
+ # Result: Rust with Clippy, Rustfmt, pre-commit, crisis management
354
+ ```
355
+
356
+ ### Documentation
357
+
358
+ After deploying Trinity to your project, comprehensive documentation is available in your project:
359
+
360
+ **Trinity Knowledge Base:**
361
+
362
+ - `.claude/trinity/knowledge-base/ARCHITECTURE.md` - System architecture with codebase metrics
363
+ - `.claude/trinity/knowledge-base/ISSUES.md` - Known issues and bug tracking
364
+ - `.claude/trinity/knowledge-base/To-do.md` - Task management and priorities
365
+ - `.claude/trinity/knowledge-base/Technical-Debt.md` - Technical debt tracking
366
+ - `.claude/trinity/knowledge-base/Trinity.md` - Project-specific Trinity guide
367
+ - `.claude/trinity/knowledge-base/TESTING-PRINCIPLES.md` - Testing standards
368
+ - `.claude/trinity/knowledge-base/CODING-PRINCIPLES.md` - Code quality standards
369
+
370
+ **Agent System:**
371
+
372
+ - `.claude/EMPLOYEE-DIRECTORY.md` - Complete agent reference and selection guide
373
+ - `.claude/agents/` - 18 specialized agent markdown files
374
+
375
+ **SDK Documentation:**
376
+
377
+ - [API Documentation](docs/) - TypeDoc-generated API reference
378
+ - [CONTRIBUTING.md](CONTRIBUTING.md) - Development setup, workflow, and standards
379
+ - [CHANGELOG.md](CHANGELOG.md) - Version history and release notes
380
+
381
+ ### After Deployment
382
+
383
+ Your project contains:
384
+
385
+ - **88 production-ready components** deployed in 90 seconds
386
+ - **18 specialized agents** in `.claude/agents/` (7 execution + 1 audit + 4 deployment + 2 leadership + 4 planning)
387
+ - **21 slash commands** in `.claude/commands/`
388
+ (3 execution + 1 infrastructure + 3 investigation + 4 maintenance + 4 planning + 3 session + 3 utility)
389
+ - **Complete knowledge base** in `.claude/trinity/knowledge-base/` (ARCHITECTURE.md, ISSUES.md, To-do.md, Technical-Debt.md)
390
+ - **Investigation templates** in `.claude/trinity/templates/investigations/` (bug, feature, performance, security, technical)
391
+ - **Work order templates** in `.claude/trinity/templates/work-orders/`
392
+ - **Session archives** in `.claude/trinity/sessions/`
393
+ - **Audit reports** in `.claude/trinity/reports/`
394
+ - **Linting tools** configured for your framework
395
+
396
+ **Complete Deployed Structure:**
397
+
398
+ ```text
399
+ your-project/
400
+ ├── .claude/
401
+ │ ├── agents/
402
+ │ │ ├── aj-team/ # 7 execution agents (APO, BAS, BON, CAP, DRA, KIL, URO)
403
+ │ │ ├── audit/ # 1 quality auditor (JUNO)
404
+ │ │ ├── deployment/ # 4 infrastructure agents (EIN, INO, TAN, ZEN)
405
+ │ │ ├── leadership/ # 2 orchestration agents (ALY, AJ MAESTRO)
406
+ │ │ └── planning/ # 4 planning agents (MON, ROR, EUS, TRA)
407
+ │ ├── commands/
408
+ │ │ ├── execution/ # trinity-orchestrate, trinity-audit, trinity-breakdown
409
+ │ │ ├── infrastructure/ # trinity-init
410
+ │ │ ├── investigation/ # trinity-create-investigation, trinity-plan-investigation, trinity-investigate-templates
411
+ │ │ ├── maintenance/ # trinity-readme, trinity-docs, trinity-docs-update, trinity-changelog
412
+ │ │ ├── planning/ # trinity-requirements, trinity-design, trinity-decompose, trinity-plan
413
+ │ │ ├── session/ # trinity-start, trinity-continue, trinity-end
414
+ │ │ └── utility/ # trinity-verify, trinity-agents, trinity-workorder
415
+ │ ├── trinity/
416
+ │ │ ├── knowledge-base/ # ARCHITECTURE.md, ISSUES.md, To-do.md, Technical-Debt.md, Trinity.md
417
+ │ │ ├── templates/
418
+ │ │ │ ├── documentation/ # 2 README templates + 23 report templates
419
+ │ │ │ ├── investigations/ # 5 investigation templates (bug, feature, performance, security, technical)
420
+ │ │ │ └── work-orders/ # 6 work order templates
421
+ │ │ ├── investigations/ # Active investigations
422
+ │ │ │ └── plans/ # Investigation execution plans
423
+ │ │ ├── sessions/ # Session archives
424
+ │ │ ├── reports/ # Audit and integration reports
425
+ │ │ ├── work-orders/ # Active work orders
426
+ │ │ └── archive/ # Archived sessions, reports, investigations
427
+ │ └── EMPLOYEE-DIRECTORY.md # 18-agent team guide
428
+ ├── CLAUDE.md # Root context file
429
+ └── src/CLAUDE.md # Framework-specific context
430
+ ```
431
+
432
+ - **Pre-commit hooks** automatically enforcing quality standards
433
+
434
+ ---
435
+
436
+ ## Contributing
437
+
438
+ Trinity Method SDK is open source and welcomes contributions!
439
+
440
+ **Ways to Contribute:**
441
+
442
+ - 🐛 Report bugs and issues
443
+ - 💡 Suggest new features or agent improvements
444
+ - 📝 Improve documentation
445
+ - 🔧 Submit pull requests
446
+ - ⭐ Star the repository if you find it useful
447
+
448
+ **Development Setup:**
449
+
450
+ ```bash
451
+ # Clone repository
452
+ git clone https://github.com/lukadfagundes/trinity-method-sdk.git
453
+ cd trinity-method-sdk
454
+
455
+ # Install dependencies
456
+ npm install
457
+
458
+ # Build SDK
459
+ npm run build
460
+
461
+ # Test locally
462
+ npm link
463
+ trinity deploy
464
+ ```
465
+
466
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines.
467
+
468
+ ---
469
+
470
+ ## Development & Publishing
471
+
472
+ ### CI/CD Pipeline
473
+
474
+ Trinity uses GitHub Actions for comprehensive continuous integration and deployment with BAS 6-phase quality gates.
475
+
476
+ #### Continuous Integration (CI)
477
+
478
+ **Automated Quality Checks on Every Push:**
479
+
480
+ - ✅ Multi-platform testing (Ubuntu, Windows, macOS)
481
+ - ✅ Multi-version testing (Node.js 18.x, 20.x, 22.x)
482
+ - ✅ Trinity component validation (18 agents, 21 slash commands, knowledge base, CI/CD templates)
483
+ - ✅ Test suite execution (unit, integration, e2e, performance)
484
+ - ✅ Code coverage validation (80%+ threshold enforced)
485
+ - ✅ Linting and type checking
486
+ - ✅ Security scanning (npm audit, dependency checks)
487
+ - ✅ Build verification with artifact validation
488
+ - ✅ Documentation validation
489
+
490
+ **BAS 6-Phase Quality Gates:**
491
+
492
+ 1. **Phase 1**: Code Quality (Linting, type checking, formatting)
493
+ 2. **Phase 2**: Structure Validation (Trinity template validation)
494
+ 3. **Phase 3**: Build Validation (TypeScript compilation, artifact verification)
495
+ 4. **Phase 4**: Testing (All test suites across platforms)
496
+ 5. **Phase 5**: Coverage Check (≥80% threshold)
497
+ 6. **Phase 6**: Documentation (API docs, README validation)
498
+
499
+ **CI Workflow Location:** [.github/workflows/ci.yml](.github/workflows/ci.yml)
500
+
501
+ #### Publishing to npm
502
+
503
+ **Manual Publishing Workflow:**
504
+
505
+ ```bash
506
+ # 1. Update version and changelog
507
+ npm version patch # or minor, major
508
+
509
+ # 2. Build and publish
510
+ npm run build
511
+ npm publish --access public
512
+
513
+ # 3. Create git tag and push
514
+ git tag -a vX.Y.Z -m "Release vX.Y.Z"
515
+ git push origin main --follow-tags
516
+ ```
517
+
518
+ **Automated Checks Before Publishing:**
519
+
520
+ The `prepublishOnly` script runs automatically before every publish:
521
+
522
+ 1. TypeScript compilation (`npm run build`)
523
+ 2. Template copying to dist/
524
+ 3. Full test suite execution (`npm run test`)
525
+ 4. Only publishes if all checks pass
526
+
527
+ ---
528
+
529
+ ## License
530
+
531
+ MIT License - see [LICENSE](LICENSE) for details
532
+
533
+ ---
534
+
535
+ ## Links
536
+
537
+ ### Project Resources
538
+
539
+ - **npm Package**: [trinity-method-sdk](https://www.npmjs.com/package/trinity-method-sdk)
540
+ - **GitHub**: [lukadfagundes/trinity-method-sdk](https://github.com/lukadfagundes/trinity-method-sdk)
541
+ - **Issues**: [GitHub Issues](https://github.com/lukadfagundes/trinity-method-sdk/issues)
542
+ - **Discussions**: [GitHub Discussions](https://github.com/lukadfagundes/trinity-method-sdk/discussions)
543
+
544
+ ### Documentation
545
+
546
+ - **API Documentation**: [docs/](docs/) - Generated TypeDoc API reference
547
+ - **Contributing Guide**: [CONTRIBUTING.md](CONTRIBUTING.md) - Development setup, workflow, and standards
548
+ - **Changelog**: [CHANGELOG.md](CHANGELOG.md) - Version history and release notes
549
+
550
+ ---
@@ -18,14 +18,8 @@ export async function updateGitignore(spinner) {
18
18
  if (await fs.pathExists(gitignorePath)) {
19
19
  gitignoreContent = await fs.readFile(gitignorePath, 'utf8');
20
20
  }
21
- // Trinity files to ignore (archive and templates are ephemeral/generated)
22
- const trinityIgnores = [
23
- '',
24
- '# Trinity Method SDK',
25
- '.claude/trinity/archive/',
26
- '.claude/trinity/templates/',
27
- '*CLAUDE.md',
28
- ];
21
+ // Trinity files to ignore (entire .claude/ directory and all CLAUDE.md files)
22
+ const trinityIgnores = ['', '# Trinity Method SDK', '.claude/', '*CLAUDE.md'];
29
23
  // Check if Trinity section already exists
30
24
  if (!gitignoreContent.includes('# Trinity Method SDK')) {
31
25
  // Append Trinity ignores
@@ -6,14 +6,15 @@
6
6
  import fs from 'fs-extra';
7
7
  import path from 'path';
8
8
  import { validatePath } from '../../utils/validate-path.js';
9
- /** Old gitignore patterns from pre-2.2.0 deployments */
10
- const OLD_GITIGNORE_PATTERNS = ['trinity/', '*CLAUDE.md', 'TRINITY.md'];
11
- /** Current gitignore patterns */
12
- const CURRENT_GITIGNORE_PATTERNS = [
9
+ /** Old gitignore patterns from previous deployments */
10
+ const OLD_GITIGNORE_PATTERNS = [
11
+ 'trinity/',
12
+ 'TRINITY.md',
13
13
  '.claude/trinity/archive/',
14
14
  '.claude/trinity/templates/',
15
- '*CLAUDE.md',
16
15
  ];
16
+ /** Current gitignore patterns */
17
+ const CURRENT_GITIGNORE_PATTERNS = ['.claude/', '*CLAUDE.md'];
17
18
  /**
18
19
  * Detect if the project has a legacy (pre-2.2.0) Trinity deployment
19
20
  * Legacy deployments use `trinity/` at root instead of `.claude/trinity/`
@@ -97,6 +98,7 @@ export async function updateGitignoreForMigration(spinner) {
97
98
  trimmed === 'trinity/' ||
98
99
  trimmed === '*CLAUDE.md' ||
99
100
  trimmed === 'TRINITY.md' ||
101
+ trimmed === '.claude/' ||
100
102
  trimmed === '.claude/trinity/archive/' ||
101
103
  trimmed === '.claude/trinity/templates/') {
102
104
  continue;
@@ -17,17 +17,29 @@ End current Trinity Method session and prepare for commit.
17
17
 
18
18
  **STRICT ARCHIVING PROTOCOL:**
19
19
 
20
- a. **Archive Completed Work Orders:**
20
+ a. **Archive Completed Work Orders from sessions/:**
21
21
  - Read all files from `.claude/trinity/sessions/` matching `WO-*.md`
22
22
  - Move each to `.claude/trinity/archive/work-orders/YYYY-MM-DD/`
23
23
  - These were moved to sessions/ after completion per work order template
24
24
 
25
- b. **Archive Completed Investigations:**
25
+ b. **Archive Completed Work Orders from work-orders/:**
26
+ - Check `.claude/trinity/work-orders/` for any completed work orders
27
+ - Completed work orders have status marked as "COMPLETED" or "CLOSED"
28
+ - Move completed ones to `.claude/trinity/archive/work-orders/YYYY-MM-DD/`
29
+ - Leave active/in-progress work orders in place
30
+
31
+ c. **Archive Completed Investigations from sessions/:**
26
32
  - Read all files from `.claude/trinity/sessions/` matching `INV-*.md`
27
33
  - Move each to `.claude/trinity/archive/investigations/YYYY-MM-DD/`
28
34
  - These were moved to sessions/ after completion per investigation template
29
35
 
30
- c. **Archive ALL Reports:**
36
+ d. **Archive Completed Investigations from investigations/:**
37
+ - Check `.claude/trinity/investigations/` for any completed investigations
38
+ - Move completed ones to `.claude/trinity/archive/investigations/YYYY-MM-DD/`
39
+ - Also check `.claude/trinity/investigations/plans/` and archive any completed investigation plans
40
+ - Leave active/in-progress investigations in place
41
+
42
+ e. **Archive ALL Reports:**
31
43
  - Move ALL files from `.claude/trinity/reports/` to `.claude/trinity/archive/reports/YYYY-MM-DD/`
32
44
  - This includes:
33
45
  - Implementation completion reports
@@ -36,15 +48,26 @@ End current Trinity Method session and prepare for commit.
36
48
  - Any other session reports
37
49
  - **NO EXCEPTIONS:** Every file in reports/ must be archived
38
50
 
39
- d. **Archive Session Files:**
51
+ f. **Archive Plan Mode Files:**
52
+ - Move ALL files from `.claude/trinity/plans/` to `.claude/trinity/archive/sessions/YYYY-MM-DD/`
53
+ - These are created by Claude Code during plan mode sessions
54
+ - They are session artifacts and should be archived with session files
55
+
56
+ g. **Archive Session Files:**
40
57
  - Move ALL remaining files from `.claude/trinity/sessions/` to `.claude/trinity/archive/sessions/YYYY-MM-DD/`
41
58
  - Create session summary document in `.claude/trinity/archive/sessions/YYYY-MM-DD/SESSION-SUMMARY-{date}.md`
42
59
 
43
- e. **Verify Clean Slate:**
60
+ h. **Organize Loose Archive Files:**
61
+ - Check each `.claude/trinity/archive/` subdirectory (work-orders/, investigations/, reports/, sessions/)
62
+ - If any files exist directly in a subdirectory (not inside a YYYY-MM-DD/ date folder), move them into the appropriate `YYYY-MM-DD/` folder based on their modification date
63
+ - This ensures all archived files are properly organized in date folders
64
+
65
+ i. **Verify Clean Slate:**
44
66
  - **CRITICAL:** After archiving, `.claude/trinity/sessions/` MUST be empty
45
67
  - **CRITICAL:** After archiving, `.claude/trinity/reports/` MUST be empty
68
+ - **CRITICAL:** After archiving, `.claude/trinity/plans/` MUST be empty
46
69
  - If any files remain, archive them or report error
47
- - Next session MUST start with completely empty sessions/ and reports/ folders
70
+ - Next session MUST start with completely empty sessions/, reports/, and plans/ folders
48
71
 
49
72
  **Archive Structure:**
50
73
  ```
@@ -56,6 +79,7 @@ End current Trinity Method session and prepare for commit.
56
79
  ├── investigations/YYYY-MM-DD/
57
80
  │ ├── INV-001-*.md
58
81
  │ ├── INV-002-*.md
82
+ │ ├── INV-001-plan-*.md
59
83
  │ └── ...
60
84
  ├── reports/YYYY-MM-DD/
61
85
  │ ├── WO-001-IMPLEMENTATION-COMPLETE-*.md
@@ -64,6 +88,7 @@ End current Trinity Method session and prepare for commit.
64
88
  │ └── ...
65
89
  └── sessions/YYYY-MM-DD/
66
90
  ├── SESSION-SUMMARY-{date}.md
91
+ ├── [plan mode files]
67
92
  └── [any other session files]
68
93
  ```
69
94
 
@@ -71,8 +96,10 @@ End current Trinity Method session and prepare for commit.
71
96
  - Keep ONLY active/in-progress work orders in `.claude/trinity/work-orders/`
72
97
  - Keep ONLY active/in-progress investigations in `.claude/trinity/investigations/`
73
98
  - Do NOT archive incomplete work
74
- - Completed work is identified by presence in `.claude/trinity/sessions/` folder
99
+ - Completed work may exist in both `sessions/` AND their source directories (`work-orders/`, `investigations/`)
100
+ - The `plans/` directory is created by Claude Code during plan mode — always archive all contents
75
101
  - All reports are archived regardless of status
102
+ - Loose files in archive subdirectories should be organized into YYYY-MM-DD date folders
76
103
 
77
104
  2. **ALY analyzes session events:**
78
105
  - Review all work completed during session
@@ -87,6 +114,8 @@ End current Trinity Method session and prepare for commit.
87
114
  - Verify .claude/trinity/investigations/ contains only active investigations
88
115
  - Verify .claude/trinity/reports/ is empty
89
116
  - Verify .claude/trinity/sessions/ is empty
117
+ - Verify .claude/trinity/plans/ is empty
118
+ - Verify all files in .claude/trinity/archive/ subdirectories are in YYYY-MM-DD date folders
90
119
  - Ready for next session
91
120
 
92
121
  4. **Git commit instructions:**
@@ -32,6 +32,23 @@ Examples: WO-042-jwt-refresh-implementation.md
32
32
 
33
33
  ---
34
34
 
35
+ ## Work Order Numbering
36
+
37
+ **To determine the next WO number:**
38
+
39
+ 1. Scan `.claude/trinity/work-orders/` for files matching `WO-*.md`
40
+ 2. Scan `.claude/trinity/sessions/` for files matching `WO-*.md`
41
+ 3. From all matches in those two directories, extract the highest `XXX` number
42
+ 4. New WO number = highest + 1 (zero-padded to 3 digits)
43
+ 5. If NO work orders are found in either directory, start at `WO-001`
44
+
45
+ **IMPORTANT:**
46
+ - Do **NOT** scan `.claude/trinity/archive/` — archived WOs belong to past sessions
47
+ - Do **NOT** scan any other directories
48
+ - Each new session with no active or pending WOs starts fresh at WO-001
49
+
50
+ ---
51
+
35
52
  ## Direct Work Order Creation
36
53
 
37
54
  When `/trinity-workorder` is invoked, the agent will:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trinity-method-sdk",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
4
4
  "description": "Trinity Method SDK - Investigation-first development methodology for any project",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",