From agent-workflows
Co-designs coupled subsystems by spawning one agent per subsystem in isolated worktrees that iteratively negotiate and stabilize a shared interface contract.
npx claudepluginhub sjarmak/agent-workflowsThis skill uses the workspace's default tool permissions.
Dependent co-design of coupled subsystems. Spawns one agent PER SUBSYSTEM in isolated worktrees, all sharing a single evolving interface contract file. A coordinator merges contract proposals and broadcasts updates. Agents iterate until the contract stabilizes. Produces N co-designed subsystems plus the negotiated contract.
Mandates invoking relevant skills via tools before any response in coding sessions. Covers access, priorities, and adaptations for Claude Code, Copilot CLI, Gemini CLI.
Share bugs, ideas, or general feedback.
Dependent co-design of coupled subsystems. Spawns one agent PER SUBSYSTEM in isolated worktrees, all sharing a single evolving interface contract file. A coordinator merges contract proposals and broadcasts updates. Agents iterate until the contract stabilizes. Produces N co-designed subsystems plus the negotiated contract.
$ARGUMENTS — format: [rounds] subsystem1 subsystem2 [subsystem3...] [path/to/requirements.md] where rounds is optional max iteration count (default: 3, min 2, max 5) and subsystems are named components of the coupled system (min 2, max 5)
Extract:
api client, schema migration query-layer, frontend backend data-model)Validate:
If a requirements path is provided: read it and extract the interfaces, data flows, and coupling points between the named subsystems.
If no requirements path: ask the user to describe:
From this, draft the initial contract file — a structured document that defines the interface between all subsystems. The contract format:
# Interface Contract v0
## Status: DRAFT
## Subsystems
- {subsystem_1}: {one-line purpose}
- {subsystem_2}: {one-line purpose}
...
## Shared Types
{Data types, schemas, or models that cross subsystem boundaries}
## Interfaces
### {subsystem_1} -> {subsystem_2}
- Endpoint/method: ...
- Input: ...
- Output: ...
- Error cases: ...
### {subsystem_2} -> {subsystem_1}
- Endpoint/method: ...
- Input: ...
- Output: ...
- Error cases: ...
{Repeat for every directional interface between subsystems}
## Constraints
- {Protocol, format, auth, versioning, or other cross-cutting rules}
## Open Questions
- {Unresolved interface decisions}
Save the initial contract to the working directory as entangle_contract_{slugified_topic}.md.
Present the contract to the user and get confirmation before proceeding. The contract is the seed — agents will evolve it.
Launch all subsystem agents in parallel using the Agent tool. Each agent MUST:
isolation: "worktree" — each gets its own copy of the reposubagent_type: "general-purpose"CONTRACT_PROPOSAL.md in the repo root with any changes they need to the contract — additions, modifications, or clarificationsENTANGLE_NOTES.md in the repo root documenting their implementation decisionsAgent prompt template:
You are a subsystem agent designing and implementing one part of a coupled system.
## Interface Contract (Current Version)
{contract_content}
## Your Subsystem: {subsystem_name}
{subsystem_description}
## Requirements
{requirements_or_context}
Design and implement your subsystem according to the interface contract.
## Instructions
1. Read the interface contract carefully — it defines how you connect to other subsystems
2. Implement your subsystem: create and modify files as needed
3. Where the contract is ambiguous or incomplete for your needs, make the best decision you can
4. If you need the contract to change, write CONTRACT_PROPOSAL.md with your requested changes:
- What interface or type you want changed
- What the current definition is
- What you propose instead
- Why you need the change (what breaks or is awkward without it)
- Impact: which other subsystems would be affected
5. Write ENTANGLE_NOTES.md in the repo root with:
- Implementation approach summary
- Key design decisions and trade-offs
- Assumptions made about other subsystems
- Where your implementation depends on contract details being exactly right
- What would break if the contract changed (your fragile points)
- Self-assessed completeness [1-5]
6. Stage and commit all changes with message: "entangle round {round}: {subsystem_name}"
Do NOT:
- Implement other subsystems — stay in your lane
- Assume you know how other subsystems are built internally
- Ignore contract ambiguities — surface them in your proposal
- Over-engineer — implement what the contract requires, not what you imagine it might require later
After ALL agents return for a round, the coordinator (you) does the following:
Read each agent's CONTRACT_PROPOSAL.md. Categorize each proposed change:
Apply changes using these rules:
Update the contract version number and status:
v1 after Round 1 merge, v2 after Round 2 merge, etc.NEGOTIATING during iteration, STABILIZED when convergedThe contract has stabilized if ANY of these conditions is met:
If stabilized, skip to Phase 5.
Present the merged contract changes to the user:
Ask the user if they want to:
If continuing, proceed to Phase 4.
Re-launch all subsystem agents in parallel with:
ENTANGLE_NOTES.md content (so they have continuity)Use the same agent prompt template from Phase 2, with these additions to the instructions:
## Contract Changes Since Last Round
{diff_summary_of_contract_changes}
## Your Previous Notes
{previous_entangle_notes_content}
## Round {N} Instructions
- Review the contract changes — some may affect your implementation
- Adapt your implementation to match the updated contract
- If you still need changes, submit a new CONTRACT_PROPOSAL.md (but only for NEW issues, not re-litigating resolved ones)
- Update your ENTANGLE_NOTES.md with what changed and why
- If the contract now fully satisfies your needs, submit an empty CONTRACT_PROPOSAL.md with only: "No changes needed."
After agents return, repeat Phase 3 (Coordinate). Continue until convergence or max rounds.
Once the contract has stabilized:
For each subsystem agent:
ENTANGLE_NOTES.md from each worktreegit diff --stat from base) per worktreeProduce an integration report:
1. Final Contract Summary The stabilized contract with version number and a changelog showing how it evolved from v0.
2. Subsystem Status Table
| Dimension | Subsystem A | Subsystem B | Subsystem C |
|---|---|---|---|
| Completeness | ... | ... | ... |
| Contract compliance | ... | ... | ... |
| Proposals submitted | ... | ... | ... |
| Proposals accepted | ... | ... | ... |
| Files changed | ... | ... | ... |
| Fragile points | ... | ... | ... |
3. Negotiation History For each round:
4. Integration Risk Map For each interface in the contract:
stable (unchanged since v0), settled (changed then stabilized), volatile (changed every round)5. Contract Fitness Assessment
Save the full report to the working directory as entangle_{slugified_topic}.md.
Present the final contract, the integration report, and ask the user how to proceed:
/stress-test targeting the interface boundariesRemind the user: the contract is the primary artifact. Even if the prototype code is thrown away, the negotiated contract captures hard-won interface decisions that should survive into production.
isolation: "worktree".This skill is used when the problem involves tightly coupled subsystems that must be co-designed:
/brainstorm or /diverge (explore the problem) -> /entangle (co-design coupled subsystems) -> /stress-test (attack the interfaces) -> /scaffold (plan the build) -> implementation
Use /entangle instead of /diverge-prototype when subsystems CANNOT be designed independently — when interface decisions in one subsystem constrain or break another. If subsystems are truly independent, use /diverge-prototype instead.