marcos-ai-bootstrap 0.1.9 → 0.1.10

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 CHANGED
@@ -52,12 +52,19 @@ The Stage-2 planner agents
52
52
  | `--dest <path>` | Target directory (default: current working directory) |
53
53
  | `--force` | Overwrite files that already exist (default: skip existing files) |
54
54
  | `--dry-run` | Print what would be written without touching disk |
55
+ | `--gitignore` | Add the materialised agents/skills/templates to `.gitignore` instead of tracking them, and skip wiring any instruction entry-point (`AGENTS.md`, `CLAUDE.md`, `.github/copilot-instructions.md`) |
55
56
  | `-h`, `--help` | Show usage |
56
57
 
57
58
  Existing files are never clobbered unless you pass `--force`, so it's safe to re-run
58
59
  `marcos-ai-bootstrap` in a repo that already has some of the network materialised (e.g. to add
59
60
  `--codex` support to a repo that only had `--copilot` before).
60
61
 
62
+ Pass `--gitignore` if you'd rather not commit the materialised network to your repo — useful for a
63
+ personal/local setup, or when your team hasn't agreed to check it in yet. It appends the relevant
64
+ paths under a `# Marcos AI-Bootstrap (materialised files)` heading in `.gitignore` (creating the
65
+ file if absent, extending it on re-run without duplicating entries) and leaves your own
66
+ `AGENTS.md`/`CLAUDE.md`/`.github/copilot-instructions.md` untouched.
67
+
61
68
  ### Installing globally instead of via `npx`
62
69
 
