You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+30Lines changed: 30 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,26 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
14
14
- Updated agent output path references from `.claude/runs/` to `.closedloop-ai/runs/` in `agent-prompt-generator`
15
15
- Updated bootstrap configuration documentation in `agent-bootstrap.md` to reference `.closedloop-ai/` state directory
16
16
17
+
### code v1.9.0
18
+
19
+
#### Added
20
+
- Multi-repo planning and exploration support via new `--add-dir` flag in `run-loop.sh`, exposing `CLOSEDLOOP_ADD_DIRS` and `CLOSEDLOOP_REPO_MAP` env vars to downstream agents
21
+
-`pre-explorer` agent produces per-repo code maps (`code-map-{name}.json`) when secondary repos are supplied
22
+
-`plan-draft-writer` agent emits multi-repo plans with a `## Repositories` table and `@{repo}:path` task prefixes
23
+
-`repositories` map field added to the plan root schema in `plan-schema.json` for multi-repo plan traceability, keyed by repo short-name with `path` and `isPrimary` metadata
24
+
- Tier 0 explicit-directory discovery and dedup helpers in `discover-repos.sh`, with structured JSON output and a `local: true` marker on `--add-dir` peers
25
+
- Tests for `discover-repos.sh` and `setup-closedloop.sh` (`test_discover_repos.py`, `test_setup_closedloop.py`) plus new multi-repo cases in `test_validate_plan.py`
26
+
27
+
#### Fixed
28
+
-`run-loop.sh` now scans the full per-iteration stream for the `<promise>` completion marker instead of only inspecting the final `type==result` record, preventing missed completion signals when the orchestrator emits the promise in an intermediate message followed by additional tool_use or wrap-up output
29
+
-`discover-repos.sh` now filters add-dirs that are ancestors of the workdir and deduplicates repo entries to prevent duplicate discovery results
30
+
31
+
#### Changed
32
+
- Consolidated Tier 0 `discover-repos.sh` tests into a single scenario-driven harness, replacing the prior fragmented per-case test files
33
+
- Migrated workdir internal state directory from `.closedloop/` to `.closedloop-ai/` across hooks, setup scripts, and loop state management
34
+
- Established `CLOSEDLOOP_STATE_DIR` constant as single source of truth for state directory name across shell scripts
35
+
- Added `Skill` to `plan-evaluator` agent's allowed tools to enable `code:plan-validate` skill execution
36
+
17
37
### code v1.6.0
18
38
19
39
#### Changed
@@ -45,6 +65,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
45
65
- Domain critic pass injection in fast-path reviewer via `{DOMAIN_CRITIC_PASS}` placeholder, enabling domain expert review within single-agent fast-path runs
- Migrated perf-substep state paths from `.closedloop/` to `.closedloop-ai/` in `run-judges` skill telemetry instrumentation
72
+
48
73
### judges v1.5.0
49
74
50
75
#### Changed
@@ -55,6 +80,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
55
80
#### Changed
56
81
- Version bump to align with cross-plugin `.closedloop-ai/` directory migration
57
82
83
+
### self-learning v1.1.1
84
+
85
+
#### Changed
86
+
- Established `CLOSEDLOOP_STATE_DIR` constant as single source of truth for state directory name in `bootstrap-learnings.sh`, `compute_success_rates.py`, and `write_merged_patterns.py`
Copy file name to clipboardExpand all lines: CLAUDE.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,7 +44,7 @@ Always use `plugin-name:skill-name` format (e.g., `self-learning:learning-qualit
44
44
45
45
### Closed Loop (run-loop.sh)
46
46
47
-
The core orchestration loop in `plugins/code/scripts/run-loop.sh`. Drives fresh-context Claude iterations — each `claude -p` invocation gets a clean context window. The orchestrator prompt at `plugins/code/prompts/prompt.md` coordinates 8 workflow phases via subagent delegation. Post-iteration, `run-loop.sh` runs an 11-step pipeline calling Python scripts from `self-learning/tools/python/`.
47
+
The core orchestration loop in `plugins/code/scripts/run-loop.sh`. Drives fresh-context Claude iterations — each `claude -p` invocation gets a clean context window. The orchestrator prompt at `plugins/code/prompts/prompt.md` coordinates 8 workflow phases via subagent delegation. Post-iteration, `run-loop.sh` runs an 11-step pipeline calling Python scripts from `self-learning/tools/python/`. Multi-repo behavior lives in the agents themselves (`pre-explorer`, `plan-draft-writer`, `cross-repo-coordinator`, `cross-repo-prd-writer`), which read `CLOSEDLOOP_REPO_MAP`, `CLOSEDLOOP_ADD_DIRS`, and the `local` flag on peers — no orchestrator-level branching is required.
Copy file name to clipboardExpand all lines: plugins/code/README.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -63,7 +63,7 @@ State is maintained in `$CLOSEDLOOP_WORKDIR/state.json` at each phase transition
63
63
```
64
64
65
65
-`working-directory`: Path to the work directory containing the PRD (defaults to current directory)
66
-
-`--prompt <name>`: Select an alternate orchestrator prompt from `prompts/` (defaults to `prompt`)
66
+
-`--prompt <name>`: Select an alternate orchestrator prompt (`prompts/<name>.md`). Defaults to `prompt`.
67
67
-`--prd <file>`: Explicitly specify the requirements file (auto-detected if omitted)
68
68
69
69
**What it does:**
@@ -276,7 +276,7 @@ Cleans up session-level artifacts: removes the session workdir mapping file, cle
276
276
277
277
Runs when any subagent starts. Performs three tasks:
278
278
279
-
1.**Loop agent state creation**: If the agent type appears in `loop-agents.json`, creates the initial state file in `{WORKDIR}/.closedloop/` if it does not already exist.
279
+
1.**Loop agent state creation**: If the agent type appears in `loop-agents.json`, creates the initial state file in `{WORKDIR}/.closedloop-ai/` if it does not already exist.
280
280
2.**Agent type tracking**: Writes the agent type, short name, and start timestamp to `.agent-types/{agent_id}` so the stop hook can track timing and type.
281
281
3.**Learning injection**: Reads `~/.closedloop-ai/learnings/org-patterns.toon`, filters patterns matching the agent's name, sorts by category priority (mistake > convention > pattern > insight) and confidence, and injects up to 15 patterns into the agent's context via `additionalContext`. Also injects environment variables (`CLOSEDLOOP_WORKDIR`, `CLAUDE_PLUGIN_ROOT`, etc.) into every agent's context.
282
282
@@ -293,7 +293,7 @@ Runs when any subagent exits. Performs:
293
293
294
294
Implements the validation loop for agents registered in `loop-agents.json`. When an agent exits:
295
295
296
-
1. Reads the loop state file (`{WORKDIR}/.closedloop/{state_file_suffix}`)
296
+
1. Reads the loop state file (`{WORKDIR}/.closedloop-ai/{state_file_suffix}`)
297
297
2. Checks whether the agent output contains the expected completion promise (e.g., `<promise>PLAN_VALIDATED</promise>`)
298
298
3. If the promise is present, optionally runs a validation script (e.g., `validate-plan.sh`)
299
299
4. If validation passes, allows the agent to exit (returns nothing)
@@ -346,7 +346,7 @@ Defines the structure of `code-map.json` produced by the `pre-explorer` agent. R
346
346
347
347
### `setup-closedloop.sh`
348
348
349
-
Initializes a ClosedLoop session. Parses arguments (`--prd`, `--max-iterations`, `--prompt`, positional workdir), auto-detects the PRD file by checking common patterns (`prd.md`, `prd.pdf`, `requirements.md`, etc.), establishes the session-to-workdir mapping, validates the prompt name, and writes `{WORKDIR}/.closedloop/config.env` with all environment variables.
349
+
Initializes a ClosedLoop session. Parses arguments (`--prd`, `--max-iterations`, `--prompt`, positional workdir), auto-detects the PRD file by checking common patterns (`prd.md`, `prd.pdf`, `requirements.md`, etc.), establishes the session-to-workdir mapping, validates the prompt name, and writes `{WORKDIR}/.closedloop-ai/config.env` with all environment variables.
350
350
351
351
### `run-loop.sh`
352
352
@@ -485,7 +485,7 @@ After a full run, the work directory will contain:
Write `$CLOSEDLOOP_WORKDIR/.cross-repo-needs.json`. The `local` field on each need entry comes directly from the peer's `local` field in `discover-repos.sh` output (defaulting to `false` when absent — only `--add-dir` peers carry `local: true`):
Copy file name to clipboardExpand all lines: plugins/code/agents/cross-repo-prd-writer.md
+17-5Lines changed: 17 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,15 +21,25 @@ Read `$CLOSEDLOOP_WORKDIR/.cross-repo-needs.json` for the list of needed capabil
21
21
22
22
Read `$CLOSEDLOOP_WORKDIR/.discovery-cache/{peer_name}.json` for each peer to see verification results.
23
23
24
-
### Step 2: Identify Missing Capabilities
24
+
### Step 2: Filter Out Local Repos
25
25
26
-
For each capability in the needs file, check the discovery cache:
26
+
Before evaluating capabilities, inspect each peer entry in `.cross-repo-needs.json`:
27
+
- If the peer has `local: true` → **exclude it entirely** from all further processing. These are add-dir repos whose tasks are already incorporated into the plan; there is nothing to build in a remote repo.
28
+
- Only process peers where `local` is absent or `local: false`.
29
+
30
+
Track the count of excluded peers for the output summary.
31
+
32
+
### Step 3: Identify Missing Capabilities
33
+
34
+
For each **non-local** peer's capabilities, check the discovery cache:
27
35
- If `exists: true` → skip (already exists in peer)
28
36
- If `exists: false` → include in PRD
29
37
30
-
### Step 3: Generate PRDs
38
+
### Step 4: Generate PRDs
39
+
40
+
For each non-local peer with missing capabilities, create `$CLOSEDLOOP_WORKDIR/cross-repo-prd-{peer_name}.md`.
31
41
32
-
For each peer with missing capabilities, create `$CLOSEDLOOP_WORKDIR/cross-repo-prd-{peer_name}.md`:
42
+
**Guard:** If a capability's parent peer has `local: true`, skip PRD generation for that capability entirely — do not create or modify any PRD file for it.
33
43
34
44
**IMPORTANT:** Before writing any file, you MUST first attempt to Read it. This is required by Claude Code's safety system:
35
45
1. Try to Read the target file path
@@ -67,7 +77,7 @@ This document describes capabilities needed from **{peer_name}** to support impl
67
77
...
68
78
```
69
79
70
-
### Step 4: Update plan.json
80
+
### Step 5: Update plan.json
71
81
72
82
**Note:** Read `$CLOSEDLOOP_WORKDIR/plan.json` first before editing it.
Optional: **Architecture Diagrams** using `engineering:mermaid-visualizer` skill.
151
+
Optional: **Repositories** (only when `CLOSEDLOOP_ADD_DIRS` is non-empty) - Table of all repos, placed after Summary. See `## Multi-Repository Plans`.
143
152
144
153
## JSON Field Sync
145
154
@@ -179,6 +188,87 @@ Optional: **Architecture Diagrams** using `engineering:mermaid-visualizer` skill
179
188
Manual tasks do NOT block the automated loop from completing. They are reported at the end for the human to perform.
180
189
</critical_constraint>
181
190
191
+
## Multi-Repository Plans
192
+
193
+
**Skip this entire section if `CLOSEDLOOP_ADD_DIRS` is empty or unset.**
194
+
195
+
When `CLOSEDLOOP_ADD_DIRS` is non-empty, the plan spans multiple repositories. Follow these steps:
196
+
197
+
### Step M1: Parse Repository Map
198
+
199
+
Read the `CLOSEDLOOP_REPO_MAP` environment variable (pipe-separated `name=path` entries) to get the list of secondary repos. The primary repo is the main project codebase. Example:
These files are produced by the pre-explorer agent. Each contains the relevant files and patterns for that repository. Use this information to understand what files in each secondary repo are affected by the plan.
216
+
217
+
### Step M3: Use `@{repo-name}:path` Prefix for File References
218
+
219
+
When writing task descriptions that reference files in secondary repos, prefix them with `@{repo-name}:`:
220
+
221
+
-**Primary repo** (no prefix): `src/components/LoginForm.tsx`
This convention makes cross-repo task scope unambiguous. Apply it consistently in all task descriptions, acceptance criteria references, and the Repositories section.
226
+
227
+
### Step M4: Add `## Repositories` Section to Plan Markdown
228
+
229
+
Include a `## Repositories` section in the markdown `content` field, placed immediately after `## Summary`:
| Multi-Repo (if applicable) | When `CLOSEDLOOP_ADD_DIRS` is set: `## Repositories` table present in markdown, `repositories` field in plan.json, `@{repo-name}:path` prefix used for secondary repo file references |
| 7 | Add-dir repos | 0 | Read CLOSEDLOOP_ADD_DIRS from environment; non-empty value forces count >= 1, failing this signal |
44
45
45
46
**Evaluation rules:**
46
47
- Count PRD words using whitespace splitting (approximate is fine)
47
48
- Forbidden term matching is case-insensitive
48
49
- Cross-repo keyword matching is case-insensitive
49
50
- If any threshold fails, `simple_mode = false`
51
+
- Signal 7 evaluates `CLOSEDLOOP_ADD_DIRS` from the injected environment -- if non-empty (count of pipe-delimited paths >= 1) the signal fails, forcing `simple_mode = false`; if empty or unset the signal passes.
50
52
51
53
### Step 3: Select Critics (only if simple_mode = false)
0 commit comments