trinity-method-sdk 2.0.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.
- package/CHANGELOG.md +116 -0
- package/LICENSE +21 -0
- package/README.md +555 -0
- package/dist/cli/commands/deploy/agents.d.ts +14 -0
- package/dist/cli/commands/deploy/agents.js +59 -0
- package/dist/cli/commands/deploy/ci-cd.d.ts +13 -0
- package/dist/cli/commands/deploy/ci-cd.js +50 -0
- package/dist/cli/commands/deploy/claude-setup.d.ts +17 -0
- package/dist/cli/commands/deploy/claude-setup.js +91 -0
- package/dist/cli/commands/deploy/configuration.d.ts +13 -0
- package/dist/cli/commands/deploy/configuration.js +215 -0
- package/dist/cli/commands/deploy/directories.d.ts +12 -0
- package/dist/cli/commands/deploy/directories.js +38 -0
- package/dist/cli/commands/deploy/gitignore.d.ts +12 -0
- package/dist/cli/commands/deploy/gitignore.js +53 -0
- package/dist/cli/commands/deploy/index.d.ts +38 -0
- package/dist/cli/commands/deploy/index.js +156 -0
- package/dist/cli/commands/deploy/knowledge-base.d.ts +16 -0
- package/dist/cli/commands/deploy/knowledge-base.js +75 -0
- package/dist/cli/commands/deploy/linting.d.ts +18 -0
- package/dist/cli/commands/deploy/linting.js +51 -0
- package/dist/cli/commands/deploy/metrics.d.ts +13 -0
- package/dist/cli/commands/deploy/metrics.js +34 -0
- package/dist/cli/commands/deploy/pre-flight.d.ts +13 -0
- package/dist/cli/commands/deploy/pre-flight.js +29 -0
- package/dist/cli/commands/deploy/root-files.d.ts +16 -0
- package/dist/cli/commands/deploy/root-files.js +178 -0
- package/dist/cli/commands/deploy/sdk-install.d.ts +12 -0
- package/dist/cli/commands/deploy/sdk-install.js +57 -0
- package/dist/cli/commands/deploy/summary.d.ts +14 -0
- package/dist/cli/commands/deploy/summary.js +130 -0
- package/dist/cli/commands/deploy/templates.d.ts +14 -0
- package/dist/cli/commands/deploy/templates.js +84 -0
- package/dist/cli/commands/deploy/types.d.ts +39 -0
- package/dist/cli/commands/deploy/types.js +5 -0
- package/dist/cli/commands/update/agents.d.ts +14 -0
- package/dist/cli/commands/update/agents.js +31 -0
- package/dist/cli/commands/update/backup.d.ts +31 -0
- package/dist/cli/commands/update/backup.js +97 -0
- package/dist/cli/commands/update/commands.d.ts +14 -0
- package/dist/cli/commands/update/commands.js +75 -0
- package/dist/cli/commands/update/index.d.ts +15 -0
- package/dist/cli/commands/update/index.js +118 -0
- package/dist/cli/commands/update/knowledge-base.d.ts +14 -0
- package/dist/cli/commands/update/knowledge-base.js +38 -0
- package/dist/cli/commands/update/pre-flight.d.ts +13 -0
- package/dist/cli/commands/update/pre-flight.js +37 -0
- package/dist/cli/commands/update/summary.d.ts +20 -0
- package/dist/cli/commands/update/summary.js +47 -0
- package/dist/cli/commands/update/templates.d.ts +14 -0
- package/dist/cli/commands/update/templates.js +25 -0
- package/dist/cli/commands/update/types.d.ts +13 -0
- package/dist/cli/commands/update/types.js +7 -0
- package/dist/cli/commands/update/utils.d.ts +11 -0
- package/dist/cli/commands/update/utils.js +19 -0
- package/dist/cli/commands/update/verification.d.ts +20 -0
- package/dist/cli/commands/update/verification.js +54 -0
- package/dist/cli/commands/update/version.d.ts +18 -0
- package/dist/cli/commands/update/version.js +36 -0
- package/dist/cli/commands/update.d.ts +7 -0
- package/dist/cli/commands/update.js +7 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.js +36 -0
- package/dist/cli/types.d.ts +77 -0
- package/dist/cli/types.js +5 -0
- package/dist/cli/utils/deploy-ci.d.ts +22 -0
- package/dist/cli/utils/deploy-ci.js +138 -0
- package/dist/cli/utils/deploy-linting.d.ts +3 -0
- package/dist/cli/utils/deploy-linting.js +136 -0
- package/dist/cli/utils/detect-stack.d.ts +3 -0
- package/dist/cli/utils/detect-stack.js +270 -0
- package/dist/cli/utils/error-classes.d.ts +63 -0
- package/dist/cli/utils/error-classes.js +84 -0
- package/dist/cli/utils/error-handler.d.ts +59 -0
- package/dist/cli/utils/error-handler.js +127 -0
- package/dist/cli/utils/errors.d.ts +52 -0
- package/dist/cli/utils/errors.js +102 -0
- package/dist/cli/utils/get-sdk-path.d.ts +18 -0
- package/dist/cli/utils/get-sdk-path.js +31 -0
- package/dist/cli/utils/inject-dependencies.d.ts +2 -0
- package/dist/cli/utils/inject-dependencies.js +55 -0
- package/dist/cli/utils/linting-tools.d.ts +8 -0
- package/dist/cli/utils/linting-tools.js +206 -0
- package/dist/cli/utils/metrics/code-quality.d.ts +32 -0
- package/dist/cli/utils/metrics/code-quality.js +122 -0
- package/dist/cli/utils/metrics/dependency-parser.d.ts +21 -0
- package/dist/cli/utils/metrics/dependency-parser.js +153 -0
- package/dist/cli/utils/metrics/file-complexity.d.ts +26 -0
- package/dist/cli/utils/metrics/file-complexity.js +77 -0
- package/dist/cli/utils/metrics/framework-detector.d.ts +17 -0
- package/dist/cli/utils/metrics/framework-detector.js +120 -0
- package/dist/cli/utils/metrics/git-metrics.d.ts +30 -0
- package/dist/cli/utils/metrics/git-metrics.js +83 -0
- package/dist/cli/utils/metrics/index.d.ts +28 -0
- package/dist/cli/utils/metrics/index.js +100 -0
- package/dist/cli/utils/template-processor.d.ts +10 -0
- package/dist/cli/utils/template-processor.js +188 -0
- package/dist/cli/utils/validate-path.d.ts +80 -0
- package/dist/cli/utils/validate-path.js +180 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +8 -0
- package/dist/templates/agents/aj-team/apo-documentation-specialist.md.template +572 -0
- package/dist/templates/agents/aj-team/bas-quality-gate.md.template +906 -0
- package/dist/templates/agents/aj-team/bon-dependency-manager.md.template +636 -0
- package/dist/templates/agents/aj-team/cap-configuration-specialist.md.template +670 -0
- package/dist/templates/agents/aj-team/dra-code-reviewer.md.template +768 -0
- package/dist/templates/agents/aj-team/kil-task-executor.md.template +764 -0
- package/dist/templates/agents/aj-team/uro-refactoring-specialist.md.template +759 -0
- package/dist/templates/agents/audit/juno-auditor.md.template +447 -0
- package/dist/templates/agents/deployment/ein-cicd.md.template +694 -0
- package/dist/templates/agents/deployment/ino-context.md.template +733 -0
- package/dist/templates/agents/deployment/tan-structure.md.template +661 -0
- package/dist/templates/agents/deployment/zen-knowledge.md.template +451 -0
- package/dist/templates/agents/leadership/aj-cc.md.template +462 -0
- package/dist/templates/agents/leadership/aj-maestro.md.template +943 -0
- package/dist/templates/agents/leadership/aly-cto.md.template +407 -0
- package/dist/templates/agents/planning/eus-decomposer.md.template +496 -0
- package/dist/templates/agents/planning/mon-requirements.md.template +323 -0
- package/dist/templates/agents/planning/ror-design.md.template +465 -0
- package/dist/templates/agents/planning/tra-planner.md.template +432 -0
- package/dist/templates/ci/cd.yml.template +175 -0
- package/dist/templates/ci/ci.yml.template +196 -0
- package/dist/templates/ci/generic-ci.yml +115 -0
- package/dist/templates/ci/github-actions.yml +86 -0
- package/dist/templates/ci/gitlab-ci.yml +103 -0
- package/dist/templates/claude/EMPLOYEE-DIRECTORY.md.template +545 -0
- package/dist/templates/documentation/ROOT-README.md.template +307 -0
- package/dist/templates/documentation/SUBDIRECTORY-README.md.template +261 -0
- package/dist/templates/investigations/bug.md.template +484 -0
- package/dist/templates/investigations/feature.md.template +564 -0
- package/dist/templates/investigations/performance.md.template +625 -0
- package/dist/templates/investigations/security.md.template +714 -0
- package/dist/templates/investigations/technical.md.template +433 -0
- package/dist/templates/knowledge-base/AI-DEVELOPMENT-GUIDE.md.template +957 -0
- package/dist/templates/knowledge-base/ARCHITECTURE.md.template +452 -0
- package/dist/templates/knowledge-base/CODING-PRINCIPLES.md.template +750 -0
- package/dist/templates/knowledge-base/DOCUMENTATION-CRITERIA.md.template +1118 -0
- package/dist/templates/knowledge-base/ISSUES.md.template +539 -0
- package/dist/templates/knowledge-base/TESTING-PRINCIPLES.md.template +894 -0
- package/dist/templates/knowledge-base/Technical-Debt.md.template +640 -0
- package/dist/templates/knowledge-base/To-do.md.template +407 -0
- package/dist/templates/knowledge-base/Trinity.md.template +464 -0
- package/dist/templates/linting/flutter/.pre-commit-config.yaml.template +27 -0
- package/dist/templates/linting/flutter/analysis_options.yaml.template +26 -0
- package/dist/templates/linting/nodejs/.eslintrc-commonjs.json.template +19 -0
- package/dist/templates/linting/nodejs/.eslintrc-esm.json.template +19 -0
- package/dist/templates/linting/nodejs/.eslintrc-typescript.json.template +22 -0
- package/dist/templates/linting/nodejs/.pre-commit-config.yaml.template +51 -0
- package/dist/templates/linting/nodejs/.prettierrc.json.template +10 -0
- package/dist/templates/linting/python/.flake8.template +16 -0
- package/dist/templates/linting/python/.pre-commit-config.yaml.template +30 -0
- package/dist/templates/linting/python/pyproject.toml.template +38 -0
- package/dist/templates/linting/rust/.pre-commit-config.yaml.template +28 -0
- package/dist/templates/linting/rust/clippy.toml.template +14 -0
- package/dist/templates/linting/rust/rustfmt.toml.template +12 -0
- package/dist/templates/root/CLAUDE.md.template +65 -0
- package/dist/templates/root/TRINITY.md.template +52 -0
- package/dist/templates/shared/claude-commands/trinity-agents.md.template +168 -0
- package/dist/templates/shared/claude-commands/trinity-audit.md.template +646 -0
- package/dist/templates/shared/claude-commands/trinity-changelog.md.template +624 -0
- package/dist/templates/shared/claude-commands/trinity-continue.md.template +549 -0
- package/dist/templates/shared/claude-commands/trinity-create-investigation.md.template +232 -0
- package/dist/templates/shared/claude-commands/trinity-decompose.md.template +181 -0
- package/dist/templates/shared/claude-commands/trinity-design.md.template +347 -0
- package/dist/templates/shared/claude-commands/trinity-docs.md.template +2093 -0
- package/dist/templates/shared/claude-commands/trinity-end.md.template +397 -0
- package/dist/templates/shared/claude-commands/trinity-init.md.template +606 -0
- package/dist/templates/shared/claude-commands/trinity-investigate-templates.md.template +725 -0
- package/dist/templates/shared/claude-commands/trinity-orchestrate.md.template +1061 -0
- package/dist/templates/shared/claude-commands/trinity-plan-investigation.md.template +135 -0
- package/dist/templates/shared/claude-commands/trinity-plan.md.template +201 -0
- package/dist/templates/shared/claude-commands/trinity-readme.md.template +1971 -0
- package/dist/templates/shared/claude-commands/trinity-requirements.md.template +148 -0
- package/dist/templates/shared/claude-commands/trinity-start.md.template +268 -0
- package/dist/templates/shared/claude-commands/trinity-verify.md.template +453 -0
- package/dist/templates/shared/claude-commands/trinity-workorder.md.template +249 -0
- package/dist/templates/source/base-CLAUDE.md.template +310 -0
- package/dist/templates/source/flutter-CLAUDE.md.template +593 -0
- package/dist/templates/source/nodejs-CLAUDE.md.template +531 -0
- package/dist/templates/source/python-CLAUDE.md.template +510 -0
- package/dist/templates/source/react-CLAUDE.md.template +513 -0
- package/dist/templates/source/rust-CLAUDE.md.template +653 -0
- package/dist/templates/source/tests-CLAUDE.md.template +432 -0
- package/dist/templates/trinity/CLAUDE.md.template +372 -0
- package/dist/templates/work-orders/ANALYSIS-TEMPLATE.md.template +276 -0
- package/dist/templates/work-orders/AUDIT-TEMPLATE.md.template +262 -0
- package/dist/templates/work-orders/IMPLEMENTATION-TEMPLATE.md.template +260 -0
- package/dist/templates/work-orders/INVESTIGATION-TEMPLATE.md.template +206 -0
- package/dist/templates/work-orders/PATTERN-TEMPLATE.md.template +320 -0
- package/dist/templates/work-orders/VERIFICATION-TEMPLATE.md.template +273 -0
- package/package.json +94 -0
|
@@ -0,0 +1,1061 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Primary command for executing tasks with AJ MAESTRO orchestration
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Trinity Orchestration
|
|
6
|
+
|
|
7
|
+
**Purpose:** Primary command for executing tasks during development sessions. AJ MAESTRO coordinates the 19-agent team to complete work, with automatic JUNO verification.
|
|
8
|
+
|
|
9
|
+
**Use throughout your session:** This command is used repeatedly as you work through tasks.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Overview
|
|
14
|
+
|
|
15
|
+
`/trinity-orchestrate` is the **main execution command** in Trinity Method development. After you start a session with `/trinity-start` or `/trinity-continue`, you'll use this command repeatedly to execute work orders, perform investigations, and complete general tasks.
|
|
16
|
+
|
|
17
|
+
**Development Session Flow:**
|
|
18
|
+
```
|
|
19
|
+
/trinity-start or /trinity-continue
|
|
20
|
+
↓
|
|
21
|
+
/trinity-orchestrate (PRIMARY LOOP - used repeatedly)
|
|
22
|
+
↓
|
|
23
|
+
/trinity-end
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**A session = User actively working with Claude Code**
|
|
27
|
+
**A session ≠ Claude Code's context window** (documentation persists across context boundaries)
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Usage Patterns
|
|
32
|
+
|
|
33
|
+
### 1. Orchestrate Work Orders (Formal Tasks)
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
/trinity-orchestrate @WO-XXX-{task-name}.md
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**When to use:**
|
|
40
|
+
- Complex tasks requiring formal tracking
|
|
41
|
+
- Multi-step implementations
|
|
42
|
+
- Tasks spanning multiple context windows
|
|
43
|
+
- Work that needs quality verification
|
|
44
|
+
|
|
45
|
+
**Workflow:**
|
|
46
|
+
1. Create work order: `/trinity-workorder`
|
|
47
|
+
2. Work order saved to: `trinity/work-orders/WO-XXX-{task-name}.md`
|
|
48
|
+
3. Execute: `/trinity-orchestrate @WO-042-jwt-refresh.md`
|
|
49
|
+
4. **AJ MAESTRO** selects agents and orchestrates execution
|
|
50
|
+
5. **TWO DELIVERABLES CREATED:**
|
|
51
|
+
a. **Implementation Report** (from work order template):
|
|
52
|
+
`trinity/reports/[COMPONENT]-IMPLEMENTATION-COMPLETE-{timestamp}.md`
|
|
53
|
+
b. **JUNO Audit Report** (automatic verification):
|
|
54
|
+
`trinity/reports/AUDIT-WO-042-{date}.md`
|
|
55
|
+
6. 🚨 **CRITICAL: MOVE completed work order** from `trinity/work-orders/` to `trinity/sessions/`
|
|
56
|
+
- **MANDATORY STEP** - Execute: `mv trinity/work-orders/WO-XXX-*.md trinity/sessions/`
|
|
57
|
+
- **Verify work order NO LONGER exists in trinity/work-orders/**
|
|
58
|
+
7. **Reports remain** in `trinity/reports/` until session end
|
|
59
|
+
8. **Run `/trinity-end`** when session complete to archive all session files
|
|
60
|
+
|
|
61
|
+
**Example:**
|
|
62
|
+
```bash
|
|
63
|
+
/trinity-orchestrate @WO-042-jwt-refresh-implementation.md
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
### 2. Orchestrate Investigations (READ-ONLY Analysis)
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
/trinity-orchestrate @INV-XXX-{title}.md
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**When to use:**
|
|
75
|
+
- Bug analysis and root cause investigation
|
|
76
|
+
- Performance investigation
|
|
77
|
+
- Security audits
|
|
78
|
+
- Technical decision research
|
|
79
|
+
- Architecture review
|
|
80
|
+
|
|
81
|
+
**Workflow:**
|
|
82
|
+
1. Create investigation: `/trinity-create-investigation`
|
|
83
|
+
2. Investigation saved to: `trinity/investigations/INV-XXX-{title}.md`
|
|
84
|
+
3. Execute: `/trinity-orchestrate @INV-015-performance-analysis.md`
|
|
85
|
+
4. **AJ MAESTRO** coordinates READ-ONLY investigation
|
|
86
|
+
5. Findings documented (no code changes)
|
|
87
|
+
6. **Investigation Report Created:**
|
|
88
|
+
`trinity/reports/INV-015-findings-{date}.md`
|
|
89
|
+
(See investigation template for required sections)
|
|
90
|
+
7. 🚨 **CRITICAL: MOVE completed investigation** from `trinity/investigations/` to `trinity/sessions/`
|
|
91
|
+
- **MANDATORY STEP** - Execute: `mv trinity/investigations/INV-XXX-*.md trinity/sessions/`
|
|
92
|
+
- **Verify investigation NO LONGER exists in trinity/investigations/**
|
|
93
|
+
8. **Report remains** in `trinity/reports/` until session end
|
|
94
|
+
9. **Run `/trinity-end`** when session complete to archive all session files
|
|
95
|
+
|
|
96
|
+
⚠️ **CRITICAL:** Investigations are READ-ONLY operations. No code changes during investigation phase. Implementation happens separately after investigation is complete.
|
|
97
|
+
|
|
98
|
+
**Example:**
|
|
99
|
+
```bash
|
|
100
|
+
/trinity-orchestrate @INV-015-database-performance-analysis.md
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
### 3. Orchestrate General Tasks (Quick Tasks)
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
/trinity-orchestrate "Task description"
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**When to use:**
|
|
112
|
+
- Quick fixes without formal work order
|
|
113
|
+
- Simple bug fixes
|
|
114
|
+
- Documentation updates
|
|
115
|
+
- Configuration changes
|
|
116
|
+
- Exploratory work
|
|
117
|
+
|
|
118
|
+
**How it works:**
|
|
119
|
+
- AJ MAESTRO assesses task complexity
|
|
120
|
+
- Selects appropriate agents
|
|
121
|
+
- Executes with quality gates
|
|
122
|
+
- JUNO verifies completion
|
|
123
|
+
- No work order file needed
|
|
124
|
+
|
|
125
|
+
**Example:**
|
|
126
|
+
```bash
|
|
127
|
+
/trinity-orchestrate "Fix date validation bug in UserForm component"
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**When to create work order instead:**
|
|
131
|
+
- Task affects 3+ files
|
|
132
|
+
- Implementation will take >2 hours
|
|
133
|
+
- Need formal tracking across context windows
|
|
134
|
+
- Complex enough to need planning phases
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## AJ MAESTRO's Orchestration Process
|
|
139
|
+
|
|
140
|
+
When you invoke `/trinity-orchestrate`, here's what happens:
|
|
141
|
+
|
|
142
|
+
### Step 1: Task Analysis
|
|
143
|
+
|
|
144
|
+
**AJ MAESTRO reads and analyzes:**
|
|
145
|
+
- Work order file (if @WO-XXX provided)
|
|
146
|
+
- Investigation file (if @INV-XXX provided)
|
|
147
|
+
- Task description (if general task)
|
|
148
|
+
|
|
149
|
+
**Determines:**
|
|
150
|
+
- Task complexity and scope
|
|
151
|
+
- Required expertise areas
|
|
152
|
+
- Which agents are needed
|
|
153
|
+
- Quality gate requirements
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
### Step 2: Agent Selection
|
|
158
|
+
|
|
159
|
+
**AJ MAESTRO selects the best agent(s) for each phase:**
|
|
160
|
+
|
|
161
|
+
**Planning Agents:**
|
|
162
|
+
- **MON** - Requirements analysis, acceptance criteria, scale determination
|
|
163
|
+
- **ROR** - Technical design, function signatures, ADR documentation
|
|
164
|
+
- **TRA** - Strategic planning, task sequencing, timeline estimation
|
|
165
|
+
- **EUS** - Atomic task decomposition (1 task = 1 commit)
|
|
166
|
+
|
|
167
|
+
**Execution Agents:**
|
|
168
|
+
- **KIL** - TDD implementation (RED-GREEN-REFACTOR cycle)
|
|
169
|
+
- **BAS** - 6-phase quality gate validation
|
|
170
|
+
- **DRA** - Code review and Design Doc compliance verification
|
|
171
|
+
|
|
172
|
+
**Support Agents:**
|
|
173
|
+
- **APO** - API documentation and inline code comments
|
|
174
|
+
- **BON** - Dependency management and security scanning
|
|
175
|
+
- **CAP** - Configuration files and environment management
|
|
176
|
+
- **URO** - Code refactoring and technical debt reduction
|
|
177
|
+
|
|
178
|
+
**Audit Agent:**
|
|
179
|
+
- **JUNO** - Comprehensive quality audit and compliance verification
|
|
180
|
+
|
|
181
|
+
**Selection Criteria:**
|
|
182
|
+
- Small tasks (1-2 files): Direct to KIL + BAS
|
|
183
|
+
- Medium tasks (3-5 files): MON → ROR → TRA → KIL + BAS → DRA
|
|
184
|
+
- Large tasks (6+ files): Full agent workflow including EUS and JUNO
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
### Step 3: Coordinate Execution
|
|
189
|
+
|
|
190
|
+
**AJ MAESTRO manages the workflow:**
|
|
191
|
+
|
|
192
|
+
1. **Hands off to selected agent(s)**
|
|
193
|
+
- Provides full context from work order/investigation
|
|
194
|
+
- Ensures agent has all necessary information
|
|
195
|
+
- Monitors agent progress
|
|
196
|
+
|
|
197
|
+
2. **Manages agent transitions**
|
|
198
|
+
- Coordinates handoffs between agents
|
|
199
|
+
- Ensures context preservation
|
|
200
|
+
- Handles dependencies between phases
|
|
201
|
+
|
|
202
|
+
3. **Ensures quality gates are met**
|
|
203
|
+
- BAS validates after each commit
|
|
204
|
+
- DRA reviews before completion
|
|
205
|
+
- Escalates issues if quality standards not met
|
|
206
|
+
|
|
207
|
+
4. **Handles escalations**
|
|
208
|
+
- If complexity exceeds initial assessment
|
|
209
|
+
- If blockers are encountered
|
|
210
|
+
- If quality gates fail
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
### Step 4: JUNO Verification (Automatic)
|
|
215
|
+
|
|
216
|
+
**After task completion, JUNO automatically verifies:**
|
|
217
|
+
|
|
218
|
+
**Quality Criteria Checked:**
|
|
219
|
+
1. ✅ **BAS Quality Gates** - All 6 phases passed
|
|
220
|
+
- Linting, structure, build, tests, coverage (≥80%), best practices
|
|
221
|
+
|
|
222
|
+
2. ✅ **Work Order Objectives** - All objectives met
|
|
223
|
+
- Deliverables completed
|
|
224
|
+
- Acceptance criteria satisfied
|
|
225
|
+
|
|
226
|
+
3. ✅ **Test Coverage** - Tests passing with adequate coverage
|
|
227
|
+
- Unit tests for new code
|
|
228
|
+
- Integration tests where applicable
|
|
229
|
+
- Edge cases covered
|
|
230
|
+
|
|
231
|
+
4. ✅ **Documentation** - Updated appropriately
|
|
232
|
+
- Code comments (if needed)
|
|
233
|
+
- API documentation (if API changed)
|
|
234
|
+
- README updates (if user-facing)
|
|
235
|
+
|
|
236
|
+
5. ✅ **Design Doc Compliance** - Follows design (if applicable)
|
|
237
|
+
- Function signatures match design
|
|
238
|
+
- Architecture decisions followed
|
|
239
|
+
- Compliance score ≥70%
|
|
240
|
+
|
|
241
|
+
6. ✅ **Technical Debt** - No new debt introduced
|
|
242
|
+
- No TODOs without tickets
|
|
243
|
+
- No code duplication
|
|
244
|
+
- Complexity within limits
|
|
245
|
+
|
|
246
|
+
**JUNO's Audit Report:**
|
|
247
|
+
- Saved to: `trinity/reports/AUDIT-{task-id}-{date}.md`
|
|
248
|
+
- Pass/Fail status for each criterion
|
|
249
|
+
- Overall assessment (APPROVED / REQUIRES FIXES)
|
|
250
|
+
- Recommendations for improvements
|
|
251
|
+
- Follow-up work orders (if issues found)
|
|
252
|
+
|
|
253
|
+
**What You See:**
|
|
254
|
+
```
|
|
255
|
+
JUNO: Audit complete ✅
|
|
256
|
+
- BAS gates: PASS ✅
|
|
257
|
+
- Test coverage: 92% ✅ (exceeds 80% threshold)
|
|
258
|
+
- Design Doc compliance: 85% ✅
|
|
259
|
+
- Technical debt: 0 new issues ✅
|
|
260
|
+
- Overall: APPROVED ✅
|
|
261
|
+
|
|
262
|
+
Task WO-042-jwt-refresh-implementation is complete and verified.
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
**If Issues Found:**
|
|
266
|
+
```
|
|
267
|
+
JUNO: Audit complete ⚠️
|
|
268
|
+
- BAS gates: PASS ✅
|
|
269
|
+
- Test coverage: 68% ❌ (below 80% threshold)
|
|
270
|
+
- Design Doc compliance: 75% ✅
|
|
271
|
+
- Overall: REQUIRES FIXES ⚠️
|
|
272
|
+
|
|
273
|
+
Recommendation: Add tests for error handling edge cases
|
|
274
|
+
Created follow-up: WO-043-jwt-test-coverage
|
|
275
|
+
|
|
276
|
+
Please address WO-043 before marking WO-042 complete.
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
### Step 5: Report to User
|
|
282
|
+
|
|
283
|
+
**AJ MAESTRO provides completion summary:**
|
|
284
|
+
- Work completed overview
|
|
285
|
+
- JUNO audit results (PASS/FAIL)
|
|
286
|
+
- Files changed and commits made
|
|
287
|
+
- Follow-up recommendations (if any)
|
|
288
|
+
- Next steps or follow-up work orders
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
## Session Workflow Context
|
|
293
|
+
|
|
294
|
+
### Development Session Lifecycle
|
|
295
|
+
|
|
296
|
+
**A development session:**
|
|
297
|
+
- Starts when user begins working (via `/trinity-start` or `/trinity-continue`)
|
|
298
|
+
- Continues with repeated `/trinity-orchestrate` invocations
|
|
299
|
+
- Ends when user finishes working (via `/trinity-end`)
|
|
300
|
+
- Is NOT tied to Claude Code's context window
|
|
301
|
+
|
|
302
|
+
```
|
|
303
|
+
┌─────────────────────────────────────────────────────┐
|
|
304
|
+
│ TRINITY DEVELOPMENT SESSION │
|
|
305
|
+
└─────────────────────────────────────────────────────┘
|
|
306
|
+
|
|
307
|
+
1. START SESSION
|
|
308
|
+
├─ /trinity-start (new session - includes workflow planning)
|
|
309
|
+
└─ OR /trinity-continue (resume interrupted session)
|
|
310
|
+
|
|
311
|
+
2. EXECUTE TASKS (PRIMARY LOOP) ← MOST OF YOUR TIME
|
|
312
|
+
│
|
|
313
|
+
├─ /trinity-orchestrate @WO-042.md
|
|
314
|
+
│ └─ AJ MAESTRO → Agents → JUNO → Report
|
|
315
|
+
│
|
|
316
|
+
├─ /trinity-orchestrate @INV-015.md
|
|
317
|
+
│ └─ AJ MAESTRO → Investigation → JUNO → Findings
|
|
318
|
+
│
|
|
319
|
+
├─ /trinity-orchestrate "Quick fix"
|
|
320
|
+
│ └─ AJ MAESTRO → Quick execution → JUNO → Done
|
|
321
|
+
│
|
|
322
|
+
└─ Repeat as needed throughout your session
|
|
323
|
+
|
|
324
|
+
3. END SESSION
|
|
325
|
+
└─ /trinity-end
|
|
326
|
+
├─ Archive completed work
|
|
327
|
+
├─ Update knowledge base
|
|
328
|
+
└─ Create session summary
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
---
|
|
332
|
+
|
|
333
|
+
## ⚠️ CRITICAL: After Task Completion Workflow - MANDATORY STEPS
|
|
334
|
+
|
|
335
|
+
### 🚨 When You've Completed a Work Order or Investigation - DO NOT SKIP 🚨
|
|
336
|
+
|
|
337
|
+
**Step 1: Verify Deliverables Created** ✅
|
|
338
|
+
|
|
339
|
+
**Work Orders:**
|
|
340
|
+
- [ ] Implementation report in `trinity/reports/[COMPONENT]-IMPLEMENTATION-COMPLETE-{timestamp}.md`
|
|
341
|
+
- [ ] JUNO audit report in `trinity/reports/AUDIT-WO-XXX-{date}.md` (if applicable)
|
|
342
|
+
|
|
343
|
+
**Investigations:**
|
|
344
|
+
- [ ] Findings report in `trinity/reports/INV-XXX-findings-{date}.md`
|
|
345
|
+
- [ ] All required sections completed (summary, findings, root cause, recommendations, evidence)
|
|
346
|
+
|
|
347
|
+
**Step 2: 🚨 MOVE THE COMPLETED FILE TO SESSIONS/ 🚨** ✅
|
|
348
|
+
|
|
349
|
+
**THIS STEP IS MANDATORY - Work orders left in trinity/work-orders/ are considered INCOMPLETE.**
|
|
350
|
+
|
|
351
|
+
```bash
|
|
352
|
+
# Work Order Example - EXECUTE THIS IMMEDIATELY AFTER CREATING DELIVERABLE
|
|
353
|
+
mv trinity/work-orders/WO-042-jwt-refresh.md trinity/sessions/
|
|
354
|
+
|
|
355
|
+
# Investigation Example - EXECUTE THIS IMMEDIATELY AFTER CREATING FINDINGS REPORT
|
|
356
|
+
mv trinity/investigations/INV-015-performance-analysis.md trinity/sessions/
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
**Step 3: Verify File Locations** ✅
|
|
360
|
+
|
|
361
|
+
**CRITICAL VERIFICATION - If this fails, the task is NOT complete:**
|
|
362
|
+
|
|
363
|
+
**For Work Orders:**
|
|
364
|
+
- [ ] Work order file NOW EXISTS in: `trinity/sessions/WO-XXX-*.md`
|
|
365
|
+
- [ ] Deliverable report exists in: `trinity/reports/[COMPONENT]-IMPLEMENTATION-COMPLETE-*.md`
|
|
366
|
+
- [ ] Work order file NO LONGER EXISTS in: `trinity/work-orders/`
|
|
367
|
+
|
|
368
|
+
**For Investigations:**
|
|
369
|
+
- [ ] Investigation file NOW EXISTS in: `trinity/sessions/INV-XXX-*.md`
|
|
370
|
+
- [ ] Findings report exists in: `trinity/reports/INV-XXX-findings-*.md`
|
|
371
|
+
- [ ] Investigation file NO LONGER EXISTS in: `trinity/investigations/`
|
|
372
|
+
|
|
373
|
+
**If any verification fails, STOP and fix immediately before proceeding.**
|
|
374
|
+
|
|
375
|
+
**Step 4: Continue Working or End Session**
|
|
376
|
+
|
|
377
|
+
**If continuing work in same session:**
|
|
378
|
+
- Reports remain in `trinity/reports/` (available for reference)
|
|
379
|
+
- Completed WOs/INVs in `trinity/sessions/` (out of active work queue)
|
|
380
|
+
- Proceed with next task
|
|
381
|
+
|
|
382
|
+
**If session is complete:**
|
|
383
|
+
```bash
|
|
384
|
+
/trinity-end
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
This will:
|
|
388
|
+
- Archive ALL files from `trinity/sessions/` → `trinity/archive/sessions/YYYY-MM-DD/`
|
|
389
|
+
- Archive ALL files from `trinity/reports/` → `trinity/archive/reports/YYYY-MM-DD/`
|
|
390
|
+
- Archive completed work orders → `trinity/archive/work-orders/YYYY-MM-DD/`
|
|
391
|
+
- Archive completed investigations → `trinity/archive/investigations/YYYY-MM-DD/`
|
|
392
|
+
- Create session summary in `trinity/archive/sessions/YYYY-MM-DD/`
|
|
393
|
+
- **Result:** Clean `trinity/sessions/` and `trinity/reports/` folders for next session
|
|
394
|
+
|
|
395
|
+
---
|
|
396
|
+
|
|
397
|
+
## Session File Organization
|
|
398
|
+
|
|
399
|
+
**Active Session:**
|
|
400
|
+
```
|
|
401
|
+
trinity/
|
|
402
|
+
├── work-orders/ # Active work orders (not yet completed)
|
|
403
|
+
├── investigations/ # Active investigations (not yet completed)
|
|
404
|
+
├── sessions/ # Completed WOs/INVs (awaiting archival)
|
|
405
|
+
├── reports/ # All session reports (awaiting archival)
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
**After /trinity-end:**
|
|
409
|
+
```
|
|
410
|
+
trinity/
|
|
411
|
+
├── work-orders/ # EMPTY (all active work complete or in-progress only)
|
|
412
|
+
├── investigations/ # EMPTY (all active investigations complete or in-progress only)
|
|
413
|
+
├── sessions/ # EMPTY (all archived)
|
|
414
|
+
├── reports/ # EMPTY (all archived)
|
|
415
|
+
├── archive/
|
|
416
|
+
│ ├── work-orders/YYYY-MM-DD/ # Completed work orders
|
|
417
|
+
│ ├── investigations/YYYY-MM-DD/ # Completed investigations
|
|
418
|
+
│ ├── reports/YYYY-MM-DD/ # All session reports
|
|
419
|
+
│ └── sessions/YYYY-MM-DD/ # Session summaries
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
**Clean Slate:** Every new session starts with empty sessions/ and reports/ folders.
|
|
423
|
+
|
|
424
|
+
---
|
|
425
|
+
|
|
426
|
+
### Context Window Management
|
|
427
|
+
|
|
428
|
+
**Key Understanding:**
|
|
429
|
+
- **Session** = You working at the computer
|
|
430
|
+
- **Context Window** = Claude Code's current memory limit
|
|
431
|
+
- **Sessions can span multiple context windows**
|
|
432
|
+
|
|
433
|
+
**How Trinity Handles Context Loss:**
|
|
434
|
+
|
|
435
|
+
1. **Documentation Persists:**
|
|
436
|
+
- Work orders: `trinity/work-orders/WO-XXX.md`
|
|
437
|
+
- Investigations: `trinity/investigations/INV-XXX.md`
|
|
438
|
+
- JUNO reports: `trinity/reports/AUDIT-*.md`
|
|
439
|
+
- Knowledge base: `trinity/knowledge-base/*.md`
|
|
440
|
+
|
|
441
|
+
2. **When Context Window Is Exceeded:**
|
|
442
|
+
- Current work is automatically documented
|
|
443
|
+
- Session state saved to `trinity/sessions/SESSION-{timestamp}.md`
|
|
444
|
+
- Use `/trinity-continue` to resume
|
|
445
|
+
- AJ MAESTRO reads files to understand current state
|
|
446
|
+
- JUNO reports show what's been completed
|
|
447
|
+
- Work continues seamlessly
|
|
448
|
+
|
|
449
|
+
3. **Recovery Process (`/trinity-continue`):**
|
|
450
|
+
- ALY (CTO) analyzes current state from files
|
|
451
|
+
- Reviews work orders, investigations, reports
|
|
452
|
+
- Provides session summary
|
|
453
|
+
- Recommends how to proceed
|
|
454
|
+
- Hands off to AJ MAESTRO to continue
|
|
455
|
+
|
|
456
|
+
**Example:**
|
|
457
|
+
```
|
|
458
|
+
[Context window limit approaching during WO-042]
|
|
459
|
+
|
|
460
|
+
System: Context window at 95%. Documenting current state...
|
|
461
|
+
[Saves progress to work order file and session log]
|
|
462
|
+
|
|
463
|
+
[User starts new context window]
|
|
464
|
+
|
|
465
|
+
User: /trinity-continue
|
|
466
|
+
|
|
467
|
+
ALY: Analyzing session state...
|
|
468
|
+
- Work Order: WO-042 (50% complete, 3/6 tasks done)
|
|
469
|
+
- Last activity: Implementing middleware (Task 3)
|
|
470
|
+
- Uncommitted changes: src/middleware/auth.middleware.ts
|
|
471
|
+
|
|
472
|
+
Recommendation: Resume with AJ MAESTRO to complete WO-042.
|
|
473
|
+
|
|
474
|
+
Shall I hand off to AJ MAESTRO to continue?
|
|
475
|
+
|
|
476
|
+
User: Yes
|
|
477
|
+
|
|
478
|
+
AJ MAESTRO: Resuming WO-042... Reading current state...
|
|
479
|
+
[Continues from Task 4]
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
---
|
|
483
|
+
|
|
484
|
+
## Real-World Examples
|
|
485
|
+
|
|
486
|
+
### Example 1: Work Order Execution
|
|
487
|
+
|
|
488
|
+
```
|
|
489
|
+
User: /trinity-orchestrate @WO-042-jwt-refresh-implementation.md
|
|
490
|
+
|
|
491
|
+
AJ MAESTRO: Reading work order WO-042...
|
|
492
|
+
|
|
493
|
+
**Analysis:**
|
|
494
|
+
- Task: JWT token refresh implementation
|
|
495
|
+
- Complexity: MEDIUM (4 files affected)
|
|
496
|
+
- Estimated time: 4-6 hours
|
|
497
|
+
- Agents needed: MON → ROR → TRA → KIL + BAS → DRA → JUNO
|
|
498
|
+
|
|
499
|
+
**Execution Plan:**
|
|
500
|
+
1. Requirements analysis (MON)
|
|
501
|
+
2. Technical design (ROR)
|
|
502
|
+
3. Implementation planning (TRA)
|
|
503
|
+
4. TDD implementation (KIL + BAS)
|
|
504
|
+
5. Code review (DRA)
|
|
505
|
+
6. Final audit (JUNO)
|
|
506
|
+
|
|
507
|
+
Proceeding...
|
|
508
|
+
|
|
509
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
510
|
+
|
|
511
|
+
**Phase 1: Requirements (MON)**
|
|
512
|
+
|
|
513
|
+
MON: Analyzing work order requirements...
|
|
514
|
+
|
|
515
|
+
✅ Functional Requirements:
|
|
516
|
+
- Automatic token refresh on expiry
|
|
517
|
+
- HttpOnly cookie storage
|
|
518
|
+
- Race condition handling
|
|
519
|
+
|
|
520
|
+
✅ Acceptance Criteria:
|
|
521
|
+
- Given: User has expired token
|
|
522
|
+
- When: Authenticated request is made
|
|
523
|
+
- Then: Token refreshes automatically without user action
|
|
524
|
+
|
|
525
|
+
✅ Risks Identified:
|
|
526
|
+
- Race conditions with concurrent requests
|
|
527
|
+
- Token theft if not properly secured
|
|
528
|
+
|
|
529
|
+
Requirements analysis complete.
|
|
530
|
+
|
|
531
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
532
|
+
|
|
533
|
+
**Phase 2: Technical Design (ROR)**
|
|
534
|
+
|
|
535
|
+
ROR: Creating technical design...
|
|
536
|
+
|
|
537
|
+
✅ Function Signatures:
|
|
538
|
+
```typescript
|
|
539
|
+
interface RefreshTokenOptions {
|
|
540
|
+
expiryBuffer: number; // milliseconds before expiry to refresh
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
async refreshToken(userId: string, options: RefreshTokenOptions): Promise<TokenPair>
|
|
544
|
+
async validateAndRefreshIfNeeded(token: string): Promise<TokenPair | null>
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
✅ Architecture Decision Record (ADR):
|
|
548
|
+
- Decision: Use HTTP-only cookies for refresh tokens
|
|
549
|
+
- Rationale: Prevents XSS attacks, more secure than localStorage
|
|
550
|
+
- Trade-offs: Slightly more complex server-side management
|
|
551
|
+
|
|
552
|
+
Design complete. Design Doc compliance criteria: ≥70%
|
|
553
|
+
|
|
554
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
555
|
+
|
|
556
|
+
**Phase 3: Implementation Planning (TRA)**
|
|
557
|
+
|
|
558
|
+
TRA: Creating implementation plan...
|
|
559
|
+
|
|
560
|
+
✅ Task Breakdown:
|
|
561
|
+
1. Create token refresh service
|
|
562
|
+
2. Implement refresh middleware
|
|
563
|
+
3. Add token validation logic
|
|
564
|
+
4. Handle race conditions (mutex)
|
|
565
|
+
5. Add error handling
|
|
566
|
+
6. Write unit tests
|
|
567
|
+
7. Write integration tests
|
|
568
|
+
8. Update API documentation
|
|
569
|
+
|
|
570
|
+
Sequencing: Tasks 1-2 must complete before 3-4 (dependencies)
|
|
571
|
+
Tasks 6-7 can run in parallel (independent)
|
|
572
|
+
|
|
573
|
+
Estimated time: 4-6 hours (with 20% parallelization savings)
|
|
574
|
+
|
|
575
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
576
|
+
|
|
577
|
+
**Phase 4: Implementation (KIL + BAS)**
|
|
578
|
+
|
|
579
|
+
KIL: Beginning TDD implementation...
|
|
580
|
+
|
|
581
|
+
**Task 1/8: Create token refresh service**
|
|
582
|
+
|
|
583
|
+
RED: Writing failing test...
|
|
584
|
+
```typescript
|
|
585
|
+
describe('TokenRefreshService', () => {
|
|
586
|
+
it('should refresh token before expiry', async () => {
|
|
587
|
+
// Test implementation
|
|
588
|
+
});
|
|
589
|
+
});
|
|
590
|
+
```
|
|
591
|
+
❌ Test fails (expected - no implementation yet)
|
|
592
|
+
|
|
593
|
+
GREEN: Implementing minimal code...
|
|
594
|
+
```typescript
|
|
595
|
+
class TokenRefreshService {
|
|
596
|
+
async refreshToken(userId: string, options: RefreshTokenOptions) {
|
|
597
|
+
// Implementation
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
```
|
|
601
|
+
✅ Test passes
|
|
602
|
+
|
|
603
|
+
REFACTOR: Cleaning up...
|
|
604
|
+
✅ Code optimized
|
|
605
|
+
|
|
606
|
+
**BAS Quality Gates:**
|
|
607
|
+
1. Linting: PASS ✅ (auto-fixed 2 formatting issues)
|
|
608
|
+
2. Structure: PASS ✅
|
|
609
|
+
3. Build: PASS ✅
|
|
610
|
+
4. Testing: PASS ✅ (1/1 tests passing)
|
|
611
|
+
5. Coverage: 95% ✅ (exceeds 80%)
|
|
612
|
+
6. Best Practices: PASS ✅
|
|
613
|
+
|
|
614
|
+
✅ Commit: "feat(auth): add token refresh service"
|
|
615
|
+
|
|
616
|
+
[Continues for Tasks 2-8...]
|
|
617
|
+
|
|
618
|
+
**Task 8/8: Update API documentation**
|
|
619
|
+
✅ API docs updated
|
|
620
|
+
✅ BAS gates: ALL PASS
|
|
621
|
+
✅ Commit: "docs(auth): document token refresh endpoints"
|
|
622
|
+
|
|
623
|
+
Implementation complete: 7 commits, all tests passing
|
|
624
|
+
|
|
625
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
626
|
+
|
|
627
|
+
**Phase 5: Code Review (DRA)**
|
|
628
|
+
|
|
629
|
+
DRA: Reviewing implementation...
|
|
630
|
+
|
|
631
|
+
✅ Design Doc Compliance Check:
|
|
632
|
+
- Function signatures match design: ✅
|
|
633
|
+
- Error handling strategy followed: ✅
|
|
634
|
+
- ADR decisions implemented: ✅
|
|
635
|
+
- Compliance score: 85% ✅ (exceeds 70% threshold)
|
|
636
|
+
|
|
637
|
+
✅ Code Quality:
|
|
638
|
+
- No code duplication: ✅
|
|
639
|
+
- Function complexity within limits: ✅
|
|
640
|
+
- Test coverage: 92% ✅
|
|
641
|
+
- Documentation complete: ✅
|
|
642
|
+
|
|
643
|
+
Code review: APPROVED ✅
|
|
644
|
+
|
|
645
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
646
|
+
|
|
647
|
+
**Phase 6: Final Audit (JUNO)**
|
|
648
|
+
|
|
649
|
+
JUNO: Performing comprehensive audit...
|
|
650
|
+
|
|
651
|
+
**Quality Verification:**
|
|
652
|
+
1. BAS Quality Gates: PASS ✅
|
|
653
|
+
- All 6 phases passed on every commit
|
|
654
|
+
|
|
655
|
+
2. Work Order Objectives: COMPLETE ✅
|
|
656
|
+
- All deliverables provided
|
|
657
|
+
- All acceptance criteria met
|
|
658
|
+
|
|
659
|
+
3. Test Coverage: 92% ✅
|
|
660
|
+
- Exceeds 80% threshold
|
|
661
|
+
- Edge cases covered
|
|
662
|
+
- Integration tests comprehensive
|
|
663
|
+
|
|
664
|
+
4. Documentation: COMPLETE ✅
|
|
665
|
+
- API docs updated
|
|
666
|
+
- Inline comments added
|
|
667
|
+
- README unchanged (not needed)
|
|
668
|
+
|
|
669
|
+
5. Design Doc Compliance: 85% ✅
|
|
670
|
+
- Exceeds 70% threshold
|
|
671
|
+
- All ADR decisions followed
|
|
672
|
+
|
|
673
|
+
6. Technical Debt: 0 NEW ISSUES ✅
|
|
674
|
+
- No TODOs without tickets
|
|
675
|
+
- No code duplication introduced
|
|
676
|
+
- Complexity within limits
|
|
677
|
+
|
|
678
|
+
**Overall Assessment: APPROVED ✅**
|
|
679
|
+
|
|
680
|
+
Audit report saved to:
|
|
681
|
+
`trinity/reports/AUDIT-WO-042-2025-12-19.md`
|
|
682
|
+
|
|
683
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
684
|
+
|
|
685
|
+
**AJ MAESTRO: Task Complete**
|
|
686
|
+
|
|
687
|
+
✅ Work Order: WO-042-jwt-refresh-implementation
|
|
688
|
+
✅ Status: COMPLETE AND VERIFIED
|
|
689
|
+
✅ Commits: 7 commits
|
|
690
|
+
✅ Files Changed: 4 files (auth.service.ts, auth.middleware.ts, auth.types.ts, auth.test.ts)
|
|
691
|
+
✅ Test Coverage: 92%
|
|
692
|
+
✅ JUNO Audit: APPROVED
|
|
693
|
+
|
|
694
|
+
**Next Steps:**
|
|
695
|
+
- Deploy to staging environment for testing
|
|
696
|
+
- Monitor for edge cases in production
|
|
697
|
+
- OR continue with next task: /trinity-orchestrate @WO-043.md
|
|
698
|
+
```
|
|
699
|
+
|
|
700
|
+
---
|
|
701
|
+
|
|
702
|
+
### Example 2: Investigation Execution
|
|
703
|
+
|
|
704
|
+
```
|
|
705
|
+
User: /trinity-orchestrate @INV-015-database-performance-analysis.md
|
|
706
|
+
|
|
707
|
+
AJ MAESTRO: Reading investigation INV-015...
|
|
708
|
+
|
|
709
|
+
**Analysis:**
|
|
710
|
+
- Type: Performance Investigation (READ-ONLY)
|
|
711
|
+
- Scope: Database query performance degradation
|
|
712
|
+
- Evidence: API response time increased 300%
|
|
713
|
+
- Agents needed: Investigation workflow (READ-ONLY mode)
|
|
714
|
+
|
|
715
|
+
⚠️ **Investigation Mode:** No code changes will be made.
|
|
716
|
+
|
|
717
|
+
Proceeding with investigation...
|
|
718
|
+
|
|
719
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
720
|
+
|
|
721
|
+
**Phase 1: Data Collection**
|
|
722
|
+
|
|
723
|
+
Collecting performance metrics...
|
|
724
|
+
✅ APM traces collected (last 7 days)
|
|
725
|
+
✅ Database slow query log analyzed
|
|
726
|
+
✅ Query execution plans captured
|
|
727
|
+
✅ Resource utilization metrics gathered
|
|
728
|
+
|
|
729
|
+
**Key Findings:**
|
|
730
|
+
- Average query time: 2.3s (was 0.5s)
|
|
731
|
+
- Slowest query: getUserOrders (5.2s average)
|
|
732
|
+
- Execution count: 500+ queries per page load
|
|
733
|
+
|
|
734
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
735
|
+
|
|
736
|
+
**Phase 2: Analysis**
|
|
737
|
+
|
|
738
|
+
Analyzing query patterns...
|
|
739
|
+
|
|
740
|
+
**Root Cause Identified:**
|
|
741
|
+
❌ **N+1 Query Pattern in getUserOrders**
|
|
742
|
+
|
|
743
|
+
```sql
|
|
744
|
+
-- Main query (executed once)
|
|
745
|
+
SELECT * FROM orders WHERE user_id = 123;
|
|
746
|
+
|
|
747
|
+
-- N+1 queries (executed 500 times!)
|
|
748
|
+
SELECT * FROM users WHERE id = ?; -- For each order
|
|
749
|
+
```
|
|
750
|
+
|
|
751
|
+
**Missing Indexes Found:**
|
|
752
|
+
❌ No index on `orders.user_id`
|
|
753
|
+
❌ No index on `user_metadata.user_id`
|
|
754
|
+
❌ No compound index on `orders(user_id, created_at)`
|
|
755
|
+
|
|
756
|
+
**Performance Impact:**
|
|
757
|
+
- Full table scans on 100k+ row tables
|
|
758
|
+
- 500+ individual queries instead of 1 JOIN
|
|
759
|
+
- No query result caching
|
|
760
|
+
|
|
761
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
762
|
+
|
|
763
|
+
**Phase 3: Recommendations**
|
|
764
|
+
|
|
765
|
+
**Recommendation 1: Add Database Indexes**
|
|
766
|
+
Priority: HIGH
|
|
767
|
+
Estimated effort: 2 hours
|
|
768
|
+
Expected improvement: 60-70% reduction in query time
|
|
769
|
+
|
|
770
|
+
```sql
|
|
771
|
+
CREATE INDEX idx_orders_user_id ON orders(user_id);
|
|
772
|
+
CREATE INDEX idx_user_metadata_user_id ON user_metadata(user_id);
|
|
773
|
+
CREATE INDEX idx_orders_user_created ON orders(user_id, created_at);
|
|
774
|
+
```
|
|
775
|
+
|
|
776
|
+
**Recommendation 2: Fix N+1 Query Pattern**
|
|
777
|
+
Priority: HIGH
|
|
778
|
+
Estimated effort: 3 hours
|
|
779
|
+
Expected improvement: 80% reduction in query count
|
|
780
|
+
|
|
781
|
+
```typescript
|
|
782
|
+
// Current (N+1 queries)
|
|
783
|
+
const orders = await Order.findAll({ where: { userId } });
|
|
784
|
+
for (const order of orders) {
|
|
785
|
+
order.user = await User.findByPk(order.userId); // N queries!
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
// Fixed (1 query with JOIN)
|
|
789
|
+
const orders = await Order.findAll({
|
|
790
|
+
where: { userId },
|
|
791
|
+
include: [{ model: User }] // Eager loading
|
|
792
|
+
});
|
|
793
|
+
```
|
|
794
|
+
|
|
795
|
+
**Recommendation 3: Implement Query Result Caching**
|
|
796
|
+
Priority: MEDIUM
|
|
797
|
+
Estimated effort: 4 hours
|
|
798
|
+
Expected improvement: Additional 40% improvement for repeated queries
|
|
799
|
+
|
|
800
|
+
```typescript
|
|
801
|
+
const cacheKey = `user_orders_${userId}`;
|
|
802
|
+
const cached = await redis.get(cacheKey);
|
|
803
|
+
if (cached) return JSON.parse(cached);
|
|
804
|
+
|
|
805
|
+
const orders = await getOrdersWithUsers(userId);
|
|
806
|
+
await redis.set(cacheKey, JSON.stringify(orders), 'EX', 300); // 5 min TTL
|
|
807
|
+
```
|
|
808
|
+
|
|
809
|
+
**Total Expected Improvement:**
|
|
810
|
+
- Query time: 2.3s → 0.4s (83% improvement)
|
|
811
|
+
- Query count: 500+ → 1 (99.8% reduction)
|
|
812
|
+
- API response time: Within target (<500ms)
|
|
813
|
+
|
|
814
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
815
|
+
|
|
816
|
+
**Phase 4: JUNO Audit**
|
|
817
|
+
|
|
818
|
+
JUNO: Auditing investigation completeness...
|
|
819
|
+
|
|
820
|
+
**Investigation Quality Check:**
|
|
821
|
+
1. Problem Statement: CLEAR ✅
|
|
822
|
+
2. Data Collection: COMPREHENSIVE ✅
|
|
823
|
+
3. Root Cause Analysis: EVIDENCE-BASED ✅
|
|
824
|
+
4. Recommendations: ACTIONABLE ✅
|
|
825
|
+
5. Effort Estimates: PROVIDED ✅
|
|
826
|
+
6. Expected Impact: QUANTIFIED ✅
|
|
827
|
+
|
|
828
|
+
**Overall: INVESTIGATION COMPLETE ✅**
|
|
829
|
+
|
|
830
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
831
|
+
|
|
832
|
+
**AJ MAESTRO: Investigation Complete**
|
|
833
|
+
|
|
834
|
+
✅ Investigation: INV-015-database-performance-analysis
|
|
835
|
+
✅ Status: COMPLETE AND VERIFIED
|
|
836
|
+
✅ Root Cause: N+1 queries + missing indexes
|
|
837
|
+
✅ Recommendations: 3 actionable items with effort estimates
|
|
838
|
+
|
|
839
|
+
**Findings Report:**
|
|
840
|
+
`trinity/reports/INV-015-findings-2025-12-19.md`
|
|
841
|
+
|
|
842
|
+
**Follow-Up Work Orders Created:**
|
|
843
|
+
- WO-043-database-index-optimization (HIGH priority, 2 hours)
|
|
844
|
+
- WO-044-fix-n-plus-one-queries (HIGH priority, 3 hours)
|
|
845
|
+
- WO-045-implement-query-caching (MEDIUM priority, 4 hours)
|
|
846
|
+
|
|
847
|
+
**Next Steps:**
|
|
848
|
+
1. Review findings report
|
|
849
|
+
2. Approve work orders for implementation
|
|
850
|
+
3. Execute with: /trinity-orchestrate @WO-043.md
|
|
851
|
+
```
|
|
852
|
+
|
|
853
|
+
---
|
|
854
|
+
|
|
855
|
+
### Example 3: Quick Task (No Work Order)
|
|
856
|
+
|
|
857
|
+
```
|
|
858
|
+
User: /trinity-orchestrate "Fix date validation bug in UserForm component"
|
|
859
|
+
|
|
860
|
+
AJ MAESTRO: Analyzing task...
|
|
861
|
+
|
|
862
|
+
**Assessment:**
|
|
863
|
+
- Type: Bug fix
|
|
864
|
+
- Complexity: SMALL (1 file)
|
|
865
|
+
- Estimated time: <1 hour
|
|
866
|
+
- Approach: Direct implementation with BAS gates
|
|
867
|
+
|
|
868
|
+
I'll handle this without a formal work order.
|
|
869
|
+
|
|
870
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
871
|
+
|
|
872
|
+
**Phase 1: Analysis**
|
|
873
|
+
|
|
874
|
+
Reviewing UserForm component...
|
|
875
|
+
|
|
876
|
+
**Bug Identified:**
|
|
877
|
+
❌ Date validation accepts invalid formats (e.g., "13/32/2025")
|
|
878
|
+
❌ No edge case handling for leap years
|
|
879
|
+
❌ Missing test coverage for date validation
|
|
880
|
+
|
|
881
|
+
**Fix Required:**
|
|
882
|
+
- Add proper date format validation
|
|
883
|
+
- Handle edge cases (leap years, invalid dates)
|
|
884
|
+
- Write comprehensive tests
|
|
885
|
+
|
|
886
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
887
|
+
|
|
888
|
+
**Phase 2: Implementation (TDD)**
|
|
889
|
+
|
|
890
|
+
**RED: Write failing tests**
|
|
891
|
+
```typescript
|
|
892
|
+
describe('UserForm date validation', () => {
|
|
893
|
+
it('should reject invalid date formats', () => {
|
|
894
|
+
expect(validateDate('13/32/2025')).toBe(false);
|
|
895
|
+
});
|
|
896
|
+
|
|
897
|
+
it('should handle leap years correctly', () => {
|
|
898
|
+
expect(validateDate('02/29/2024')).toBe(true); // Leap year
|
|
899
|
+
expect(validateDate('02/29/2023')).toBe(false); // Not leap year
|
|
900
|
+
});
|
|
901
|
+
});
|
|
902
|
+
```
|
|
903
|
+
❌ Tests fail (expected - no validation yet)
|
|
904
|
+
|
|
905
|
+
**GREEN: Implement fix**
|
|
906
|
+
```typescript
|
|
907
|
+
function validateDate(dateStr: string): boolean {
|
|
908
|
+
const date = new Date(dateStr);
|
|
909
|
+
return date instanceof Date && !isNaN(date.getTime());
|
|
910
|
+
}
|
|
911
|
+
```
|
|
912
|
+
✅ Tests pass
|
|
913
|
+
|
|
914
|
+
**REFACTOR: Improve validation**
|
|
915
|
+
```typescript
|
|
916
|
+
function validateDate(dateStr: string): boolean {
|
|
917
|
+
const date = new Date(dateStr);
|
|
918
|
+
if (!(date instanceof Date) || isNaN(date.getTime())) {
|
|
919
|
+
return false;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
// Ensure date string round-trips correctly
|
|
923
|
+
const roundTrip = date.toISOString().split('T')[0];
|
|
924
|
+
return roundTrip === dateStr;
|
|
925
|
+
}
|
|
926
|
+
```
|
|
927
|
+
✅ Tests still pass, validation more robust
|
|
928
|
+
|
|
929
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
930
|
+
|
|
931
|
+
**Phase 3: BAS Quality Gates**
|
|
932
|
+
|
|
933
|
+
1. **Linting:** PASS ✅
|
|
934
|
+
- Auto-fixed 1 formatting issue
|
|
935
|
+
|
|
936
|
+
2. **Structure:** PASS ✅
|
|
937
|
+
- File organization correct
|
|
938
|
+
|
|
939
|
+
3. **Build:** PASS ✅
|
|
940
|
+
- TypeScript compilation successful
|
|
941
|
+
|
|
942
|
+
4. **Testing:** PASS ✅
|
|
943
|
+
- All 52 tests passing (added 5 new tests)
|
|
944
|
+
|
|
945
|
+
5. **Coverage:** 91% ✅
|
|
946
|
+
- Exceeds 80% threshold
|
|
947
|
+
- Edge cases covered
|
|
948
|
+
|
|
949
|
+
6. **Best Practices:** PASS ✅
|
|
950
|
+
- Function complexity: LOW
|
|
951
|
+
- No code duplication
|
|
952
|
+
|
|
953
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
954
|
+
|
|
955
|
+
**Phase 4: JUNO Verification**
|
|
956
|
+
|
|
957
|
+
JUNO: Verifying quick fix...
|
|
958
|
+
|
|
959
|
+
**Quality Check:**
|
|
960
|
+
1. Bug fixed: CONFIRMED ✅
|
|
961
|
+
2. Tests comprehensive: YES ✅
|
|
962
|
+
3. No regressions: VERIFIED ✅
|
|
963
|
+
4. Code quality: EXCELLENT ✅
|
|
964
|
+
|
|
965
|
+
**Overall: APPROVED ✅**
|
|
966
|
+
|
|
967
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
968
|
+
|
|
969
|
+
**AJ MAESTRO: Task Complete**
|
|
970
|
+
|
|
971
|
+
✅ Bug: Date validation fixed
|
|
972
|
+
✅ Tests: 5 new tests added (all passing)
|
|
973
|
+
✅ Coverage: 91%
|
|
974
|
+
✅ BAS Gates: ALL PASS
|
|
975
|
+
✅ JUNO: APPROVED
|
|
976
|
+
|
|
977
|
+
**Commit:** "fix(UserForm): validate date format edge cases"
|
|
978
|
+
|
|
979
|
+
**Files Changed:**
|
|
980
|
+
- src/components/UserForm.tsx (validation logic)
|
|
981
|
+
- src/components/UserForm.test.tsx (5 new tests)
|
|
982
|
+
|
|
983
|
+
Task complete. Ready for next task.
|
|
984
|
+
```
|
|
985
|
+
|
|
986
|
+
---
|
|
987
|
+
|
|
988
|
+
## When NOT to Use /trinity-orchestrate
|
|
989
|
+
|
|
990
|
+
**Don't use for:**
|
|
991
|
+
|
|
992
|
+
❌ **Starting a session**
|
|
993
|
+
→ Use `/trinity-start` (new session) or `/trinity-continue` (resume)
|
|
994
|
+
|
|
995
|
+
❌ **Creating work orders**
|
|
996
|
+
→ Use `/trinity-workorder` to create, then orchestrate it
|
|
997
|
+
|
|
998
|
+
❌ **Creating investigations**
|
|
999
|
+
→ Use `/trinity-create-investigation` to create, then orchestrate it
|
|
1000
|
+
|
|
1001
|
+
❌ **Ending your session**
|
|
1002
|
+
→ Use `/trinity-end` to archive work and update knowledge base
|
|
1003
|
+
|
|
1004
|
+
❌ **Planning workflows**
|
|
1005
|
+
→ Use `/trinity-start` (includes workflow planning guidance)
|
|
1006
|
+
|
|
1007
|
+
**Use /trinity-orchestrate for:**
|
|
1008
|
+
|
|
1009
|
+
✅ Executing work orders
|
|
1010
|
+
✅ Performing investigations
|
|
1011
|
+
✅ Completing general tasks
|
|
1012
|
+
✅ Any actual development work during your session
|
|
1013
|
+
|
|
1014
|
+
---
|
|
1015
|
+
|
|
1016
|
+
## Related Commands
|
|
1017
|
+
|
|
1018
|
+
### Session Management
|
|
1019
|
+
- `/trinity-start` - Begin new development session (includes workflow planning)
|
|
1020
|
+
- `/trinity-continue` - Resume interrupted session (ALY analyzes state)
|
|
1021
|
+
- `/trinity-end` - End session and archive work
|
|
1022
|
+
|
|
1023
|
+
### Task Creation
|
|
1024
|
+
- `/trinity-workorder` - Create formal work order for complex tasks
|
|
1025
|
+
- `/trinity-create-investigation` - Create investigation for analysis
|
|
1026
|
+
- `/trinity-plan-investigation` - Generate investigation execution plan
|
|
1027
|
+
|
|
1028
|
+
### Specialized Planning
|
|
1029
|
+
- `/trinity-requirements` - Deep requirements analysis with MON
|
|
1030
|
+
- `/trinity-design` - Technical design creation with ROR
|
|
1031
|
+
- `/trinity-plan` - Implementation planning with TRA
|
|
1032
|
+
- `/trinity-decompose` - Atomic task decomposition with EUS
|
|
1033
|
+
|
|
1034
|
+
### Utilities
|
|
1035
|
+
- `/trinity-verify` - Verify Trinity installation completeness
|
|
1036
|
+
- `/trinity-agents` - View all 19 Trinity agents and their roles
|
|
1037
|
+
|
|
1038
|
+
---
|
|
1039
|
+
|
|
1040
|
+
## Summary
|
|
1041
|
+
|
|
1042
|
+
**Primary Development Command:** `/trinity-orchestrate` is your main execution command during development sessions.
|
|
1043
|
+
|
|
1044
|
+
**Key Points:**
|
|
1045
|
+
1. **AJ MAESTRO orchestrates:** Selects best agents for each task
|
|
1046
|
+
2. **JUNO verifies automatically:** Every task gets quality audit
|
|
1047
|
+
3. **Used repeatedly:** Throughout your session, not just once
|
|
1048
|
+
4. **Three usage patterns:** @WO-XXX (work orders), @INV-XXX (investigations), "description" (quick tasks)
|
|
1049
|
+
5. **Session ≠ Context window:** Documentation persists, use `/trinity-continue` to resume
|
|
1050
|
+
|
|
1051
|
+
**Typical Session Flow:**
|
|
1052
|
+
```bash
|
|
1053
|
+
/trinity-start # Begin session
|
|
1054
|
+
/trinity-orchestrate @WO-042-jwt-refresh.md # Execute work order
|
|
1055
|
+
/trinity-orchestrate @INV-015-performance.md # Investigate issue
|
|
1056
|
+
/trinity-orchestrate "Fix validation bug" # Quick fix
|
|
1057
|
+
# ... repeat as needed throughout session ...
|
|
1058
|
+
/trinity-end # End session
|
|
1059
|
+
```
|
|
1060
|
+
|
|
1061
|
+
**Next:** Describe your task, provide a work order/investigation file, or continue working on your current task. AJ MAESTRO will orchestrate execution with automatic JUNO verification.
|