cortex-tms 3.2.0 β†’ 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/README.md +245 -526
  2. package/dist/cli.js +52 -32
  3. package/dist/cli.js.map +1 -1
  4. package/dist/commands/archive.d.ts +5 -0
  5. package/dist/commands/archive.d.ts.map +1 -0
  6. package/dist/commands/archive.js +85 -0
  7. package/dist/commands/archive.js.map +1 -0
  8. package/dist/commands/auto-tier.d.ts +1 -1
  9. package/dist/commands/auto-tier.d.ts.map +1 -1
  10. package/dist/commands/auto-tier.js +77 -76
  11. package/dist/commands/auto-tier.js.map +1 -1
  12. package/dist/commands/dashboard.d.ts +3 -0
  13. package/dist/commands/dashboard.d.ts.map +1 -0
  14. package/dist/commands/dashboard.js +20 -0
  15. package/dist/commands/dashboard.js.map +1 -0
  16. package/dist/commands/init.d.ts +1 -1
  17. package/dist/commands/init.d.ts.map +1 -1
  18. package/dist/commands/init.js +73 -73
  19. package/dist/commands/init.js.map +1 -1
  20. package/dist/commands/migrate.d.ts +2 -2
  21. package/dist/commands/migrate.d.ts.map +1 -1
  22. package/dist/commands/migrate.js +147 -136
  23. package/dist/commands/migrate.js.map +1 -1
  24. package/dist/commands/prompt.d.ts +1 -1
  25. package/dist/commands/prompt.d.ts.map +1 -1
  26. package/dist/commands/prompt.js +32 -31
  27. package/dist/commands/prompt.js.map +1 -1
  28. package/dist/commands/review.d.ts +1 -1
  29. package/dist/commands/review.d.ts.map +1 -1
  30. package/dist/commands/review.js +76 -58
  31. package/dist/commands/review.js.map +1 -1
  32. package/dist/commands/status.d.ts +2 -1
  33. package/dist/commands/status.d.ts.map +1 -1
  34. package/dist/commands/status.js +54 -144
  35. package/dist/commands/status.js.map +1 -1
  36. package/dist/commands/tutorial.d.ts +1 -1
  37. package/dist/commands/tutorial.js +168 -168
  38. package/dist/commands/tutorial.js.map +1 -1
  39. package/dist/commands/validate.d.ts +1 -1
  40. package/dist/commands/validate.d.ts.map +1 -1
  41. package/dist/commands/validate.js +60 -60
  42. package/dist/commands/validate.js.map +1 -1
  43. package/dist/types/cli.d.ts +23 -15
  44. package/dist/types/cli.d.ts.map +1 -1
  45. package/dist/types/guardian.d.ts +2 -2
  46. package/dist/ui/components/Dashboard.d.ts +11 -0
  47. package/dist/ui/components/Dashboard.d.ts.map +1 -0
  48. package/dist/ui/components/Dashboard.js +64 -0
  49. package/dist/ui/components/Dashboard.js.map +1 -0
  50. package/dist/ui/components/dashboard/ContextReductionCard.d.ts +9 -0
  51. package/dist/ui/components/dashboard/ContextReductionCard.d.ts.map +1 -0
  52. package/dist/ui/components/dashboard/ContextReductionCard.js +38 -0
  53. package/dist/ui/components/dashboard/ContextReductionCard.js.map +1 -0
  54. package/dist/ui/components/dashboard/CostSavingsCard.d.ts +10 -0
  55. package/dist/ui/components/dashboard/CostSavingsCard.d.ts.map +1 -0
  56. package/dist/ui/components/dashboard/CostSavingsCard.js +45 -0
  57. package/dist/ui/components/dashboard/CostSavingsCard.js.map +1 -0
  58. package/dist/ui/components/dashboard/FileDistributionCard.d.ts +10 -0
  59. package/dist/ui/components/dashboard/FileDistributionCard.d.ts.map +1 -0
  60. package/dist/ui/components/dashboard/FileDistributionCard.js +51 -0
  61. package/dist/ui/components/dashboard/FileDistributionCard.js.map +1 -0
  62. package/dist/ui/components/dashboard/FileSizeHealthCard.d.ts +15 -0
  63. package/dist/ui/components/dashboard/FileSizeHealthCard.d.ts.map +1 -0
  64. package/dist/ui/components/dashboard/FileSizeHealthCard.js +48 -0
  65. package/dist/ui/components/dashboard/FileSizeHealthCard.js.map +1 -0
  66. package/dist/ui/components/dashboard/Footer.d.ts +3 -0
  67. package/dist/ui/components/dashboard/Footer.d.ts.map +1 -0
  68. package/dist/ui/components/dashboard/Footer.js +13 -0
  69. package/dist/ui/components/dashboard/Footer.js.map +1 -0
  70. package/dist/ui/components/dashboard/GovernanceHealthCard.d.ts +10 -0
  71. package/dist/ui/components/dashboard/GovernanceHealthCard.d.ts.map +1 -0
  72. package/dist/ui/components/dashboard/GovernanceHealthCard.js +46 -0
  73. package/dist/ui/components/dashboard/GovernanceHealthCard.js.map +1 -0
  74. package/dist/ui/components/dashboard/GuardianStatusCard.d.ts +10 -0
  75. package/dist/ui/components/dashboard/GuardianStatusCard.d.ts.map +1 -0
  76. package/dist/ui/components/dashboard/GuardianStatusCard.js +71 -0
  77. package/dist/ui/components/dashboard/GuardianStatusCard.js.map +1 -0
  78. package/dist/ui/components/dashboard/Header.d.ts +7 -0
  79. package/dist/ui/components/dashboard/Header.d.ts.map +1 -0
  80. package/dist/ui/components/dashboard/Header.js +21 -0
  81. package/dist/ui/components/dashboard/Header.js.map +1 -0
  82. package/dist/ui/components/dashboard/HotFilesCard.d.ts +8 -0
  83. package/dist/ui/components/dashboard/HotFilesCard.d.ts.map +1 -0
  84. package/dist/ui/components/dashboard/HotFilesCard.js +28 -0
  85. package/dist/ui/components/dashboard/HotFilesCard.js.map +1 -0
  86. package/dist/ui/components/dashboard/NotConfiguredCard.d.ts +10 -0
  87. package/dist/ui/components/dashboard/NotConfiguredCard.d.ts.map +1 -0
  88. package/dist/ui/components/dashboard/NotConfiguredCard.js +13 -0
  89. package/dist/ui/components/dashboard/NotConfiguredCard.js.map +1 -0
  90. package/dist/ui/components/dashboard/SprintProgressCard.d.ts +11 -0
  91. package/dist/ui/components/dashboard/SprintProgressCard.d.ts.map +1 -0
  92. package/dist/ui/components/dashboard/SprintProgressCard.js +33 -0
  93. package/dist/ui/components/dashboard/SprintProgressCard.js.map +1 -0
  94. package/dist/ui/components/dashboard/StalenessCard.d.ts +10 -0
  95. package/dist/ui/components/dashboard/StalenessCard.d.ts.map +1 -0
  96. package/dist/ui/components/dashboard/StalenessCard.js +43 -0
  97. package/dist/ui/components/dashboard/StalenessCard.js.map +1 -0
  98. package/dist/ui/components/dashboard/TabBar.d.ts +8 -0
  99. package/dist/ui/components/dashboard/TabBar.d.ts.map +1 -0
  100. package/dist/ui/components/dashboard/TabBar.js +16 -0
  101. package/dist/ui/components/dashboard/TabBar.js.map +1 -0
  102. package/dist/ui/components/dashboard/ValidationCard.d.ts +10 -0
  103. package/dist/ui/components/dashboard/ValidationCard.d.ts.map +1 -0
  104. package/dist/ui/components/dashboard/ValidationCard.js +62 -0
  105. package/dist/ui/components/dashboard/ValidationCard.js.map +1 -0
  106. package/dist/ui/components/dashboard/ViewContainer.d.ts +14 -0
  107. package/dist/ui/components/dashboard/ViewContainer.d.ts.map +1 -0
  108. package/dist/ui/components/dashboard/ViewContainer.js +53 -0
  109. package/dist/ui/components/dashboard/ViewContainer.js.map +1 -0
  110. package/dist/ui/components/dashboard/index.d.ts +14 -0
  111. package/dist/ui/components/dashboard/index.d.ts.map +1 -0
  112. package/dist/ui/components/dashboard/index.js +14 -0
  113. package/dist/ui/components/dashboard/index.js.map +1 -0
  114. package/dist/ui/index.d.ts +5 -0
  115. package/dist/ui/index.d.ts.map +1 -0
  116. package/dist/ui/index.js +46 -0
  117. package/dist/ui/index.js.map +1 -0
  118. package/dist/utils/backup.d.ts.map +1 -1
  119. package/dist/utils/backup.js +20 -20
  120. package/dist/utils/backup.js.map +1 -1
  121. package/dist/utils/config.d.ts +1 -1
  122. package/dist/utils/config.js +68 -68
  123. package/dist/utils/detection.d.ts +1 -1
  124. package/dist/utils/detection.js +25 -25
  125. package/dist/utils/errors.d.ts.map +1 -1
  126. package/dist/utils/errors.js +4 -4
  127. package/dist/utils/errors.js.map +1 -1
  128. package/dist/utils/git-history.d.ts.map +1 -1
  129. package/dist/utils/git-history.js +9 -5
  130. package/dist/utils/git-history.js.map +1 -1
  131. package/dist/utils/git-staleness.d.ts +13 -0
  132. package/dist/utils/git-staleness.d.ts.map +1 -0
  133. package/dist/utils/git-staleness.js +129 -0
  134. package/dist/utils/git-staleness.js.map +1 -0
  135. package/dist/utils/guardian-prompt.d.ts.map +1 -1
  136. package/dist/utils/guardian-prompt.js +1 -1
  137. package/dist/utils/guardian-prompt.js.map +1 -1
  138. package/dist/utils/llm-client.d.ts +5 -5
  139. package/dist/utils/llm-client.d.ts.map +1 -1
  140. package/dist/utils/llm-client.js +56 -53
  141. package/dist/utils/llm-client.js.map +1 -1
  142. package/dist/utils/prompt-parser.d.ts.map +1 -1
  143. package/dist/utils/prompt-parser.js +13 -17
  144. package/dist/utils/prompt-parser.js.map +1 -1
  145. package/dist/utils/prompts.d.ts +1 -1
  146. package/dist/utils/prompts.d.ts.map +1 -1
  147. package/dist/utils/prompts.js +74 -49
  148. package/dist/utils/prompts.js.map +1 -1
  149. package/dist/utils/sanitize.js +6 -6
  150. package/dist/utils/sanitize.js.map +1 -1
  151. package/dist/utils/stats-collector.d.ts +56 -0
  152. package/dist/utils/stats-collector.d.ts.map +1 -0
  153. package/dist/utils/stats-collector.js +244 -0
  154. package/dist/utils/stats-collector.js.map +1 -0
  155. package/dist/utils/status.d.ts +1 -1
  156. package/dist/utils/status.d.ts.map +1 -1
  157. package/dist/utils/status.js +16 -16
  158. package/dist/utils/status.js.map +1 -1
  159. package/dist/utils/templates.d.ts +3 -3
  160. package/dist/utils/templates.d.ts.map +1 -1
  161. package/dist/utils/templates.js +59 -54
  162. package/dist/utils/templates.js.map +1 -1
  163. package/dist/utils/tier-tags.d.ts +1 -1
  164. package/dist/utils/tier-tags.js +2 -2
  165. package/dist/utils/token-counter.d.ts +1 -43
  166. package/dist/utils/token-counter.d.ts.map +1 -1
  167. package/dist/utils/token-counter.js +32 -80
  168. package/dist/utils/token-counter.js.map +1 -1
  169. package/dist/utils/validation.d.ts +2 -11
  170. package/dist/utils/validation.d.ts.map +1 -1
  171. package/dist/utils/validation.js +26 -39
  172. package/dist/utils/validation.js.map +1 -1
  173. package/dist/utils/validator.d.ts +1 -1
  174. package/dist/utils/validator.d.ts.map +1 -1
  175. package/dist/utils/validator.js +145 -73
  176. package/dist/utils/validator.js.map +1 -1
  177. package/package.json +10 -5
  178. package/templates/CLAUDE.md +1 -1
  179. package/templates/FUTURE-ENHANCEMENTS.md +1 -1
  180. package/templates/NEXT-TASKS.md +1 -1
  181. package/templates/PROMPTS.md +1 -1
  182. package/templates/README.md +1 -1
  183. package/templates/docs/archive/v1.0-CHANGELOG.md +1 -1
  184. package/templates/docs/core/ARCHITECTURE.md +1 -1
  185. package/templates/docs/core/DECISIONS.md +1 -1
  186. package/templates/docs/core/DOMAIN-LOGIC.md +1 -1
  187. package/templates/docs/core/GLOSSARY.md +1 -1
  188. package/templates/docs/core/PATTERNS.md +1 -1
  189. package/templates/docs/core/SCHEMA.md +1 -1
  190. package/templates/docs/core/TROUBLESHOOTING.md +1 -1
