Skip to content

Commit 56ea5e5

Browse files
committed
feat: Implement RFC-0015 Primer System Redesign
Major features: - 4-tier primer system (micro, minimal, standard, full) with budget-based selection - New `acp context` command with create/modify/debug/explore operations - IDE environment detection (Cursor, VS Code, Cline, JetBrains, Zed) - Foundation prompt support with --standalone flag - Naming convention detection per directory with confidence scoring - Import tracking (imported_by field) for reverse dependency analysis - Enhanced stats with primary_language and language breakdown New modules: - src/commands/context.rs: Operation-specific context command - src/conventions/: Naming pattern detection - src/primer/ide.rs: IDE environment detection Cache enhancements: - conventions section with file_naming and imports - imported_by field in file entries - stats.primary_language and stats.languages Updated documentation: - README.md with tier table and new commands - CHANGELOG.md with 0.6.0 changes - RELEASE-0.6.0.md with release notes
1 parent bab4c07 commit 56ea5e5

19 files changed

Lines changed: 2110 additions & 67 deletions

File tree

CHANGELOG.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.6.0] - 2025-12-31
11+
12+
### Added
13+
- **RFC-0015: Primer System Redesign** - Accuracy-focused, context-aware bootstrap
14+
- 4-tier system: micro (<300), minimal (<450), standard (<700), full (≥700 tokens)
15+
- Automatic tier selection based on token budget
16+
- IDE environment detection (Cursor, VS Code, Cline, JetBrains, Zed, Claude Code)
17+
- `--standalone` flag for raw API usage with IDE context warnings
18+
- **New `acp context` command** for operation-specific AI context
19+
- `acp context create` - Naming conventions, import style for new files
20+
- `acp context modify --file <path>` - Constraints, importers for existing files
21+
- `acp context debug --file <path>` - Related files, symbols for debugging
22+
- `acp context explore` - Project overview, domains, stats
23+
- **Naming convention detection** - Auto-detects file naming patterns per directory
24+
- **Import tracking** - Tracks which files import each module (importers)
25+
- **MCP `acp_context` tool** - Operation-specific context via MCP protocol
26+
- **Cache enhancements**:
27+
- `conventions` section with file naming patterns and import style
28+
- `imported_by` field for reverse import tracking
29+
- `primary_language` detection with percentage
30+
31+
### Changed
32+
- Primer tier thresholds now use RFC-0015 values (300, 450, 700)
33+
- `PrimerTier` enum: `Micro`, `Minimal`, `Standard`, `Full`
34+
- Improved primer output format with tier information
35+
36+
### Infrastructure
37+
- acp-mcp updated to 0.2.0 with `acp_context` tool
38+
1039
## [0.5.3] - 2025-12-30
1140

1241
### Fixed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# @acp:summary "Package metadata and publishing information"
88
[package]
99
name = "acp-protocol"
10-
version = "0.5.3"
10+
version = "0.6.0"
1111
edition = "2021"
1212
authors = ["ACP Contributors"]
1313
description = "AI Context Protocol - Token-efficient and context enhancing code documentation for AI systems"

README.md

