EARS Init: Project-Aware EARS Initialization
Analyze the current project and generate customized EARS configuration files so that Claude Code (and optionally Cursor and Codex) can capture knowledge effectively.
When to Use
- Starting work on a new project that has no EARS setup
- Onboarding a project that another developer started
- Upgrading a project from generic EARS to project-specific EARS
- After significant project restructuring
Workflow
Phase 1: Project Analysis
Scan the project to build a profile:
Detect language and framework:
- Look for
package.json → Node.js/TypeScript
- Look for
pyproject.toml or setup.py or requirements.txt → Python
- Look for
Cargo.toml → Rust
- Look for
go.mod → Go
- Look for
pom.xml or build.gradle → Java/Kotlin
- Look for
*.sln or *.csproj → C#/.NET
- Look for
Makefile + *.c/*.cpp/*.h → C/C++
- Look for
Gemfile → Ruby
- Look for
mix.exs → Elixir
- Multiple matches = polyglot project
Detect build commands:
package.json → read scripts (build, test, dev, start)
pyproject.toml → read [project.scripts] and [tool.pytest]
Makefile → list top-level targets
Cargo.toml → cargo build, cargo test
go.mod → go build, go test
Detect test commands:
- Python:
pytest, python -m unittest, tox
- Node.js:
jest, vitest, mocha, npm test
- Rust:
cargo test
- Go:
go test ./...
- Java:
mvn test, gradle test
Understand architecture:
- List top-level directories with brief descriptions
- Read existing README.md for project overview
- Identify key patterns (monorepo, MVC, microservices, library, CLI tool, etc.)
Check for existing EARS artifacts:
CLAUDE.md → exists? has EARS section?
KNOWN_ISSUES.md → exists?
LEARNING.md → exists?
traces/ → exists? has content?
ears-config.json → exists?
.cursor/rules/ → has EARS rules?
AGENTS.md → exists?
Phase 2: Generate Project CLAUDE.md
Use the project analysis to fill in a CLAUDE.md. Use the template from this plugin's templates/PROJECT-CLAUDE.md as the base structure.
If CLAUDE.md already exists:
- Read it fully
- Check if it has an EARS section
- If no EARS section: offer to append the EARS block
- If has EARS section: compare and offer to update
- NEVER overwrite existing content without asking
If CLAUDE.md does not exist:
- Generate a complete one using the template
- Fill in all placeholders from the analysis:
- Project name from package manifest or directory name
- Overview from README.md or directory structure
- Build & test commands from detected tools
- Architecture from directory scan
- EARS section fully populated
The EARS section must include:
- PostToolUse hook behavior explanation
- All three entry formats (Error, Checkpoint, Dead End) with examples
- Four-tier knowledge architecture with promotion rules
- "How to respond" guidance when seeing
[EARS] prompts
- Project-specific error patterns to watch for
Phase 3: Create EARS Skeleton
Create the directory structure and files:
traces/ directory — create if missing
Initial trace.md — ask user for the current task name, create traces/<task-name>/trace.md:
# Trace: <task-name>
Started: <current timestamp>
KNOWN_ISSUES.md — create from template if missing
LEARNING.md — create if missing:
# Learning Log
Tech decisions, new concepts, mistakes, and lessons for this project.
ears-config.json — create with project-specific error patterns:
For Python projects:
{
"error_patterns": [
"Traceback (most recent call last)",
"SyntaxError:", "TypeError:", "ValueError:", "KeyError:",
"IndexError:", "AttributeError:", "ImportError:",
"ModuleNotFoundError:", "FileNotFoundError:", "RuntimeError:",
"AssertionError:", "PermissionError:", "ConnectionError:"
],
"checkpoint_interval": 10,
"error_cooldown_seconds": 120,
"checkpoint_cooldown_seconds": 600,
"ignore_paths": [".claude/", ".git/", "__pycache__/", ".venv/", ".mypy_cache/"]
}
For Node.js/TypeScript projects:
{
"error_patterns": [
"ReferenceError:", "TypeError:", "SyntaxError:", "RangeError:",
"ENOENT:", "EACCES:", "ECONNREFUSED:", "ERR_MODULE_NOT_FOUND",
"Cannot find module", "Unexpected token", "FATAL ERROR:",
"UnhandledPromiseRejection"
],
"checkpoint_interval": 10,
"error_cooldown_seconds": 120,
"checkpoint_cooldown_seconds": 600,
"ignore_paths": [".git/", "node_modules/", "dist/", ".next/", "coverage/"]
}
For Rust projects:
{
"error_patterns": [
"error[E", "panicked at", "fatal runtime error",
"thread 'main' panicked", "cannot find", "mismatched types",
"borrow of moved value", "lifetime"
],
"checkpoint_interval": 10,
"error_cooldown_seconds": 120,
"checkpoint_cooldown_seconds": 600,
"ignore_paths": [".git/", "target/"]
}
For Go projects:
{
"error_patterns": [
"panic:", "fatal error:", "undefined:", "cannot use",
"too many arguments", "not enough arguments",
"imported and not used", "declared and not used"
],
"checkpoint_interval": 10,
"error_cooldown_seconds": 120,
"checkpoint_cooldown_seconds": 600,
"ignore_paths": [".git/", "vendor/"]
}
For other/mixed projects: use the default patterns from the hook.
Phase 4: Multi-Tool Setup (Optional)
Ask the user: "Do you use Cursor or Codex for this project? I can generate EARS rules for them too."
If Cursor is used:
Generate .cursor/rules/ears-project.mdc (create .cursor/rules/ if needed):
- Use the
templates/cursor-ears.mdc template
- Fill in project name and tech stack
- Set
alwaysApply: true
If Codex is used:
Generate project-level AGENTS.md:
- Use the
templates/PROJECT-AGENTS.md template
- Fill in project overview, build/test commands, architecture
- Include EARS instructions
Phase 5: Hook Check (Optional)
- Check if
~/.claude/scripts/ears-trace.py exists
- If it exists, inform the user about the improved hook in the Synapse plugin
- Offer to install/upgrade:
- Copy
hooks/ears-trace.py from the plugin to ~/.claude/scripts/ears-trace.py
- Verify
~/.claude/settings.json has PostToolUse hooks configured
- If the user declines, that's fine — the existing hook works, just without auto-discovery
Output Summary
After completion, display a summary:
EARS initialized for <project-name>:
- CLAUDE.md: <created | updated | already exists>
- traces/<task>/trace.md: created
- KNOWN_ISSUES.md: <created | already exists>
- LEARNING.md: <created | already exists>
- ears-config.json: created (<tech-stack> patterns)
- Cursor rules: <created | skipped>
- Codex AGENTS.md: <created | skipped>
- Hook: <upgraded | current | skipped>
You're ready to go. EARS will automatically prompt you to record
errors, checkpoints, discoveries, and dead ends as you work.
Important Principles
- Never overwrite existing files without asking
- Merge, don't replace — append EARS sections to existing CLAUDE.md
- Project-specific — error patterns, ignore paths, and commands should reflect the actual project
- Minimal by default — only create what's needed, ask before adding optional pieces
- Respect existing setup — if the project already has EARS, offer upgrades, don't force changes
Source: CHOSENX-GPU/synapse — distributed by TomeVault.
1---2name: chosenx-gpu-synapse-ears-init3description: EARS Init: Project-Aware EARS Initialization4---56# EARS Init: Project-Aware EARS Initialization78Analyze the current project and generate customized EARS configuration files so that Claude Code (and optionally Cursor and Codex) can capture knowledge effectively.910## When to Use1112- Starting work on a new project that has no EARS setup13- Onboarding a project that another developer started14- Upgrading a project from generic EARS to project-specific EARS15- After significant project restructuring1617## Workflow1819### Phase 1: Project Analysis2021Scan the project to build a profile:22231. **Detect language and framework:**24 - Look for `package.json` → Node.js/TypeScript25 - Look for `pyproject.toml` or `setup.py` or `requirements.txt` → Python26 - Look for `Cargo.toml` → Rust27 - Look for `go.mod` → Go28 - Look for `pom.xml` or `build.gradle` → Java/Kotlin29 - Look for `*.sln` or `*.csproj` → C#/.NET30 - Look for `Makefile` + `*.c`/`*.cpp`/`*.h` → C/C++31 - Look for `Gemfile` → Ruby32 - Look for `mix.exs` → Elixir33 - Multiple matches = polyglot project34352. **Detect build commands:**36 - `package.json` → read `scripts` (build, test, dev, start)37 - `pyproject.toml` → read `[project.scripts]` and `[tool.pytest]`38 - `Makefile` → list top-level targets39 - `Cargo.toml` → `cargo build`, `cargo test`40 - `go.mod` → `go build`, `go test`41423. **Detect test commands:**43 - Python: `pytest`, `python -m unittest`, `tox`44 - Node.js: `jest`, `vitest`, `mocha`, `npm test`45 - Rust: `cargo test`46 - Go: `go test ./...`47 - Java: `mvn test`, `gradle test`48494. **Understand architecture:**50 - List top-level directories with brief descriptions51 - Read existing README.md for project overview52 - Identify key patterns (monorepo, MVC, microservices, library, CLI tool, etc.)53545. **Check for existing EARS artifacts:**55 - `CLAUDE.md` → exists? has EARS section?56 - `KNOWN_ISSUES.md` → exists?57 - `LEARNING.md` → exists?58 - `traces/` → exists? has content?59 - `ears-config.json` → exists?60 - `.cursor/rules/` → has EARS rules?61 - `AGENTS.md` → exists?6263### Phase 2: Generate Project CLAUDE.md6465Use the project analysis to fill in a CLAUDE.md. Use the template from this plugin's `templates/PROJECT-CLAUDE.md` as the base structure.6667**If CLAUDE.md already exists:**68- Read it fully69- Check if it has an EARS section70- If no EARS section: offer to append the EARS block71- If has EARS section: compare and offer to update72- NEVER overwrite existing content without asking7374**If CLAUDE.md does not exist:**75- Generate a complete one using the template76- Fill in all placeholders from the analysis:77 - Project name from package manifest or directory name78 - Overview from README.md or directory structure79 - Build & test commands from detected tools80 - Architecture from directory scan81 - EARS section fully populated8283**The EARS section must include:**84- PostToolUse hook behavior explanation85- All three entry formats (Error, Checkpoint, Dead End) with examples86- Four-tier knowledge architecture with promotion rules87- "How to respond" guidance when seeing `[EARS]` prompts88- Project-specific error patterns to watch for8990### Phase 3: Create EARS Skeleton9192Create the directory structure and files:93941. **`traces/` directory** — create if missing952. **Initial trace.md** — ask user for the current task name, create `traces/<task-name>/trace.md`:96 ```markdown97 # Trace: <task-name>9899 Started: <current timestamp>100 ```1013. **`KNOWN_ISSUES.md`** — create from template if missing1024. **`LEARNING.md`** — create if missing:103 ```markdown104 # Learning Log105106 Tech decisions, new concepts, mistakes, and lessons for this project.107 ```1085. **`ears-config.json`** — create with project-specific error patterns:109110 For **Python** projects:111 ```json112 {113 "error_patterns": [114 "Traceback (most recent call last)",115 "SyntaxError:", "TypeError:", "ValueError:", "KeyError:",116 "IndexError:", "AttributeError:", "ImportError:",117 "ModuleNotFoundError:", "FileNotFoundError:", "RuntimeError:",118 "AssertionError:", "PermissionError:", "ConnectionError:"119 ],120 "checkpoint_interval": 10,121 "error_cooldown_seconds": 120,122 "checkpoint_cooldown_seconds": 600,123 "ignore_paths": [".claude/", ".git/", "__pycache__/", ".venv/", ".mypy_cache/"]124 }125 ```126127 For **Node.js/TypeScript** projects:128 ```json129 {130 "error_patterns": [131 "ReferenceError:", "TypeError:", "SyntaxError:", "RangeError:",132 "ENOENT:", "EACCES:", "ECONNREFUSED:", "ERR_MODULE_NOT_FOUND",133 "Cannot find module", "Unexpected token", "FATAL ERROR:",134 "UnhandledPromiseRejection"135 ],136 "checkpoint_interval": 10,137 "error_cooldown_seconds": 120,138 "checkpoint_cooldown_seconds": 600,139 "ignore_paths": [".git/", "node_modules/", "dist/", ".next/", "coverage/"]140 }141 ```142143 For **Rust** projects:144 ```json145 {146 "error_patterns": [147 "error[E", "panicked at", "fatal runtime error",148 "thread 'main' panicked", "cannot find", "mismatched types",149 "borrow of moved value", "lifetime"150 ],151 "checkpoint_interval": 10,152 "error_cooldown_seconds": 120,153 "checkpoint_cooldown_seconds": 600,154 "ignore_paths": [".git/", "target/"]155 }156 ```157158 For **Go** projects:159 ```json160 {161 "error_patterns": [162 "panic:", "fatal error:", "undefined:", "cannot use",163 "too many arguments", "not enough arguments",164 "imported and not used", "declared and not used"165 ],166 "checkpoint_interval": 10,167 "error_cooldown_seconds": 120,168 "checkpoint_cooldown_seconds": 600,169 "ignore_paths": [".git/", "vendor/"]170 }171 ```172173 For **other/mixed** projects: use the default patterns from the hook.174175### Phase 4: Multi-Tool Setup (Optional)176177Ask the user: "Do you use Cursor or Codex for this project? I can generate EARS rules for them too."178179**If Cursor is used:**180Generate `.cursor/rules/ears-project.mdc` (create `.cursor/rules/` if needed):181- Use the `templates/cursor-ears.mdc` template182- Fill in project name and tech stack183- Set `alwaysApply: true`184185**If Codex is used:**186Generate project-level `AGENTS.md`:187- Use the `templates/PROJECT-AGENTS.md` template188- Fill in project overview, build/test commands, architecture189- Include EARS instructions190191### Phase 5: Hook Check (Optional)1921931. Check if `~/.claude/scripts/ears-trace.py` exists1942. If it exists, inform the user about the improved hook in the Synapse plugin1953. Offer to install/upgrade:196 - Copy `hooks/ears-trace.py` from the plugin to `~/.claude/scripts/ears-trace.py`197 - Verify `~/.claude/settings.json` has PostToolUse hooks configured1984. If the user declines, that's fine — the existing hook works, just without auto-discovery199200## Output Summary201202After completion, display a summary:203204```205EARS initialized for <project-name>:206 - CLAUDE.md: <created | updated | already exists>207 - traces/<task>/trace.md: created208 - KNOWN_ISSUES.md: <created | already exists>209 - LEARNING.md: <created | already exists>210 - ears-config.json: created (<tech-stack> patterns)211 - Cursor rules: <created | skipped>212 - Codex AGENTS.md: <created | skipped>213 - Hook: <upgraded | current | skipped>214215You're ready to go. EARS will automatically prompt you to record216errors, checkpoints, discoveries, and dead ends as you work.217```218219## Important Principles220221- **Never overwrite** existing files without asking222- **Merge, don't replace** — append EARS sections to existing CLAUDE.md223- **Project-specific** — error patterns, ignore paths, and commands should reflect the actual project224- **Minimal by default** — only create what's needed, ask before adding optional pieces225- **Respect existing setup** — if the project already has EARS, offer upgrades, don't force changes226227---228> Source: [CHOSENX-GPU/synapse](https://github.com/CHOSENX-GPU/synapse) — distributed by [TomeVault](https://tomevault.io).229<!-- tomevault:4.0:skill_md:2026-05-23 -->