package/README.md CHANGED
@@ -5,20 +5,12 @@
5
5
  <h1 align="center">Cortex TMS</h1>
6
6
 
7
7
  <p align="center">
8
- <strong>AI Governance Platform - Stop Wasting Tokens. Stop Burning GPU Cycles on Old Docs.</strong>
8
+ <strong>Documentation Governance for AI Coding Agents</strong>
9
9
  </p>
10
10
 
11
- ---
12
-
13
- Cortex TMS is an **AI Governance Platform** built on three pillars:
14
-
15
- 1. **πŸ’° Cost Efficiency** - Reduce input tokens by **60-70%** through intelligent context management (works with ANY model)
16
- 2. **βœ… Quality** - Reduce hallucinations from outdated docs with semantic validation and focused context
17
- 3. **🌱 Sustainability** - Cut compute requirements by **60-70%** with Green Governanceβ€”less energy, greener development
18
-
19
- Stop feeding your AI coding tool thousands of outdated lines. **60-70% input token reduction** (measured across 47 sessions on Cortex TMS itself) means **lower costs for paid models**, **less compute for free models**, and **fewer hallucinations** from irrelevant context.
20
-
21
- **Works with any AI coding tool** - Claude Code, Copilot, Cursor, Warp, Augment, you name it. The architecture is model-agnostic. Input token reduction is universal.
11
+ <p align="center">
12
+ ⭐ 166+ GitHub Stars | Open source, community-driven
13
+ </p>
22
14
 