Lines changed: 157 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -609,16 +609,26 @@ acp validate .acp/acp.vars.json
609609
610610
### `acp primer`
611611
612-
Generate AI bootstrap primers with value-based section selection (RFC-0004).
612+
Generate AI bootstrap primers with tiered content selection (RFC-0015).
613+
614+
**Automatic Tier Selection:**
615+
616+
| Tier | Token Budget | Content |
617+
|------|--------------|---------|
618+
| `micro` | <300 | Essential safety constraints only |
619+
| `minimal` | 300-449 | Core project context |
620+
| `standard` | 450-699 | Balanced context with conventions |
621+
| `full` | ≥700 | Complete project understanding |
613622
614623
```bash
615624
acp primer [OPTIONS]
616625
617626
Core Options:
618-
-b, --budget <N> Token budget [default: 200]
627+
-b, --budget <N> Token budget determines tier [default: 200]
619628
--capabilities <caps> Filter by capabilities (shell, mcp, editor)
620629
-f, --format <type> Output format: markdown, compact, json, text [default: markdown]
621630
--json Output as JSON with metadata
631+
--standalone Standalone mode for raw API usage (not needed in IDEs)
622632
623633
Selection Options:
624634
-p, --preset <name> Weight preset: safe, efficient, accurate, balanced [default: balanced]
@@ -628,7 +638,7 @@ Selection Options:
628638
--no-dynamic Disable dynamic value modifiers
629639
630640
Introspection:
631-
--list-sections List all available sections (37 sections)
641+
--list-sections List all available sections
632642
--list-presets List weight presets with dimension weights
633643
--preview Preview selection without rendering
634644
--explain Show selection reasoning
@@ -650,28 +660,28 @@ Configuration:
650660
**Examples:**
651661
652662
```bash
653-
# Standard primer (200 tokens)
654-
acp primer
655-
656-
# Minimal primer for small context windows
663+
# Micro tier primer (~250 tokens)
657664
acp primer -b 100
658665
659-
# Full primer with selection reasoning
666+
# Minimal tier primer (~400 tokens)
667+
acp primer -b 350
668+
669+
# Standard tier primer (~600 tokens)
660670
acp primer -b 500 --explain
661671
662-
# MCP-only primer with safe preset
663-
acp primer -b 300 --capabilities mcp --preset safe
672+
# Full tier primer with MCP capability
673+
acp primer -b 800 --capabilities mcp --preset safe
674+
675+
# Standalone mode for raw API usage
676+
acp primer -b 500 --standalone
664677
665678
# List available sections
666679
acp primer --list-sections
667680
668681
# Preview what would be selected
669682
acp primer -b 400 --preview
670683
671-
# Exclude specific sections
672-
acp primer --exclude cli-overview,annotation-syntax
673-
674-
# JSON output with metadata
684+
# JSON output with tier metadata
675685
acp primer --json
676686
```
677687
@@ -685,6 +695,55 @@ Create `.acp/primer.json` to customize:
685695
686696
---
687697
698+
### `acp context`
699+
700+
Get operation-specific context for AI agents (RFC-0015).
701+
702+
```bash
703+
acp context <OPERATION> [OPTIONS]
704+
705+
Operations:
706+
create <directory> Get context for creating new files
707+
modify <file> Get context for modifying existing files
708+
debug <target> Get context for debugging (file or symbol)
709+
explore [--domain] Get context for exploring the codebase
710+
711+
Options:
712+
--cache <path> Cache file [default: .acp/acp.cache.json]
713+
--json Output as JSON
714+
--verbose Verbose output
715+
```
716+
717+
**Context Types:**
718+
719+
| Operation | Returns |
720+
|-----------|---------|
721+
| `create` | Naming conventions, import style, similar files |
722+
| `modify` | Constraints, importers (affected files), symbols |
723+
| `debug` | Related files, symbol info, hotpaths |
724+
| `explore` | Project stats, domain overview, key files |
725+
726+
**Examples:**
727+
728+
```bash
729+
# Get context before creating a new file
730+
acp context create src/auth/
731+
732+
# Get context before modifying a file
733+
acp context modify src/auth/session.ts
734+
735+
# Get debug context for a symbol
736+
acp context debug validateSession
737+
738+
# Explore the codebase structure
739+
acp context explore
740+
741+
# Focus on a specific domain
742+
acp context explore --domain auth
743+
```
744+
745+
---
746+
688747
## Configuration
689748
690749
Create `.acp.config.json` in your project root (or run `acp init`):
@@ -748,10 +807,90 @@ Or install separately from [acp-mcp](https://github.com/acp-protocol/acp-mcp).
748807
749808
**Available MCP Tools:**
750809
751-
- **acp_query** — Query symbols, files, and domains
752-
- **acp_constraints** — Check file constraints before modification
753-
- **acp_primer** — Generate context primers
754-
- **acp_expand** — Expand variable references
810+
- **acp_get_architecture** — Get project overview with domains, files, symbols
811+
- **acp_get_file_context** — Get detailed context for a specific file
812+
- **acp_get_symbol_context** — Get symbol info with callers and callees
813+
- **acp_get_domain_files** — Get files in a domain
814+
- **acp_check_constraints** — Check file constraints before modification
815+
- **acp_get_hotpaths** — Get frequently-called symbols
816+
- **acp_expand_variable** — Expand ACP variable references
817+
- **acp_generate_primer** — Generate context primers with tier selection
818+
- **acp_context** — Operation-specific context (create, modify, debug, explore)
819+
820+
---
821+
822+
## IDE Integration
823+
824+
ACP automatically detects your IDE environment and adapts its behavior accordingly.
825+
826+
**Supported IDEs:**
827+
828+
| IDE | Detection | Notes |
829+
|-----|-----------|-------|
830+
| Cursor | `CURSOR_*` env vars | Uses `.cursorrules` |
831+
| VS Code | `VSCODE_*` env vars | Uses CLAUDE.md with Cline |
832+
| Cline | `CLINE_*` env vars | Extension-provided context |
833+
| JetBrains | `JETBRAINS_IDE` env var | IntelliJ, WebStorm, etc. |
834+
| Zed | `ZED_*` env vars | Built-in AI integration |
835+
| Claude Code | `CLAUDE_CODE` env var | Uses CLAUDE.md |
836+
| Terminal | Default | Raw API usage |
837+
838+
**Bootstrap Files:**
839+
840+
When you run `acp init`, it creates IDE-specific bootstrap files:
841+
842+
```bash
843+
# Bootstrap for Cursor
844+
.cursorrules
845+
846+
# Bootstrap for Claude Code, Cline
847+
CLAUDE.md
848+
849+
# Both include primers and project context
850+
```
851+
852+
**Using Primers with IDEs:**
853+
854+
```bash
855+
# IDE context (auto-detected) - no --standalone needed
856+
acp primer -b 500
857+
858+
# Raw API usage (e.g., direct Anthropic API calls)
859+
acp primer -b 500 --standalone
860+
```
861+
862+
**Environment Variables:**
863+
864+
| Variable | Purpose |
865+
|----------|---------|
866+
| `ACP_NO_IDE_DETECT=1` | Disable IDE detection |
867+
868+
**Example: Cursor Integration**
869+
870+
```bash
871+
# 1. Initialize project
872+
acp init
873+
874+
# 2. Add primer to .cursorrules
875+
echo "$(acp primer -b 400)" >> .cursorrules
876+
877+
# 3. Get context before modifications
878+
acp context modify src/auth/session.ts
879+
```
880+
881+
**Example: Claude Code Integration**
882+
883+
```bash
884+
# 1. Initialize project
885+
acp init
886+
887+
# 2. Add primer to CLAUDE.md
888+
echo "$(acp primer -b 500)" >> CLAUDE.md
889+
890+
# 3. Use context command for operations
891+
acp context create src/utils/
892+
acp context debug validateSession
893+
```
755894
756895
---
757896

0 commit comments

Comments
 (0)