https://github.com/cortex-tms/cortex-tms
The Universal AI-Optimized Project Boilerplate. A Tiered Memory System (TMS) designed to maximize AI agent performance. Includes an interactive CLI tool and a high-signal documentation standard.
https://github.com/cortex-tms/cortex-tms
ai anthropic architecture best-practices claude-code cli code-generation cursor developer-experience developer-tools devtools documentation github-copilot governance llm project-scaffolding task-management typescipt version-control workflow-automation
Last synced: about 22 hours ago
JSON representation
The Universal AI-Optimized Project Boilerplate. A Tiered Memory System (TMS) designed to maximize AI agent performance. Includes an interactive CLI tool and a high-signal documentation standard.
- Host: GitHub
- URL: https://github.com/cortex-tms/cortex-tms
- Owner: cortex-tms
- License: mit
- Created: 2026-01-11T05:54:18.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2026-02-02T23:24:19.000Z (19 days ago)
- Last Synced: 2026-02-02T23:31:39.536Z (19 days ago)
- Topics: ai, anthropic, architecture, best-practices, claude-code, cli, code-generation, cursor, developer-experience, developer-tools, devtools, documentation, github-copilot, governance, llm, project-scaffolding, task-management, typescipt, version-control, workflow-automation
- Language: MDX
- Homepage: https://cortex-tms.org/
- Size: 4.55 MB
- Stars: 150
- Watchers: 2
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
Cortex TMS
Documentation Governance for AI Coding Agents
β 166+ GitHub Stars | Open source, community-driven
[](https://www.npmjs.com/package/cortex-tms)
[](https://www.npmjs.com/package/cortex-tms)
[](https://github.com/cortex-tms/cortex-tms/blob/main/LICENSE)
[](https://nodejs.org)
[](https://github.com/cortex-tms/cortex-tms/stargazers)
---
## What is Cortex TMS?
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.
**The Challenge**: Modern AI agents (Claude Opus 4.6, GPT-4, etc.) handle large context windows and can work autonomouslyβbut without governance, they drift from your standards, overengineer solutions, and write inconsistent code.
**The Solution**: Cortex TMS provides:
- π **Documentation scaffolding** - Templates for PATTERNS.md, ARCHITECTURE.md, CLAUDE.md
- β
**Staleness detection** - Detects when governance docs go stale relative to code changes (v4.0)
- π **Structure validation** - Automated health checks in CI or locally
- π¦ **Archive management** - Keep task lists focused and maintainable
---
## Three Pillars
### 1. π Consistency - Document Your Standards
Scaffold governance docs that AI agents actually read:
- `PATTERNS.md` - Code patterns and conventions
- `CLAUDE.md` - Agent workflow rules (git protocol, scope discipline, human approval gates)
- `ARCHITECTURE.md` - System design and tech stack
- `DOMAIN-LOGIC.md` - Business rules and constraints
**Result**: AI writes code that follows YOUR patterns, not random conventions from its training data.
### 2. π Freshness - Detect Staleness
New in v4.0: Git-based staleness detection catches when docs go stale:
```bash
cortex-tms validate
β οΈ Doc Staleness
PATTERNS.md may be outdated
Doc is 45 days older than code with 12 meaningful commits
Code: 2026-02-20
Doc: 2026-01-06
Review docs/core/PATTERNS.md to ensure it reflects current codebase
```
**How it works**: Compares doc modification dates vs code commit activity. Flags stale docs before they mislead AI agents.
**Note**: Staleness v1 uses git timestamps (temporal comparison only). Cannot detect semantic misalignment. Future versions will add semantic analysis.
### 3. π‘οΈ Safety - Human Oversight
`CLAUDE.md` governance rules require human approval for critical operations:
- Git commits/pushes require approval
- Scope discipline prevents overengineering
- Pattern adherence enforced through validation
**Result**: AI agents stay powerful but don't run wild.
---
## What Cortex Does (and Doesn't Do)
### β
What Cortex Does
- **Scaffolds governance docs** - Templates for common project documentation
- **Validates doc health** - Checks structure, freshness, completeness
- **Detects staleness** - Flags when docs are outdated relative to code (v4.0)
- **Enforces size limits** - Keeps docs focused and scannable
- **Archives completed tasks** - Maintains clean NEXT-TASKS.md
- **Works in CI/CD** - GitHub Actions validation templates included
### β What Cortex Does NOT Do
- **Not a token optimizer** - Modern models (200K+ contexts) make this less relevant
- **Not code enforcement** - Validates DOCUMENTATION health, not code directly
- **Not a replacement for code review** - Complements human review, doesn't replace it
- **Not semantic analysis (yet)** - Staleness v1 uses timestamps, not AI-powered diff analysis
---
## Quick Start
```bash
# Initialize governance docs in your project
npx cortex-tms@latest init
# Validate doc health (including staleness detection)
npx cortex-tms@latest validate
# Strict mode (warnings = errors, for CI)
npx cortex-tms@latest validate --strict
# Check project status
npx cortex-tms@latest status
# Archive completed tasks
npx cortex-tms@latest archive --dry-run
```
**Installation**: No installation required with `npx`. For frequent use: `npm install -g cortex-tms@latest`
---
## CLI Commands
### `cortex-tms init`
Scaffold TMS documentation structure with interactive scope selection.
```bash
cortex-tms init # Interactive mode
cortex-tms init --scope standard # Non-interactive
cortex-tms init --dry-run # Preview changes
```
### `cortex-tms validate`
Verify project TMS health with automated checks.
```bash
cortex-tms validate # Check project health
cortex-tms validate --fix # Auto-repair missing files
cortex-tms validate --strict # Strict mode (warnings = errors)
```
**What it checks:**
- β
Mandatory files exist (NEXT-TASKS.md, CLAUDE.md, copilot-instructions.md)
- β
File size limits (Rule 4: HOT files < 200 lines)
- β
Placeholder completion (no `[Project Name]` markers left)
- β
Archive status (completed tasks should be archived)
- β
**Doc staleness** (NEW in v4.0) - governance docs current with code
### `cortex-tms status`
Project cockpit with health dashboard and sprint progress.
```bash
cortex-tms status # Visual dashboard with progress bars
```
Shows:
- Project identity (name, scope, TMS version)
- Health status (validation checks passed/failed)
- Sprint progress (current tasks, completion %)
- Backlog size (future enhancements)
### `cortex-tms archive`
Archive completed tasks and old content.
```bash
cortex-tms archive # Archive completed tasks
cortex-tms archive --dry-run # Preview what would be archived
```
Archives completed tasks from NEXT-TASKS.md to `docs/archive/` with timestamp.
**Note**: `cortex-tms auto-tier` is deprecatedβuse `archive` instead.
### `cortex-tms migrate`
Intelligent version managementβdetect outdated templates and upgrade safely.
```bash
cortex-tms migrate # Analyze version status
cortex-tms migrate --apply # Auto-upgrade OUTDATED files
cortex-tms migrate --rollback # Restore from backup
```
### `cortex-tms prompt`
Access project-aware AI prompts from the Essential 7 library.
```bash
cortex-tms prompt # Interactive selection
cortex-tms prompt init-session # Auto-copies to clipboard
```
### `cortex-tms review` π‘οΈ
Guardian: AI-powered semantic validation against project patterns.
```bash
cortex-tms review src/index.ts # Validate against PATTERNS.md
cortex-tms review src/index.ts --safe # High-confidence violations only
```
### `cortex-tms tutorial`
Interactive walkthrough teaching the Cortex Way.
```bash
cortex-tms tutorial # 5-lesson guided tour (~15 minutes)
```
---
## Documentation Structure
| Folder / File | Purpose | Tier |
| :-------------------------------- | :------------------------------------- | :------------------------ |
| `NEXT-TASKS.md` | Active sprint and current focus | **HOT** (Always Read) |
| `PROMPTS.md` | AI interaction templates (Essential 7) | **HOT** (Always Read) |
| `CLAUDE.md` | CLI commands & workflow config | **HOT** (Always Read) |
| `.github/copilot-instructions.md` | Global guardrails and critical rules | **HOT** (Always Read) |
| `FUTURE-ENHANCEMENTS.md` | Living backlog (not current sprint) | **PLANNING** |
| `docs/core/ARCHITECTURE.md` | System design & tech stack | **WARM** (Read on Demand) |
| `docs/core/PATTERNS.md` | Canonical code examples (Do/Don't) | **WARM** (Read on Demand) |
| `docs/core/DOMAIN-LOGIC.md` | Immutable project rules | **WARM** (Read on Demand) |
| `docs/core/GIT-STANDARDS.md` | Git & PM conventions | **WARM** (Read on Demand) |
| `docs/core/DECISIONS.md` | Architecture Decision Records | **WARM** (Read on Demand) |
| `docs/core/GLOSSARY.md` | Project terminology | **WARM** (Read on Demand) |
| `docs/archive/` | Historical changelogs | **COLD** (Ignore) |
**HOT/WARM/COLD System**: Organizes docs by access frequency (not token optimization). Helps AI find what's relevant for each task.
---
## Staleness Detection Configuration
Configure staleness thresholds in `.cortexrc`:
```json
{
"version": "4.0.0",
"scope": "standard",
"staleness": {
"enabled": true,
"thresholdDays": 30,
"minCommits": 3,
"docs": {
"docs/core/PATTERNS.md": ["src/"],
"docs/core/ARCHITECTURE.md": ["src/", "infrastructure/"],
"docs/core/DOMAIN-LOGIC.md": ["src/"]
}
}
}
```
**How it works**:
- Compares doc last modified date vs code commit activity
- Flags stale if: `daysSinceDocUpdate > thresholdDays AND meaningfulCommits >= minCommits`
- Excludes merge commits, test-only changes, lockfile-only changes
**Limitations (v1)**:
- Temporal comparison only (git timestamps)
- Cannot detect semantic misalignment
- Requires full git history (not shallow clones)
**CI Setup**: Ensure `fetch-depth: 0` in GitHub Actions to enable staleness detection.
---
## CI/CD Integration
Add to `.github/workflows/validate.yml`:
```yaml
name: Cortex TMS Validation
on: [push, pull_request]
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Required for staleness detection
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Validate TMS Health
run: npx cortex-tms@latest validate --strict
```
**Strict mode**: Warnings become errors, failing the build if:
- Governance docs are stale
- File size limits exceeded
- Mandatory files missing
- Placeholders not replaced
---
## What's New in v4.0
**π― Strategic Repositioning**: Quality governance over token optimization
**Context**: Modern AI models (GPT-4, Claude Opus 4.6) now handle large contexts (200K+ tokens). The bottleneck shifted from "can AI see enough?" to "will AI stay aligned with project standards?"
### New Features
**Staleness Detection** (v4.0):
- β
Git-based freshness checks for governance docs
- β
Configurable thresholds (days + commit count)
- β
Per-doc watch directories
- β
Exclude merges, test-only, lockfile-only commits
- β
CI-ready (with `fetch-depth: 0`)
**Archive Command**:
- β
`cortex-tms archive` - Archive completed tasks
- β
Replaces deprecated `auto-tier` command
- β
Dry-run mode for previewing changes
**Simplified Status**:
- β
Removed `--tokens` flag (streamlined to governance focus)
- β
Shows: project health, sprint progress, backlog
### Breaking Changes
**Removed**:
- β `cortex-tms status --tokens` flag
- β Token counting and cost analysis features
**Deprecated**:
- β οΈ `cortex-tms auto-tier` β Use `cortex-tms archive` (still works with warning)
**Migration**:
- Status command: Use `cortex-tms status` (no flags needed)
- Archive tasks: Use `cortex-tms archive` instead of `auto-tier`
See [CHANGELOG.md](CHANGELOG.md) for full version history.
---
## When to Use Cortex TMS
### β
Good Fit
- **Multi-file projects** - Complex codebases with established patterns
- **Team projects** - Multiple developers + AI agents need consistency
- **Long-running projects** - Documentation drift is a real risk
- **AI-heavy workflows** - Using Claude Code, Cursor, Copilot extensively
- **Quality-focused** - You value consistent code over speed
### β οΈ Maybe Not
- **Single-file projects** - Overhead may outweigh benefits
- **Throwaway prototypes** - Documentation governance not worth setup time
- **Solo dev, simple project** - Mental model may be sufficient
- **Pure exploration** - Constraints may slow discovery
**Start simple**: Use `--scope nano` for minimal setup, expand as needed.
---
## Developer Experience
- **Instant Setup**: `npx cortex-tms init` - 60 seconds to governance docs
- **Zero Config**: Works out of the box with sensible defaults
- **CI Ready**: GitHub Actions templates included
- **Production Grade**: 316 tests (97% pass rate), enterprise-grade security (v3.2)
- **Open Source**: MIT license, community-driven
**Tested With**: Claude Code, GitHub Copilot (in VS Code). Architecture supports any AI tool.
---
## Community & Support
### Get Help
- **[GitHub Discussions](https://github.com/cortex-tms/cortex-tms/discussions)** - Ask questions, share ideas
- [Q&A](https://github.com/cortex-tms/cortex-tms/discussions/categories/q-a) - Get help from community
- [Ideas](https://github.com/cortex-tms/cortex-tms/discussions/categories/ideas) - Suggest features
- [Show and Tell](https://github.com/cortex-tms/cortex-tms/discussions/categories/show-and-tell) - Share projects
### Report Issues
- **[Bug Reports](https://github.com/cortex-tms/cortex-tms/issues/new)** - Found a bug? Let us know
- **[Security Issues](https://github.com/cortex-tms/cortex-tms/security/advisories/new)** - Responsible disclosure
### Contributing
- **[Contributing Guide](CONTRIBUTING.md)** - How to contribute
- **[Community Guide](docs/COMMUNITY.md)** - Community guidelines
**Star us on GitHub** β if Cortex TMS helps your AI development workflow!
---
## Roadmap
**v4.0** (Current - Feb 2026):
- β
Staleness detection (git-based, v1)
- β
Archive command
- β
Validation-first positioning
- β
Token claims removed
**v4.1** (Planned - Mar 2026):
- π Git hooks integration (`cortex-tms hooks install`)
- π Staleness v2 (improved heuristics, fewer false positives)
- π Incremental doc updates
**v4.2+** (Future):
- π MCP Server (expose docs to any AI tool)
- π Multi-tool config generation (.cursorrules, .windsurfrules)
- π Skills integration
See [FUTURE-ENHANCEMENTS.md](FUTURE-ENHANCEMENTS.md) for full roadmap.
---
## License
MIT - See [LICENSE](LICENSE) for details
---
## Status
**Version**: 4.0.0 (In Development)
**Last Updated**: 2026-02-21
**Current Sprint**: v4.0 - "Quality Governance & Staleness Detection"