23
15
  [![npm version](https://img.shields.io/npm/v/cortex-tms.svg?style=flat-square)](https://www.npmjs.com/package/cortex-tms)
24
16
  [![npm downloads](https://img.shields.io/npm/dm/cortex-tms.svg?style=flat-square)](https://www.npmjs.com/package/cortex-tms)
@@ -26,152 +18,113 @@ Stop feeding your AI coding tool thousands of outdated lines. **60-70% input tok
26
18
  [![node version](https://img.shields.io/node/v/cortex-tms.svg?style=flat-square)](https://nodejs.org)
27
19
  [![GitHub stars](https://img.shields.io/github/stars/cortex-tms/cortex-tms.svg?style=flat-square)](https://github.com/cortex-tms/cortex-tms/stargazers)
28
20
 
29
- **Current Status**: βœ… **Stable / Production Ready** | [NPM Package](https://www.npmjs.com/package/cortex-tms) | [GitHub Repository](https://github.com/cortex-tms/cortex-tms) | [Documentation](https://cortex-tms.org)
30
-
31
21
  ---
32
22
 
33
- ## πŸš€ Instant Activation
34
-
35
- Get started in under 60 seconds (no installation required):
23
+ ## What is Cortex TMS?
36
24
 
37
- ```bash
38
- # 1. Initialize your project
39
- npx cortex-tms@latest init
25
+ Cortex TMS scaffolds and validates governance documentation for AI coding agents. As AI models get more powerful and autonomous, they need clear, current governance docs to stay aligned with your project standards.
40
26
 
41
- # 2. Open the Project Cockpit
42
- npx cortex-tms@latest status
27
+ **The Challenge**: Modern AI agents handle large context windows and can work autonomouslyβ€”but without governance, they drift from your standards, overengineer solutions, and write inconsistent code.
43
28
 
44
- # 3. Activate your AI Agent
45
- npx cortex-tms@latest prompt init-session
46
- # (Copies project-aware prompt to clipboard!)
47
-
48
- # 4. Check version health
49
- npx cortex-tms@latest migrate
50
- ```
29
+ **The Solution**: Cortex TMS provides:
30
+ - πŸ“‹ **Documentation scaffolding** - Templates for PATTERNS.md, ARCHITECTURE.md, CLAUDE.md
31
+ - βœ… **Staleness detection** - Detects when governance docs go stale relative to code changes (v4.0)
32
+ - πŸ” **Structure validation** - Automated health checks in CI or locally
33
+ - πŸ“¦ **Archive management** - Keep task lists focused and maintainable
51
34
 
52
- **Note**: Using `npx` requires no installation. For frequent use, install globally: `npm install -g cortex-tms@latest`
35
+ ---
53
36
 
54
- Choose your scope (Nano/Standard/Enterprise) and start building with AI-optimized documentation and intelligent CLI tooling.
37
+ ## Three Pillars
55
38
 
56
- πŸ“– **New here?** The Essential 7 prompts in `PROMPTS.md` will guide you through the entire development lifecycle.
39
+ ### 1. πŸ“‹ Consistency - Document Your Standards
57
40
 
58
- ## 🎬 See It In Action
41
+ Scaffold governance docs that AI agents actually read:
42
+ - `PATTERNS.md` - Code patterns and conventions
43
+ - `CLAUDE.md` - Agent workflow rules (git protocol, scope discipline, human approval gates)
44
+ - `ARCHITECTURE.md` - System design and tech stack
45
+ - `DOMAIN-LOGIC.md` - Business rules and constraints
59
46
 
60
- ![Cortex TMS Demo](assets/demo.gif)
47
+ **Result**: AI writes code that follows YOUR patterns, not random conventions from its training data.
61
48
 
62
- **Watch** the `cortex status` dashboard and `cortex migrate` workflow in action. See how Cortex TMS provides real-time project health metrics and intelligent version management.
49
+ ### 2. πŸ” Freshness - Detect Staleness
63
50
 
64
- ---
51
+ New in v4.0: Git-based staleness detection catches when docs go stale:
65
52
 
66
- ## πŸ’° The Value: Measurable Efficiency Gains
53
+ ```bash
54
+ cortex-tms validate
67
55
 
68
- **Real Numbers from Cortex TMS itself** (TypeScript monorepo, measured across 47 development sessions):
56
+ ⚠️ Doc Staleness
57
+ PATTERNS.md may be outdated
58
+ Doc is 45 days older than code with 12 meaningful commits
59
+ Code: 2026-02-20
60
+ Doc: 2026-01-06
69
61
 
70
- ```bash
71
- cortex status --tokens -m claude-sonnet-4-5
62
+ Review docs/core/PATTERNS.md to ensure it reflects current codebase
72
63
  ```
73
64
 
74
- | Metric | Value | Impact |
75
- | :---------------------- | :------------------- | :---------------------------------------------- |
76
- | **Input Token Reduction** | 60-70% typical | Read 3,647 tokens instead of 66,834 (measured on our project) |
77
- | **Cost Savings (Paid Models)** | ~60-70% lower costs | Example: Claude Sonnet $0.20 β†’ $0.06/session |
78
- | **Compute Savings (Free Models)** | ~60-70% less processing | Less GPU cycles = lower electricity + greener development |
79
- | **Quality Improvement** | Fewer hallucinations | AI reads focused context, not thousands of irrelevant lines |
65
+ **How it works**: Compares doc modification dates vs code commit activity. Flags stale docs before they mislead AI agents.
80
66
 
81
- **How?** The HOT/WARM/COLD tier system ensures AI agents only read what matters:
67
+ **Note**: Staleness v1 uses git timestamps (temporal comparison only). Cannot detect semantic misalignment. Future versions will add semantic analysis.
82
68
 
83
- - **HOT**: Current sprint (always read) - 3,647 tokens
84
- - **WARM**: Architectural truth (on-demand) - 20,109 tokens
85
- - **COLD**: Historical archive (ignored) - 43,078 tokens
69
+ ### 3. πŸ›‘οΈ Safety - Human Oversight
86
70
 
87
- **Result**: Your AI assistant stays focused, costs less (paid models) or uses less compute (free models), and makes fewer mistakes.
71
+ `CLAUDE.md` governance rules require human approval for critical operations:
72
+ - Git commits/pushes require approval
73
+ - Scope discipline prevents overengineering
74
+ - Pattern adherence enforced through validation
88
75
 
89
- **Tested Models**: Claude Sonnet/Opus, GPT-4. Architecture is model-agnosticβ€”should work with any AI tool. Input token reduction benefit is universal.
76
+ **Result**: AI agents stay powerful but don't run wild.
90
77
 
91
78
  ---
92
79
 
93
- ## πŸ“Š Measurement & Validation
80
+ ## What Cortex Does (and Doesn't Do)
94
81
 
95
- **How We Measured These Numbers**:
82
+ ### βœ… What Cortex Does
96
83
 
97
- The 60-70% input token reduction is based on 47 development sessions working on Cortex TMS itself (TypeScript monorepo, ~66K total tokens). We tracked:
98
- - HOT tier tokens: ~3,647 (what AI actually reads)
99
- - Full repository: ~66,834 (without TMS)
100
- - Reduction: ~94.5% when comparing HOT tier vs full repo with archives
84
+ - **Scaffolds governance docs** - Templates for common project documentation
85
+ - **Validates doc health** - Checks structure, freshness, completeness
86
+ - **Detects staleness** - Flags when docs are outdated relative to code (v4.0)
87
+ - **Enforces size limits** - Keeps docs focused and scannable
88
+ - **Archives completed tasks** - Maintains clean NEXT-TASKS.md
89
+ - **Works in CI/CD** - GitHub Actions validation templates included
101
90
 
102
- **Transparency**:
103
- - Sample: 47 sessions over 24 days (Jan 2026)
104
- - Project type: TypeScript monorepo (Cortex TMS dogfooding itself)
105
- - Tools tested: Claude Code, GitHub Copilot (in VS Code)
106
- - Models tested: Claude Sonnet/Opus, GPT-4, and other Copilot models
107
- - Your results may vary based on project size, structure, usage patterns, and model choice
108
- - Read our measurement methodology: [Measuring Context Optimization](website/src/content/blog/measuring-context-optimization.mdx)
91
+ ### ❌ What Cortex Does NOT Do
109
92
 
110
- **Community Feedback Welcome**:
111
- If you use other models (local LLMs, etc.) and your experience differs, please share! We're building a public benchmark suite to validate findings across diverse projects and models. See [FUTURE-ENHANCEMENTS.md](FUTURE-ENHANCEMENTS.md) for roadmap.
112
-
113
- **Honest Approach**: These are our real measurements from dogfooding with the models we actually use. Not marketing fluff, not fake data. We invite the community to validate, challenge, and improve these findings.
93
+ - **Not a token optimizer** - Validates documentation health, not context size
94
+ - **Not code enforcement** - Validates DOCUMENTATION health, not code directly
95
+ - **Not a replacement for code review** - Complements human review, doesn't replace it
96
+ - **Not semantic analysis (yet)** - Staleness v1 uses timestamps, not AI-powered diff analysis
114
97
 
115
98
  ---
116
99
 
117
- ## 🎯 The Philosophy: Signal over Noise
118
-
119
- Traditional repos drown AI agents in thousands of lines of historical tasks and stale documentation. **Cortex TMS** forces agents into a "Tiered" approach:
120
-
121
- 1. **HOT (Active)**: `NEXT-TASKS.md`, `PROMPTS.md` β€” What we are doing _now_ and how to ask the AI for help.
122
- 2. **WARM (Truth)**: `docs/core/` β€” The project's "Laws" (Architecture, Patterns, Domain Logic).
123
- 3. **COLD (History)**: `docs/archive/` β€” Historical changelogs (Ignore unless asked).
124
-
125
- **Why this works**: AI agents have limited context windows. Reading everything is wasteful. The tier system maximizes signal, minimizes noise.
126
-
127
- ---
128
-
129
- ## πŸ†• What's New in v3.2 (Upcoming)
130
-
131
- **Security & Production Readiness** - Making Cortex TMS enterprise-grade:
132
-
133
- - πŸ›‘οΈ **Centralized Error Handling** β€” No more process crashes. All commands use consistent `CLIError` patterns with proper cleanup
134
- - βœ… **Zod-Based Input Validation** β€” Runtime type safety for all CLI commands with clear, actionable error messages
135
- - πŸ§ͺ **Comprehensive E2E Tests** β€” 61 E2E tests covering full CLI workflows (init, validate, migrate, review, auto-tier)
136
- - πŸ”’ **Path Traversal Protection** β€” Template operations secured against `../../etc/passwd` attacks with `validateSafePath()`
137
- - πŸ” **API Key Sanitization** β€” Guardian automatically redacts Anthropic/OpenAI keys in all error messages and logs
138
- - πŸ“Š **Automated Security Scanning** β€” CI pipeline runs `pnpm audit` on every PR to catch dependency vulnerabilities
100
+ ## Quick Start
139
101
 
140
- **Test Coverage**: 316 tests (97% pass rate) β€” up from 269 tests (+17%)
141
-
142
- **For Developers**: See [Security Testing Guide](docs/guides/SECURITY-TESTING.md) for how to verify security patterns.
143
-
144
- **Full Details**: [CHANGELOG.md](CHANGELOG.md#320---unreleased)
145
-
146
- ---
147
-
148
- ## πŸ› οΈ CLI Commands
102
+ ```bash
103
+ # Initialize governance docs in your project
104
+ npx cortex-tms@latest init
149
105
 
150
- Cortex TMS provides 8 production-ready commands:
106
+ # Validate doc health (including staleness detection)
107
+ npx cortex-tms@latest validate
151
108
 
152
- ### `cortex-tms tutorial`
109
+ # Strict mode (warnings = errors, for CI)
110
+ npx cortex-tms@latest validate --strict
153
111
 
154
- Interactive walkthrough teaching the "Cortex Way" - perfect for first-time users.
112
+ # Check project status
113
+ npx cortex-tms@latest status
155
114
 
156
- ```bash
157
- cortex-tms tutorial # Start the guided tour
115
+ # Archive completed tasks
116
+ npx cortex-tms@latest archive --dry-run
158
117
  ```
159
118
 
160
- **What You'll Learn**:
161
-
162
- - Project Dashboard: Using `status` to see your cockpit
163
- - AI Activation: Using `prompt` to activate project-aware AI agents
164
- - Zero-Drift Governance: Automated version sync with `docs:sync`
165
- - Health Checks: Understanding `validate` and the Archive Protocol
166
- - Safe Migration: Fearless template upgrades with backup/rollback
167
-
168
- **Navigation**: Use arrow keys and Enter to progress, select Exit to quit anytime
119
+ **Installation**: No installation required with `npx`. For frequent use: `npm install -g cortex-tms@latest`
169
120
 
170
121
  ---
171
122
 
123
+ ## CLI Commands
124
+
172
125
  ### `cortex-tms init`
173
126
 
174
- Initialize TMS structure in your project with interactive scope selection.
127
+ Scaffold TMS documentation structure with interactive scope selection.
175
128
 
176
129
  ```bash
177
130
  cortex-tms init # Interactive mode
@@ -181,230 +134,99 @@ cortex-tms init --dry-run # Preview changes
181
134
 
182
135
  ### `cortex-tms validate`
183
136
 
184
- Verify your project's TMS health and auto-fix common issues.
137
+ Verify project TMS health with automated checks.
185
138
 
186
139
  ```bash
187
140
  cortex-tms validate # Check project health
188
141
  cortex-tms validate --fix # Auto-repair missing files
189
- cortex-tms validate --strict # Strict mode with no warnings
142
+ cortex-tms validate --strict # Strict mode (warnings = errors)
190
143
  ```
191
144
 
145
+ **What it checks:**
146
+ - βœ… Mandatory files exist (NEXT-TASKS.md, CLAUDE.md, copilot-instructions.md)
147
+ - βœ… File size limits (Rule 4: HOT files < 200 lines)
148
+ - βœ… Placeholder completion (no `[Project Name]` markers left)
149
+ - βœ… Archive status (completed tasks should be archived)
150
+ - βœ… **Doc staleness** (NEW in v4.0) - governance docs current with code
151
+
192
152
  ### `cortex-tms status`
193
153
 
194
- Project cockpit with health dashboard, sprint progress, and token analysis.
154
+ Text summary of project health and sprint progress.
195
155
 
196
156
  ```bash
197
- cortex-tms status # Visual dashboard with progress bars
198
- cortex-tms status --tokens # Token usage analysis (HOT/WARM/COLD)
199
- cortex-tms status --tokens -m gpt-4 # Cost comparison across models
157
+ cortex-tms status # Health summary with progress bars
200
158
  ```
201
159
 
202
- **Token Analysis Features**:
160
+ Shows: project identity, validation status, sprint progress, backlog size.
203
161
 
204
- - HOT/WARM/COLD tier breakdown with token counts
205
- - Context reduction percentage (typically 60-70%)
206
- - Cost estimates per session/day/month (for paid models)
207
- - Model comparison (Claude Sonnet 4.5, Opus 4.5, GPT-4, etc.)
208
- - Sustainability impact tracking (compute savings for all models)
162
+ ### `cortex-tms dashboard` ✨ New in v4.0
209
163
 
210
- ### `cortex-tms auto-tier`
211
-
212
- Git-based automatic tier assignment - reduce manual tier management using file recency as a relevance signal.
164
+ Full-screen interactive terminal UI for governance health monitoring.
213
165
 
214
166
  ```bash
215
- cortex-tms auto-tier # Apply tier tags based on git history
216
- cortex-tms auto-tier --dry-run # Preview tier suggestions
217
- cortex-tms auto-tier --hot 14 --warm 60 # Custom thresholds
218
- cortex-tms auto-tier --force # Overwrite existing tags
167
+ cortex-tms dashboard # Interactive dashboard (navigate with 1/2/3 keys)
168
+ cortex-tms dashboard --live # Auto-refresh every 5 seconds
219
169
  ```
220
170
 
221
- **Community-requested feature**: Built in response to feedback from Reddit users [Illustrious-Report96](https://www.reddit.com/user/Illustrious-Report96/), [pbalIII](https://www.reddit.com/user/pbalIII/), and [durable-racoon](https://www.reddit.com/user/durable-racoon/) who identified manual tier management as a scalability bottleneck and suggested using git history to determine file "heat".
171
+ **Three views** (switch with number keys):
172
+ - **1 β€” Overview**: Governance health score (0–100), staleness status, sprint progress
173
+ - **2 β€” Files**: HOT files list, HOT/WARM/COLD distribution, file size health
174
+ - **3 β€” Health**: Validation status, Guardian violation summary
175
+
176
+ ### `cortex-tms archive`
222
177
 
223
- **How It Works**:
178
+ Archive completed tasks and old content.
224
179
 
225
- - Analyzes git commit history and file paths to calculate priority scores
226
- - **Scoring system**: Canonical files (100 pts) > docs/ (40 pts) + recency (15 pts)
227
- - **Strict cap**: Maximum 10 HOT files (prevents context bloat)
228
- - **Smart defaults**: `docs/archive/` β†’ COLD, `docs/guides/` β†’ WARM, canonical files always HOT
229
- - Adds `<!-- @cortex-tms-tier HOT -->` tags to markdown files
230
- - Respects explicit tier tags unless `--force` is used
180
+ ```bash
181
+ cortex-tms archive # Archive completed tasks
182
+ cortex-tms archive --dry-run # Preview what would be archived
183
+ ```
231
184
 
232
- **Why Auto-Tier?**
185
+ Archives completed tasks from NEXT-TASKS.md to `docs/archive/` with timestamp.
233
186
 
234
- - **Automates tier management**: No more manual tier decisions
235
- - **Objective signal**: Git history provides measurable recency data
236
- - **Aligns with "Lost in the Middle" research**: Recent files (likely relevant) placed at context beginning
237
- - **Adapts to workflow**: Tiers stay current as project evolves
187
+ **Note**: `cortex-tms auto-tier` is deprecatedβ€”use `archive` instead.
238
188
 
239
189
  ### `cortex-tms migrate`
240
190
 
241
- Intelligent version managementβ€”detect outdated templates and automatically upgrade with safety backups.
191
+ Intelligent version managementβ€”detect outdated templates and upgrade safely.
242
192
 
243
193
  ```bash
244
194
  cortex-tms migrate # Analyze version status
245
- cortex-tms migrate --apply # Auto-upgrade OUTDATED files (creates backup)
246
- cortex-tms migrate --apply --force # Upgrade ALL files including customized
247
- cortex-tms migrate --rollback # Restore from backup (interactive selection)
248
- cortex-tms migrate --dry-run # Preview migration plan
195
+ cortex-tms migrate --apply # Auto-upgrade OUTDATED files
196
+ cortex-tms migrate --rollback # Restore from backup
249
197
  ```
250
198
 
251
- **Status Categories**:
252
-
253
- - `LATEST`: Already on current version
254
- - `OUTDATED`: Safe to auto-upgrade (matches old template)
255
- - `CUSTOMIZED`: Manual review needed (has user changes)
256
- - `MISSING`: Optional file not installed
257
-
258
- **Safety Features**:
259
-
260
- - Automatic backups in `.cortex/backups/` before any changes
261
- - Timestamped snapshots with manifest files
262
- - One-click rollback with interactive backup selection
263
- - Confirmation prompts prevent accidental overwrites
264
-
265
199
  ### `cortex-tms prompt`
266
200
 
267
201
  Access project-aware AI prompts from the Essential 7 library.
268
202
 
269
203
  ```bash
270
204
  cortex-tms prompt # Interactive selection
271
- cortex-tms prompt init-session # Direct access (auto-copies to clipboard!)
272
- cortex-tms prompt --list # Browse all prompts
205
+ cortex-tms prompt init-session # Auto-copies to clipboard
273
206
  ```
274
207
 
275
- **The Essential 7**:
276
-
277
- - `init-session` - Start your AI session with context
278
- - `feature` - Implement new features with architectural anchors
279
- - `debug` - Troubleshoot with known issues lookup
280
- - `review` - Code review against project patterns
281
- - `refactor` - Structural improvements
282
- - `decision` - Create Architecture Decision Records
283
- - `finish` - Execute maintenance protocol
284
-
285
208
  ### `cortex-tms review` πŸ›‘οΈ
286
209
 
287
- **Guardian**: AI-powered semantic validation against project patterns and domain logic.
210
+ Guardian: AI-powered semantic validation against project patterns.
288
211
 
289
212
  ```bash
290
- cortex-tms review src/index.ts # Validate file against PATTERNS.md
291
- cortex-tms review src/index.ts --safe # Safe Mode: only high-confidence violations (β‰₯70%)
292
- cortex-tms review src/index.ts --output-json # Raw JSON output (for Agent Skills/CI/CD)
293
- cortex-tms review src/index.ts --provider openai # Use OpenAI instead of Anthropic
294
- cortex-tms review src/index.ts --model gpt-4 # Specify model
295
- ```
296
-
297
- **What Guardian Does**:
298
-
299
- - Analyzes code against `PATTERNS.md` (canonical examples, do/don't patterns)
300
- - Validates against `DOMAIN-LOGIC.md` (immutable project rules)
301
- - Uses LLM to catch **semantic violations**, not just syntax errors
302
- - Reports violations with specific pattern references
303
-
304
- **Why Guardian?**
305
-
306
- - **Structured Output**: JSON-based violation detection (80%+ accuracy target, from 65.5% baseline)
307
- - **Safe Mode**: `--safe` flag filters to high-confidence violations only (β‰₯70%), reducing false positive noise
308
- - **Semantic Understanding**: Catches violations grep/regex can't find
309
- - **Pattern Enforcement**: Stops drift from architectural decisions
310
- - **BYOK (Bring Your Own Key)**: Uses your OpenAI or Anthropic API key
311
- - **Reliable Parsing**: Deterministic JSON eliminates keyword collision false positives
312
-
313
- **Example Output**:
314
-
315
- ```
316
- πŸ›‘οΈ Guardian Code Review
317
-
318
- βœ… Analysis Complete
319
-
320
- ❌ **Major Violations**
321
-
322
- Code violates Pattern 1: Placeholder Syntax
323
-
324
- ## Violations
325
-
326
- 1. ❌ **Pattern 1: Placeholder Syntax**
327
- πŸ“ Line: 45
328
- ❗ Issue: Using {braces} instead of [brackets] for placeholders
329
- πŸ’‘ Fix: Replace {project-name} with [project-name]
330
-
331
- ## Positive Observations
332
-
333
- βœ… Consistent indentation and formatting
334
- βœ… Good use of TypeScript strict types
213
+ cortex-tms review src/index.ts # Validate against PATTERNS.md
214
+ cortex-tms review src/index.ts --safe # High-confidence violations only
335
215
  ```
336
216
 
337
- ---
338
-
339
- ## πŸ”„ CI/CD Integration
340
-
341
- ### Reusable GitHub Action
342
-
343
- Validate your TMS documentation in GitHub Actions workflows without installing the CLI locally.
344
-
345
- **Basic Usage** (in your `.github/workflows/tms-validate.yml`):
346
-
347
- ```yaml
348
- name: TMS Validation
349
-
350
- on:
351
- push:
352
- branches: [main]
353
- pull_request:
354
- branches: [main]
355
-
356
- jobs:
357
- validate:
358
- uses: cortex-tms/cortex-tms/.github/workflows/validate-reusable.yml@main
359
- ```
360
-
361
- **With Custom Configuration**:
362
-
363
- ```yaml
364
- jobs:
365
- validate:
366
- uses: cortex-tms/cortex-tms/.github/workflows/validate-reusable.yml@main
367
- with:
368
- strict: true # Enable strict mode (default: true)
369
- scope: 'standard' # Validation scope (default: auto-detect)
370
- ignore-files: 'README.md' # Comma-separated files to ignore
371
- cortex-version: 'latest' # Cortex TMS version (default: latest)
372
- node-version: '20' # Node.js version (default: 20)
373
- ```
374
-
375
- **Available Inputs**:
376
-
377
- | Input | Description | Default |
378
- |:------|:------------|:--------|
379
- | `strict` | Enable strict validation mode (fails on warnings) | `true` |
380
- | `scope` | Validation scope (nano/standard/enterprise/auto-detect) | `auto-detect` |
381
- | `ignore-files` | Comma-separated list of files to ignore | `''` |
382
- | `cortex-version` | Cortex TMS version to install (e.g., "latest", "2.7.0") | `latest` |
383
- | `node-version` | Node.js version to use | `20` |
217
+ ### `cortex-tms tutorial`
384
218
 
385
- **Example with Multiple Ignored Files**:
219
+ Interactive walkthrough teaching the Cortex Way.
386
220
 
387
- ```yaml
388
- jobs:
389
- validate:
390
- uses: cortex-tms/cortex-tms/.github/workflows/validate-reusable.yml@main
391
- with:
392
- strict: false
393
- ignore-files: 'README.md,CHANGELOG.md,docs/archive/*'
221
+ ```bash
222
+ cortex-tms tutorial # 5-lesson guided tour (~15 minutes)
394
223
  ```
395
224
 
396
- **Benefits**:
397
-
398
- - βœ… Zero-friction adoption (no local installation required)
399
- - βœ… Validates PRs automatically
400
- - βœ… Consistent enforcement across team
401
- - βœ… Works with any project using Cortex TMS
402
-
403
225
  ---
404
226
 
405
- ## πŸ“‚ Documentation Structure
227
+ ## Documentation Structure
406
228
 
407
- | Folder / File | Purpose | AI Context Tier |
229
+ | Folder / File | Purpose | Tier |
408
230
  | :-------------------------------- | :------------------------------------- | :------------------------ |
409
231
  | `NEXT-TASKS.md` | Active sprint and current focus | **HOT** (Always Read) |
410
232
  | `PROMPTS.md` | AI interaction templates (Essential 7) | **HOT** (Always Read) |
@@ -417,312 +239,209 @@ jobs:
417
239
  | `docs/core/GIT-STANDARDS.md` | Git & PM conventions | **WARM** (Read on Demand) |
418
240
  | `docs/core/DECISIONS.md` | Architecture Decision Records | **WARM** (Read on Demand) |
419
241
  | `docs/core/GLOSSARY.md` | Project terminology | **WARM** (Read on Demand) |
420
- | `docs/core/SCHEMA.md` | Data models (optional) | **WARM** (Read on Demand) |
421
- | `docs/core/TROUBLESHOOTING.md` | Framework gotchas (optional) | **WARM** (Read on Demand) |
422
242
  | `docs/archive/` | Historical changelogs | **COLD** (Ignore) |
423
243
 
424
- **Context Budget Limits**: To keep HOT files efficient:
425
-
426
- - `NEXT-TASKS.md`: Stay under **200 lines** (archive completed sprints to `docs/archive/`)
427
- - `.github/copilot-instructions.md`: Stay under **100 lines** (critical rules only)
428
-
429
- **Archive Trigger**: When a sprint completes, move tasks from `NEXT-TASKS.md` to `docs/archive/sprint-vX.X-YYYY-MM.md`.
244
+ **HOT/WARM/COLD System**: Organizes docs by access frequency (not token optimization). Helps AI find what's relevant for each task.
430
245
 
431
246
  ---
432
247
 
433
- ## πŸš€ What's New in v2.6.1 (Current Published Release)
434
-
435
- ### Token Counter - Prove Your Savings (GREEN GOVERNANCE)
436
-
437
- - **Real-Time Token Analysis**: `cortex status --tokens` shows HOT/WARM/COLD breakdown
438
- - **Multi-Model Cost Comparison**: Claude Sonnet 4.5, Opus 4.5, GPT-4, and more
439
- - **Sustainability Metrics**: Track your sustainability impact from less compute
440
- - **60-70% Input Token Reduction**: Measured on Cortex TMS itself (3,647 vs 66,834 tokens)
441
- - **Universal Savings**: Lower costs for paid models, less compute for free models
442
-
443
- ### Guardian Semantic Validation (QUALITY ENFORCEMENT)
444
-
445
- - **Pattern Enforcement**: `cortex review <file>` validates against PATTERNS.md
446
- - **Domain Logic Checker**: Audits code against immutable project rules
447
- - **High Accuracy**: 80%+ accuracy target with Safe Mode (from 65.5% baseline)
448
- - **LLM-Powered Detection**: Uses Claude/GPT to catch semantic violations, not just syntax
449
-
450
- ### Integration Test Suite (PRODUCTION QUALITY)
451
-
452
- - **111 Passing Tests**: 96 unit + 15 integration tests
453
- - **End-to-End Workflows**: Validates command interactions work correctly
454
- - **Error Recovery Testing**: Ensures rollback and fix workflows function
455
- - **CI/CD Ready**: ~8.5s execution time, zero flakiness
456
-
457
- ### Error Handling Refactor (DEVELOPER EXPERIENCE)
248
+ ## Staleness Detection Configuration
249
+
250
+ Configure staleness thresholds in `.cortexrc`:
251
+
252
+ ```json
253
+ {
254
+ "version": "4.0.0",
255
+ "scope": "standard",
256
+ "staleness": {
257
+ "enabled": true,
258
+ "thresholdDays": 30,
259
+ "minCommits": 3,
260
+ "docs": {
261
+ "docs/core/PATTERNS.md": ["src/"],
262
+ "docs/core/ARCHITECTURE.md": ["src/", "infrastructure/"],
263
+ "docs/core/DOMAIN-LOGIC.md": ["src/"]
264
+ }
265
+ }
266
+ }
267
+ ```
458
268
 
459
- - **Clean Exit Management**: Removed 17 `process.exit()` calls from command files
460
- - **Better Testability**: Commands throw errors instead of forcing exits
461
- - **Centralized Error Handler**: Commander.js `exitOverride()` for consistent behavior
269
+ **How it works**:
270
+ - Compares doc last modified date vs code commit activity
271
+ - Flags stale if: `daysSinceDocUpdate > thresholdDays AND meaningfulCommits >= minCommits`
272
+ - Excludes merge commits, test-only changes, lockfile-only changes
462
273
 
463
- ### What's in v2.6.1 and Earlier
274
+ **Limitations (v1)**:
275
+ - Temporal comparison only (git timestamps)
276
+ - Cannot detect semantic misalignment
277
+ - Requires full git history (not shallow clones)
464
278
 
465
- - **Interactive Tutorial**: 5-lesson guided walkthrough (<15 minutes)
466
- - **Safe-Fail Migration**: Automatic backups with one-click rollback
467
- - **Zero-Drift Governance**: Automated version sync with CI Guardian
468
- - **Self-Healing Validation**: `--fix` flag auto-repairs common issues
469
- - **Migration Auditor**: Version tracking and customization detection
470
- - **Prompt Engine**: Essential 7 library with clipboard integration
279
+ **CI Setup**: Ensure `fetch-depth: 0` in GitHub Actions to enable staleness detection.
471
280
 
472
281
  ---
473
282
 
474
- ## πŸ€– How to Work with AI Agents
475
-
476
- This repo is a **"Machine-Legible Project Constitution."** To get the best results:
283
+ ## CI/CD Integration
477
284
 
478
- ### 1. The Context Trigger
285
+ Add to `.github/workflows/validate.yml`:
479
286
 
480
- ```bash
481
- cortex-tms prompt init-session
482
- # Copies: "Review NEXT-TASKS.md, docs/core/ARCHITECTURE.md, and CLAUDE.md.
483
- # Summarize current priorities and propose a step-by-step plan..."
484
- ```
287
+ ```yaml
288
+ name: Cortex TMS Validation
485
289
 
486
- ### 2. Pattern Enforcement
290
+ on: [push, pull_request]
487
291
 
488
- ```bash
489
- cortex-tms prompt review
490
- # Copies: "Review the current changes against PATTERNS.md.
491
- # Flag any violations and suggest specific fixes."
292
+ jobs:
293
+ validate:
294
+ runs-on: ubuntu-latest
295
+ steps:
296
+ - uses: actions/checkout@v4
297
+ with:
298
+ fetch-depth: 0 # Required for staleness detection
299
+
300
+ - uses: actions/setup-node@v4
301
+ with:
302
+ node-version: '20'
303
+
304
+ - name: Validate TMS Health
305
+ run: npx cortex-tms@latest validate --strict
492
306
  ```
493
307
 
494
- ### 3. Truth Anchoring
495
-
496
- If the AI hallucinates logic:
497
-
498
- > _"Your calculation is wrong. Refer to the rules in docs/core/DOMAIN-LOGIC.md."_
499
-
500
- ### 4. Check Current Sprint
501
-
502
- ```bash
503
- cortex-tms status # Visual dashboard with current tasks
504
- ```
308
+ **Strict mode**: Warnings become errors, failing the build if:
309
+ - Governance docs are stale
310
+ - File size limits exceeded
311
+ - Mandatory files missing
312
+ - Placeholders not replaced
505
313
 
506
314
  ---
507
315
 
508
- ## πŸ“‹ Development Roadmap
509
-
510
- **Completed Phases** (All βœ…):
316
+ ## What's New in v4.0
511
317
 
512
- - [x] **Phase 1**: Dogfood the System - Applied TMS to Cortex itself
513
- - [x] **Phase 2**: Complete Template Library - All templates built and validated
514
- - [x] **Phase 3**: Build Example App - Gold Standard Next.js 15 Todo App
515
- - [x] **Phase 4**: Create CLI Tool - Full-featured CLI with 6 commands
516
- - [x] **Phase 5**: Documentation & Guides - Status dashboard, snippets, validation
517
- - [x] **Phase 6**: Publish & Scale - npm package + GitHub releases
318
+ **🎯 Strategic Repositioning**: Quality governance over token optimization
518
319
 
519
- **Current Version**: v2.6.1 "Guardian & Green Governance" βœ…
320
+ **Context**: Modern AI models handle large contexts and improved reasoning. The bottleneck shifted from "can AI see enough?" to "will AI stay aligned with project standards?"
520
321
 
521
- - βœ… Token Counter with real-time cost analysis
522
- - βœ… Guardian semantic validation (Pattern + Domain Logic enforcement)
523
- - βœ… 111 passing tests (96 unit + 15 integration)
524
- - βœ… Error handling refactor for better testability
525
- - βœ… Multi-model cost comparison (Claude, GPT-4)
322
+ ### New Features
526
323
 
527
- **Next Phase (v3.0)**: Development & Refinement
324
+ **Staleness Detection** (v4.0):
325
+ - βœ… Git-based freshness checks for governance docs
326
+ - βœ… Configurable thresholds (days + commit count)
327
+ - βœ… Per-doc watch directories
328
+ - βœ… Exclude merges, test-only, lockfile-only commits
329
+ - βœ… CI-ready (with `fetch-depth: 0`)
528
330
 
529
- - Website performance optimization
530
- - Guardian enhancements and reliability improvements
531
- - Migration experience improvements
532
- - Advanced token analytics
331
+ **Archive Command**:
332
+ - βœ… `cortex-tms archive` - Archive completed tasks
333
+ - βœ… Replaces deprecated `auto-tier` command
334
+ - βœ… Dry-run mode for previewing changes
533
335
 
534
- See `NEXT-TASKS.md` for current sprint details and `CHANGELOG.md` for full version history.
336
+ **Simplified Status**:
337
+ - βœ… Removed `--tokens` flag (streamlined to governance focus)
338
+ - βœ… Shows: project health, sprint progress, backlog
535
339
 
536
- ---
340
+ ### Breaking Changes
537
341
 
538
- ## πŸ—οΈ Project Structure
342
+ **Removed**:
343
+ - ❌ `cortex-tms status --tokens` flag
344
+ - ❌ Token counting and cost analysis features
539
345
 
540
- ```
541
- cortex-tms/
542
- β”œβ”€β”€ NEXT-TASKS.md # HOT: Current sprint
543
- β”œβ”€β”€ PROMPTS.md # HOT: AI interaction templates
544
- β”œβ”€β”€ FUTURE-ENHANCEMENTS.md # PLANNING: Backlog
545
- β”œβ”€β”€ CLAUDE.md # HOT: Workflow config
546
- β”œβ”€β”€ README.md # This file
547
- β”œβ”€β”€ .github/
548
- β”‚ └── copilot-instructions.md # HOT: AI guardrails
549
- β”œβ”€β”€ bin/ # CLI executable
550
- β”œβ”€β”€ src/ # CLI source code
551
- β”‚ β”œβ”€β”€ commands/ # CLI commands (init, validate, status, migrate, prompt, tutorial)
552
- β”‚ β”œβ”€β”€ utils/ # Template processing, validation, prompt parsing, backup
553
- β”‚ └── types/ # TypeScript definitions
554
- β”œβ”€β”€ templates/ # User-facing boilerplate
555
- β”‚ β”œβ”€β”€ NEXT-TASKS.md
556
- β”‚ β”œβ”€β”€ PROMPTS.md # Essential 7 prompt library
557
- β”‚ β”œβ”€β”€ CLAUDE.md
558
- β”‚ β”œβ”€β”€ .github/
559
- β”‚ β”‚ └── copilot-instructions.md
560
- β”‚ β”œβ”€β”€ vscode/
561
- β”‚ β”‚ └── tms.code-snippets # VS Code productivity snippets
562
- β”‚ └── docs/
563
- β”‚ β”œβ”€β”€ core/
564
- β”‚ β”‚ β”œβ”€β”€ ARCHITECTURE.md
565
- β”‚ β”‚ β”œβ”€β”€ PATTERNS.md
566
- β”‚ β”‚ β”œβ”€β”€ DOMAIN-LOGIC.md
567
- β”‚ β”‚ β”œβ”€β”€ GIT-STANDARDS.md
568
- β”‚ β”‚ β”œβ”€β”€ DECISIONS.md
569
- β”‚ β”‚ β”œβ”€β”€ GLOSSARY.md
570
- β”‚ β”‚ β”œβ”€β”€ SCHEMA.md
571
- β”‚ β”‚ └── TROUBLESHOOTING.md
572
- β”‚ └── archive/
573
- β”‚ └── v1.0-CHANGELOG.md
574
- β”œβ”€β”€ docs/ # Cortex TMS project documentation
575
- β”‚ β”œβ”€β”€ core/
576
- β”‚ └── archive/
577
- └── examples/ # Reference implementations
578
- └── todo-app/ # βœ… Gold Standard Next.js 15 App
579
- ```
580
-
581
- ---
346
+ **Deprecated**:
347
+ - ⚠️ `cortex-tms auto-tier` β†’ Use `cortex-tms archive` (still works with warning)
582
348
 
583
- ## πŸ§ͺ Validation: Dogfooding
349
+ **Migration**:
350
+ - Status command: Use `cortex-tms status` (no flags needed)
351
+ - Archive tasks: Use `cortex-tms archive` instead of `auto-tier`
584
352
 
585
- **This repository uses TMS to build itself.**
586
-
587
- - Cortex's own `NEXT-TASKS.md` tracks Cortex development
588
- - Cortex's own `docs/core/PATTERNS.md` documents template patterns
589
- - Cortex's own `PROMPTS.md` guides AI collaboration on Cortex
590
-
591
- **Validation Test**: "Can an AI agent working on Cortex find what it needs in < 3 file reads?" βœ…
353
+ See [CHANGELOG.md](CHANGELOG.md) for full version history.
592
354
 
593
355
  ---
594
356
 
595
- ## πŸ“š Key Documentation
357
+ ## When to Use Cortex TMS
596
358
 
597
- - **For AI Agents**: Read `.github/copilot-instructions.md` and `PROMPTS.md` first
598
- - **For Developers**: Read `docs/core/ARCHITECTURE.md` for system design
599
- - **For Contributors**: Read `docs/core/PATTERNS.md` for template patterns
600
- - **For Understanding**: Read `docs/core/DOMAIN-LOGIC.md` for TMS principles
359
+ ### βœ… Good Fit
601
360
 
602
- ---
361
+ - **Multi-file projects** - Complex codebases with established patterns
362
+ - **Team projects** - Multiple developers + AI agents need consistency
363
+ - **Long-running projects** - Documentation drift is a real risk
364
+ - **AI-heavy workflows** - Using Claude Code, Cursor, Copilot extensively
365
+ - **Quality-focused** - You value consistent code over speed
603
366
 
604
- ## 🀝 Contributing
367
+ ### ⚠️ Maybe Not
605
368
 
606
- We welcome contributions! Please read **[CONTRIBUTING.md](CONTRIBUTING.md)** for detailed guidelines on:
607
- - How to submit bug reports and feature requests
608
- - Development setup and workflow
609
- - Pull request process and quality standards
610
- - Code style and testing requirements
611
- - Areas where we need help
369
+ - **Single-file projects** - Overhead may outweigh benefits
370
+ - **Throwaway prototypes** - Documentation governance not worth setup time
371
+ - **Solo dev, simple project** - Mental model may be sufficient
372
+ - **Pure exploration** - Constraints may slow discovery
612
373
 
613
- **Quick Start for Contributors**:
614
- 1. Read [CONTRIBUTING.md](CONTRIBUTING.md) - **Required for all contributions**
615
- 2. Check [open issues](https://github.com/cortex-tms/cortex-tms/issues) for `good-first-issue` labels
616
- 3. For significant changes, open an issue for discussion **before** coding
617
- 4. Follow patterns in `docs/core/PATTERNS.md`
618
- 5. Ensure tests pass: `npm test`
619
- 6. Submit PR with clear description and linked issue
374
+ **Start simple**: Use `--scope nano` for minimal setup, expand as needed.
620
375
 
621
376
  ---
622
377
 
623
- ## πŸ“– Learn More
378
+ ## Developer Experience
624
379
 
625
- - **Release Notes**: See `CHANGELOG.md` for version history
626
- - **Architecture**: See `docs/core/ARCHITECTURE.md` for system design
627
- - **Decisions**: See `docs/core/DECISIONS.md` for ADRs
628
- - **Glossary**: See `docs/core/GLOSSARY.md` for terminology
629
- - **Patterns**: See `docs/core/PATTERNS.md` for implementation examples
380
+ - **Instant Setup**: `npx cortex-tms init` - 60 seconds to governance docs
381
+ - **Zero Config**: Works out of the box with sensible defaults
382
+ - **CI Ready**: GitHub Actions templates included
383
+ - **Production Grade**: 316 tests (97% pass rate), enterprise-grade security (v3.2)
384
+ - **Open Source**: MIT license, community-driven
630
385
 
631
- ---
386
+ **Tested With**: Claude Code, GitHub Copilot (in VS Code). Architecture supports any AI tool.
632
387
 
633
- ## 🎯 Why Cortex TMS? Three Pillars, Measurable Results
634
-
635
- **Based on 47 development sessions on Cortex TMS itself (TypeScript monorepo) using Claude Code and GitHub Copilot with various models. Your results may vary.**
636
-
637
- ### πŸ’° Cost Efficiency (Pillar 1) - Input Token Reduction
638
-
639
- **Before TMS**: AI reads entire repository (66,834 tokens in our case)
640
- **After TMS**: AI reads focused context (3,647 tokensβ€”60-70% reduction)
641
- **Impact**:
642
- - **Paid models** (tested: Claude, GPT-4): ~60-70% lower API costs
643
- - **Free/local models** (untested, but architecturally supported): Should see ~60-70% less compute/electricity
644
- - **Universal benefit**: Input token reduction works with any AI tool
645
-
646
- **How**: HOT/WARM/COLD tiers ensure AI only reads what matters (3,647 vs 66,834 tokens measured on our project with Claude/GPT)
647
-
648
- ### βœ… Quality (Pillar 2) - Focused Context Means Fewer Hallucinations
649
-
650
- **Before TMS**: AI reads thousands of outdated lines, leading to pattern violations
651
- **After TMS**: AI reads focused, current contextβ€”fewer mistakes from irrelevant information
652
- **Impact**: Guardian enforces `PATTERNS.md` and `DOMAIN-LOGIC.md` automatically
653
-
654
- **How**: LLM-powered semantic review catches drift that grep/regex can't find
655
-
656
- ### 🌱 Sustainability (Pillar 3) - Greener Development Through Efficiency
657
-
658
- **Before TMS**: Burning GPU cycles on archived changelogs and stale tasks
659
- **After TMS**: 60-70% lower compute requirements through intelligent tiering
660
- **Impact**: Less compute = lower electricity costs + greener development
661
- - Especially important for free/local models where YOU pay the electricity bill
662
-
663
- **How**: Stop reading COLD files unless explicitly needed
388
+ ---
664
389
 
665
- ### πŸš€ Developer Experience
390
+ ## Community & Support
666
391
 
667
- - **Instant AI Activation**: Essential 7 prompts in `PROMPTS.md` (no manual prompt writing)
668
- - **Signal over Noise**: HOT/WARM/COLD system keeps AI focused
669
- - **Production-Ready**: 316 tests (97% pass rate), enterprise-grade security (v3.2)
670
- - **Tested With**: Claude Code, GitHub Copilot (in VS Code). Architecture supports any AI tool (Cursor, etc.).
392
+ ### Get Help
671
393
 
672
- ---
394
+ - **[GitHub Discussions](https://github.com/cortex-tms/cortex-tms/discussions)** - Ask questions, share ideas
395
+ - [Q&A](https://github.com/cortex-tms/cortex-tms/discussions/categories/q-a) - Get help from community
396
+ - [Ideas](https://github.com/cortex-tms/cortex-tms/discussions/categories/ideas) - Suggest features
397
+ - [Show and Tell](https://github.com/cortex-tms/cortex-tms/discussions/categories/show-and-tell) - Share projects
673
398
 
674
- ## πŸ”’ Security
399
+ ### Report Issues
675
400
 
676
- Cortex TMS implements enterprise-grade security practices:
401
+ - **[Bug Reports](https://github.com/cortex-tms/cortex-tms/issues/new)** - Found a bug? Let us know
402
+ - **[Security Issues](https://github.com/cortex-tms/cortex-tms/security/advisories/new)** - Responsible disclosure
677
403
 
678
- - **API Key Protection**: Guardian automatically sanitizes API keys in all output (errors, logs, console)
679
- - **Input Validation**: All CLI commands use Zod schemas for runtime type safety
680
- - **Path Security**: Template operations protected against directory traversal attacks
681
- - **Automated Scanning**: CI pipeline includes `pnpm audit` to catch dependency vulnerabilities
404
+ ### Contributing
682
405
 
683
- **Documentation**:
684
- - [Security Overview](docs/core/SECURITY.md) β€” Threat model, mitigations, and best practices
685
- - [Security Testing Guide](docs/guides/SECURITY-TESTING.md) β€” How to verify security patterns
686
- - [Security Patterns](docs/core/PATTERNS.md) β€” Implementation patterns (Error Handling, Input Validation)
406
+ - **[Contributing Guide](CONTRIBUTING.md)** - How to contribute
407
+ - **[Community Guide](docs/COMMUNITY.md)** - Community guidelines
687
408
 
688
- **Reporting Vulnerabilities**: Use [GitHub Security Advisories](https://github.com/cortex-tms/cortex-tms/security/advisories/new) for responsible disclosure.
409
+ **Star us on GitHub** ⭐ if Cortex TMS helps your AI development workflow!
689
410
 
690
411
  ---
691
412
 
692
- ## πŸ’¬ Community & Support
693
-
694
- We have an active and growing community! ⭐ **146 stars** and counting.
413
+ ## Roadmap
695
414
 
696
- ### Get Help & Connect
697
- - **[GitHub Discussions](https://github.com/cortex-tms/cortex-tms/discussions)** - Ask questions, share ideas, showcase projects
698
- - [Q&A](https://github.com/cortex-tms/cortex-tms/discussions/categories/q-a) - Get help from the community
699
- - [Ideas](https://github.com/cortex-tms/cortex-tms/discussions/categories/ideas) - Suggest features (vote with πŸ‘)
700
- - [Show and Tell](https://github.com/cortex-tms/cortex-tms/discussions/categories/show-and-tell) - Share what you've built
701
- - [Announcements](https://github.com/cortex-tms/cortex-tms/discussions/categories/announcements) - Release notes and updates
415
+ **v4.0** (Current - Feb 2026):
416
+ - βœ… Staleness detection (git-based, v1)
417
+ - βœ… Archive command
418
+ - βœ… Validation-first positioning
419
+ - βœ… Token claims removed
702
420
 
703
- ### Report Issues
704
- - **[Bug Reports](https://github.com/cortex-tms/cortex-tms/issues/new)** - Found a bug? Let us know!
705
- - **[Security Issues](https://github.com/cortex-tms/cortex-tms/security/advisories/new)** - Responsible disclosure for security vulnerabilities
421
+ **v4.1** (Planned - Mar 2026):
422
+ - πŸ”„ Git hooks integration (`cortex-tms hooks install`)
423
+ - πŸ”„ Staleness v2 (improved heuristics, fewer false positives)
424
+ - πŸ”„ Incremental doc updates
706
425
 
707
- ### Contributing
708
- - **[Contributing Guide](CONTRIBUTING.md)** - How to contribute code, docs, or ideas
709
- - **[Community Guide](docs/COMMUNITY.md)** - Community guidelines and best practices
426
+ **v4.2+** (Future):
427
+ - πŸ“‹ MCP Server (expose docs to any AI tool)
428
+ - πŸ“‹ Multi-tool config generation (.cursorrules, .windsurfrules)
429
+ - πŸ“‹ Skills integration
710
430
 
711
- **Star us on GitHub** ⭐ if you find Cortex TMS useful!
431
+ See [FUTURE-ENHANCEMENTS.md](FUTURE-ENHANCEMENTS.md) for full roadmap.
712
432
 
713
433
  ---
714
434
 
715
435
  ## License
716
436
 
717
- MIT
437
+ MIT - See [LICENSE](LICENSE) for details
718
438
 
719
439
  ---
720
440
 
721
441
  ## Status
722
442
 
723
- **Version**: 3.2.0 (Upcoming - Phase 1 Complete)
724
- **Last Updated**: 2026-01-31
725
- **Current Sprint**: v3.2 - "Security Hardening + Production Readiness"
726
- **Recent Sprints**: v3.1 (Git-Based Auto-Tiering), v3.0 (AI-Powered Onboarding) β€” see [docs/archive/](docs/archive/)
443
+ **Version**: 4.0.0
444
+ **Last Updated**: 2026-02-21
445
+ **Current Sprint**: v4.0 - "Quality Governance & Staleness Detection"
727
446
 
728
- <!-- @cortex-tms-version 3.2.0 -->
447
+ <!-- @cortex-tms-version 4.0.0 -->