PLN-202: Add multi-repo support for planning and exploration - #45
Conversation
Add --add-dir flag to run-loop.sh enabling cross-repository planning.
When secondary repos are specified, the pre-explorer generates per-repo
code maps (code-map-{name}.json), the plan-draft-writer produces
multi-repo plans with @{repo} file prefixes, and discover-repos.sh
deduplicates peers across discovery tiers via CLOSEDLOOP_ADD_DIRS.
Key changes:
- run-loop.sh: --add-dir CLI flag, CLOSEDLOOP_ADD_DIRS/REPO_MAP env vars
- pre-explorer: multi-repo exploration with per-repo code-map output
- plan-draft-writer: ## Repositories table, @{repo}:path task prefixes
- discover-repos.sh: Tier 0 explicit dirs, dedup helpers, structured JSON
- plan-schema.json: repo field in tasks for multi-repo plans
- cross-repo agents: enhanced for multi-repo context
- New prompt-multi-repo.md orchestrator prompt
- Tests for discover-repos and setup-closedloop scripts
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Previous commit erroneously bumped 1.6.0 to 1.12.0 for PLN-202 multi-repo support. Per semver rules, a single MINOR bump to 1.7.0 is correct. Also adds the missing CHANGELOG.md entry documenting the multi-repo feature. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The `type` field duplicated `isPrimary` and its enum constraint blocked any future repurposing. Removed from schema, agent prompt examples, and field contract. Consolidated repositories validation tests into a single parametrized test covering single- and multi-entry canonical shapes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Keep prompt.md as the single source of truth and express the multi-repo variant as a small append-only overlay assembled onto the base at runtime by setup-closedloop.sh. Eliminates the drift risk of maintaining two near-identical 540-line prompts. - Add prompts/overlays/multi-repo.overlay.md with the three phase amendments (pre-explorer, plan-draft-writer, cross-repo-coordinator) - Add prompts/overlays/README.md documenting the overlay mechanism, authoring rules, and runtime contract - setup-closedloop.sh: resolve --prompt <name> as direct base file, else assemble base + overlay into \$WORKDIR/.closedloop/prompt-assembled.md, else fail loud. Auto-select "multi-repo" (not "prompt-multi-repo") when --add-dir is passed without explicit --prompt - run-loop.sh: accept --prompt <name> when either prompts/<name>.md or prompts/overlays/<name>.overlay.md exists - Delete prompts/prompt-multi-repo.md - Update test_setup_closedloop.py to verify assembled file equals base + blank + overlay - CLAUDE.md and plugins/code/README.md point at the overlays README Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… harness Replace six near-identical Tier 0 test functions with a single parametrized test driven by a declarative Tier0Scenario registry (RepoSpec + PeerExpect dataclasses). Adding a new case is now one registry entry instead of a new test function with duplicated setup. Work in progress — no version bump. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The equality check only caught exact workdir matches but missed the case where an --add-dir is a parent directory of the workdir (e.g. symphony-alpha vs symphony-alpha/.closedloop-ai/work). Extend the guard to also skip ancestor paths. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Bump code plugin to v1.9.0 and correct CHANGELOG section header - discover-repos.sh: root discoveryMethod now reports "add_dir" when only Tier 0 contributed peers (previously misreported "sibling_scan") - run-loop.sh: replace unexpanded $CLOSEDLOOP_STATE_DIR inside single-quoted help heredoc with literal .closedloop-ai so copy-pasted MONITORING commands from --help work - bootstrap-learnings.sh: use $CLOSEDLOOP_STATE_DIR in PROJECT_DIR suffix trim (completes SSOT migration) - test_compute_success_rates.py: import CLOSEDLOOP_STATE_DIR from compute_success_rates instead of duplicating the constant Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…closedloop.sh Tightens the overlays/README.md wording flagged in PR #45 review. The previous phrasing ("run-loop.sh --add-dir auto-selects --prompt multi-repo") was accurate from the user's vantage point but misleading for anyone auditing run-loop.sh in isolation: the auto-selection actually happens downstream in setup-closedloop.sh via PROMPT_NAME_EXPLICIT. Updated the README to name the correct file and explain the forwarding chain through the /code:code slash command. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Spent some time tracing how the multi-repo context actually reaches the agents and want to flag a few concerns before this merges. Not bug blockers, but worth addressing while the surface is small.
This PR introduces a new prompt-overlay abstraction (prompts/overlays/ dir, 65-line README, assembly branch in setup-closedloop.sh, auto-selection on --add-dir) to support exactly one consumer:
Net effect: we built an extension point, used it once, and the one use adds zero behavioral delta while spending ~38 lines of tokens per iteration and creating a drift risk (if the @repo:path convention in If there's no second overlay lined up, my vote is to delete the overlay infrastructure entirely (overlays dir, README, the assembly and auto-select branches in Side note: the PR description lists
The mechanism of tagging at discovery time is the right shape (much better than path-matching inside the agent), but the representation should pick one:
Either way, Step 1.1 in |
…ethod field Addresses PR #45 review: 1. Delete the prompt-overlay infrastructure (prompts/overlays/ directory and assembly/auto-select branches in setup-closedloop.sh). The sole overlay (multi-repo) only restated behavior that the target agents — pre-explorer, plan-draft-writer, cross-repo-prd-writer — already implement directly from CLOSEDLOOP_REPO_MAP / CLOSEDLOOP_ADD_DIRS. No behavioral delta from removal. 2. Drop the redundant "discoveryMethod": "add_dir" field from per-peer JSON in discover-repos.sh. "local": true is the single source of truth for identifying --add-dir peers. Remove the hand-written preservation step (Step 1.1) from cross-repo-coordinator.md. 3. Bump code plugin version 1.9.0 → 1.10.0 and consolidate unreleased changelog entries.
Summary
--add-dirflag torun-loop.shenabling multi-repository planning workflows. Secondary repos are passed viaCLOSEDLOOP_ADD_DIRSandCLOSEDLOOP_REPO_MAPenvironment variables.pre-exploreragent to generate per-repo code maps (code-map-{name}.json) for secondary repositories, andplan-draft-writerto produce multi-repo plans with## Repositoriestable and@{repo}:pathfile prefixes.discover-repos.shwith Tier 0 explicit directory support, path deduplication helpers, and alocal: truemarker on peers added via--add-dir(consumed bycross-repo-prd-writerto exclude local peers from PRD generation).repofield to plan schema for multi-repo task targeting and update cross-repo agents for enhanced context. Multi-repo behavior is owned by the agents themselves — the orchestrator prompt is unchanged.discover-repos.shandsetup-closedloop.shscripts.CLOSEDLOOP_STATE_DIRas a single source of truth for state directory name —.closedloop-ai.Changed Files
run-loop.sh,setup-closedloop.shpre-explorer.md,plan-draft-writer.md,plan-evaluator.md,cross-repo-coordinator.md,cross-repo-prd-writer.mdplan-schema.jsondiscover-repos.shsubagent-start-hook.shtest_discover_repos.py,test_setup_closedloop.py,test_validate_plan.py(new)plugin.json(version bump to 1.10.0)Test plan
Run
pytest plugins/code/tools/python/test_discover_repos.py— verify discover-repos tests passRun
pytest plugins/code/tools/python/test_setup_closedloop.py— verify setup-closedloop tests passRun
run-loop.sh --add-dir /path/to/secondary-repo --prd test.md— verify multi-repo env vars are exportedVerify pre-explorer generates
code-map-{name}.jsonfor secondary reposLoop ID: 019d7291-c472-706c-bf30-19de89cc4afe
Artifact: https://app.closedloop.ai/implementation-plans/PLN-202