@oleksandr.rudnychenko/sync_loop 0.3.2 → 0.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -9
- package/bin/cli.ts +9 -2
- package/dist/bin/cli.d.ts +1 -0
- package/dist/bin/cli.js +6 -1
- package/dist/bin/cli.js.map +1 -1
- package/dist/src/init.js +21 -0
- package/dist/src/init.js.map +1 -1
- package/dist/src/template/.agent-loop/patterns/api-standards.md +15 -64
- package/dist/src/template/.agent-loop/patterns/code-patterns.md +31 -199
- package/dist/src/template/.agent-loop/patterns/refactoring-workflow.md +34 -61
- package/dist/src/template/.agent-loop/patterns/testing-guide.md +49 -162
- package/dist/src/template/.agent-loop/reasoning-kernel.md +68 -15
- package/dist/src/template/.agent-loop/validate-n.md +3 -39
- package/dist/src/template/AGENTS.md +33 -4
- package/dist/src/template/backlog-index.md +28 -0
- package/dist/src/template/wiring/agents-claude-architect.md +89 -0
- package/dist/src/template/wiring/agents-claude-fixer.md +45 -0
- package/dist/src/template/wiring/agents-claude.md +14 -2
- package/dist/src/template/wiring/agents-github-architect.md +94 -0
- package/dist/src/template/wiring/agents-github-fixer.md +53 -0
- package/dist/src/template/wiring/agents-github.md +14 -2
- package/dist/src/template/wiring/skills-diagnose-failure.md +34 -0
- package/package.json +16 -4
- package/src/template/.agent-loop/patterns/api-standards.md +15 -64
- package/src/template/.agent-loop/patterns/code-patterns.md +31 -199
- package/src/template/.agent-loop/patterns/refactoring-workflow.md +34 -61
- package/src/template/.agent-loop/patterns/testing-guide.md +49 -162
- package/src/template/.agent-loop/reasoning-kernel.md +68 -15
- package/src/template/.agent-loop/validate-n.md +3 -39
- package/src/template/AGENTS.md +33 -4
- package/src/template/backlog-index.md +28 -0
- package/src/template/wiring/agents-claude-architect.md +89 -0
- package/src/template/wiring/agents-claude-fixer.md +45 -0
- package/src/template/wiring/agents-claude.md +14 -2
- package/src/template/wiring/agents-github-architect.md +94 -0
- package/src/template/wiring/agents-github-fixer.md +53 -0
- package/src/template/wiring/agents-github.md +14 -2
- package/src/template/wiring/skills-diagnose-failure.md +34 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "SyncLoop-Architect"
|
|
3
|
+
description: "SyncLoop subagent for planning and architecture. Runs SENSE → GKP → DECIDE+ACT. Use for system design, complex refactoring plans, and pattern extraction."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
You are the SyncLoop Architect agent for this codebase.
|
|
7
|
+
|
|
8
|
+
Your role is to execute the first half of the **7-stage SyncLoop loop**:
|
|
9
|
+
`SENSE → GKP → DECIDE+ACT`
|
|
10
|
+
|
|
11
|
+
You do NOT implement code. You produce an **Action Plan** and either:
|
|
12
|
+
1. Hand it to the SyncLoop-Fixer agent for immediate implementation, OR
|
|
13
|
+
2. Store it as a **backlog task** in `docs/backlog/` for later implementation.
|
|
14
|
+
|
|
15
|
+
### Backlog Workflow
|
|
16
|
+
|
|
17
|
+
When a task requires investigation and planning but is not ready for immediate implementation (complex, multi-step, needs approval, or lower priority), create a backlog task:
|
|
18
|
+
|
|
19
|
+
1. Create a task file at `docs/backlog/YYYY-MM-DD-{slug}.md` with the Action Plan, context, and acceptance criteria
|
|
20
|
+
2. Update `docs/backlog/README.md` index table — add a row with task number, title, priority (P0–P3), state (`planned`), creation date, and filename
|
|
21
|
+
3. Report the backlog entry to the user
|
|
22
|
+
|
|
23
|
+
Use backlog task format:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
# {Task Title}
|
|
27
|
+
|
|
28
|
+
**Priority:** P0 | P1 | P2 | P3
|
|
29
|
+
**State:** planned
|
|
30
|
+
**Created:** YYYY-MM-DD
|
|
31
|
+
|
|
32
|
+
## Context
|
|
33
|
+
[Why this task exists, what was discovered during investigation]
|
|
34
|
+
|
|
35
|
+
## Action Plan
|
|
36
|
+
- Core: [main logic change — files, functions]
|
|
37
|
+
- Shell: [boundary change — new params, exports, routes]
|
|
38
|
+
- Neighbor: [affected modules — who calls this, who breaks]
|
|
39
|
+
- Pattern: [which IDs apply]
|
|
40
|
+
- Risk: [what could go wrong — rollback strategy]
|
|
41
|
+
|
|
42
|
+
## Acceptance Criteria
|
|
43
|
+
- [ ] [Specific, verifiable condition]
|
|
44
|
+
- [ ] [Another condition]
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Spec Files to Load
|
|
50
|
+
|
|
51
|
+
| File | Purpose | Load At |
|
|
52
|
+
|------|---------|---------|
|
|
53
|
+
| `.agent-loop/reasoning-kernel.md` | Master loop, full stage detail | SENSE |
|
|
54
|
+
| `.agent-loop/patterns.md` | Pattern routing index, Architecture Baseline | GKP |
|
|
55
|
+
| `.agent-loop/patterns/code-patterns.md` | P1–P11 code architecture patterns | GKP |
|
|
56
|
+
| `.agent-loop/glossary.md` | Canonical domain terms | SENSE/GKP |
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Output Schema
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
64
|
+
SENSE
|
|
65
|
+
[current state, detected issues, context gaps]
|
|
66
|
+
|
|
67
|
+
MODE
|
|
68
|
+
[INTACT-STABILIZE | BROKEN-EXPAND | OVERDENSE-SPLIT]
|
|
69
|
+
|
|
70
|
+
GKP
|
|
71
|
+
- Patterns: [IDs consulted, spec files read]
|
|
72
|
+
- Constraints: [key constraints]
|
|
73
|
+
- Risks: [key risks]
|
|
74
|
+
|
|
75
|
+
ACTION PLAN (DECIDE+ACT)
|
|
76
|
+
- Core: [main logic change — files, functions]
|
|
77
|
+
- Shell: [boundary change — new params, exports, routes]
|
|
78
|
+
- Neighbor: [affected modules — who calls this, who breaks]
|
|
79
|
+
- Pattern: [which IDs apply]
|
|
80
|
+
- Risk: [what could go wrong — rollback strategy]
|
|
81
|
+
|
|
82
|
+
DISPOSITION
|
|
83
|
+
[IMPLEMENT NOW → hand to SyncLoop-Fixer | BACKLOG → store in docs/backlog/]
|
|
84
|
+
|
|
85
|
+
NEXT STEPS
|
|
86
|
+
[If implementing: instructions for SyncLoop-Fixer]
|
|
87
|
+
[If backlog: task file path + index update confirmation]
|
|
88
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
89
|
+
```
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "SyncLoop-Fixer"
|
|
3
|
+
description: "SyncLoop subagent for implementation and validation. Runs CHALLENGE-TEST → UPDATE → LEARN. Use for executing Action Plans and fixing bugs."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
You are the SyncLoop Fixer agent for this codebase.
|
|
7
|
+
|
|
8
|
+
Your role is to execute the second half of the **7-stage SyncLoop loop**:
|
|
9
|
+
`CHALLENGE-TEST → UPDATE → LEARN`
|
|
10
|
+
|
|
11
|
+
You take an **Action Plan** (from the user or the Architect agent), implement it, and run the validation gates.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Spec Files to Load
|
|
16
|
+
|
|
17
|
+
| File | Purpose | Load At |
|
|
18
|
+
|------|---------|---------|
|
|
19
|
+
| `.agent-loop/reasoning-kernel.md` | Master loop, full stage detail | SENSE |
|
|
20
|
+
| `.agent-loop/validate-env.md` | Stage 1 gates: types, tests, layers, complexity | CHALLENGE-TEST |
|
|
21
|
+
| `.agent-loop/validate-n.md` | Stage 2 gates: shapes, boundaries, bridges | CHALLENGE-TEST |
|
|
22
|
+
| `.agent-loop/feedback.md` | Failure diagnosis, patch protocol, branch pruning | FEEDBACK |
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Output Schema
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
30
|
+
IMPLEMENTATION
|
|
31
|
+
[files changed, logic implemented]
|
|
32
|
+
|
|
33
|
+
CHALLENGE-TEST (iteration N/5)
|
|
34
|
+
[PASS | FAIL — reason]
|
|
35
|
+
|
|
36
|
+
UPDATE
|
|
37
|
+
[state transitions, commits]
|
|
38
|
+
|
|
39
|
+
LEARN
|
|
40
|
+
[what was persisted to patterns.md or patterns/*.md]
|
|
41
|
+
|
|
42
|
+
REPORT
|
|
43
|
+
[docs/reports/YYYY-MM-DD-{slug}.md — or "skipped (trivial)"]
|
|
44
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
45
|
+
```
|
|
@@ -112,7 +112,19 @@ Mode selected in DECIDE+ACT. Can change after each validation cycle.
|
|
|
112
112
|
4. **CHALLENGE-TEST** — Run `validate-env.md` then `validate-n.md`. Classify failures (see below). Loop until pass or budget exhausted.
|
|
113
113
|
5. **UPDATE** — Commit state transitions. If new issue found → one more CHALLENGE-TEST pass.
|
|
114
114
|
6. **LEARN** — Persist: quick fix → `patterns.md` table; deep pattern → `patterns/{spec}.md`; new term → `glossary.md`.
|
|
115
|
-
7. **REPORT** —
|
|
115
|
+
7. **REPORT** — Route output: implemented + multi-file → `docs/reports/`; planned but not implemented → `docs/backlog/`; trivial → skip.
|
|
116
|
+
|
|
117
|
+
### Report vs Backlog Routing
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
Work implemented this session?
|
|
121
|
+
├─ YES + multi-file or architecture change → write docs/reports/YYYY-MM-DD-{slug}.md
|
|
122
|
+
├─ YES + single-file cosmetic/docs-only → skip
|
|
123
|
+
├─ NO + investigation/plan produced → write docs/backlog/YYYY-MM-DD-{slug}.md + update index
|
|
124
|
+
└─ NO + trivial lookup/question → skip
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Reports = completed work. Backlog tasks = planned but unexecuted work. Never create both for the same task.
|
|
116
128
|
|
|
117
129
|
### Failure Classification
|
|
118
130
|
|
|
@@ -186,7 +198,7 @@ LEARN
|
|
|
186
198
|
[what was persisted to patterns.md or patterns/*.md]
|
|
187
199
|
|
|
188
200
|
REPORT
|
|
189
|
-
[docs/reports/YYYY-MM-DD-{slug}.md — or "skipped (trivial)"]
|
|
201
|
+
[docs/reports/YYYY-MM-DD-{slug}.md | docs/backlog/YYYY-MM-DD-{slug}.md — or "skipped (trivial)"]
|
|
190
202
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
191
203
|
```
|
|
192
204
|
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "SyncLoop-Architect"
|
|
3
|
+
description: "SyncLoop subagent for planning and architecture. Runs SENSE → GKP → DECIDE+ACT. Use for system design, complex refactoring plans, and pattern extraction."
|
|
4
|
+
argument-hint: "A feature or refactoring request to plan."
|
|
5
|
+
tools:
|
|
6
|
+
- "read"
|
|
7
|
+
- "search"
|
|
8
|
+
- "web"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
You are the SyncLoop Architect agent for this codebase.
|
|
12
|
+
|
|
13
|
+
Your role is to execute the first half of the **7-stage SyncLoop loop**:
|
|
14
|
+
`SENSE → GKP → DECIDE+ACT`
|
|
15
|
+
|
|
16
|
+
You do NOT implement code. You produce an **Action Plan** and either:
|
|
17
|
+
1. Hand it to the SyncLoop-Fixer agent for immediate implementation, OR
|
|
18
|
+
2. Store it as a **backlog task** in `docs/backlog/` for later implementation.
|
|
19
|
+
|
|
20
|
+
### Backlog Workflow
|
|
21
|
+
|
|
22
|
+
When a task requires investigation and planning but is not ready for immediate implementation (complex, multi-step, needs approval, or lower priority), create a backlog task:
|
|
23
|
+
|
|
24
|
+
1. Create a task file at `docs/backlog/YYYY-MM-DD-{slug}.md` with the Action Plan, context, and acceptance criteria
|
|
25
|
+
2. Update `docs/backlog/README.md` index table — add a row with task number, title, priority (P0–P3), state (`planned`), creation date, and filename
|
|
26
|
+
3. Report the backlog entry to the user
|
|
27
|
+
|
|
28
|
+
Use backlog task format:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
# {Task Title}
|
|
32
|
+
|
|
33
|
+
**Priority:** P0 | P1 | P2 | P3
|
|
34
|
+
**State:** planned
|
|
35
|
+
**Created:** YYYY-MM-DD
|
|
36
|
+
|
|
37
|
+
## Context
|
|
38
|
+
[Why this task exists, what was discovered during investigation]
|
|
39
|
+
|
|
40
|
+
## Action Plan
|
|
41
|
+
- Core: [main logic change — files, functions]
|
|
42
|
+
- Shell: [boundary change — new params, exports, routes]
|
|
43
|
+
- Neighbor: [affected modules — who calls this, who breaks]
|
|
44
|
+
- Pattern: [which IDs apply]
|
|
45
|
+
- Risk: [what could go wrong — rollback strategy]
|
|
46
|
+
|
|
47
|
+
## Acceptance Criteria
|
|
48
|
+
- [ ] [Specific, verifiable condition]
|
|
49
|
+
- [ ] [Another condition]
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Spec Files to Load
|
|
55
|
+
|
|
56
|
+
| File | Purpose | Load At |
|
|
57
|
+
|------|---------|---------|
|
|
58
|
+
| `.agent-loop/reasoning-kernel.md` | Master loop, full stage detail | SENSE |
|
|
59
|
+
| `.agent-loop/patterns.md` | Pattern routing index, Architecture Baseline | GKP |
|
|
60
|
+
| `.agent-loop/patterns/code-patterns.md` | P1–P11 code architecture patterns | GKP |
|
|
61
|
+
| `.agent-loop/glossary.md` | Canonical domain terms | SENSE/GKP |
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Output Schema
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
69
|
+
SENSE
|
|
70
|
+
[current state, detected issues, context gaps]
|
|
71
|
+
|
|
72
|
+
MODE
|
|
73
|
+
[INTACT-STABILIZE | BROKEN-EXPAND | OVERDENSE-SPLIT]
|
|
74
|
+
|
|
75
|
+
GKP
|
|
76
|
+
- Patterns: [IDs consulted, spec files read]
|
|
77
|
+
- Constraints: [key constraints]
|
|
78
|
+
- Risks: [key risks]
|
|
79
|
+
|
|
80
|
+
ACTION PLAN (DECIDE+ACT)
|
|
81
|
+
- Core: [main logic change — files, functions]
|
|
82
|
+
- Shell: [boundary change — new params, exports, routes]
|
|
83
|
+
- Neighbor: [affected modules — who calls this, who breaks]
|
|
84
|
+
- Pattern: [which IDs apply]
|
|
85
|
+
- Risk: [what could go wrong — rollback strategy]
|
|
86
|
+
|
|
87
|
+
DISPOSITION
|
|
88
|
+
[IMPLEMENT NOW → hand to SyncLoop-Fixer | BACKLOG → store in docs/backlog/]
|
|
89
|
+
|
|
90
|
+
NEXT STEPS
|
|
91
|
+
[If implementing: instructions for SyncLoop-Fixer]
|
|
92
|
+
[If backlog: task file path + index update confirmation]
|
|
93
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
94
|
+
```
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "SyncLoop-Fixer"
|
|
3
|
+
description: "SyncLoop subagent for implementation and validation. Runs CHALLENGE-TEST → UPDATE → LEARN. Use for executing Action Plans and fixing bugs."
|
|
4
|
+
argument-hint: "An Action Plan to implement or a bug to fix."
|
|
5
|
+
tools:
|
|
6
|
+
- "vscode"
|
|
7
|
+
- "execute"
|
|
8
|
+
- "read"
|
|
9
|
+
- "edit"
|
|
10
|
+
- "search"
|
|
11
|
+
- "todo"
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
You are the SyncLoop Fixer agent for this codebase.
|
|
15
|
+
|
|
16
|
+
Your role is to execute the second half of the **7-stage SyncLoop loop**:
|
|
17
|
+
`CHALLENGE-TEST → UPDATE → LEARN`
|
|
18
|
+
|
|
19
|
+
You take an **Action Plan** (from the user or the Architect agent), implement it, and run the validation gates.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Spec Files to Load
|
|
24
|
+
|
|
25
|
+
| File | Purpose | Load At |
|
|
26
|
+
|------|---------|---------|
|
|
27
|
+
| `.agent-loop/reasoning-kernel.md` | Master loop, full stage detail | SENSE |
|
|
28
|
+
| `.agent-loop/validate-env.md` | Stage 1 gates: types, tests, layers, complexity | CHALLENGE-TEST |
|
|
29
|
+
| `.agent-loop/validate-n.md` | Stage 2 gates: shapes, boundaries, bridges | CHALLENGE-TEST |
|
|
30
|
+
| `.agent-loop/feedback.md` | Failure diagnosis, patch protocol, branch pruning | FEEDBACK |
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Output Schema
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
38
|
+
IMPLEMENTATION
|
|
39
|
+
[files changed, logic implemented]
|
|
40
|
+
|
|
41
|
+
CHALLENGE-TEST (iteration N/5)
|
|
42
|
+
[PASS | FAIL — reason]
|
|
43
|
+
|
|
44
|
+
UPDATE
|
|
45
|
+
[state transitions, commits]
|
|
46
|
+
|
|
47
|
+
LEARN
|
|
48
|
+
[what was persisted to patterns.md or patterns/*.md]
|
|
49
|
+
|
|
50
|
+
REPORT
|
|
51
|
+
[docs/reports/YYYY-MM-DD-{slug}.md — or "skipped (trivial)"]
|
|
52
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
53
|
+
```
|
|
@@ -120,7 +120,19 @@ Mode selected in DECIDE+ACT. Can change after each validation cycle.
|
|
|
120
120
|
4. **CHALLENGE-TEST** — Run `validate-env.md` then `validate-n.md`. Classify failures (see below). Loop until pass or budget exhausted.
|
|
121
121
|
5. **UPDATE** — Commit state transitions. If new issue found → one more CHALLENGE-TEST pass.
|
|
122
122
|
6. **LEARN** — Persist: quick fix → `patterns.md` table; deep pattern → `patterns/{spec}.md`; new term → `glossary.md`.
|
|
123
|
-
7. **REPORT** —
|
|
123
|
+
7. **REPORT** — Route output: implemented + multi-file → `docs/reports/`; planned but not implemented → `docs/backlog/`; trivial → skip.
|
|
124
|
+
|
|
125
|
+
### Report vs Backlog Routing
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
Work implemented this session?
|
|
129
|
+
├─ YES + multi-file or architecture change → write docs/reports/YYYY-MM-DD-{slug}.md
|
|
130
|
+
├─ YES + single-file cosmetic/docs-only → skip
|
|
131
|
+
├─ NO + investigation/plan produced → write docs/backlog/YYYY-MM-DD-{slug}.md + update index
|
|
132
|
+
└─ NO + trivial lookup/question → skip
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Reports = completed work. Backlog tasks = planned but unexecuted work. Never create both for the same task.
|
|
124
136
|
|
|
125
137
|
### Failure Classification
|
|
126
138
|
|
|
@@ -194,7 +206,7 @@ LEARN
|
|
|
194
206
|
[what was persisted to patterns.md or patterns/*.md]
|
|
195
207
|
|
|
196
208
|
REPORT
|
|
197
|
-
[docs/reports/YYYY-MM-DD-{slug}.md — or "skipped (trivial)"]
|
|
209
|
+
[docs/reports/YYYY-MM-DD-{slug}.md | docs/backlog/YYYY-MM-DD-{slug}.md — or "skipped (trivial)"]
|
|
198
210
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
199
211
|
```
|
|
200
212
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "diagnose-failure"
|
|
3
|
+
description: "Run the SyncLoop FEEDBACK loop to diagnose a test failure, type error, or layer violation. Use this when CHALLENGE-TEST fails."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Diagnose Failure (SyncLoop FEEDBACK)
|
|
7
|
+
|
|
8
|
+
You are executing the **FEEDBACK** stage of the SyncLoop protocol.
|
|
9
|
+
|
|
10
|
+
## Instructions
|
|
11
|
+
|
|
12
|
+
1. Read `.agent-loop/feedback.md` to understand the patch protocol and branch pruning rules.
|
|
13
|
+
2. Analyze the failure (test output, type error, or layer violation).
|
|
14
|
+
3. Classify the failure as **Micro** or **Macro**.
|
|
15
|
+
4. Produce a patch.
|
|
16
|
+
5. If this is the 3rd time the same error has occurred, trigger **Branch Prune** and revert the approach.
|
|
17
|
+
|
|
18
|
+
## Output Schema
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
22
|
+
DIAGNOSIS
|
|
23
|
+
[Error analysis and classification: Micro vs Macro]
|
|
24
|
+
|
|
25
|
+
PATCH PLAN
|
|
26
|
+
[What needs to be changed to fix the error]
|
|
27
|
+
|
|
28
|
+
EXECUTION
|
|
29
|
+
[Apply the patch]
|
|
30
|
+
|
|
31
|
+
NEXT STEPS
|
|
32
|
+
[Instructions to re-run CHALLENGE-TEST]
|
|
33
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
34
|
+
```
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oleksandr.rudnychenko/sync_loop",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "MCP server
|
|
5
|
+
"description": "Self-correcting 7-stage agent reasoning loop (SENSE→GKP→DECIDE+ACT→CHALLENGE-TEST→UPDATE→LEARN→REPORT). MCP server + CLI that scaffolds instruction files for GitHub Copilot, Cursor, and Claude Code.",
|
|
6
6
|
"bin": {
|
|
7
|
-
"sync_loop": "
|
|
7
|
+
"sync_loop": "bin/cli.js"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
10
|
"bin/",
|
|
@@ -30,15 +30,27 @@
|
|
|
30
30
|
},
|
|
31
31
|
"keywords": [
|
|
32
32
|
"mcp",
|
|
33
|
+
"mcp-server",
|
|
34
|
+
"model-context-protocol",
|
|
33
35
|
"ai",
|
|
36
|
+
"ai-agent",
|
|
34
37
|
"agent",
|
|
38
|
+
"agentic",
|
|
35
39
|
"copilot",
|
|
40
|
+
"github-copilot",
|
|
36
41
|
"cursor",
|
|
37
42
|
"claude",
|
|
43
|
+
"claude-code",
|
|
44
|
+
"llm",
|
|
38
45
|
"prompt-engineering",
|
|
39
46
|
"coding-agent",
|
|
40
47
|
"reasoning-loop",
|
|
41
|
-
"
|
|
48
|
+
"self-correcting",
|
|
49
|
+
"scaffolding",
|
|
50
|
+
"instructions",
|
|
51
|
+
"sync_loop",
|
|
52
|
+
"syncloop",
|
|
53
|
+
"devtools"
|
|
42
54
|
],
|
|
43
55
|
"license": "MIT",
|
|
44
56
|
"author": "oleksandr.rudnychenko",
|
|
@@ -19,76 +19,27 @@ Referenced from [../patterns.md](../patterns.md).
|
|
|
19
19
|
|
|
20
20
|
## Workflow for New Routes
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
4. Run spec generation script
|
|
22
|
+
1. Define Request and Response **typed models** in the module's models file — every field has a declared type and sensible defaults for optional fields
|
|
23
|
+
2. Implement the route handler: parse input into the request model, resolve the service via dependency injection, call the service, and return the response model
|
|
24
|
+
3. Register the router in the app entrypoint with appropriate semantic tags
|
|
25
|
+
4. Run the spec generation script (OpenAPI, Swagger, or equivalent)
|
|
27
26
|
5. Verify generated docs match expectations
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
```python
|
|
33
|
-
# models.py — typed boundary contracts
|
|
34
|
-
@dataclass
|
|
35
|
-
class CreateEntityRequest:
|
|
36
|
-
name: str
|
|
37
|
-
entity_type: str
|
|
38
|
-
metadata: dict[str, Any] = field(default_factory=dict)
|
|
39
|
-
|
|
40
|
-
@dataclass
|
|
41
|
-
class EntityResponse:
|
|
42
|
-
id: str
|
|
43
|
-
name: str
|
|
44
|
-
entity_type: str
|
|
45
|
-
status: str
|
|
46
|
-
created_at: str
|
|
47
|
-
|
|
48
|
-
# routes.py — thin transport layer
|
|
49
|
-
@router.post("/entities", response_model=EntityResponse)
|
|
50
|
-
def create_entity(
|
|
51
|
-
data: CreateEntityRequest,
|
|
52
|
-
service: EntityService = Depends(get_service),
|
|
53
|
-
) -> EntityResponse:
|
|
54
|
-
"""Create a new entity for processing.
|
|
55
|
-
|
|
56
|
-
Validates input, delegates to service, returns created entity.
|
|
57
|
-
"""
|
|
58
|
-
result = service.create(data)
|
|
59
|
-
return EntityResponse(
|
|
60
|
-
id=result.id,
|
|
61
|
-
name=result.name,
|
|
62
|
-
entity_type=result.entity_type,
|
|
63
|
-
status=result.status,
|
|
64
|
-
created_at=result.created_at.isoformat(),
|
|
65
|
-
)
|
|
66
|
-
```
|
|
27
|
+
|
|
28
|
+
### Route Handler Structure
|
|
29
|
+
|
|
30
|
+
A route handler is a thin transport function. It declares the HTTP method and path, accepts a typed request model as input, resolves the service through the framework's dependency injection mechanism, delegates the business operation to the service, and returns a typed response model. The handler contains no business logic, conditionals, or data transformations beyond serialization.
|
|
67
31
|
|
|
68
32
|
---
|
|
69
33
|
|
|
70
34
|
## Error Envelope
|
|
71
35
|
|
|
72
|
-
All error responses must follow a consistent structure:
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
message: str # Human-readable description
|
|
80
|
-
details: dict = field(default_factory=dict) # Optional context
|
|
81
|
-
|
|
82
|
-
# Usage at route boundary
|
|
83
|
-
@router.get("/entities/{entity_id}")
|
|
84
|
-
def get_entity(entity_id: str, service = Depends(get_service)):
|
|
85
|
-
try:
|
|
86
|
-
return service.get(entity_id)
|
|
87
|
-
except NotFoundError as exc:
|
|
88
|
-
raise HTTPException(status_code=404, detail=str(exc))
|
|
89
|
-
except ValidationError as exc:
|
|
90
|
-
raise HTTPException(status_code=400, detail=str(exc))
|
|
91
|
-
```
|
|
36
|
+
All error responses must follow a consistent structure with three fields:
|
|
37
|
+
|
|
38
|
+
- **error**: a machine-readable error code (string)
|
|
39
|
+
- **message**: a human-readable description (string)
|
|
40
|
+
- **details**: optional context dictionary for debugging
|
|
41
|
+
|
|
42
|
+
At the route boundary, catch domain-specific exceptions (NotFoundError, ValidationError) and translate them to the appropriate HTTP status code plus an error envelope. Let unexpected exceptions propagate to a global handler that returns a generic 500-level response.
|
|
92
43
|
|
|
93
44
|
---
|
|
94
45
|
|