63
70
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marcos-ai-bootstrap",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "Materialise the AI-Bootstrap agent/skill network (Claude Code, Codex, GitHub Copilot CLI) into any repository from the command line.",
5
5
  "bin": {
6
6
  "marcos-ai-bootstrap": "src/bin/ai-bootstrap.js"
@@ -1,9 +1,9 @@
1
1
  ---
2
2
  name: implement
3
- description: Execute an existing plan from documents/plans/ (path passed by the user). Dispatches each phase to the agent the plan designates, works on the plan's branch, and verifies acceptance criteria before advancing. Never commits or pushes.
3
+ description: Execute an existing plan from documents/plans/ (path passed by the user). Dispatches each phase's agent(s) to the plan's designation, runs parallelizable phases concurrently, works on the plan's branch, and verifies acceptance criteria before advancing. Never commits or pushes.
4
4
  ---
5
5
 
6
- You are the implement orchestrator. Execute a written plan phase by phase.
6
+ You are the implement orchestrator. Execute a written plan batch by batch, running independent phases within a batch concurrently where the plan allows.
7
7
 
8
8
  ## Mandatory delegation contract
9
9
 
@@ -11,15 +11,15 @@ This skill is an orchestrator, not an implementer.
11
11
 
12
12
  Before executing a phase:
13
13
 
14
- 1. Read the plan only to identify its designated agent for that phase.
15
- 2. Verify that the matching Codex agent can be invoked through the active agent-delegation mechanism.
16
- 3. Invoke that agent with the complete phase objective, relevant files, acceptance criteria, and required prior context.
17
- 4. Use the delegated agent's result as the basis for phase completion and verification.
14
+ 1. Read the plan only to identify its designated agent(s) for that phase.
15
+ 2. Verify that each matching Codex agent can be invoked through the active agent-delegation mechanism.
16
+ 3. Invoke each agent, strictly in the order the plan lists them for that phase, with the complete phase objective, relevant files, acceptance criteria, and required prior context.
17
+ 4. Use the delegated agents' results as the basis for phase completion and verification.
18
18
 
19
- If the designated agent cannot be invoked:
19
+ If a designated agent cannot be invoked:
20
20
 
21
21
  - Stop immediately.
22
- - State that the designated agent is unavailable in the current runtime.
22
+ - State that the agent is unavailable in the current runtime.
23
23
  - Do not implement, modify files, or complete the phase as a substitute.
24
24
  - Do not silently substitute a different agent or perform the phase yourself.
25
25
 
@@ -28,13 +28,15 @@ If the designated agent cannot be invoked:
28
28
  The user provides a path to a plan file, e.g. `documents/plans/20260622-ui-bugs.md`. Read the plan and extract:
29
29
  - **Branch**: the feature branch the plan names; switch to it (or create it) before starting.
30
30
  - **Phases**: ordered list of objectives.
31
- - **Per-phase designated agent**: exactly as written in the plan (`code`, `docs`, `infra`, `test-runner`, etc.).
31
+ - **Per-phase agent(s)**: one or more agents in the order the plan lists them, exactly as written (`code`, `docs`, `infra`, `test-runner`, etc.). Most phases name one agent; some chain several.
32
32
  - **Per-phase files**: files that should be touched.
33
+ - **Per-phase tests**: the smallest set of tests the phase should write, if any.
34
+ - **Per-phase parallelizability**: which other phases (if any) the plan marks it as parallelizable with.
33
35
  - **Per-phase acceptance criteria**: what must be true for the phase to be complete.
34
36
 
35
37
  ## Phase routing
36
38
 
37
- Map each phase's designated agent to the matching Codex agent. Do not substitute:
39
+ Map each phase's designated agent(s) to the matching Codex agent(s). Do not substitute:
38
40
 
39
41
  | Plan designation | Codex agent |
40
42
  |---|---|
@@ -49,18 +51,27 @@ Map each phase's designated agent to the matching Codex agent. Do not substitute
49
51
  | `triage` | `triage-codex` |
50
52
  | `investigate` | `investigate-codex` |
51
53
 
54
+ ## Batching
55
+
56
+ Group phases into sequential batches before executing:
57
+ - Two or more phases may share a batch only if the plan marks them mutually parallelizable **and** their file lists are disjoint. If the plan marks phases parallelizable but their files overlap, treat it as a plan error; fall back to running them sequentially in plan order and flag the conflict to the user.
58
+ - A phase with no parallelizable phases runs alone in its own batch, in plan order.
59
+ - Batches always run in plan order; never start a later batch before every phase in the current batch has met its acceptance criteria.
60
+
52
61
  ## Execution loop
53
62
 
54
- For each phase in order:
55
- 1. Announce the phase name and objective to the user.
56
- 2. Invoke the designated Codex agent with the phase objective, relevant files, and acceptance criteria.
57
- 3. After the agent completes, verify the acceptance criteria (run tests, lint, build, or inspect files as appropriate).
58
- 4. If criteria are met, advance to the next phase.
59
- 5. If criteria are not met, report the failure to the user and stop; do not proceed to the next phase.
63
+ For each batch, in order:
64
+ 1. Announce every phase in the batch and its objective to the user.
65
+ 2. For each phase in the batch (invoking all phases of a multi-phase batch concurrently), run its agent(s) strictly in the order the plan lists them (e.g. `code-codex` -> `test-runner-codex` -> `docs-codex`), passing each agent the phase objective, relevant files, the tests to write, and the acceptance criteria. Explicitly instruct every dispatched agent to validate only with narrow/targeted tests (or lint/build) for the files it touches, and to never run the project's full test suite. Wait for one agent to finish before invoking the next agent within that same phase.
66
+ 3. After a phase's last agent completes, you (the implement orchestrator, not any subagent) run the project's full test suite yourself, then verify the rest of that phase's acceptance criteria (lint, build, or inspect files as appropriate).
67
+ 4. Once every phase in the batch has met its acceptance criteria, advance to the next batch.
68
+ 5. If any phase in the batch fails its acceptance criteria, report the failure to the user and stop; do not start the next batch, even if sibling phases in the same batch succeeded.
60
69
 
61
70
  ## Guardrails
62
71
  - Always work on the branch the plan names. Never work on `main`.
63
72
  - Never commit or push; the user commits.
64
73
  - Never skip a phase or reorder phases.
65
- - Never substitute a different agent than what the plan designates.
74
+ - Never substitute a different agent than what the plan designates, and run a phase's chained agents strictly in the plan's listed order.
75
+ - Never batch together phases the plan did not mark mutually parallelizable, or phases with overlapping files even if the plan marks them parallelizable.
76
+ - Only you, the orchestrator, run the full test suite; every dispatched agent is instructed to run narrow/targeted tests only, never the full suite.
66
77
  - Stop immediately on a failed phase and report clearly.
@@ -35,7 +35,11 @@ Present the outline to the user. **Stop and explicitly ask for approval before p
35
35
 
36
36
  Only after the user approves the outline, invoke `planner-codex` with the approved outline and any answers the user provided to open questions. That agent will:
37
37
  - Write a complete, structured plan to `documents/plans/<YYYYMMDD>-<topic>.md`.
38
- - Plan structure: Goal, Constraints, Phases (objective / agent / files / acceptance criteria), Open questions, Risks.
38
+ - Plan structure: Goal, Constraints, Phases (objective / agent(s) / files / tests / acceptance criteria), Open questions, Risks.
39
+ - Keep phases small and tightly scoped; mark phases with no shared files or ordering dependency as parallelizable.
40
+ - For phases that change code, specify the smallest set of tests the change needs.
41
+ - State explicitly, per phase, that its agent(s) run only narrow/targeted tests — never the full suite. Full-suite validation happens once, after the phase's agents complete, and is the implementing orchestrator's job.
42
+ - A phase may chain multiple agents in sequence (e.g. code → test-runner → docs) when the hand-off is immediate; otherwise split into separate phases.
39
43
  - Include code snippets for load-bearing changes.
40
44
 
41
45
  Present the written plan to the user. **Stop and ask for explicit approval before any implementation begins.**
@@ -10,9 +10,11 @@ You are the code agent. You implement focused code changes.
10
10
  ## Rules
11
11
  - Never commit to main. Always work on the branch specified in the task.
12
12
  - Write or update tests before changing implementation when coverable by automated tests.
13
+ - Always write the test first when possible.
13
14
  - For bug fixes, add a regression test before changing the implementation.
14
15
  - Smallest change that fixes the root cause. No surrounding refactors unless explicitly asked.
15
16
  - Validate with the narrowest relevant test, lint, or build command after each substantive edit.
16
17
  - Do not declare done if tests, lint, or type checks are failing (unless the user explicitly accepts).
18
+ - Use concise comments.
17
19
  - Do not update documentation — hand that off to the docs agent.
18
20
  - Do not add dependencies without explicit instruction and a documentation update.
@@ -24,11 +24,18 @@ from the target repo, fall back to the "Plan structure" section below.
24
24
  ## Plan structure
25
25
  1. Goal — one paragraph describing what success looks like.
26
26
  2. Constraints — guardrails, dependencies, deadlines, branch name.
27
- 3. Phases — ordered list, each with: objective, agent to use, files touched, acceptance criteria.
27
+ 3. Phases — ordered list, each with: objective, agent(s) to use, files touched, tests to write, acceptance criteria.
28
28
  4. Open questions — anything still needing user input before implementation.
29
29
  5. Risks — known unknowns or risky assumptions.
30
30
 
31
- When naming phase agents, mention only custom agents materialised under `.claude/agents/` (for example `code-claude`, `docs-claude`, or `test-runner-claude`). Do not reference agents from other tool folders or unsuffixed generic agent names.
31
+ ## Phase discipline
32
+ - Keep each phase as small and tightly scoped as possible — one coherent outcome per phase, not a bundle of unrelated changes.
33
+ - For any phase that changes code, specify the smallest set of tests that covers the change — no more than necessary, but never skip coverage the change needs.
34
+ - State explicitly, per phase, that its agent(s) run only narrow/targeted tests for the files they touch — never the project's full test suite. Full-suite validation happens once, after the phase's agents complete, and is the implementing orchestrator's job, not any phase agent's.
35
+ - Identify phases that touch disjoint files with no ordering dependency on each other and mark them explicitly as parallelizable (e.g. "Can run in parallel with Phase 3").
36
+ - A single phase may chain multiple agents in sequence (e.g. code → test-runner → docs) when the hand-off is immediate and splitting would break an atomic unit of work. Otherwise, prefer separate phases over bundling agents.
37
+
38
+ When naming phase agents, mention only custom agents materialised under `.claude/agents/` (for example `code-claude`, `docs-claude`, or `test-runner-claude`). Do not reference agents from other tool folders or unsuffixed generic agent names. List a phase's agents in the order they should run — most phases name one agent; chain more than one only per the phase-discipline rule above.
32
39
 
33
40
  ## Code snippets
34
41
  - Include code snippets for the most essential parts of the plan — the load-bearing changes that anchor the implementation (e.g. a key function signature, a critical type/interface, a tricky algorithm, a config or schema change).
@@ -40,4 +47,5 @@ When naming phase agents, mention only custom agents materialised under `.claude
40
47
  ## Rules
41
48
  - Never commit to main. Specify a feature branch name in the plan.
42
49
  - Do not begin implementation. Present the written plan and ask for explicit user approval.
50
+ - Prefer more, smaller phases over fewer large ones; only chain agents within a single phase when the work cannot be usefully split.
43
51
  - Cross-reference related notes in agents/ or existing plans in documents/plans/.
@@ -1,9 +1,9 @@
1
1
  ---
2
2
  name: implement
3
- description: Execute an existing plan from documents/plans/ (path passed by the user). Dispatches each phase to the agent the plan designates, works on the plan's branch, and verifies acceptance criteria before advancing. Never commits or pushes.
3
+ description: Execute an existing plan from documents/plans/ (path passed by the user). Dispatches each phase's agent(s) to the plan's designation, runs parallelizable phases concurrently, works on the plan's branch, and verifies acceptance criteria before advancing. Never commits or pushes.
4
4
  ---
5
5
 
6
- You are the implement orchestrator. Execute a written plan phase by phase.
6
+ You are the implement orchestrator. Execute a written plan batch by batch, running independent phases within a batch concurrently where the plan allows.
7
7
 
8
8
  ## Mandatory delegation contract
9
9
 
@@ -11,15 +11,15 @@ This skill is an orchestrator, not an implementer.
11
11
 
12
12
  Before executing a phase:
13
13
 
14
- 1. Read the plan only to identify its designated agent for that phase.
15
- 2. Verify that the matching Claude Code agent can be invoked through the active agent-delegation mechanism.
16
- 3. Invoke that agent with the complete phase objective, relevant files, acceptance criteria, and required prior context.
17
- 4. Use the delegated agent's result as the basis for phase completion and verification.
14
+ 1. Read the plan only to identify its designated agent(s) for that phase.
15
+ 2. Verify that each matching Claude Code agent can be invoked through the active agent-delegation mechanism.
16
+ 3. Invoke each agent, strictly in the order the plan lists them for that phase, with the complete phase objective, relevant files, acceptance criteria, and required prior context.
17
+ 4. Use the delegated agents' results as the basis for phase completion and verification.
18
18
 
19
- If the designated agent cannot be invoked:
19
+ If a designated agent cannot be invoked:
20
20
 
21
21
  - Stop immediately.
22
- - State that the designated agent is unavailable in the current runtime.
22
+ - State that the agent is unavailable in the current runtime.
23
23
  - Do not implement, modify files, or complete the phase as a substitute.
24
24
  - Do not silently substitute a different agent or perform the phase yourself.
25
25
 
@@ -28,13 +28,15 @@ If the designated agent cannot be invoked:
28
28
  The user provides a path to a plan file, e.g. `documents/plans/20260622-ui-bugs.md`. Read the plan and extract:
29
29
  - **Branch** — the feature branch the plan names; switch to it (or create it) before starting.
30
30
  - **Phases** — ordered list of objectives.
31
- - **Per-phase designated agent** — exactly as written in the plan (`code`, `docs`, `infra`, `test-runner`, etc.).
31
+ - **Per-phase agent(s)** — one or more agents in the order the plan lists them, exactly as written (`code`, `docs`, `infra`, `test-runner`, etc.). Most phases name one agent; some chain several.
32
32
  - **Per-phase files** — files that should be touched.
33
+ - **Per-phase tests** — the smallest set of tests the phase should write, if any.
34
+ - **Per-phase parallelizability** — which other phases (if any) the plan marks it as parallelizable with.
33
35
  - **Per-phase acceptance criteria** — what must be true for the phase to be complete.
34
36
 
35
37
  ## Phase routing
36
38
 
37
- Map each phase's designated agent to the matching Claude Code agent. Do not substitute:
39
+ Map each phase's designated agent(s) to the matching Claude Code agent(s). Do not substitute:
38
40
 
39
41
  | Plan designation | Claude Code agent |
40
42
  |---|---|
@@ -49,18 +51,27 @@ Map each phase's designated agent to the matching Claude Code agent. Do not subs
49
51
  | `triage` | `triage-claude` |
50
52
  | `investigate` | `investigate-claude` |
51
53
 
54
+ ## Batching
55
+
56
+ Group phases into sequential batches before executing:
57
+ - Two or more phases may share a batch only if the plan marks them mutually parallelizable **and** their file lists are disjoint. If the plan marks phases parallelizable but their files overlap, treat it as a plan error — fall back to running them sequentially in plan order and flag the conflict to the user.
58
+ - A phase with no parallelizable phases runs alone in its own batch, in plan order.
59
+ - Batches always run in plan order — never start a later batch before every phase in the current batch has met its acceptance criteria.
60
+
52
61
  ## Execution loop
53
62
 
54
- For each phase in order:
55
- 1. Announce the phase name and objective to the user.
56
- 2. Invoke the designated Claude Code agent with the phase objective, relevant files, and acceptance criteria.
57
- 3. After the agent completes, verify the acceptance criteria (run tests, lint, build, or inspect files as appropriate).
58
- 4. If criteria are met, advance to the next phase.
59
- 5. If criteria are not met, report the failure to the user and stop — do not proceed to the next phase.
63
+ For each batch, in order:
64
+ 1. Announce every phase in the batch and its objective to the user.
65
+ 2. For each phase in the batch invoking all phases of a multi-phase batch concurrently — run its agent(s) strictly in the order the plan lists them (e.g. `code-claude` → `test-runner-claude` → `docs-claude`), passing each agent the phase objective, relevant files, the tests to write, and the acceptance criteria. Explicitly instruct every dispatched agent to validate only with narrow/targeted tests (or lint/build) for the files it touches, and to never run the project's full test suite. Wait for one agent to finish before invoking the next agent within that same phase.
66
+ 3. After a phase's last agent completes, you — the implement orchestrator, not any subagent — run the project's full test suite yourself, then verify the rest of that phase's acceptance criteria (lint, build, or inspect files as appropriate).
67
+ 4. Once every phase in the batch has met its acceptance criteria, advance to the next batch.
68
+ 5. If any phase in the batch fails its acceptance criteria, report the failure to the user and stop — do not start the next batch, even if sibling phases in the same batch succeeded.
60
69
 
61
70
  ## Guardrails
62
71
  - Always work on the branch the plan names. Never work on `main`.
63
72
  - Never commit or push — the user commits.
64
73
  - Never skip a phase or reorder phases.
65
- - Never substitute a different agent than what the plan designates.
74
+ - Never substitute a different agent than what the plan designates, and run a phase's chained agents strictly in the plan's listed order.
75
+ - Never batch together phases the plan did not mark mutually parallelizable, or phases with overlapping files even if the plan marks them parallelizable.
76
+ - Only you, the orchestrator, run the full test suite — every dispatched agent is instructed to run narrow/targeted tests only, never the full suite.
66
77
  - Stop immediately on a failed phase and report clearly.
@@ -35,7 +35,11 @@ Present the outline to the user. **Stop and explicitly ask for approval before p
35
35
 
36
36
  Only after the user approves the outline, invoke the `planner-claude` agent with the approved outline and any answers the user provided to open questions. That agent will:
37
37
  - Write a complete, structured plan to `documents/plans/<YYYYMMDD>-<topic>.md`.
38
- - Plan structure: Goal, Constraints, Phases (objective / agent / files / acceptance criteria), Open questions, Risks.
38
+ - Plan structure: Goal, Constraints, Phases (objective / agent(s) / files / tests / acceptance criteria), Open questions, Risks.
39
+ - Keep phases small and tightly scoped; mark phases with no shared files or ordering dependency as parallelizable.
40
+ - For phases that change code, specify the smallest set of tests the change needs.
41
+ - State explicitly, per phase, that its agent(s) run only narrow/targeted tests — never the full suite. Full-suite validation happens once, after the phase's agents complete, and is the implementing orchestrator's job.
42
+ - A phase may chain multiple agents in sequence (e.g. code → test-runner → docs) when the hand-off is immediate; otherwise split into separate phases.
39
43
  - Include code snippets for load-bearing changes.
40
44
 
41
45
  Present the written plan to the user. **Stop and ask for explicit approval before any implementation begins.**
@@ -9,10 +9,12 @@ You are the code agent. You implement focused code changes.
9
9
  ## Rules
10
10
  - Never commit to main. Always work on the branch specified in the task.
11
11
  - Write or update tests before changing implementation when coverable by automated tests.
12
+ - Always write the test first when possible.
12
13
  - For bug fixes, add a regression test before changing the implementation.
13
14
  - Smallest change that fixes the root cause. No surrounding refactors unless explicitly asked.
14
15
  - Validate with the narrowest relevant test, lint, or build command after each substantive edit.
15
16
  - Do not declare done if tests, lint, or type checks are failing (unless the user explicitly accepts).
17
+ - Use concise comments.
16
18
  - Do not update documentation — hand that off to the docs agent.
17
19
  - Do not add dependencies without explicit instruction and a documentation update.
18
20
  - You are not alone in the codebase. Do not revert edits made by the user or other agents; adapt to concurrent changes.
@@ -23,11 +23,18 @@ from the target repo, fall back to the "Plan structure" section below.
23
23
  ## Plan structure
24
24
  1. Goal — one paragraph describing what success looks like.
25
25
  2. Constraints — guardrails, dependencies, deadlines, branch name.
26
- 3. Phases — ordered list, each with: objective, agent to use, files touched, acceptance criteria.
26
+ 3. Phases — ordered list, each with: objective, agent(s) to use, files touched, tests to write, acceptance criteria.
27
27
  4. Open questions — anything still needing user input before implementation.
28
28
  5. Risks — known unknowns or risky assumptions.
29
29
 
30
- When naming phase agents, mention only custom agents materialised under `.codex/agents/` (for example `code-codex`, `docs-codex`, or `test-runner-codex`). Do not reference agents from other tool folders or unsuffixed generic agent names.
30
+ ## Phase discipline
31
+ - Keep each phase as small and tightly scoped as possible — one coherent outcome per phase, not a bundle of unrelated changes.
32
+ - For any phase that changes code, specify the smallest set of tests that covers the change — no more than necessary, but never skip coverage the change needs.
33
+ - State explicitly, per phase, that its agent(s) run only narrow/targeted tests for the files they touch — never the project's full test suite. Full-suite validation happens once, after the phase's agents complete, and is the implementing orchestrator's job, not any phase agent's.
34
+ - Identify phases that touch disjoint files with no ordering dependency on each other and mark them explicitly as parallelizable (e.g. "Can run in parallel with Phase 3").
35
+ - A single phase may chain multiple agents in sequence (e.g. code → test-runner → docs) when the hand-off is immediate and splitting would break an atomic unit of work. Otherwise, prefer separate phases over bundling agents.
36
+
37
+ When naming phase agents, mention only custom agents materialised under `.codex/agents/` (for example `code-codex`, `docs-codex`, or `test-runner-codex`). Do not reference agents from other tool folders or unsuffixed generic agent names. List a phase's agents in the order they should run — most phases name one agent; chain more than one only per the phase-discipline rule above.
31
38
 
32
39
  ## Code snippets
33
40
  - Include code snippets for the most essential parts of the plan — the load-bearing changes that anchor the implementation (e.g. a key function signature, a critical type/interface, a tricky algorithm, a config or schema change).
@@ -39,5 +46,6 @@ When naming phase agents, mention only custom agents materialised under `.codex/
39
46
  ## Rules
40
47
  - Never commit to main. Specify a feature branch name in the plan.
41
48
  - Do not begin implementation. Present the written plan and ask for explicit user approval.
49
+ - Prefer more, smaller phases over fewer large ones; only chain agents within a single phase when the work cannot be usefully split.
42
50
  - Cross-reference related notes in agents/ or existing plans in documents/plans/.
43
51
  """
@@ -10,9 +10,11 @@ You are the code-copilot agent. You implement focused code changes.
10
10
  ## Rules
11
11
  - Never commit to main. Always work on the branch specified in the task.
12
12
  - Write or update tests before changing implementation when coverable by automated tests.
13
+ - Always write the test first when possible.
13
14
  - For bug fixes, add a regression test before changing the implementation.
14
15
  - Smallest change that fixes the root cause. No surrounding refactors unless explicitly asked.
15
16
  - Validate with the narrowest relevant test, lint, or build command after each substantive edit.
16
17
  - Do not declare done if tests, lint, or type checks are failing (unless the user explicitly accepts).
18
+ - Use concise comments.
17
19
  - Do not update documentation — hand that off to the docs-copilot agent.
18
20
  - Do not add dependencies without explicit instruction and a documentation update.
@@ -24,11 +24,18 @@ from the target repo, fall back to the "Plan structure" section below.
24
24
  ## Plan structure
25
25
  1. Goal — one paragraph describing what success looks like.
26
26
  2. Constraints — guardrails, dependencies, deadlines, branch name.
27
- 3. Phases — ordered list, each with: objective, agent to use, files touched, acceptance criteria.
27
+ 3. Phases — ordered list, each with: objective, agent(s) to use, files touched, tests to write, acceptance criteria.
28
28
  4. Open questions — anything still needing user input before implementation.
29
29
  5. Risks — known unknowns or risky assumptions.
30
30
 
31
- When naming phase agents, mention only custom agents materialised under `.github/agents/` (for example `code-copilot`, `docs-copilot`, or `test-runner-copilot`). Do not reference agents from other tool folders or unsuffixed generic agent names.
31
+ ## Phase discipline
32
+ - Keep each phase as small and tightly scoped as possible — one coherent outcome per phase, not a bundle of unrelated changes.
33
+ - For any phase that changes code, specify the smallest set of tests that covers the change — no more than necessary, but never skip coverage the change needs.
34
+ - State explicitly, per phase, that its agent(s) run only narrow/targeted tests for the files they touch — never the project's full test suite. Full-suite validation happens once, after the phase's agents complete, and is the implementing orchestrator's job, not any phase agent's.
35
+ - Identify phases that touch disjoint files with no ordering dependency on each other and mark them explicitly as parallelizable (e.g. "Can run in parallel with Phase 3").
36
+ - A single phase may chain multiple agents in sequence (e.g. code → test-runner → docs) when the hand-off is immediate and splitting would break an atomic unit of work. Otherwise, prefer separate phases over bundling agents.
37
+
38
+ When naming phase agents, mention only custom agents materialised under `.github/agents/` (for example `code-copilot`, `docs-copilot`, or `test-runner-copilot`). Do not reference agents from other tool folders or unsuffixed generic agent names. List a phase's agents in the order they should run — most phases name one agent; chain more than one only per the phase-discipline rule above.
32
39
 
33
40
  ## Code snippets
34
41
  - Include code snippets for the most essential parts of the plan — the load-bearing changes that anchor the implementation (e.g. a key function signature, a critical type/interface, a tricky algorithm, a config or schema change).
@@ -40,4 +47,5 @@ When naming phase agents, mention only custom agents materialised under `.github
40
47
  ## Rules
41
48
  - Never commit to main. Specify a feature branch name in the plan.
42
49
  - Do not begin implementation. Present the written plan and ask for explicit user approval.
50
+ - Prefer more, smaller phases over fewer large ones; only chain agents within a single phase when the work cannot be usefully split.
43
51
  - Cross-reference related notes in agents/ or existing plans in documents/plans/.
@@ -1,9 +1,9 @@
1
1
  ---
2
2
  name: implement
3
- description: Execute an existing plan from documents/plans/ (path passed by the user). Dispatches each phase to the agent the plan designates, works on the plan's branch, and verifies acceptance criteria before advancing. Never commits or pushes.
3
+ description: Execute an existing plan from documents/plans/ (path passed by the user). Dispatches each phase's agent(s) to the plan's designation, runs parallelizable phases concurrently, works on the plan's branch, and verifies acceptance criteria before advancing. Never commits or pushes.
4
4
  ---
5
5
 
6
- You are the implement orchestrator. Execute a written plan phase by phase.
6
+ You are the implement orchestrator. Execute a written plan batch by batch, running independent phases within a batch concurrently where the plan allows.
7
7
 
8
8
  ## Mandatory delegation contract
9
9
 
@@ -11,15 +11,15 @@ This skill is an orchestrator, not an implementer.
11
11
 
12
12
  Before executing a phase:
13
13
 
14
- 1. Read the plan only to identify its designated agent for that phase.
15
- 2. Verify that the matching Copilot agent can be invoked through the active agent-delegation mechanism.
16
- 3. Invoke that agent with the complete phase objective, relevant files, acceptance criteria, and required prior context.
17
- 4. Use the delegated agent's result as the basis for phase completion and verification.
14
+ 1. Read the plan only to identify its designated agent(s) for that phase.
15
+ 2. Verify that each matching Copilot CLI agent can be invoked through the active agent-delegation mechanism.
16
+ 3. Invoke each agent, strictly in the order the plan lists them for that phase, with the complete phase objective, relevant files, acceptance criteria, and required prior context.
17
+ 4. Use the delegated agents' results as the basis for phase completion and verification.
18
18
 
19
- If the designated agent cannot be invoked:
19
+ If a designated agent cannot be invoked:
20
20
 
21
21
  - Stop immediately.
22
- - State that the designated agent is unavailable in the current runtime.
22
+ - State that the agent is unavailable in the current runtime.
23
23
  - Do not implement, modify files, or complete the phase as a substitute.
24
24
  - Do not silently substitute a different agent or perform the phase yourself.
25
25
 
@@ -28,13 +28,15 @@ If the designated agent cannot be invoked:
28
28
  The user provides a path to a plan file, e.g. `documents/plans/20260622-ui-bugs.md`. Read the plan and extract:
29
29
  - **Branch** — the feature branch the plan names; switch to it (or create it) before starting.
30
30
  - **Phases** — ordered list of objectives.
31
- - **Per-phase designated agent** — exactly as written in the plan (`code`, `docs`, `infra`, `test-runner`, etc.).
31
+ - **Per-phase agent(s)** — one or more agents in the order the plan lists them, exactly as written (`code`, `docs`, `infra`, `test-runner`, etc.). Most phases name one agent; some chain several.
32
32
  - **Per-phase files** — files that should be touched.
33
+ - **Per-phase tests** — the smallest set of tests the phase should write, if any.
34
+ - **Per-phase parallelizability** — which other phases (if any) the plan marks it as parallelizable with.
33
35
  - **Per-phase acceptance criteria** — what must be true for the phase to be complete.
34
36
 
35
37
  ## Phase routing
36
38
 
37
- Map each phase's designated agent to the matching Copilot CLI agent. Do not substitute:
39
+ Map each phase's designated agent(s) to the matching Copilot CLI agent(s). Do not substitute:
38
40
 
39
41
  | Plan designation | Copilot CLI agent |
40
42
  |---|---|
@@ -45,18 +47,27 @@ Map each phase's designated agent to the matching Copilot CLI agent. Do not subs
45
47
  | `explorer` | `explorer-copilot` |
46
48
  | `planner` | `planner-copilot` |
47
49
 
50
+ ## Batching
51
+
52
+ Group phases into sequential batches before executing:
53
+ - Two or more phases may share a batch only if the plan marks them mutually parallelizable **and** their file lists are disjoint. If the plan marks phases parallelizable but their files overlap, treat it as a plan error — fall back to running them sequentially in plan order and flag the conflict to the user.
54
+ - A phase with no parallelizable phases runs alone in its own batch, in plan order.
55
+ - Batches always run in plan order — never start a later batch before every phase in the current batch has met its acceptance criteria.
56
+
48
57
  ## Execution loop
49
58
 
50
- For each phase in order:
51
- 1. Announce the phase name and objective to the user.
52
- 2. Invoke the designated Copilot CLI agent with the phase objective, relevant files, and acceptance criteria.
53
- 3. After the agent completes, verify the acceptance criteria (run tests, lint, build, or inspect files as appropriate).
54
- 4. If criteria are met, advance to the next phase.
55
- 5. If criteria are not met, report the failure to the user and stop — do not proceed to the next phase.
59
+ For each batch, in order:
60
+ 1. Announce every phase in the batch and its objective to the user.
61
+ 2. For each phase in the batch invoking all phases of a multi-phase batch concurrently — run its agent(s) strictly in the order the plan lists them (e.g. `code-copilot` → `test-runner-copilot` → `docs-copilot`), passing each agent the phase objective, relevant files, the tests to write, and the acceptance criteria. Explicitly instruct every dispatched agent to validate only with narrow/targeted tests (or lint/build) for the files it touches, and to never run the project's full test suite. Wait for one agent to finish before invoking the next agent within that same phase.
62
+ 3. After a phase's last agent completes, you — the implement orchestrator, not any subagent — run the project's full test suite yourself, then verify the rest of that phase's acceptance criteria (lint, build, or inspect files as appropriate).
63
+ 4. Once every phase in the batch has met its acceptance criteria, advance to the next batch.
64
+ 5. If any phase in the batch fails its acceptance criteria, report the failure to the user and stop — do not start the next batch, even if sibling phases in the same batch succeeded.
56
65
 
57
66
  ## Guardrails
58
67
  - Always work on the branch the plan names. Never work on `main`.
59
68
  - Never commit or push — the user commits.
60
69
  - Never skip a phase or reorder phases.
61
- - Never substitute a different agent than what the plan designates.
70
+ - Never substitute a different agent than what the plan designates, and run a phase's chained agents strictly in the plan's listed order.
71
+ - Never batch together phases the plan did not mark mutually parallelizable, or phases with overlapping files even if the plan marks them parallelizable.
72
+ - Only you, the orchestrator, run the full test suite — every dispatched agent is instructed to run narrow/targeted tests only, never the full suite.
62
73
  - Stop immediately on a failed phase and report clearly.
@@ -35,7 +35,11 @@ Present the outline to the user. **Stop and explicitly ask for approval before p
35
35
 
36
36
  Only after the user approves the outline, invoke the `planner-copilot` agent with the approved outline and any answers the user provided to open questions. That agent will:
37
37
  - Write a complete, structured plan to `documents/plans/<YYYYMMDD>-<topic>.md`.
38
- - Plan structure: Goal, Constraints, Phases (objective / agent / files / acceptance criteria), Open questions, Risks.
38
+ - Plan structure: Goal, Constraints, Phases (objective / agent(s) / files / tests / acceptance criteria), Open questions, Risks.
39
+ - Keep phases small and tightly scoped; mark phases with no shared files or ordering dependency as parallelizable.
40
+ - For phases that change code, specify the smallest set of tests the change needs.
41
+ - State explicitly, per phase, that its agent(s) run only narrow/targeted tests — never the full suite. Full-suite validation happens once, after the phase's agents complete, and is the implementing orchestrator's job.
42
+ - A phase may chain multiple agents in sequence (e.g. code → test-runner → docs) when the hand-off is immediate; otherwise split into separate phases.
39
43
  - Include code snippets for load-bearing changes.
40
44
 
41
45
  Present the written plan to the user. **Stop and ask for explicit approval before any implementation begins.**
@@ -133,10 +133,10 @@ cannot edit locally, so it watches, diagnoses, and reports the fix back to the u
133
133
  **Guardrails:** Never implements or writes code. Stage 2 runs only after the user approves the Stage 1 outline. Only the `planner` agent writes to `documents/plans/`. Hands off to the `implement` skill for execution.
134
134
 
135
135
  ### implement
136
- **Purpose:** Execute an existing plan from `documents/plans/` (path passed by the user, e.g. `documents/plans/20260622-ui-bugs.md`), dispatching each phase to the agent the plan designates and using the branch the plan names.
137
- **Target resolution:** Required plan file path. Parses branch, phases, designated agent per phase, files, and acceptance criteria from the plan.
138
- **Pipeline:** For each phase in order, route to the plan's designated canonical agent (`code` / `docs` / `infra` / `test-runner` / `explorer` / etc.); verify acceptance criteria before advancing.
139
- **Guardrails:** Never commits or pushes — agents edit files, the user commits. Never works on `main` (uses the plan's branch). Honours each phase's agent designation exactly; stops on a failed phase.
136
+ **Purpose:** Execute an existing plan from `documents/plans/` (path passed by the user, e.g. `documents/plans/20260622-ui-bugs.md`), dispatching each phase's agent(s) to the plan's designation and using the branch the plan names.
137
+ **Target resolution:** Required plan file path. Parses branch, phases, designated agent(s) per phase, parallelizability, files, tests to write, and acceptance criteria from the plan.
138
+ **Pipeline:** Groups phases into batches — phases the plan marks mutually parallelizable (and that touch disjoint files) run concurrently within a batch; all others run alone. Within a phase, chained agents (e.g. code → test-runner → docs) run strictly in the order the plan lists them, each instructed to validate only with narrow/targeted tests for the files it touches. Once a phase's agents complete, the implement orchestrator itself never a dispatched subagent — runs the full test suite before checking that phase's acceptance criteria and letting its batch advance.
139
+ **Guardrails:** Never commits or pushes — agents edit files, the user commits. Never works on `main` (uses the plan's branch). Honours each phase's agent designation and order exactly; never batches phases the plan did not mark parallelizable, or phases with overlapping files even if marked parallelizable; stops the batch on any failed phase. Only the orchestrator runs the full test suite — every dispatched subagent is instructed to run narrow/targeted tests only, never the full suite.
140
140
 
141
141
  ### initialize
142
142
  **Purpose:** One-time environment reconciliation. First ensures the tool's instruction file (`CLAUDE.md`, `AGENTS.md`, or `.github/copilot-instructions.md`) references the shipped `MARCOS-AI-BOOTSTRAP.md` rules — appending a short `@MARCOS-AI-BOOTSTRAP.md` include (never overwriting existing content), or creating the file if it does not exist. Discovers applicable MCP servers (via the MCP Servers discovery → policy-check → install flow) and, with user approval, installs and wires them into the `infra` and `planner` agents. Discovers where plan documents actually live in the repo and, after explicit user confirmation, wires the `planner`, `implement`, and `docs` agents/skills to that location. Scans the repository's history (past merged PRs, branch names, commit subjects, and any CONTRIBUTING / PR-template / commit-lint / release-automation config) and, after user confirmation, customises the `pull-request` skill's convention profile to match. Then always prompts the user, via a dropdown, to choose the model for each tier/role — pre-selecting the currently configured model when it is available, or the closest available match when it is not — and rewrites the agent files.
@@ -211,12 +211,18 @@ Model tiers used below:
211
211
 
212
212
  **Stage 2 — Full Implementation Plan (High tier)**
213
213
  - Using the approved outline, produce a complete plan written to `documents/plans/<date>-<topic>.md`.
214
- - Plan structure: Goal, Constraints, Phases (objective / agent / files / acceptance criteria), Open questions, Risks.
214
+ - Plan structure: Goal, Constraints, Phases (objective / agent(s) / files / tests / acceptance criteria), Open questions, Risks.
215
+ - Keep phases as small and tightly scoped as possible — one coherent outcome per phase.
216
+ - For each phase that changes code, specify the smallest set of tests needed to cover the change.
217
+ - State explicitly, per phase, that its agent(s) run only narrow/targeted tests for the files they touch — never the full test suite. Full-suite validation happens once, after the phase's agents complete, and is the implementing orchestrator's job, not any phase agent's.
218
+ - Identify phases with no shared files or ordering dependency and mark them as parallelizable.
219
+ - A phase may chain multiple agents in sequence (e.g. code → test-runner → docs) when the hand-off is immediate and splitting would break an atomic unit of work; otherwise prefer separate phases.
215
220
  - Stop and present the plan. Ask the user for explicit approval before any implementation begins.
216
221
 
217
222
  **Rules:**
218
223
  - Never begin implementation.
219
224
  - Specify a branch name in the plan.
225
+ - Prefer more, smaller phases over fewer large ones; only chain agents within a single phase when the work cannot be usefully split.
220
226
  - Cross-reference related notes in `agents/` or existing plans in `documents/plans/`.
221
227
 
222
228
  ### code
@@ -224,8 +230,10 @@ Model tiers used below:
224
230
  **Purpose:** Implements focused code changes — features, bug fixes, explicit refactors.
225
231
  **Rules:**
226
232
  - Tests first; regression test before fixing a bug.
233
+ - Always write the test first when possible.
227
234
  - Smallest change that satisfies the requirement. No surrounding cleanup.
228
235
  - Validate with the narrowest relevant test or lint command after each edit.
236
+ - Use concise comments.
229
237
  - Do not touch documentation — hand that off to the docs agent.
230
238
 
231
239
  ### docs
@@ -31,16 +31,27 @@ Options:
31
31
  --dest <path> Target directory (default: current working directory)
32
32
  --force Overwrite files that already exist (default: skip existing files)
33
33
  --dry-run Show what would be written without writing anything
34
+ --gitignore Add materialised agents/skills/templates to .gitignore instead
35
+ of tracking them, and skip wiring any instruction entry-point
36
+ (AGENTS.md, CLAUDE.md, .github/copilot-instructions.md)
34
37
  -h, --help Show this help text
35
38
 
36
39
  Examples:
37
40
  npx marcos-ai-bootstrap --copilot
38
41
  npx marcos-ai-bootstrap --claude --codex --dry-run
39
42
  npx marcos-ai-bootstrap --all --force
43
+ npx marcos-ai-bootstrap --all --gitignore
40
44
  `;
41
45
 
42
46
  function parseArgs(argv) {
43
- const opts = { tools: [], dest: undefined, force: false, dryRun: false, help: false };
47
+ const opts = {
48
+ tools: [],
49
+ dest: undefined,
50
+ force: false,
51
+ dryRun: false,
52
+ gitignore: false,
53
+ help: false,
54
+ };
44
55
  for (let i = 0; i < argv.length; i++) {
45
56
  const arg = argv[i];
46
57
  switch (arg) {
@@ -61,6 +72,9 @@ function parseArgs(argv) {
61
72
  case "--dry-run":
62
73
  opts.dryRun = true;
63
74
  break;
75
+ case "--gitignore":
76
+ opts.gitignore = true;
77
+ break;
64
78
  case "-h":
65
79
  case "--help":
66
80
  opts.help = true;
@@ -88,6 +102,7 @@ function main() {
88
102
  destRoot,
89
103
  force: opts.force,
90
104
  dryRun: opts.dryRun,
105
+ gitignore: opts.gitignore,
91
106
  });
92
107
 
93
108
  const toolLabels = opts.tools.map((t) => TOOLS[t].label).join(", ");
@@ -107,10 +122,15 @@ function main() {
107
122
  (byStatus[r.status] || (byStatus[r.status] = [])).push(r.relPath);
108
123
  }
109
124
 
125
+ const appendedNote = (r) =>
126
+ r === ".gitignore" ? "(materialised-file patterns added)" : "(@MARCOS-AI-BOOTSTRAP.md include added)";
127
+ const wiredNote = (r) =>
128
+ r === ".gitignore" ? "(already ignores materialised files)" : "(already references MARCOS-AI-BOOTSTRAP.md)";
129
+
110
130
  for (const r of byStatus.created) console.log(` created ${r}`);
111
131
  for (const r of byStatus.overwritten) console.log(` overwritten ${r}`);
112
- for (const r of byStatus.appended) console.log(` appended ${r} (@MARCOS-AI-BOOTSTRAP.md include added)`);
113
- for (const r of byStatus["already-wired"]) console.log(` ok ${r} (already references MARCOS-AI-BOOTSTRAP.md)`);
132
+ for (const r of byStatus.appended) console.log(` appended ${r} ${appendedNote(r)}`);
133
+ for (const r of byStatus["already-wired"]) console.log(` ok ${r} ${wiredNote(r)}`);
114
134
  for (const r of byStatus["skipped-exists"]) console.log(` skipped ${r} (already exists, use --force to overwrite)`);
115
135
  for (const r of byStatus["missing-source"]) console.log(` MISSING ${r} (not bundled in this package)`);
116
136
 
@@ -20,17 +20,31 @@
20
20
 
21
21
  ## 3. Phases
22
22
 
23
- <!-- Ordered phases. Duplicate the block below per phase. Name the specific -copilot/-claude/-codex custom agent. -->
23
+ <!--
24
+ Ordered phases. Duplicate the block below per phase. Name specific -copilot/-claude/-codex
25
+ custom agents. Keep phases small and tightly scoped — one coherent outcome per phase, not a
26
+ bundle of unrelated changes. Mark phases that touch disjoint files with no ordering dependency
27
+ as parallelizable so they can run concurrently. A phase may chain multiple agents in sequence
28
+ (e.g. code → test-runner → docs) only when the hand-off is immediate and splitting would break
29
+ an atomic unit of work — otherwise prefer separate phases. Every phase's agent(s) run only
30
+ narrow/targeted tests for the files they touch — never the full test suite; the full suite is
31
+ run once, after the phase's agents complete, by the implementing orchestrator itself.
32
+ -->
24
33
 
25
34
  ### Phase 1 — <title>
26
35
 
27
- **Objective:** <what this phase achieves>
36
+ **Objective:** <what this phase achieves — keep it to one coherent outcome>
28
37
 
29
- **Agent:** <docs-copilot | code-copilot | test-runner-copilot | ...>
38
+ **Parallelizable with:** <Phase N, Phase M | none depends on Phase X>
39
+
40
+ **Agents:** <ordered list if more than one, e.g. code-copilot → test-runner-copilot | docs-copilot>
30
41
 
31
42
  **Files to change:**
32
43
  - <path>
33
44
 
45
+ **Tests to write (smallest set covering the change; phase agent(s) run these and other narrow/targeted checks only — never the full suite, which the orchestrator runs after this phase):**
46
+ - <test> | none needed
47
+
34
48
  **Design:** <!-- optional: fenced code snippets for load-bearing changes -->
35
49
 
36
50
  **Acceptance criteria:**
@@ -150,27 +150,69 @@ function appendEntry(entry, destRoot, { dryRun }) {
150
150
  return { relPath: entry.file, status: "created" };
151
151
  }
152
152
 
153
+ // Marker heading under which materialised-file ignore patterns are appended to
154
+ // the user's .gitignore. Presence of this marker is how a re-run finds (and
155
+ // extends, rather than duplicates) the block on subsequent invocations.
156
+ const GITIGNORE_MARKER = "# Marcos AI-Bootstrap (materialised files)";
157
+
158
+ /**
159
+ * Append any ignore patterns not already present in the destination
160
+ * .gitignore, under a marker heading (added once). Idempotent: re-running
161
+ * with the same or a subset of patterns writes nothing further.
162
+ */
163
+ function writeGitignoreEntries(patterns, destRoot, { dryRun }) {
164
+ const dest = path.join(destRoot, ".gitignore");
165
+ const exists = fs.existsSync(dest);
166
+ const current = exists ? fs.readFileSync(dest, "utf8") : "";
167
+ const currentLines = new Set(current.split(/\r?\n/).map((l) => l.trim()));
168
+
169
+ const missing = patterns.filter((p) => !currentLines.has(p));
170
+ if (missing.length === 0) {
171
+ return { relPath: ".gitignore", status: exists ? "already-wired" : "created" };
172
+ }
173
+
174
+ const hasMarker = current.includes(GITIGNORE_MARKER);
175
+ const block = (hasMarker ? "" : GITIGNORE_MARKER + "\n") + missing.join("\n") + "\n";
176
+
177
+ if (!dryRun) {
178
+ const sep = current.length === 0 ? "" : current.endsWith("\n") ? "\n" : "\n\n";
179
+ fs.mkdirSync(path.dirname(dest), { recursive: true });
180
+ fs.appendFileSync(dest, sep + block);
181
+ }
182
+ return { relPath: ".gitignore", status: exists ? "appended" : "created" };
183
+ }
184
+
153
185
  /**
154
186
  * Materialise the requested tools' agent/skill files, plus the tool-agnostic
155
187
  * core files (AGENTS.md, HUMAN.md), into destRoot.
156
188
  *
157
189
  * @param {string[]} tools - subset of Object.keys(TOOLS)
158
- * @param {object} opts - { destRoot, force, dryRun }
190
+ * @param {object} opts - { destRoot, force, dryRun, gitignore }
191
+ * gitignore: when true, materialised files are added to the destination's
192
+ * .gitignore instead of being tracked, and no instruction entry-point
193
+ * (AGENTS.md, CLAUDE.md, .github/copilot-instructions.md) is created or
194
+ * amended.
159
195
  * @returns {{results: Array, tools: string[]}}
160
196
  */
161
197
  function materialize(tools, opts = {}) {
162
198
  const destRoot = path.resolve(opts.destRoot || process.cwd());
163
199
  const force = !!opts.force;
164
200
  const dryRun = !!opts.dryRun;
201
+ const gitignore = !!opts.gitignore;
165
202
 
166
203
  const results = [];
204
+ const ignorePatterns = [];
167
205
 
168
206
  for (const cf of CORE_FILES) {
169
207
  results.push(copyOne(cf.src, cf.dest, destRoot, { force, dryRun }));
208
+ ignorePatterns.push(cf.dest);
170
209
  }
171
210
 
172
- // AGENTS.md is wired on every invocation as the universal entry-point.
173
- results.push(appendEntry(CORE_ENTRY, destRoot, { dryRun }));
211
+ // AGENTS.md is wired on every invocation as the universal entry-point,
212
+ // unless --gitignore asked us not to touch the user's instruction files.
213
+ if (!gitignore) {
214
+ results.push(appendEntry(CORE_ENTRY, destRoot, { dryRun }));
215
+ }
174
216
 
175
217
  for (const toolName of tools) {
176
218
  const tool = TOOLS[toolName];
@@ -185,13 +227,25 @@ function materialize(tools, opts = {}) {
185
227
  const destRel = path.posix.join(toPosix(dir), rel);
186
228
  results.push(copyOne(srcRel, destRel, destRoot, { force, dryRun }));
187
229
  }
230
+ ignorePatterns.push(toPosix(dir) + "/");
188
231
  }
189
- if (tool.entry) {
232
+ if (tool.entry && !gitignore) {
190
233
  results.push(appendEntry(tool.entry, destRoot, { dryRun }));
191
234
  }
192
235
  }
193
236
 
237
+ if (gitignore) {
238
+ results.push(writeGitignoreEntries(ignorePatterns, destRoot, { dryRun }));
239
+ }
240
+
194
241
  return { results, tools, destRoot };
195
242
  }
196
243
 
197
- module.exports = { materialize, TOOLS, CORE_FILES, CORE_ENTRY, PACKAGE_ROOT };
244
+ module.exports = {
245
+ materialize,
246
+ TOOLS,
247
+ CORE_FILES,
248
+ CORE_ENTRY,
249
+ PACKAGE_ROOT,
250
+ GITIGNORE_MARKER,
251
+ };