Modern codebases have a knowledge problem. Commit messages record what changed. PRs explain why at that moment. But over time, the reasoning behind architectural choices, constraints, and active plans disappears into history.
AI agents have the same problem — they can read your code but they can't read your mind. They don't know that the auth middleware is being rewritten for compliance reasons, that the listing limit exists because of a vendor contract, or that you're mid-way through a multi-sprint migration.
Intent solves this by making reasoning a first-class commit artifact — committed alongside the code it documents:
git add src/auth/middleware.ts .intent/plans/auth-rewrite.md
git commit -m "Refactor auth middleware for session token compliance"Intent lives inside your repository as a .intent/ directory and tracks the why behind code: plans, architectural decisions, constraints, and system context. It's designed to be read by both humans and AI agents.
Git already tracks what changed. Intent tracks why it changed.
Directory structure.intent/
intent.json ← project config
plans/ ← active and historical plans
decisions/ ← architectural decision records (ADRs)
systems/ ← system / domain definitions
constraints/ ← hard and soft constraints
links/ ← auto-generated index (never edit manually)
index.jsonThe links/ directory is auto-generated and git-ignored. Everything else is plain markdown — readable without any tooling, versioned alongside code, present in every clone.
Intent is a TypeScript monorepo published as five npm packages. Install the meta-package to get everything, or install pieces individually.
@dev-sixbyfive/intentMeta-package. Installs both the CLI and the MCP server in one command. The recommended install for most projects.
@dev-sixbyfive/intent-schemasZod schemas and TypeScript types for all document formats. The shared type contract used by core, CLI, and MCP. Use this if you're building tooling on top of the .intent/ format.
@dev-sixbyfive/intent-coreAll .intent/ file I/O, parsing, validation, git integration, and context management. Returns Result<T, IntentError> throughout — no silent failures. Not typically installed directly.
@dev-sixbyfive/intent-cliCommander.js CLI. A thin command layer — all business logic lives in core. Install directly if you only need the CLI and not the MCP server.
@dev-sixbyfive/intent-mcpMCP server exposing 11 Intent tools via stdio. Configure once in your AI agent and it has access to your repository's full reasoning context. Install directly if you only need the server.
Dependency rule: schemas → core → cli / mcp. Core never imports CLI. Schemas never import core. All business logic belongs in core, not in command handlers.
Install
# Recommended: installs CLI + MCP server in one go
npm install -g @dev-sixbyfive/intent
# Or with pnpm
pnpm add -g @dev-sixbyfive/intent
# CLI only
npm install -g @dev-sixbyfive/intent-cli
# MCP server only
npm install -g @dev-sixbyfive/intent-mcpRequirements: Node 18+, must be run inside a git repository.
Initialise a repository
cd your-project
intent init
# Creates .intent/ with intent.json and all subdirectories
# Adds .intent/links/ to .gitignoreCreate a plan
intent plan create auth-rewrite --title "Auth middleware rewrite" --system authRecord an architectural decision
intent decision add --title "Use short-lived JWTs over session tokens" --system auth
# Auto-increments the ID: DEC-0001, DEC-0002, …Review what intent context applies to your current diff
git add src/auth/
intent review-diff
# Cross-references changed files against the links index
# Surfaces only plans and decisions relevant to this commitConfigure the MCP server (Claude Code)
Add to .claude/settings.json in your project, or ~/.claude/settings.json globally:
{
"mcpServers": {
"intent": {
"command": "npx",
"args": ["@dev-sixbyfive/intent-mcp"]
}
}
}Every .intent/ file uses hybrid frontmatter markdown: structured YAML frontmatter for machine-readable metadata, free-form markdown body for human reasoning. No editor dependency — valid markdown in any viewer.
Plan — .intent/plans/plan-*.md
Captures an active or completed development initiative: what's being built, which system it belongs to, which decisions apply. Plans are the "now" of Intent — what's in flight.
---
id: plan-auth-rewrite
title: Auth middleware rewrite
type: plan
status: active # draft | active | archived | superseded
created: 2024-01-15T09:00:00Z
updated: 2024-01-15T09:00:00Z
system: auth
decisions: [DEC-0001]
constraints: []
tags: [security, compliance]
---
## Goal
Replace the legacy session token middleware with short-lived JWTs.
## Reason
Legal flagged the current session token storage as non-compliant
with the new data residency requirements. Must be resolved before Q2 audit.
## Rules
- Tokens must expire in 15 minutes
- Refresh tokens stored in httpOnly cookies only
- No token data written to application logsDecision — .intent/decisions/DEC-NNNN.md
Architectural Decision Records. Each decision is a permanent record of a choice and its reasoning — including alternatives considered and consequences. IDs are auto-incremented.
---
id: DEC-0001
title: Use short-lived JWTs over session tokens
type: decision
status: active # draft | active | archived | superseded
created: 2024-01-15T09:00:00Z
updated: 2024-01-15T09:00:00Z
system: auth
plans: [plan-auth-rewrite]
tags: [security]
---
## Context
We need to replace the current session token approach. Options were:
opaque session tokens (existing), short-lived JWTs, or a
third-party auth provider.
## Decision
Short-lived JWTs (15 min) with httpOnly refresh tokens.
## Consequences
- Stateless auth — no session store required
- Must implement token refresh flow on the client
- All services need to validate JWTs independentlySystem — .intent/systems/sys-*.md
Domain or service definitions. Groups plans and decisions by architectural boundary. Systems have no status — they're always active as long as the domain exists.
---
id: sys-auth
title: Auth system
type: system
created: 2024-01-10T09:00:00Z
updated: 2024-01-15T09:00:00Z
plans: [plan-auth-rewrite]
decisions: [DEC-0001]
tags: [security]
---
Session management, token issuance, and access control.
Shared by the web platform and the mobile app.Constraint — .intent/constraints/CON-NNNN.md
Hard and soft constraints that affect architectural choices — compliance requirements, infrastructure limits, contractual obligations. Referenced from plans and decisions to make dependencies explicit.
---
id: CON-0001
title: No token data written to application logs
type: constraint
severity: hard # hard | soft
created: 2024-01-10T09:00:00Z
updated: 2024-01-10T09:00:00Z
system: auth
plans: [plan-auth-rewrite]
tags: [security, compliance]
---
Tokens, refresh tokens, and session identifiers must never
appear in application log output. Compliance requirement.All commands accept --help for detailed usage.
intent initInitialise Intent in a git repository. Creates .intent/ structure and intent.json config.--project <name>Explicit project name (defaults to repo name).--forceReinitialise an existing .intent/ directory.intent plan create <name>Create a new plan at .intent/plans/<name>.md with a structured template.--title <t>Plan title.--system <s>Assign to a system.--status <s>Initial status (default: active).intent plan update <name>Update a plan's status or title without editing the file directly.--status <s>New status: draft | active | archived | superseded.--title <t>New title.intent plan listList all plans with status, system, and last-updated.intent decision addRecord an architectural decision. IDs auto-increment: DEC-0001, DEC-0002, …--title <t>Decision title.--system <s>Assign to a system.intent decision update <id>Update a decision's status or title.--status <s>New status: draft | active | archived | superseded.--title <t>New title.intent decision listList all decisions with status and supersession relationships.intent system create <name>Create a system definition at .intent/systems/<name>.md.--title <t>System title.intent system listList all systems.intent constraint addRecord a constraint. IDs auto-increment: CON-0001, CON-0002, …--title <t>Constraint title.--severity <s>hard or soft.--system <s>Assign to a system.intent constraint listList all constraints.intent context [system]Show all intent context for the project. Pass a system name to filter.intent review-diffShow intent context relevant to the current git diff — the highest-value command. Cross-references changed files against the links index and surfaces only what applies to this commit.--allInclude staged + unstaged changes (default: staged only).--base <ref>Diff against a branch or commit instead (CI mode).intent linkRebuild the .intent/links/index.json index. Run after adding or editing .intent/ files to keep review-diff results accurate.intent validateValidate all .intent/ files and check referential integrity. Exits 0 if valid, 1 if there are errors. Pipe into CI.--errors-onlySuppress warnings, show errors only.intent statusHealth overview: plan/decision/system counts, active and draft plans, links index freshness, and validation summary.intent export <target>Export intent context as a formatted markdown block into the config file your editor or AI tool reads automatically. Updates in place on subsequent runs using intent-context markers.claudeWrite to CLAUDE.md.cursorWrite to .cursor/rules.copilotWrite to .github/copilot-instructions.md.--system <s>Filter export to a single system.intent agent prepare [task]Keyword-score all plans, decisions, and systems against a task description and return the most relevant context. Falls back to full context when no task is given.--hookEmit JSON on stdout — for Claude Code hooks that inject context into the system prompt.intent agent reviewReview the current diff against documented intent and validate all files. In interactive mode, prompts you to write a draft decision if unlinked changes are detected.--base <ref>Review against a branch (CI mode).--unstagedInclude unstaged changes.--hookJSON output + exit code for CI / hooks.Configure @dev-sixbyfive/intent-mcp once and every AI agent session has access to your repository's full reasoning layer.
All tools accept an optional cwd parameter. When omitted, the tool uses the process working directory — which is usually the project root and therefore correct automatically.
Claude Code
Add to .claude/settings.json (project) or ~/.claude/settings.json (global):
{
"mcpServers": {
"intent": {
"command": "npx",
"args": ["@dev-sixbyfive/intent-mcp"]
}
}
}Cursor
Add to .cursor/mcp.json in your project:
{
"mcpServers": {
"intent": {
"command": "npx",
"args": ["@dev-sixbyfive/intent-mcp"]
}
}
}OpenAI Codex CLI
# ~/.codex/config.yaml
mcpServers:
intent:
command: npx
args:
- "@dev-sixbyfive/intent-mcp"ChatGPT desktop
Add to %APPDATA%\ChatGPT\mcp.json on Windows, or ~/Library/Application Support/ChatGPT/mcp.json on Mac:
{
"mcpServers": {
"intent": {
"command": "npx",
"args": ["@dev-sixbyfive/intent-mcp"]
}
}
}intent_context(cwd?, system?)Get all plans, decisions, and systems. Pass system to filter to a single domain.
intent_review_diff(cwd?, staged?, base?)Get intent context relevant to the current git diff. Set staged: true for staged-only; pass base to diff against a branch.
intent_list_plans(cwd?)List all plans with status and metadata.
intent_list_decisions(cwd?)List all decisions with status and supersession relationships.
intent_list_systems(cwd?)List all system definitions.
intent_rebuild_links(cwd?)Rebuild the links index after manual edits or branch merges.
intent_validate(cwd?)Validate all documents for schema correctness and broken cross-references. Returns a structured error list.
intent_status(cwd?)Health overview: counts by type, active plans, validation summary, and links index state.
intent_agent_prepare(cwd?, task)Keyword-score context for relevance to a task and return the most applicable items. Use before starting non-trivial implementation.
intent_agent_review(cwd?, staged?, base?)Review the diff against documented intent. Flags undocumented decisions and schema violations. Returns suggestDecision signal.
intent_export(cwd?, system?, target)Export context as markdown or write to IDE config files (claude, cursor, copilot).
Example agent workflow
User: Implement the vendor listing limit
Agent calls: intent_agent_prepare "implement vendor listing limit"
→ scores plans/decisions by keyword relevance
→ returns plan-subscriptions, DEC-0007 (listing constraints),
sys-marketplace
Agent implements accordingly — without asking the user to
re-explain the plan or constraints
Agent calls: intent_agent_review (after making changes)
→ changes covered by plan-subscriptions ✓
→ all files valid ✓
→ suggestDecision: false (changes were already linked)Intent includes a GitHub Action that automatically posts relevant context as a PR comment — surfacing applicable plans and decisions to reviewers without anyone having to look them up.
# .github/workflows/intent-pr.yml
name: Intent PR Context
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
intent:
name: Post intent context
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: SixByFive/intent/.github/actions/intent-pr@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
base-ref: origin/${{ github.base_ref }}When a PR is opened or updated, the action runs intent review-diff --base origin/<base-branch> against the diff, posts a comment with all relevant plans, decisions, and systems, and updates that comment on subsequent pushes. If no related context exists, no comment is posted.
Wiring intent agent review into Claude Code hooks
Automatically inject relevant context before every tool call by adding this to .claude/settings.json:
{
"hooks": {
"PreToolUse": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "intent agent prepare --hook"
}
]
}
]
}
}Worth being explicit: