| name | sub-kopring-engineer |
| description | Kotlin/Java Spring Boot codebase workflow agent. Generates code adhering to Hexagonal Architecture, Kotlin/Java idioms, JPA patterns, JOOQ, and test conventions through Brainstorm โ Plan โ Implement โ Verify phases. Activated by keywords: "implement", "feature development", "code writing", "plan", "implement", "verify", "loop", "kotlin", "java", "hexagonal", "refactoring", "write tests", "brainstorm", "dry-run". |
| argument-hint | [task description | plan | implement | verify | loop N | dry-run] |
| user-invocable | true |
| allowed-tools | ["Read","Grep","Glob","Bash","Write","Edit","Task"] |
Sub Kopring Engineer โ Kotlin/Java Spring Boot Workflow Agent
An agent that generates consistent, convention-compliant code through the Brainstorm โ Plan โ Implement โ Verify workflow
Role
A workflow agent that writes code following Hexagonal Architecture (Ports & Adapters) in Kotlin/Java Spring Boot projects.
It automatically detects the project language (Kotlin/Java/Mixed) and produces consistent code based on injected context documents without requiring repeated prompting.
Core Principles
- Lazy-load context documents per Phase to ensure convention compliance
- Sequential execution of Brainstorm โ Plan โ Implement โ Verify
- Repeat Verify loop the number of times specified by the user (Ralph-style)
- Automatically adjust verification level based on change scale (Tiered Verification)
Quick Start (Zero-Config)
Phase 0 ์๋์ผ๋ก ๋ชจ๋ ์ค์ ์ ์๋ฃํ๋ฏ๋ก ์ฌ์ฉ์ ๊ฐ์
์ด ํ์ ์๋ค:
1. Project Discovery โ build.gradle.kts ๋ถ์ โ ์ธ์ด, ๋ชจ๋, ํ๋ฌ๊ทธ์ธ, ์ํคํ
์ฒ ์๋ ๊ฐ์ง
2. Pattern Learning โ Base Class, Annotation, Naming ํจํด ์๋ ํ์ต ํ ์บ์
3. Static Analysis โ ๋น๋ ํ๋ฌ๊ทธ์ธ์์ detekt/checkstyle/spotless ๋ฑ ์๋ ๊ฐ์ง โ .sub-kopring-engineer/static-analysis-tools.txt ์์ฑ
4. Hooks Installation โ lint-on-edit, secret-guard, test-quality-gate ์๋ ์ค์น (.claude/settings.json)
์ฒซ ์คํ ์ ์ถ๊ฐ ํ๋กฌํํธ ์์ด ์ 4๋จ๊ณ๊ฐ ์์ฐจ์ ์ผ๋ก ์คํ๋๋ค.
๊ฐ์ง๋ ์ค์ ์ ๋ณ๊ฒฝํ๋ ค๋ฉด ํด๋น ํ์ผ์ ์ง์ ํธ์งํ๋ฉด ๋๋ค:
- ์ ์ ๋ถ์ ๋๊ตฌ:
.sub-kopring-engineer/static-analysis-tools.txt (์ค ๋จ์, ์ญ์ ์ ์ฌ๊ฐ์ง)
- Hooks:
.claude/settings.json์ hooks ์น์
(์ญ์ ์ ์ฌ์ค์น)
Phase Workflow Diagram
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ sub-kopring-engineer โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Phase 0: Discovery โ
โ โข ์ธ์ด/๋ชจ๋/ํจํด ์๋ ๊ฐ์ง โ
โ โข ํ๋กํ์ผ ์บ์ ์ ์ฅ โ
โโโโโโโโโโโโโโฌโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโผโโโโโโโโโโโโโโ
โ Request Clarity Check โ
โ Level 1? (๋จ์ ์์ฒญ) โ
โโโโโโโโโโโโโโฌโโโโโโโโโโโโโโ
โ
โโโโโ YES โโโโโโโโโโดโโโโโโโโโโ NO โโโโโ
โ โ
โ โโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโ
โ โ Phase 1: Brainstorm โ
โ โ โข ์๊ตฌ์ฌํญ ๋ช
ํํ โ
โ โ โข ์ฌ์ฉ์ ์ค์ฝํ ํ์ธ โ
โ โโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโ
โ โ
โโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโผโโโโโโโโโโโโโโ
โ โ Plan Readiness Check โ โโโ (v2.6) Profile + Clarity + Codebase
โ ๋ฏธ์ถฉ์กฑ ์ ์ด์ Phase โ
โโโโโโโโโโโโโโฌโโโโโโโโโโโโโโ
โ PASS
โโโโโโโโโโโโโโผโโโโโโโโโโโโโโ
โ Phase 2: Plan โ
โ โข ์ํคํ
์ฒ ๋ณ๊ฒฝ ์ค๊ณ โ
โ โข ํ์ผ๋ณ ๋ณ๊ฒฝ ๋ช
์ธ โ
โโโโโโโโโโโโโโฌโโโโโโโโโโโโโโ
โ
โโโโโ dry-run? โโโโโดโโโโโโโโโโโโโโโโโโโ
โ โ
โโโโโโผโโโโโ โโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโ
โ HALT โ โ โ Implement Readiness Check โ โโโ (v2.6)
โ (์๋ฎฌ๋ ์ด์
)โ โ Pre-flight (ยง2-0) 4ํญ๋ชฉ โ
โโโโโโโโโโโ โโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโ
โ PASS
โโโโโโโโโโโโโผโโโโโโโโโโโโ
โ Phase 3: Implement โ
โ โข ํ์ผ ์์ฑ/์์ โ
โ โข ํ
์คํธ ์์ฑ โ
โโโโโโโโโโโโโฌโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโ
โ โ Verify Readiness Check โ โโโ (v2.6)
โ ํ์ผ๋ณ๊ฒฝ + ํ
์คํธ + snapshot โ
โโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโ
โ PASS
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Phase 4: Verify Loop โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โข Context Health ์ฒดํฌ (70/80/85% ์๊ณ๊ฐ) โ โ
โ โ โข 6-์นดํ
๊ณ ๋ฆฌ + Cross-Layer ์ปจ๋ฒค์
๊ฒ์ฆ โ โ
โ โ โข Tier๋ณ ์ ์ ๋ถ์ (LIGHT/STANDARD/THOROUGH) โ โ
โ โ โข ์๋ฐ ์๋ ์์ ์๋ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโ โ
โ โ ์ข
๋ฃ ์กฐ๊ฑด ํ์ธ โ โ
โ โ โข ์๋ฐ 0๊ฐ? โ โ
โ โ โข ๋์ผ ์๋ฌ 3ํ ๋ฐ๋ณต? โ โ
โ โ โข max loop ๋๋ฌ? โ โ
โ โโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โโโโ EXIT โโโโโโโโโโดโโโโโโโ CONTINUE โโโโ โ
โ โ โ โ
โ โ Loop N++ (์ฌ๊ฒ์ฆ) โ
โ โ โ โ
โโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โผ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ Complete โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โข ์ธ์
์์ฝ ์ถ๋ ฅ โ
โ โข PROGRESS.md ๊ธฐ๋ก โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Phase Transition Conditions
| Phase | Entry Condition | Exit Condition | Skip Condition |
|---|
| 0 Discovery | Always first | Project profile loaded and cached | Never |
| 1 Brainstorm | After Phase 0 | Requirements clarified (user confirms scope) | Request clarity Level 1 (see below) |
| 2 Plan | After Phase 0 or 1 | Plan approved by user, OR dry-run halt | Never |
| 3 Implement | After Phase 2 (plan approved) | All planned files written | dry-run mode active |
| 4 Verify | After Phase 3 | Loop termination (see Loop Control below) | loop 0 specified |
Phase 1 Skip Criteria (Level 1 Clarity):
- ๋จ์ผ ํ์ผ ์์ ์์ฒญ (e.g., "OrderService์ cancel ๋ฉ์๋ ์ถ๊ฐ")
- ๋ฒ๊ทธ ์์ ์์ฒญ (e.g., "null ์ฒดํฌ ๋๋ฝ ์์ ")
- ํ๋/๋ฉ์๋ ์ถ๊ฐ (e.g., "Order์ canceledAt ํ๋ ์ถ๊ฐ")
- ์ํคํ
์ฒ ์ํฅ ์์ (์ Port/Adapter ๋ถํ์, ๋ชจ๋ ๋ณ๊ฒฝ ์์)
Phase Transition Contract (v2.6)
๊ฐ Phase๋ ๋ค์ Phase๋ก ์ ํํ๊ธฐ ์ ๋ฐ๋์ ์๋ ์ฐ์ถ๋ฌผ์ ์์ฑํด์ผ ํ๋ค.
์ฐ์ถ๋ฌผ์ด ๋ถ์์ ํ๋ฉด ๋ค์ Phase๋ก ์ง์
ํ์ง ์๋๋ค. ์์ Entry/Exit Condition ํ
์ด๋ธ๊ณผ ๊ฒฐํฉํ์ฌ ์ ์ฉํ๋ค.
| ์ ํ | ํ์ ์ฐ์ถ๋ฌผ | ๊ฒ์ฆ ๊ธฐ์ค | ๋ฏธ์ถฉ์กฑ ์ |
|---|
| Discovery โ Brainstorm/Plan | ProjectProfile (์ธ์ด, ๋ชจ๋ ๊ตฌ์กฐ, ์ฟผ๋ฆฌ ๋ผ์ด๋ธ๋ฌ๋ฆฌ, ํจํด ์บ์) | profile์ language, modules, architecture ํญ๋ชฉ์ด ๋ชจ๋ ๊ฒฐ์ ๋จ | Discovery ์ฌ์คํ |
| Brainstorm โ Plan | ๋ช
ํํ๋ ์๊ตฌ์ฌํญ (clarity=CLEAR ๋๋ ์ฌ์ฉ์ ์น์ธ) | VAGUE ์ํ์์ ์ ํ ๊ธ์ง. MODERATE๋ ์ฌ์ฉ์ ์น์ธ ํ์ | Brainstorm ๊ณ์ |
| Plan โ Implement | ๊ตฌํ ๊ณํ (๋ ์ด์ด๋ณ ํ์ผ ๋ชฉ๋ก + ๋ณ๊ฒฝ ์์ฝ) | ์ต์ 1๊ฐ ํ์ผ ๋ณ๊ฒฝ ๊ณํ ์กด์ฌ + Pre-flight Check ํต๊ณผ (ยง2-0) | Plan ์์ |
| Implement โ Verify | ๋ณ๊ฒฝ๋ ํ์ผ ์งํฉ + snapshot.json ๊ฐฑ์ | ์ค์ ๋ณ๊ฒฝ๋ ํ์ผ โฅ 1๊ฐ. ๋ณ๊ฒฝ 0๊ฐ์ด๋ฉด Verify ์คํต | Implement ๊ณ์ ๋๋ ์ข
๋ฃ |
| Verify โ Loop/์ข
๋ฃ | ๊ฒ์ฆ ๊ฒฐ๊ณผ ํ
์ด๋ธ (6-์นดํ
๊ณ ๋ฆฌ + Cross-Layer violations + fixes) | ๊ฒฐ๊ณผ ํ
์ด๋ธ ์์ฑ ํ์. ํ
์ด๋ธ ์์ด Loop ์ข
๋ฃ ๋ถ๊ฐ | Verify ์ฌ์คํ |
Phase Readiness Check ์ ์ฐจ:
Phase ์ ํ ์์ ์ ์๋ ์ฒดํฌ๋ฆฌ์คํธ๋ฅผ ์์ฐจ ํ์ธํ๋ค. ์คํจ ์ ํด๋น Phase๋ก ๋์๊ฐ๋ค.
Plan ์ง์
์ (Discovery/Brainstorm ์๋ฃ ํ):
โก ProjectProfile์ด ํ์ฌ ์ปจํ
์คํธ์ ์กด์ฌ (์์ถ ์ ์ฌ๋ก๋ ์๋ฃ)
โก ์๊ตฌ์ฌํญ ๋ช
ํ๋ CLEAR (๋๋ ์ฌ์ฉ์๊ฐ MODERATE์์ ์งํ ์น์ธ)
โก ๋์ ์ฝ๋๋ฒ ์ด์ค ์ ๊ทผ ๊ฐ๋ฅ (Glob์ผ๋ก ์ต์ 1๊ฐ ๊ด๋ จ ํ์ผ/๋๋ ํ ๋ฆฌ ํ์ธ)
Implement ์ง์
์ (Plan ์๋ฃ ํ):
โก Plan ์ฐ์ถ๋ฌผ์ ์ต์ 1๊ฐ ํ์ผ ๋ณ๊ฒฝ ๊ณํ ์กด์ฌ
โก Pre-flight Check 4ํญ๋ชฉ ํต๊ณผ (์ํ ์์กด์ฑ, Port ์์ ์ฑ, ๋ค์ด๋ฐ ์ถฉ๋, ์ฐธ์กฐ ํด๋์ค ์กด์ฌ)
โก dry-run ๋ชจ๋๊ฐ ์๋
Verify ์ง์
์ (Implement ์๋ฃ ํ):
โก ์ต์ 1๊ฐ ํ์ผ์ด ์ค์ ๋ก ๋ณ๊ฒฝ๋จ (Write/Edit ๋๊ตฌ ์ฌ์ฉ ์ด๋ ฅ)
โก ํ
์คํธ ์ฝ๋๊ฐ Plan์ ๋ช
์๋ ๋๋ก ์์ฑ๋จ (ํ
์คํธ ๋๋ฝ ์ Implement ๊ณ์)
โก snapshot.json์ด ํ์ฌ ๋ณ๊ฒฝ ์ฌํญ์ผ๋ก ๊ฐฑ์ ๋จ
Execution Modes
| Mode | Input Example | Behavior |
|---|
| All-in-one (default) | Order cancel feature implement | Brainstorm โ Plan โ Implement โ Verifyร1 |
| All-in-one + loop | Order cancel implement. loop 3 | Brainstorm โ Plan โ Implement โ Verifyร3 |
| Step-by-step | plan: payment cancel | Execute only a specific phase |
| Verify only | verify loop 2 | Verifyร2 on current code |
| Dry-run | Order cancel implement. dry-run | Execute only up to Plan, simulate without file changes |
| Skip loop | Order cancel implement. loop 0 | Brainstorm โ Plan โ Implement (no Verify) |
Step-by-step commands: brainstorm, plan: {task}, implement, verify
Domain-Specific Keywords (v2.3)
๋๋ฉ์ธ ํนํ ํค์๋๋ก ์ํฌํ๋ก์ฐ ๋์์ ์ธ๋ฐํ๊ฒ ์ ์ดํ ์ ์๋ค.
| ํค์๋ | ํจ๊ณผ | ์ ์ฉ Phase |
|---|
jpa-focus | JPA ๊ฒ์ฆ ๊ฐํ โ Entity-Model ๋ถ๋ฆฌ, ์ฐ๊ด๊ด๊ณ ๋งคํ, cascade ๊ฒ์ฆ | Plan, Verify |
port-first | Port ์ธํฐํ์ด์ค ๋จผ์ ์ ์ โ Adapter ๊ตฌํ ์์ ๊ฐ์ | Plan, Implement |
test-heavy | ํ
์คํธ ์ปค๋ฒ๋ฆฌ์ง 80% ์ด์ ๋ชฉํ, TDD ์คํ์ผ (ํ
์คํธ ๋จผ์ ์์ฑ) | Plan, Implement |
infra-only | Infrastructure ๋ ์ด์ด๋ง ๋ณ๊ฒฝ (Domain/Application ํฐ์น ๊ธ์ง) | Plan, Implement |
api-contract | API ์คํ(OpenAPI) ๋จผ์ ํ์ โ Controller ๊ตฌํ ์์ | Plan |
migration | DB ๋ง์ด๊ทธ๋ ์ด์
ํฌํจ, ๋กค๋ฐฑ ๊ณํ ํ์ ์ถ๋ ฅ | Plan, Implement |
security | ๋ณด์ ๊ด๋ จ ๊ฒ์ฆ THOROUGH ๊ฐ์ , ์ธ์ฆ/์ธ๊ฐ ์ฒดํฌ๋ฆฌ์คํธ ์ ์ฉ | Verify |
์ฌ์ฉ ์์:
Order ์ทจ์ ๊ธฐ๋ฅ ๊ตฌํ. port-first loop 3
๊ฒฐ์ ์ฐ๋ ๋ฆฌํฉํ ๋ง. jpa-focus security
API v2 ๋ง์ด๊ทธ๋ ์ด์
. api-contract migration
Phase-specific Detailed Protocols
Detailed execution procedures for each Phase are defined in resources/.
When entering a Phase, documents already read in the previous Phase are not reloaded.
However, they are reloaded for step-by-step execution (individual Phase invocation) or when context compression occurs.
Within Verify loops (loop 2+), protocol documents and references already loaded in loop 1 are not reloaded. Only the verify-snapshot.json is re-read for incremental comparison.
Context compression recovery:
- At start of each Phase/loop, check for
## Project Profile header in current context
- If FOUND โ proceed normally (no reload needed)
- If NOT FOUND:
- Loop 1 OR step-by-step mode โ Re-read profile + all Required Reads for current Phase (Base Set + Phase-specific)
- Loop 2+ โ Re-read profile + verify-snapshot.json only (skip protocol/reference docs unless a specific reference is needed for fix)
Context Loading Optimization Strategy (v2.6)
๋ฌธ์ ๋ก๋ฉ ์ ํ ํฐ ํจ์จ์ ๊ทน๋ํํ๊ธฐ ์ํ ์ ๋ต. ๊ธฐ์กด Lazy Load + Load Once ๊ท์น์ ๋ณด์ํ๋ค.
Batch-First ์์น:
๋์ผ Phase ๋ด์์ ์ฌ๋ฌ ๋ฌธ์๋ฅผ ์ฝ์ด์ผ ํ ๋, ๊ฐ๋ณ Read ํธ์ถ ๋์ ๊ด๋ จ ๋ฌธ์๋ฅผ ๊ทธ๋ฃน์ผ๋ก ๋ฌถ์ด ๋ก๋ฉํ๋ค.
โ Bad: Read(profile) โ Read(code-style) โ Read(hexagonal) โ Read(unit-testing) (4 ํธ์ถ)
โ
Good: Read(profile) โ Read([code-style, hexagonal, unit-testing]) (2 ํธ์ถ, ๋ณ๋ ฌ ๊ฐ๋ฅ)
Phase๋ณ ๋ก๋ฉ ์ ๋ต:
| ์ํฉ | ์ ๋ต | ๊ทผ๊ฑฐ |
|---|
| Loop 1 ์ง์
| Base Set + Phase ๋ฌธ์ ์ผ๊ด ๋ก๋ฉ | ์ ์ฒด ์บ์ ๊ตฌ์ถ (์ดํ ์ฌ์ฌ์ฉ) |
| Loop 2+ ์ง์
| snapshot.json๋ง ์ฌ๋ก๋ฉ | ๋ฌธ์ ์บ์ ์ฌ์ฌ์ฉ (compression recovery ์ฐธ์กฐ) |
| ์๋ธ์์ด์ ํธ ์คํฐ | Agent Context Scope Rules(extended/sub-agent-isolation.md ยง1-2) ๊ธฐ๋ฐ ์ ๋ณ ๋ก๋ฉ | ์์ด์ ํธ๋ณ ํ์ ๋ฌธ์๋ง |
| ์ปจํ
์คํธ ์์ถ ํ | profile + ํ์ฌ Phase ํ์ ๋ฌธ์๋ง ๋ณต๊ตฌ | ์ต์ ๋ณต๊ตฌ ์์น |
์๋ธ์์ด์ ํธ ๋ก๋ฉ ์ต์ ํ (๋ณ๋ ฌ ์คํ ์):
1. Orchestrator: Plan ์ฐ์ถ๋ฌผ + ๊ณตํต ์ฐธ์กฐ ๋ฌธ์(Port ์ธํฐํ์ด์ค) ํ๋ณด
โ ์ด ์์ ์์ ๊ณตํต ์ปจํ
์คํธ ์บ์ ํ๋ฆฝ
2. ๊ฐ ์์ด์ ํธ์ ์ ๋ฌํ ์ปจํ
์คํธ ๊ตฌ์ฑ:
a. ๊ณตํต ๋ถ๋ถ: Port ์ธํฐํ์ด์ค ์๊ทธ๋์ฒ (๋ชจ๋ ์์ด์ ํธ ๋์ผ)
b. ๊ณ ์ ๋ถ๋ถ: Plan ๋ฐ์ท + ์์ด์ ํธ๋ณ reference ๋ฌธ์ (extended/sub-agent-isolation.md ยง1-2 ๋งคํธ๋ฆญ์ค ์ฐธ์กฐ)
3. ์ค๋ณต ๋ฐฉ์ง ๊ท์น:
- ๋์ผ reference ๋ฌธ์๋ฅผ ์ฌ๋ฌ ์์ด์ ํธ์ ์ค๋ณต ๋ก๋ฉ ํ์ฉ (์์ด์ ํธ ๊ฐ ์ปจํ
์คํธ ๊ฒฉ๋ฆฌ)
- ๋จ, Orchestrator๊ฐ ์ด๋ฏธ ์ฝ์ ํ์ผ ๋ด์ฉ์ ์์ด์ ํธ ํ๋กฌํํธ์ ์ธ๋ผ์ธ ์ ๋ฌ ๊ฐ๋ฅ
โ ์์ด์ ํธ๊ฐ ์ง์ Readํ ํ์ ์์ด ํ๋กฌํํธ์ ํฌํจ โ Read ํธ์ถ ์ ๊ฐ
๋์ฉ๋ ํ์ผ ๋ก๋ฉ ๊ท์น:
| ํ์ผ ํฌ๊ธฐ | ์ ๋ต |
|---|
| โค 200์ค | ์ ์ฒด Read |
| 201-500์ค | ํ์ํ ์น์
๋ง offset/limit์ผ๋ก Read |
| > 500์ค | Grep์ผ๋ก ๊ด๋ จ ๋ถ๋ถ ํ์ ํ ํด๋น ์์ญ๋ง Read |
์ด ๊ท์น์ Context Health Protocol(ยงContext Health)์ ์ ์ฝ ์ง์นจ๊ณผ ์ฐ๊ณ๋๋ค.
Phase 0: Project Discovery (automatic)
Details: resources/project-discovery-protocol.md
Automatically detects the project's build configuration, language (Kotlin/Java/Mixed), architecture, and code patterns.
If .sub-kopring-engineer/static-analysis-tools.txt does not exist, it detects available static analysis tools and requests selection.
Selected tools are automatically executed according to Tier during subsequent Verify phases.
Falls back to existing references/-based conventions if discovery fails.
ast-grep Status (recommended):
| Status | Message | Level |
|---|
| Installed + rules exist | [discover] ast-grep: active ({N} rules) | INFO |
| Installed + no rules | [discover] ast-grep: installed, no rules yet | INFO |
| Not installed | [discover] ast-grep: not found (recommended for ~98% verify accuracy vs ~75% grep-only) | WARN |
ast-grep is recommended for higher verification accuracy. Without it, verify-conventions.sh falls back to grep-based checks (~75% accuracy). Install via npm i -g @ast-grep/cli or cargo install ast-grep.
Phase 1: Brainstorm (for ambiguous requests)
Details: resources/brainstorm-protocol.md
If the request is ambiguous or the scope is unclear, requirements are clarified through Socratic questioning before implementation.
This phase is skipped for clear requests.
Phase 2: Plan
Details: resources/plan-protocol.md
Template: templates/plan-template.md
Phase 3: Implement
Details: resources/implement-protocol.md
Phase 4: Verify
Details: resources/verify-protocol.md
Verification levels: resources/verification-tiers.md
Error handling: resources/error-playbook.md
Scripts: scripts/verify-conventions.sh [target path] [summary|detailed] [--changed-only]
Static analysis: scripts/run-static-analysis.sh [project root] [Tier] โ runs tools based on allow-list
Loop 2+: incremental verification with --changed-only.
Pattern capture: โ verify-protocol.md Section 3-4
Loop Control
| Input | Behavior |
|---|
loop N | VerifyรN (with fixes) |
verify loop N | VerifyรN on current code |
loop 0 | Skip Verify |
| (not specified) | Verifyร1 (default) |
Loop termination decision flow (evaluated AFTER auto-fix attempt, in order):
Loop N termination check (after fix):
1. violations == 0 (after fix) โ EXIT (success)
2. Same violation appears 3x consecutive โ Spawn root-cause analysis sub-agent, then retry
3. N >= max_loops AND violations > 0 โ EXIT (report remaining violations)
Otherwise โ next iteration (N += 1)
Context Documents (Lazy Load)
Consistency assertion: Once query-lib is detected in Phase 0 (e.g., jooq, querydsl, or none), the same value MUST be used consistently across all subsequent phases. Do not re-detect.
Base Set (loaded in Phases 2, 3, 4 โ referenced by all protocol Required Reads):
- project profile cache (unconditional, every phase)
- learned patterns (if pattern cache exists in
.sub-kopring-engineer/)
- kotlin/code-style-guide.md (if language=kotlin/mixed)
- java/code-style-guide.md (if language=java/mixed)
- architecture reference: shared/hexagonal-architecture.md
| Document | Phases | Load Condition | Load Frequency |
|---|
| project profile (auto-discovered) | 0, 1, 2, 3, 4 | Every phase entry (unconditional) | Every Phase |
| learned patterns (auto-discovered) | 2, 3, 4 | IF pattern cache file exists in .sub-kopring-engineer/ | Load Once |
| code-style-guide.md | 2, 3, 4 | IF language=kotlin OR language=mixed | Load Once |
| code-style-guide.md | 2, 3, 4 | IF language=java OR language=mixed | Load Once |
| layering-principles.md | 2, 3, 4 | IF tier=STANDARD OR tier=THOROUGH OR multi-layer changes | Load Once |
| hexagonal-architecture.md | 2, 3, 4 | Always | Load Once |
| unit-testing.md | 2, 3, 4 | IF language=kotlin OR language=mixed | Load Once |
| unit-testing.md | 2, 3, 4 | IF language=java OR language=mixed | Load Once |
| integration-testing.md | 2, 3, 4 | IF language=kotlin OR language=mixed | Load Once |
| integration-testing.md | 2, 3, 4 | IF language=java OR language=mixed | Load Once |
| advanced-testing.md | 2, 4 | IF mutation/contract/performance testing mentioned OR tier=THOROUGH | Load Once |
| gradle-build-guide.md | 2, 3 | IF multi-module=true AND (new module creation OR build config changes) | Load Once |
| jooq-conventions.md | 2, 3 | IF query-lib=jooq (detected in Phase 0) | Load Once |
| git-conventions.md | 3 | Once per session, on first commit action | Once per Session |
| static-analysis allow-list (.sub-kopring-engineer/) | 0, 4 | IF .sub-kopring-engineer/static-analysis-tools.txt exists | Load Once |
Resources โ Core (Phase ์ง์
์ ์๋ ๋ก๋)
Resources โ Extended (์กฐ๊ฑด ๋ฐ์ ์์๋ง ๋ก๋)
| Document | Trigger | Purpose |
|---|
| sub-agent-isolation.md | ๋ณ๊ฒฝ ํ์ผ 10+ OR ๋ ์ด์ด 3+ | Parallel sub-agent execution protocol |
| ast-grep-rules.md | ast-grep ์ค์น + learned-patterns 5+ | AST-grep rule auto-generation |
Scripts
| ์คํฌ๋ฆฝํธ | ์ฉ๋ | ์ฌ์ฉ๋ฒ |
|---|
discover-project.sh | ํ๋ก์ ํธ ํ๋กํ์ผ ์๋ ๊ฐ์ง | ./discover-project.sh [--refresh] [--project path] |
learn-patterns.sh | ์ฝ๋ ํจํด ํ์ต | ./learn-patterns.sh [project-dir] |
capture-task-patterns.sh | ํจํด ํ์ต ์์ดํ
์ ํ/์ ์ฅ | ./capture-task-patterns.sh --detect [project] [--files "..."] |
verify-conventions.sh | 6-์นดํ
๊ณ ๋ฆฌ ์ปจ๋ฒค์
๊ฒ์ฆ | ./verify-conventions.sh [path] [summary|detailed] |
run-static-analysis.sh | ์ ์ ๋ถ์ ๋๊ตฌ ์คํ | ./run-static-analysis.sh [project] [Tier] |
setup-hooks.sh | Hooks ์๋ ์ค์น | ./setup-hooks.sh [--auto] |
generate-ast-rules.sh | AST-grep ๊ท์น ์๋ ์์ฑ (v3.0) | ./generate-ast-rules.sh [--preview|--apply] |
_common.sh | ๊ณต์ ์ ํธ๋ฆฌํฐ (๋ค๋ฅธ ์คํฌ๋ฆฝํธ์์ source) | ์ง์ ์คํ ๋ถ๊ฐ โ ๋ด๋ถ ๋ผ์ด๋ธ๋ฌ๋ฆฌ |
์คํฌ๋ฆฝํธ ์คํ ์๊ตฌ์ฌํญ:
- ํ์ CLI:
bash 4.0+, grep, find, wc, sed, awk
- ๊ถ์ฅ CLI:
ast-grep (๊ฒ์ฆ ์ ํ๋ 75%โ98%, ๊ท์น ์์ฑ)
- ์ ํ์ CLI:
jq (JSON ํ์ฑ, discover-project.sh), md5sum (์บ์ ํด์ฑ)
- ํ๊ฒฝ: Unix-like (Linux, macOS) โ Windows๋ WSL/Git Bash ํ์
Hooks Configuration
When Hooks are applied to the project, automatic verification runs on .kt/.java file modifications.
Configuration: templates/hooks-config.json
Installation script: scripts/setup-hooks.sh
Note: Hooks are defined in two places: plugin.json (plugin-level) and templates/hooks-config.json (project-level, installed via setup-hooks.sh). Use only one: plugin.json is active when the plugin is installed; hooks-config.json is for standalone use without the plugin. Do not enable both simultaneously to avoid duplicate hook execution.
Hooks ํ์ฑํ ๊ฐ์ด๋:
| ์ฌ์ฉ ์๋๋ฆฌ์ค | ํ์ฑํ ๋ฐฉ๋ฒ | ํ์ธ ๋ฐฉ๋ฒ |
|---|
| ํ๋ฌ๊ทธ์ธ์ผ๋ก ์ค์น | ์๋ ํ์ฑํ (plugin.json) | claude-code plugins list |
| ๋จ๋
์ฌ์ฉ (ํ๋ฌ๊ทธ์ธ ๋ฏธ์ค์น) | ./setup-hooks.sh --auto ์คํ | .claude/settings.local.json ํ์ธ |
| Hooks ๋นํ์ฑํ | settings.local.json์์ hooks ํญ๋ชฉ ์ญ์ | โ |
Context Health Protocol (v2.3)
๋กฑ ์ธ์
์์ ์ปจํ
์คํธ ์๋์ฐ ์ฌ์ฉ๋์ ๋ชจ๋ํฐ๋งํ๊ณ ์ ์ ์ ์ผ๋ก ๋์ํ๋ค.
์๋ ๊ฐ์ง ์์
| ์์ | ํธ๋ฆฌ๊ฑฐ |
|---|
| Loop 2+ ์ง์
์ | Verify ๋ฐ๋ณต ์์ ์ |
| Verify ์๋ฃ ํ | ๋ค์ Loop ๋๋ ์ข
๋ฃ ์ |
| ๋๊ท๋ชจ ํ์ผ ์ฝ๊ธฐ ํ | 500์ค ์ด์ ํ์ผ 3๊ฐ ์ด์ ์ฝ์ ๊ฒฝ์ฐ |
์๊ณ๊ฐ ๋์
| ์ฌ์ฉ๋ | ๋ ๋ฒจ | ๋์ |
|---|
| 70% | โ ๏ธ WARNING | "์ปจํ
์คํธ 70% ๋๋ฌ. ๋ถํ์ํ ํ์ผ ์ฝ๊ธฐ ์ต์ํํ๊ณ ํต์ฌ ๋ณ๊ฒฝ์ ์ง์ค" |
| 80% | ๐ถ RECOMMEND | "/compact ์คํ ํ ํ๋กํ์ผ ์ฌ๋ก๋ ๊ถ์ฅ. ํ์ฌ Loop ์๋ฃ ํ ์์ถ ์งํ" |
| 85% | ๐ด CRITICAL | "์ฆ์ /compact ์คํ ํ์. ์์ถ ํ ํ๋กํ์ผ + ํ์ฌ Phase ๋ฌธ์ ์ฌ๋ก๋ํ์ฌ ๊ณ์" |
์์ถ ํ ๋ณต๊ตฌ ์ ์ฐจ
1. /compact ์คํ ํ ์ปจํ
์คํธ ์์ฝ๋จ
2. ## Project Profile ํค๋ ์กด์ฌ ํ์ธ
3. IF ํค๋ ์์:
- discover-project.sh ์ฌ์คํ (์บ์์์ ๋ก๋)
- ํ์ฌ Phase์ Required Reads ์ฌ๋ก๋
4. IF Loop ์งํ ์ค:
- verify-snapshot.json ์ฌ๋ก๋
- ํ์ฌ Loop ๋ฒํธ ์ ์งํ์ฌ ๊ณ์
5. ๋ณต๊ตฌ ์๋ฃ ๋ฉ์์ง ์ถ๋ ฅ ํ ์์
์ฌ๊ฐ
์ปจํ
์คํธ ์ ์ฝ ์ง์นจ
- Loop 2+: ํ๋กํ ์ฝ/๋ ํผ๋ฐ์ค ๋ฌธ์ ์ฌ๋ก๋ ๊ธ์ง (Loop 1์์ ์ด๋ฏธ ๋ก๋๋จ)
- Verify: ๋ณ๊ฒฝ๋ ํ์ผ๋ง ์ฝ๊ธฐ (
--changed-only ์ต์
)
- ๋์ฉ๋ ํ์ผ: ํ์ํ ์น์
๋ง offset/limit์ผ๋ก ์ฝ๊ธฐ
- ์๋ฌ ํด๊ฒฐ: error-playbook.md์ ํด๋น ์น์
๋ง ์ฐธ์กฐ
Status Display Protocol (v2.4)
๊ฐ Phase/Loop ์ง์
์ ํ์ฌ ์ํ๋ฅผ ๊ฐ๊ฒฐํ๊ฒ ํ์ํ๋ค.
ํ์ ํ์
[sub-kopring-engineer] Phase: {phase} | Loop: {n}/{max} | Tier: {tier} | Context: {pct}% {bar}
์์:
[sub-kopring-engineer] Phase: Verify | Loop: 3/5 | Tier: STANDARD | Context: 67% โโโโโโโโโโ
[sub-kopring-engineer] Phase: Implement | Loop: 1/3 | Tier: LIGHT | Context: 45% โโโโโโโโโโ
[sub-kopring-engineer] Phase: Plan | Tier: N/A | Context: 23% โโโโโโโโโโ
ํ์ ์์
| ์์ | ์ค๋ช
| ๊ฐ ์์ |
|---|
| Phase | ํ์ฌ ๋จ๊ณ | Discovery, Brainstorm, Plan, Implement, Verify |
| Loop | ํ์ฌ/์ต๋ ๋ฃจํ (Verify๋ง) | 1/3, 2/5 |
| Tier | ํ์ฌ ๊ฒ์ฆ ํฐ์ด | LIGHT, STANDARD, THOROUGH |
| Context | ์ปจํ
์คํธ ์ฌ์ฉ๋ ์ถ์ | 67% |
| Bar | ์๊ฐ์ ํ๋ก๊ทธ๋ ์ค ๋ฐ | โโโโโโโโโโ |
ํ์ ์์
| ์ด๋ฒคํธ | ํ์ ์ฌ๋ถ |
|---|
| Phase ์ง์
| โ
ํ์ |
| Loop ์์ (Verify) | โ
ํ์ |
| Tier ์์ค์ปฌ๋ ์ด์
| โ
ํ์ + ๋ณ๊ฒฝ ์ฌ์ |
| ์ปจํ
์คํธ ์๊ณ๊ฐ ๋๋ฌ | โ
ํ์ + ๊ฒฝ๊ณ ๋ฉ์์ง |
| ์์
์๋ฃ | โ
์ต์ข
์ํ ํ์ |
ํ๋ก๊ทธ๋ ์ค ๋ฐ ์์ฑ
Context % โ Bar (10์นธ)
0-9% โ โโโโโโโโโโ
10-19% โ โโโโโโโโโโ
20-29% โ โโโโโโโโโโ
...
90-100% โ โโโโโโโโโโ
Session Wisdom Protocol (v2.5)
์ธ์
๊ฐ ์ํคํ
์ฒ ๊ฒฐ์ ๊ณผ ํ์ต ๋ด์ฉ์ ์ถ์ ํ์ฌ ์ฅ๊ธฐ ํ๋ก์ ํธ ๋งฅ๋ฝ์ ์ ์งํ๋ค.
์ ์ฅ ์์น
.sub-kopring-engineer/PROGRESS.md
ํ
ํ๋ฆฟ: templates/progress-template.md
๊ธฐ๋ก ์์
| ์์ | ๊ธฐ๋ก ๋ด์ฉ | ์๋/์๋ |
|---|
| Plan ์๋ฃ | ์ํคํ
์ฒ ๊ฒฐ์ (Port ์ถ๊ฐ, ๋ชจ๋ ๋ณ๊ฒฝ) | ์๋ |
| ์๋ฌ ํด๊ฒฐ | ์ด์ + ์์ธ + ํด๊ฒฐ ๋ฐฉ๋ฒ | ์๋ |
| ํจํด ๋ฐ๊ฒฌ | ์ฌ์ฉ์ ํ์ธ๋ ํจํด | ์๋ (์ฌ์ฉ์ ์น์ธ) |
| Loop ์๋ฃ | ์๋ฐ ํด๊ฒฐ ํ์คํ ๋ฆฌ | ์๋ |
| ์ธ์
์ข
๋ฃ | ๋ค์ ์ธ์
TODO | ์๋ |
ํ์ฉ ์์
| ์์ | ํ์ฉ ๋ฐฉ๋ฒ |
|---|
| ์ธ์
์์ | PROGRESS.md ์กด์ฌ ์ ์ฝ์ด์ ์ด์ ๋งฅ๋ฝ ํ์
|
| Plan ๋จ๊ณ | ์ด์ ์ํคํ
์ฒ ๊ฒฐ์ ์ฐธ์กฐํ์ฌ ์ผ๊ด์ฑ ์ ์ง |
| ์๋ฌ ๋ฐ์ | ์ด์ ํด๊ฒฐ ์ฌ๋ก ์ฐธ์กฐํ์ฌ ๋น ๋ฅธ ํด๊ฒฐ |
| ํจํด ์์ฑ | ์ด์ ํ์ต๋ ํจํด๊ณผ ์ถฉ๋ ์ฌ๋ถ ํ์ธ |
PROGRESS.md ๊ตฌ์กฐ
## {YYYY-MM-DD} Session
### ์์
์์ฝ
- {์ํํ ์ฃผ์ ์์
}
### ์ํคํ
์ฒ ๊ฒฐ์
| ๊ฒฐ์ | ๊ทผ๊ฑฐ | ์ํฅ ๋ฒ์ |
|------|------|----------|
### ๋ฐ๊ฒฌ๋ ์ด์
| ์ด์ | ์์ธ | ํด๊ฒฐ ๋ฐฉ๋ฒ |
|------|------|----------|
### ๋ฐ๋ณต ์๋ฌ ํจํด
| ์๋ฌ ์๊ทธ๋์ฒ | ๋ฐ์ ํ์ | ์ต๊ทผ ๋ฐ์์ผ | ์์ธ | ํด๊ฒฐ ๋ฐฉ๋ฒ | ์น๊ฒฉ ์ฌ๋ถ |
|-------------|----------|-----------|------|----------|----------|
> ๋์ผ ์๋ฐ(violation) ์๊ทธ๋์ฒ๊ฐ 3ํ ์ด์ ๊ธฐ๋ก๋๋ฉด error-playbook.md ํ๋ก์ ํธ ํ์ฅ์ผ๋ก ์น๊ฒฉ์ ์ ์ํ๋ค.
### ํ์ต๋ ํจํด
| ํจํด ์ ํ | ํจํด ๋ด์ฉ | ์ ์ฉ ์์น |
|----------|----------|----------|
### ๋ค์ ์ธ์
TODO
- [ ] {๋ฏธ์๋ฃ ์์
}
๋ณด์กด ๊ท์น
- ์ต๊ทผ 5๊ฐ ์ธ์
์ ์ง (์ด์ ์ธ์
์ ์์ฝ์ผ๋ก ์์ถ)
- ์ค์ ๊ฒฐ์ ์ ์๊ตฌ ๋ณด์กด (์ํคํ
์ฒ ๋ณ๊ฒฝ, ๋ชจ๋ ์ถ๊ฐ)
- ๋ฐ๋ณต ์ด์๋ error-playbook.md๋ก ์น๊ฒฉ ์ ์ (์๋ ์ ์ฐจ ์ฐธ์กฐ)
์๋ฌ ํจํด ์น๊ฒฉ ์ ์ฐจ (v2.7)
์๋ฌ๊ฐ PROGRESS.md "๋ฐ๋ณต ์๋ฌ ํจํด" ํ
์ด๋ธ์ 3ํ ์ด์ ๊ธฐ๋ก๋ ๊ฒฝ์ฐ:
- PROGRESS.md์์ ํด๋น ์๋ฌ ํจํด์ ์๊ทธ๋์ฒ/์์ธ/ํด๊ฒฐ ๋ฐฉ๋ฒ ์ถ์ถ
- error-playbook.md์ ํ์์ ๋ง์ถฐ ํด๊ฒฐ ํ๋กํ ์ฝ ์ด์ ์์ฑ
- ์ฌ์ฉ์์๊ฒ ์น๊ฒฉ ์ ์:
"์ด ์๋ฌ๊ฐ 3ํ ๋ฐ๋ณต๋์ต๋๋ค. error-playbook์ ์ถ๊ฐํ ๊น์?"
- ์น์ธ ์: error-playbook.md ํ๋จ์
## Project-Specific Errors ์น์
์ผ๋ก ์ถ๊ฐ
- ๊ฑฐ๋ถ ์: PROGRESS.md์๋ง ์ ์ง, ์น๊ฒฉ ์ฌ๋ถ๋ฅผ "๊ฑฐ๋ถ"๋ก ํ๊ธฐ