Skip to content

Commit 4deb916

Browse files
committed
refactor(levelup): revert CDR storage to markdown
- /levelup.init outputs to {PROJECT}/.specify/memory/cdr.md - /levelup.clarify reads/writes .specify/memory/cdr.md - /levelup.skills validates only Accepted CDRs - /levelup.implement extracts accepted CDRs to {TEAM_DIRECTIVES}/CDR.md - Added CDR_FILE to setup-levelup scripts - Bump version to 0.0.127
1 parent 2d6f59b commit 4deb916

8 files changed

Lines changed: 147 additions & 93 deletions

File tree

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@ All notable changes to the Specify CLI and templates are documented here.
77
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
88
and this project adheres to to [Semantic Versioning](https://semver.org/spec/v2.0.0/).
99

10+
## [0.0.127] - 2026-03-13
11+
12+
### Changed
13+
14+
- **Breaking**: Reverted CDR storage from JSON to markdown
15+
- `/levelup.init` now outputs to `{PROJECT}/.specify/memory/cdr.md` (local)
16+
- `/levelup.clarify` reads/writes `.specify/memory/cdr.md`
17+
- `/levelup.skills` validates only CDRs with status "Accepted"
18+
- `/levelup.implement` copies only accepted CDRs to `{TEAM_DIRECTIVES}/CDR.md` (root)
19+
- Added `CDR_FILE` to setup-levelup scripts output
20+
- Removed status field from `.skills.json` references
21+
1022
## [0.0.126] - 2026-03-12
1123

1224
### Changed

extensions/levelup/commands/clarify.md

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ You **MUST** consider the user input before proceeding (if not empty).
3737

3838
Resolve ambiguities in discovered or proposed CDRs through **clarifying questions**. Update module statuses based on answers.
3939

40-
**Input**: Modules from `{TEAM_DIRECTIVES}/.cdrs.json` with status "discovered" or "proposed"
40+
**Input**: CDRs from `{REPO_ROOT}/.specify/memory/cdr.md` with status "Discovered" or "Proposed"
4141

42-
**Output**: Updated modules with refined content and new statuses in `.cdrs.json`
42+
**Output**: Updated CDRs with refined content and new statuses in `.specify/memory/cdr.md`
4343

4444
**Key Concept**:
4545

@@ -105,11 +105,11 @@ Or set: export SPECIFY_TEAM_DIRECTIVES=/path/to/team-ai-directives
105105

106106
#### Step 1: Load CDRs
107107

108-
Read `{TEAM_DIRECTIVES}/.cdrs.json` and parse all modules.
108+
Read `{REPO_ROOT}/.specify/memory/cdr.md` and parse all CDRs.
109109

110110
Filter modules by status:
111-
- **Primary**: Status = "discovered" or "proposed"
112-
- **Skip**: Status = "accepted", "active", "deprecated"
111+
- **Primary**: Status = "Discovered" or "Proposed"
112+
- **Skip**: Status = "Accepted", "Rejected", "Deprecated"
113113

114114
If user specified specific module IDs, filter to those.
115115

@@ -247,33 +247,30 @@ If content needs revision:
247247

248248
### Phase 5: Update Modules
249249

250-
**Objective**: Write updated modules to `.cdrs.json`
250+
**Objective**: Write updated CDRs to `.specify/memory/cdr.md`
251251

252-
#### Step 1: Update Module File
252+
#### Step 1: Update CDR File
253253

254-
Update `{TEAM_DIRECTIVES}/.cdrs.json` for each clarified module:
254+
Update `{REPO_ROOT}/.specify/memory/cdr.md` for each clarified CDR:
255255

256-
1. Update status field
256+
1. Update status in the CDR index table
257257
2. Add or update content if revised
258-
3. Add clarification metadata:
258+
3. Add clarification metadata in the CDR section:
259259

260-
```json
261-
{
262-
"modules": {
263-
"{module-id}": {
264-
"path": "context_modules/rules/{domain}/{file}.md",
265-
"type": "rule",
266-
"status": "accepted",
267-
"clarification": {
268-
"date": "2026-03-12",
269-
"validation": "{validity answer}",
270-
"scope": "{scope answer}",
271-
"priority": "{priority answer}",
272-
"changes": ["{list of changes}"]
273-
}
274-
}
275-
}
276-
}
260+
```markdown
261+
### CDR-{ID}: {Title}
262+
263+
**Status**
264+
265+
**Accepted** | Proposed | Rejected
266+
267+
### Clarification
268+
269+
- **Date**: {YYYY-MM-DD}
270+
- **Validation**: {validity answer}
271+
- **Scope**: {scope answer}
272+
- **Priority**: {priority answer}
273+
- **Changes**: {list of changes}
277274
```
278275

279276
### Phase 6: Summary
@@ -345,13 +342,13 @@ Run `/levelup.implement` to:
345342

346343
| File | Description |
347344
|------|-------------|
348-
| `{TEAM_DIRECTIVES}/.cdrs.json` | Updated Context Directive Records |
345+
| `{REPO_ROOT}/.specify/memory/cdr.md` | Updated Context Directive Records |
349346

350347
## Notes
351348

352-
- Only modules with status "discovered" or "proposed" are clarified
353-
- Accepted modules (status "accepted") are ready for `/levelup.implement`
354-
- Rejected modules can be removed or kept with status "deprecated"
349+
- Only CDRs with status "Discovered" or "Proposed" are clarified
350+
- Accepted CDRs (status "Accepted") are ready for `/levelup.implement`
351+
- Rejected CDRs can be removed or kept with status "Deprecated"
355352
- Content can be revised multiple times before acceptance
356353
- No automatic handoff - user decides next step
357354

extensions/levelup/commands/implement.md

Lines changed: 73 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,16 @@ You **MUST** consider the user input before proceeding (if not empty).
2525
Compile accepted CDRs into a **draft PR** to the team-ai-directives repository. Create or update context modules based on CDR decisions.
2626

2727
**Input**:
28-
- Accepted CDRs from `{TEAM_DIRECTIVES}/.cdrs.json` (with status "accepted")
28+
- Accepted CDRs from `{REPO_ROOT}/.specify/memory/cdr.md` (with status "Accepted")
2929
- Draft skills from `.specify/drafts/skills/`
3030
- Team-ai-directives repository
3131

3232
**Output**:
3333
- New branch in team-ai-directives
3434
- Created/updated context modules
3535
- Draft PR (or ready PR with `--ready` flag)
36-
- Updated CDR statuses to "active" in `.cdrs.json`
36+
- Creates/updates context modules in team-ai-directives
37+
- Copies accepted CDRs to `{TEAM_DIRECTIVES}/CDR.md`
3738

3839
**MCP Integration**:
3940

@@ -53,7 +54,7 @@ You are acting as a **Context Publisher** - moving accepted CDRs from local draf
5354
### Prerequisites
5455

5556
Before running:
56-
1. At least one module with status "accepted" in `{TEAM_DIRECTIVES}/.cdrs.json`
57+
1. At least one CDR with status "Accepted" in `{REPO_ROOT}/.specify/memory/cdr.md`
5758
2. Team-ai-directives repository configured and accessible
5859
3. Working tree at team-ai-directives is clean
5960
4. Git credentials configured for push
@@ -109,7 +110,7 @@ Please commit or stash changes before running /levelup.implement.
109110

110111
#### Step 3: Load Accepted CDRs
111112

112-
Read `{TEAM_DIRECTIVES}/.cdrs.json` and filter modules with:
113+
Read `{REPO_ROOT}/.specify/memory/cdr.md` and filter CDRs with:
113114
- Status = "accepted"
114115

115116
If no accepted modules, **STOP**:
@@ -205,15 +206,69 @@ Update `.skills.json`:
205206
```json
206207
{
207208
"skills": {
208-
"internal": {
209-
"local:./skills/{skill-name}": {
210-
// entry from .skills-entry.json
211-
}
209+
"local:./skills/{skill-name}": {
210+
"version": "1.0.0",
211+
"description": "{description}"
212212
}
213213
}
214214
}
215215
```
216216

217+
#### Step 5: Extract Accepted CDRs to CDR.md
218+
219+
Extract only CDRs with status "Accepted" from `{REPO_ROOT}/.specify/memory/cdr.md` and create `{TEAM_DIRECTIVES}/CDR.md`:
220+
221+
1. Parse the source cdr.md file
222+
2. Filter to only include CDRs with status "Accepted"
223+
3. Generate new CDR.md with the accepted CDRs only
224+
225+
```markdown
226+
# Context Directive Records
227+
228+
Context Directive Records tracking approved contributions to team-ai-directives.
229+
230+
## CDR Index
231+
232+
| ID | Target Module | Context Type | Status | Date | Source |
233+
|----|---------------|--------------|--------|------|--------|
234+
| CDR-001 | context_modules/rules/python/error-handling.md | Rule | Accepted | 2026-03-12 | {project-name} |
235+
236+
---
237+
238+
## CDR-001: {Title}
239+
240+
### Status
241+
242+
**Accepted** | Proposed | Rejected
243+
244+
### Date
245+
246+
YYYY-MM-DD
247+
248+
### Source
249+
250+
{project-name}
251+
252+
### Target Module
253+
254+
`context_modules/rules/{domain}/{file}.md`
255+
256+
### Context Type
257+
258+
Rule | Persona | Example | Constitution Amendment
259+
260+
### Context
261+
262+
{Content from CDR}
263+
264+
### Decision
265+
266+
{Decision from CDR}
267+
268+
...
269+
270+
```
271+
217272
### Phase 3: Commit Changes
218273

219274
**Objective**: Stage and commit all changes
@@ -222,7 +277,7 @@ Update `.skills.json`:
222277

223278
```bash
224279
cd "$TEAM_DIRECTIVES"
225-
git add context_modules/ skills/ .skills.json
280+
git add context_modules/ skills/ .skills.json CDR.md
226281
```
227282

228283
#### Step 2: Generate Commit Message
@@ -270,6 +325,10 @@ Context module contributions from **{project-name}**.
270325
| CDR-001 | Rule | context_modules/rules/python/error-handling.md |
271326
| CDR-002 | Example | context_modules/examples/testing/fixtures.md |
272327

328+
### CDR Records
329+
330+
Accepted CDRs are recorded in `CDR.md` for tracking.
331+
273332
### Skills Added
274333

275334
- `{skill-name}`: {description}
@@ -323,35 +382,9 @@ MCP tools not available. Create PR manually:
323382
5. Body: {copy PR description above}
324383
```
325384

326-
### Phase 5: Update CDR Statuses
327-
328-
**Objective**: Mark CDRs as active
385+
### Phase 5: Summary
329386

330-
Update `{TEAM_DIRECTIVES}/.cdrs.json`:
331-
332-
For each implemented module:
333-
- Change status: "accepted" → "active"
334-
335-
Add implementation metadata to the module entry:
336-
```json
337-
{
338-
"modules": {
339-
"{module-id}": {
340-
"path": "context_modules/rules/{domain}/{file}.md",
341-
"type": "rule",
342-
"status": "active",
343-
"implemented": {
344-
"date": "2026-03-12",
345-
"branch": "{BRANCH_NAME}",
346-
"pr": "{PR-URL}",
347-
"commit": "{commit-sha}"
348-
}
349-
}
350-
}
351-
}
352-
```
353-
354-
### Phase 6: Summary
387+
**Objective**: Present implementation results
355388

356389
**Objective**: Present implementation results
357390

@@ -405,7 +438,7 @@ Add implementation metadata to the module entry:
405438

406439
| File | Description |
407440
|------|-------------|
408-
| `{TEAM_DIRECTIVES}/.cdrs.json` | Updated CDR statuses (accepted → active) |
441+
| `{TEAM_DIRECTIVES}/CDR.md` | Accepted CDRs from this contribution |
409442
| `{TEAM_DIRECTIVES}/context_modules/**` | New/updated context modules |
410443
| `{TEAM_DIRECTIVES}/skills/**` | New skills |
411444
| `{TEAM_DIRECTIVES}/.skills.json` | Updated manifest |
@@ -420,8 +453,8 @@ Add implementation metadata to the module entry:
420453
## Notes
421454

422455
- Creates draft PR by default for review before merge
423-
- Only implements modules with status "accepted" in `.cdrs.json`
424-
- Updates module statuses to "active" after successful PR creation
456+
- Only implements CDRs with status "Accepted" from `.specify/memory/cdr.md`
457+
- Copies only accepted CDRs to `{TEAM_DIRECTIVES}/CDR.md`
425458
- Skills from `.specify/drafts/skills/` are included unless `--skip-skills`
426459
- If MCP unavailable, provides manual instructions
427460
- Working tree must be clean before running

extensions/levelup/commands/init.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Scan an **existing codebase** (brownfield) and discover patterns that could beco
4545

4646
**Output**:
4747

48-
1. **Proposed modules** added to `{TEAM_DIRECTIVES}/.cdrs.json` with status "proposed"
48+
1. **Proposed modules** added to `{REPO_ROOT}/.specify/memory/cdr.md` with status "Discovered" or "Proposed"
4949
2. **Summary** of discovered patterns by context type
5050
3. **Manual handoff options** to `/levelup.clarify` or `/levelup.specify`
5151

@@ -99,7 +99,7 @@ You are acting as a **Context Archaeologist** uncovering implicit team AI direct
9999
7. **Deduplication** (Phase 7): Filter out patterns already in team-ai-directives
100100
8. **CDR Generation** (Phase 8): Create CDRs for discovered patterns (status: "proposed")
101101
9. **Gap Analysis** (Phase 9): Identify areas where patterns are unclear
102-
10. **Output** (Phase 10): Write modules to `{TEAM_DIRECTIVES}/.cdrs.json`
102+
10. **Output** (Phase 10): Write CDRs to `{REPO_ROOT}/.specify/memory/cdr.md`
103103
11. **Handoff Options** (Phase 11): Present next step options
104104

105105
## Execution Steps
@@ -233,7 +233,7 @@ Run `{SCRIPT}` to set up the infrastructure:
233233
- Creates skills drafts directory at `.specify/drafts/skills/`
234234
- Returns JSON with `TEAM_DIRECTIVES`, `REPO_ROOT`
235235

236-
The `.cdrs.json` file should already exist in team-ai-directives.
236+
The `.specify/memory/cdr.md` file will be created in the project directory.
237237

238238
#### Step 2: Setup Directories
239239

@@ -436,12 +436,12 @@ Document gaps for `/levelup.clarify`:
436436

437437
#### Step 1: Write CDRs
438438

439-
Add proposed modules to `{TEAM_DIRECTIVES}/.cdrs.json`:
439+
Add proposed CDRs to `{REPO_ROOT}/.specify/memory/cdr.md`:
440440

441-
- Load existing `.cdrs.json`
442-
- Add new proposed modules with unique IDs
443-
- Save updated JSON
444-
- Do not overwrite existing active/accepted modules
441+
- Create `.specify/memory/` directory if it doesn't exist
442+
- Use the CDR template format (markdown with CDR index table)
443+
- Add new CDRs with unique IDs (CDR-001, CDR-002, etc.)
444+
- Do not overwrite existing accepted/active CDRs
445445

446446
#### Step 2: Create Summary
447447

@@ -480,9 +480,9 @@ Present discovery summary:
480480

481481
### Next Steps
482482

483-
1. Review proposed modules in `{TEAM_DIRECTIVES}/.cdrs.json`
483+
1. Review proposed CDRs in `{REPO_ROOT}/.specify/memory/cdr.md`
484484
2. Run `/levelup.clarify` to resolve ambiguities
485-
3. Mark modules as "accepted" or "deprecated"
485+
3. Mark CDRs as "Accepted" or "Rejected"
486486
4. Run `/levelup.implement` to create PR
487487
```
488488

@@ -518,7 +518,7 @@ Run `/levelup.implement` to:
518518

519519
| File | Description |
520520
|------|-------------|
521-
| `{TEAM_DIRECTIVES}/.cdrs.json` | Context Directive Records |
521+
| `{REPO_ROOT}/.specify/memory/cdr.md` | Context Directive Records (markdown) |
522522

523523
## Notes
524524

0 commit comments

Comments
 (0)