marcos-ai-bootstrap 0.1.0

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.
Files changed (49) hide show
  1. package/.agents/skills/implement/SKILL.md +48 -0
  2. package/.agents/skills/initialize/SKILL.md +50 -0
  3. package/.agents/skills/planner/SKILL.md +30 -0
  4. package/.agents/skills/watch-ci/SKILL.md +49 -0
  5. package/.claude/agents/code-claude.md +18 -0
  6. package/.claude/agents/docs-claude.md +14 -0
  7. package/.claude/agents/explorer-claude.md +14 -0
  8. package/.claude/agents/infra-claude.md +17 -0
  9. package/.claude/agents/investigate-claude.md +25 -0
  10. package/.claude/agents/log-reader-claude.md +21 -0
  11. package/.claude/agents/planner-claude.md +37 -0
  12. package/.claude/agents/planner-discovery-claude.md +24 -0
  13. package/.claude/agents/test-runner-claude.md +16 -0
  14. package/.claude/agents/triage-claude.md +46 -0
  15. package/.claude/skills/implement/SKILL.md +48 -0
  16. package/.claude/skills/initialize/SKILL.md +50 -0
  17. package/.claude/skills/planner/SKILL.md +30 -0
  18. package/.claude/skills/watch-ci/SKILL.md +49 -0
  19. package/.codex/agents/code-codex.toml +19 -0
  20. package/.codex/agents/docs-codex.toml +16 -0
  21. package/.codex/agents/explorer-codex.toml +15 -0
  22. package/.codex/agents/infra-codex.toml +18 -0
  23. package/.codex/agents/investigate-codex.toml +25 -0
  24. package/.codex/agents/log-reader-codex.toml +22 -0
  25. package/.codex/agents/planner-codex.toml +37 -0
  26. package/.codex/agents/planner-discovery-codex.toml +24 -0
  27. package/.codex/agents/test-runner-codex.toml +17 -0
  28. package/.codex/agents/triage-codex.toml +46 -0
  29. package/.github/agents/code-copilot.agent.md +18 -0
  30. package/.github/agents/docs-copilot.agent.md +14 -0
  31. package/.github/agents/explorer-copilot.agent.md +14 -0
  32. package/.github/agents/infra-copilot.agent.md +17 -0
  33. package/.github/agents/investigate-copilot.agent.md +25 -0
  34. package/.github/agents/log-reader-copilot.agent.md +21 -0
  35. package/.github/agents/planner-copilot.agent.md +37 -0
  36. package/.github/agents/planner-discovery-copilot.agent.md +24 -0
  37. package/.github/agents/test-runner-copilot.agent.md +16 -0
  38. package/.github/agents/triage-copilot.agent.md +46 -0
  39. package/.github/skills/implement/SKILL.md +44 -0
  40. package/.github/skills/initialize/SKILL.md +52 -0
  41. package/.github/skills/planner/SKILL.md +30 -0
  42. package/.github/skills/watch-ci/SKILL.md +47 -0
  43. package/LICENSE +21 -0
  44. package/README.md +117 -0
  45. package/package.json +37 -0
  46. package/src/AGENTS.md +200 -0
  47. package/src/HUMAN.md +31 -0
  48. package/src/bin/ai-bootstrap.js +115 -0
  49. package/src/lib/materialize.js +140 -0
@@ -0,0 +1,47 @@
1
+ ---
2
+ name: watch-ci
3
+ description: Watch a GitHub Actions workflow, auto-fix failures via the agent pipeline (log-reader-copilot → triage-copilot → investigate-copilot → code-copilot), and re-trigger until green. Accepts nothing (current-branch PR), a PR number, or a PR/workflow-run/workflow-file URL.
4
+ ---
5
+
6
+ You are the watch-ci orchestrator. Drive the CI fix loop until the target workflow is green.
7
+
8
+ ## Target resolution
9
+
10
+ Parse the optional input argument:
11
+ - **Empty** → look up the current-branch PR with `gh pr view`.
12
+ - **Digits only** → treat as a PR number on the current repo.
13
+ - **URL containing `/pull/<n>`** → PR URL; extract `owner/repo` from the URL and pass `--repo owner/repo` to all `gh` calls.
14
+ - **URL containing `/actions/runs/<id>`** → direct run URL; extract the run ID and `owner/repo`.
15
+ - **URL containing `/actions/workflows/<file>`** or **`/blob/<ref>/.github/workflows/<file>`** → workflow-file URL; extract `owner/repo` and the workflow file name.
16
+
17
+ ## Trigger-type detection
18
+
19
+ After identifying the failing workflow file, fetch its `on:` block and classify:
20
+
21
+ | `on:` block | Trigger type | Re-trigger method |
22
+ |---|---|---|
23
+ | Contains `push` or `pull_request` | auto-on-push | Commit and push on the feature branch |
24
+ | Contains `workflow_dispatch` (without push/PR) | manual-dispatch | `gh workflow run <file> --repo owner/repo` |
25
+ | Only `schedule` | scheduled-only | **Stop** — cannot force; report the fix to the user |
26
+ | Anything else | manual-dispatch | `gh workflow run <file> --repo owner/repo` |
27
+
28
+ ## Fix loop (max 5 iterations)
29
+
30
+ Repeat until green or 5 iterations reached:
31
+
32
+ 1. **Collect** — invoke the `log-reader-copilot` agent to gather logs and produce a structured diagnostic report.
33
+ 2. **Triage** — invoke the `triage-copilot` agent with the diagnostic report; receive EASY or HARD classification.
34
+ 3. **Investigate** (HARD only) — invoke the `investigate-copilot` agent with the diagnostic report and triage output; receive a root-cause analysis and fix strategy.
35
+ 4. **Fix** — invoke the `code-copilot` agent with the triage fix suggestion (EASY) or investigate fix strategy (HARD) to apply the change.
36
+ 5. **Commit & push** — commit the fix on the current feature branch and push; never push to `main`.
37
+ 6. **Re-trigger** — use the trigger method determined above.
38
+ 7. **Wait** — poll `gh run watch` until the new run completes.
39
+ 8. If still failing, go to step 1.
40
+
41
+ After 5 iterations without green, stop and report the current state and last error to the user.
42
+
43
+ ## Guardrails
44
+ - Never push to `main`.
45
+ - Never force-push.
46
+ - Never use `--no-verify`.
47
+ - For remote-repo targets this agent cannot edit locally: diagnose, propose the fix, and report back to the user without pushing.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Marco Petralia
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,117 @@
1
+ # marcos-ai-bootstrap
2
+
3
+ AI tools for doing work. No overcomplications.
4
+
5
+ Tool-agnostic agent/skill network that is built around a basic flow of plan -> implement -> deploy -> fix -> deploy etc.
6
+
7
+ Currently supporting **Claude Code**, **Codex**, and **GitHub Copilot CLI** but easily adjustable to fit your workflow.
8
+
9
+ See [`HUMAN.md`](./HUMAN.md) for the day-to-day workflow once the network is set up.
10
+
11
+ ## Quick start: the `marcos-ai-bootstrap` CLI
12
+
13
+ The fastest way to bring this agent network into any repository — no AI turn required,
14
+ works the same on Windows/Mac/Linux, and doesn't care whether the target project is
15
+ Node, Python, Go, or anything else:
16
+
17
+ ```bash
18
+ npx marcos-ai-bootstrap --copilot # GitHub Copilot CLI agents + skills
19
+ npx marcos-ai-bootstrap --claude # Claude Code agents + skills
20
+ npx marcos-ai-bootstrap --codex # Codex agents + skills
21
+ npx marcos-ai-bootstrap --claude --codex # combine any subset
22
+ npx marcos-ai-bootstrap --all # every tool at once
23
+ ```
24
+
25
+ Run it from the root of the repository you want to bootstrap. It writes `AGENTS.md`
26
+ and `HUMAN.md` (the tool-agnostic rules + human guide) alongside
27
+ the agent/skill files for whichever tool(s) you selected:
28
+
29
+ | Flag | Writes |
30
+ |---|---|
31
+ | `--claude` | `.claude/agents/*.md`, `.claude/skills/**/SKILL.md`, `CLAUDE.md` (`@AGENTS.md` stub) |
32
+ | `--codex` | `.codex/agents/*.toml`, `.agents/skills/**/SKILL.md` |
33
+ | `--copilot` | `.github/agents/*.agent.md`, `.github/skills/**/SKILL.md`, `.github/copilot-instructions.md` |
34
+ | `--all` | all of the above |
35
+
36
+ ### Options
37
+
38
+ | Flag | Effect |
39
+ |---|---|
40
+ | `--dest <path>` | Target directory (default: current working directory) |
41
+ | `--force` | Overwrite files that already exist (default: skip existing files) |
42
+ | `--dry-run` | Print what would be written without touching disk |
43
+ | `-h`, `--help` | Show usage |
44
+
45
+ Existing files are never clobbered unless you pass `--force`, so it's safe to re-run
46
+ `marcos-ai-bootstrap` in a repo that already has some of the network materialised (e.g. to add
47
+ `--codex` support to a repo that only had `--copilot` before).
48
+
49
+ ### Installing globally instead of via `npx`
50
+
51
+ ```bash
52
+ npm install -g marcos-ai-bootstrap
53
+ marcos-ai-bootstrap --all
54
+ ```
55
+
56
+ ## Repository layout
57
+
58
+ - `src/AGENTS.md`, `src/HUMAN.md` — the **canonical, shipped** copies. These are the source
59
+ of truth the CLI reads and writes into target repos (as root-level `AGENTS.md`/`HUMAN.md`).
60
+ - `AGENTS.md`, `HUMAN.md` (repo root) — this repository's **own self-hosting** copies, used
61
+ by the agent network running against this repo. Kept separate from the shipped `src/` copies
62
+ and not published to npm.
63
+ - `.claude/`, `.codex/`, `.github/`, `.agents/` — the already-materialised, checked-in
64
+ agent/skill files for this repo itself, and the templates the `marcos-ai-bootstrap` CLI ships
65
+ and copies into other repositories.
66
+ - `src/bin/ai-bootstrap.js`, `src/lib/materialize.js` — the CLI implementation.
67
+ - `src/AGENTS-BOOTSTRAP.md` — maintainer-only source of truth for each tool's
68
+ materialised agent/skill prompt bodies, model tier mappings, and MCP server
69
+ discovery/policy flow. **Not published to npm and not copied into target repos** —
70
+ the materialised agent/skill files under `.claude/`, `.codex/`, `.github/`, `.agents/`
71
+ are the shipped source of truth.
72
+ - `src/extract-agents.py` — maintainer tool: regenerates the `.claude/`, `.codex/`,
73
+ `.github/`, `.agents/` template files at the repo root from `src/AGENTS-BOOTSTRAP.md`
74
+ after editing it. Run this after changing `src/AGENTS-BOOTSTRAP.md`, then commit the
75
+ regenerated templates so `marcos-ai-bootstrap` ships the update.
76
+
77
+ ## Maintaining this repo
78
+
79
+ 1. Edit `src/AGENTS-BOOTSTRAP.md` (the source of truth for agent/skill prompt bodies).
80
+ 2. Run `python src/extract-agents.py` to regenerate the materialised template files.
81
+ 3. Run `node src/bin/ai-bootstrap.js --all --dry-run --dest <scratch-dir>` to sanity-check
82
+ the CLI still packages everything correctly.
83
+ 4. Commit the changes.
84
+
85
+ ## Releasing to npm
86
+
87
+ Releases are automated with [release-please](https://github.com/googleapis/release-please)
88
+ via `.github/workflows/release.yml`, so no one commits a version bump or pushes to `main`
89
+ directly.
90
+
91
+ How it works:
92
+
93
+ 1. On every push to `main`, release-please opens/updates a **Release PR** that bumps the
94
+ version in `package.json` and updates `CHANGELOG.md`, based on the conventional-commit
95
+ messages since the last release.
96
+ 2. When you're ready to ship, **merge the Release PR**. That merge creates the git tag and
97
+ a GitHub Release.
98
+ 3. The same workflow then publishes to npm with `npm publish --provenance --access public`
99
+ using OIDC **trusted publishing** (no stored `NPM_TOKEN`).
100
+
101
+ Bump size is derived from your commit messages:
102
+
103
+ | Commit type | Result |
104
+ |---|---|
105
+ | `fix:` / `chore:` / `refactor:` … | patch (`0.0.1`) |
106
+ | `feat:` … | minor |
107
+ | `feat!:` or a `BREAKING CHANGE:` footer | major |
108
+ | any commit with a `Release-As: X.Y.Z` footer | forces exactly that version |
109
+
110
+ So the default cadence is a patch per batch of merged fixes; larger releases happen simply
111
+ by using `feat:` or a breaking-change marker. Non-releasable commits (e.g. `docs:`, `ci:`)
112
+ won't create a Release PR on their own.
113
+
114
+ **One-time setup on npmjs.com:** configure this repository and the `Release` workflow as a
115
+ [trusted publisher](https://docs.npmjs.com/trusted-publishers) for the `marcos-ai-bootstrap`
116
+ package so OIDC auth works without a token. Also enable "Allow GitHub Actions to create and
117
+ approve pull requests" in the repo's Actions settings so release-please can open the Release PR.
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "marcos-ai-bootstrap",
3
+ "version": "0.1.0",
4
+ "description": "Materialise the AI-Bootstrap agent/skill network (Claude Code, Codex, GitHub Copilot CLI) into any repository from the command line.",
5
+ "bin": {
6
+ "marcos-ai-bootstrap": "src/bin/ai-bootstrap.js"
7
+ },
8
+ "main": "src/lib/materialize.js",
9
+ "files": [
10
+ "src/bin",
11
+ "src/lib",
12
+ "src/AGENTS.md",
13
+ "src/HUMAN.md",
14
+ ".claude",
15
+ ".codex",
16
+ ".agents",
17
+ ".github/agents",
18
+ ".github/skills"
19
+ ],
20
+ "engines": {
21
+ "node": ">=16"
22
+ },
23
+ "license": "MIT",
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "https://github.com/marcorpetralia/marcos-ai-bootstrap"
27
+ },
28
+ "keywords": [
29
+ "ai",
30
+ "agents",
31
+ "copilot",
32
+ "claude",
33
+ "codex",
34
+ "bootstrap",
35
+ "cli"
36
+ ]
37
+ }
package/src/AGENTS.md ADDED
@@ -0,0 +1,200 @@
1
+ # Agent Rules
2
+
3
+ This file is tool-agnostic. Drop it into any repository and reference it from your AI tool's config entry-point (e.g. `CLAUDE.md` via `@AGENTS.md`, `.github/copilot-instructions.md`, `.opencode/instructions.md`) to immediately apply these rules and bootstrap the agent network.
4
+
5
+ For tool-specific agent materialisation instructions (file templates, model IDs, config paths), see `AGENTS-BOOTSTRAP.md`.
6
+
7
+ ---
8
+
9
+ ## Bootstrap
10
+
11
+ At the start of every session:
12
+ 1. Confirm this file has been read.
13
+ 2. Identify which tool you are running under.
14
+ 3. Follow the bootstrap instructions in `AGENTS-BOOTSTRAP.md` for that tool to verify the agent network **and the skill network** are fully materialised. Create any missing agents or skills before starting any other work.
15
+ 4. Discover, policy-check, and configure the applicable **MCP servers** as described in the MCP Servers section of `AGENTS-BOOTSTRAP.md`. Use MCP servers wherever applicable — prefer them for authoritative, live platform access (e.g. Azure, Cloudflare) over guessing or stale knowledge, subject to organization policy.
16
+
17
+ ---
18
+
19
+ ## Guardrails
20
+
21
+ - **No agent shall commit code.** Agents modify files and write changes; the user owns committing those changes to git.
22
+ - Never commit to main
23
+ - Never push to main
24
+ - Always work on a feature / chore / bugfix branch
25
+ - Never merge a Pull Request
26
+ - Never update cloud infrastructure manually — all changes must go through IAC or deployment pipelines
27
+
28
+ ---
29
+
30
+ ## Skills
31
+
32
+ Skills are reusable, user-invocable orchestration workflows (slash commands) that drive the agent network. They are tool-specific in how they are materialised — see `AGENTS-BOOTSTRAP.md` for file templates, paths, and discovery rules for your tool.
33
+
34
+ Canonical skills:
35
+
36
+ ### watch-ci
37
+ **Purpose:** Watch a GitHub Actions workflow, auto-fix failures through the agent pipeline, and re-trigger correctly until the build is green.
38
+ **Target resolution:** Accepts nothing (current-branch PR), a PR number, or a pasted PR URL, workflow-run URL, or workflow-file URL. Parses `owner/repo` from URLs and passes `--repo` to `gh` for remote targets.
39
+ **Trigger-aware re-runs:** Inspects the workflow's `on:` block and classifies the trigger as auto-on-push, manual-dispatch, scheduled, or other. Re-triggers by pushing (auto-on-push), by `gh workflow run` (manual-dispatch/other), or stops with an explanation when a scheduled-only workflow cannot be forced.
40
+ **Pipeline:** `log-reader` → `triage` → (`investigate` if HARD) → `code`, then commit/push on the feature branch and loop (max 5 iterations).
41
+ **Guardrails:** Never pushes to `main`, never force-pushes, never `--no-verify`. For remote-repo targets it cannot edit locally, so it watches, diagnoses, and reports the fix back to the user.
42
+
43
+ ### planner
44
+ **Purpose:** Formalise the two-stage planning flow into a single command. Runs the `planner-discovery` agent (Stage 1: clarifying questions + outline), gates on explicit user approval, then runs the `planner` agent (Stage 2: full implementation plan written to `documents/plans/<YYYYMMDD>-<topic>.md`).
45
+ **Pipeline:** `planner-discovery` → (user approval) → `planner`.
46
+ **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.
47
+
48
+ ### implement
49
+ **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.
50
+ **Target resolution:** Required plan file path. Parses branch, phases, designated agent per phase, files, and acceptance criteria from the plan.
51
+ **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.
52
+ **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.
53
+
54
+ ### initialize
55
+ **Purpose:** One-time environment reconciliation. 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. Then verifies every agent's configured model exists in the current tool and, for any missing model, prompts the user to pick the closest available match from a dropdown and rewrites the agent files.
56
+ **Pipeline:** MCP discovery → user approval → install + wire agents → plans-location discovery → user confirmation → rewrite plan-location references → model availability check → user picks replacements → rewrite agent files.
57
+ **Guardrails:** Never commits or pushes. Only edits agent/skill files and MCP config — never source code. Never installs a policy-blocked or unapproved server. Never changes the plans location without explicit user confirmation. Idempotent.
58
+
59
+ ---
60
+
61
+ ## Delivery Rules
62
+
63
+ - Write or update tests first when a change can be covered by automated tests.
64
+ - For bug fixes, add a regression test before changing the implementation.
65
+ - Make the smallest change that fixes the root cause — no broad refactors unless that is the explicit task.
66
+ - Validate each edited slice immediately with the narrowest relevant test, lint, or build command.
67
+ - Do not declare a task done if relevant tests, lint, or type checks are failing (unless the user explicitly accepts that state).
68
+
69
+ ---
70
+
71
+ ## Documentation Rules
72
+
73
+ - Update the root `README.md` on every change.
74
+ - Update the service-level `README.md` inside the affected application on relevant changes.
75
+ - Update documentation last — after implementation and verification are complete.
76
+ - Never leave examples, commands, file paths, or architecture descriptions stale after a change.
77
+
78
+ ---
79
+
80
+ ## Change Discipline
81
+
82
+ - Prefer focused patches over broad refactors.
83
+ - Preserve existing conventions unless the task explicitly changes them.
84
+ - Do not add dependencies without a concrete need and a corresponding documentation update.
85
+ - If a subdirectory contains its own `AGENTS.md`, follow the more specific file in addition to this one.
86
+
87
+ ---
88
+
89
+ ## Memory Location
90
+
91
+ - Store task notes, handoff notes, decisions, and implementation checklists as Markdown files under `agents/`.
92
+ - Name files by date and topic, e.g. `agents/2026-05-22-feature-x.md`.
93
+ - Remove or update stale notes when they no longer match the codebase.
94
+ - Do not commit ephemeral scratch notes — only durable decisions and handoffs.
95
+
96
+ ---
97
+
98
+ ## Agent Network
99
+
100
+ These are the canonical agent roles. They are defined here without tool-specific syntax. See `AGENTS-BOOTSTRAP.md` for how to materialise them in your specific tool.
101
+
102
+ Model tiers used below:
103
+ - **High** — most capable; use for planning and complex cross-file reasoning (e.g. Opus-class)
104
+ - **Standard** — fast and accurate; use for code, infra, tests, orchestration (e.g. Sonnet-class)
105
+ - **Fast** — lightweight; use for docs and read-only research (e.g. Haiku-class)
106
+
107
+ ---
108
+
109
+ ### planner
110
+ **Tiers:** Standard (Stage 1) → High (Stage 2)
111
+ **Purpose:** Creates structured, phased implementation plans in two gated stages. Writes the final plan to `documents/plans/`. Does not implement — requires explicit user approval between stages and before any code is written.
112
+
113
+ **Stage 1 — Discovery & Outline (Standard tier)**
114
+ - Ask lots of clarifying questions — be exhaustive. The goal of Stage 1 is to find out everything about what the user has asked for: scope and boundaries, expected behaviour and edge cases, inputs and outputs, affected components, constraints, dependencies, and success criteria. Do not assume — surface every ambiguity and keep asking until nothing material about the task is left unknown.
115
+ - Explore the codebase and any relevant context.
116
+ - Produce a concise outline: goal, high-level phases, open questions.
117
+ - Stop and present the outline. Ask the user for explicit approval to proceed to Stage 2.
118
+
119
+ **Stage 2 — Full Implementation Plan (High tier)**
120
+ - Using the approved outline, produce a complete plan written to `documents/plans/<date>-<topic>.md`.
121
+ - Plan structure: Goal, Constraints, Phases (objective / agent / files / acceptance criteria), Open questions, Risks.
122
+ - Stop and present the plan. Ask the user for explicit approval before any implementation begins.
123
+
124
+ **Rules:**
125
+ - Never begin implementation.
126
+ - Specify a branch name in the plan.
127
+ - Cross-reference related notes in `agents/` or existing plans in `documents/plans/`.
128
+
129
+ ### code
130
+ **Tier:** Standard
131
+ **Purpose:** Implements focused code changes — features, bug fixes, explicit refactors.
132
+ **Rules:**
133
+ - Tests first; regression test before fixing a bug.
134
+ - Smallest change that satisfies the requirement. No surrounding cleanup.
135
+ - Validate with the narrowest relevant test or lint command after each edit.
136
+ - Do not touch documentation — hand that off to the docs agent.
137
+
138
+ ### docs
139
+ **Tier:** Fast
140
+ **Purpose:** Updates README files and documentation only. Runs after implementation is verified.
141
+ **Rules:**
142
+ - Never modifies code, config, or infrastructure files.
143
+ - Keep examples, commands, paths, and architecture descriptions accurate.
144
+ - Prefer bullet lists and tables over prose.
145
+
146
+ ### infra
147
+ **Tier:** Standard
148
+ **Purpose:** Modifies infrastructure as code — Bicep, Terraform, pipeline YAML, IAC config.
149
+ **Rules:**
150
+ - Never runs manual CLI commands against shared or production environments.
151
+ - All changes go through IAC files and deployment pipelines.
152
+ - Lint/validate IAC before declaring done.
153
+ - Do not change application code.
154
+
155
+ ### explorer
156
+ **Tier:** Fast
157
+ **Purpose:** Read-only codebase research — finding files, tracing call paths, locating symbols, understanding architecture.
158
+ **Rules:**
159
+ - No file writes, edits, or state-modifying shell commands.
160
+ - Return a concise, structured report.
161
+ - Run independent searches in parallel.
162
+
163
+ ### test-runner
164
+ **Tier:** Standard
165
+ **Purpose:** Runs tests, diagnoses failures, fixes broken tests, adds regression tests.
166
+ **Rules:**
167
+ - Run the narrowest test first (single file / single test) before the full suite.
168
+ - Fix failures with the smallest code change possible.
169
+ - Write a regression test before fixing a bug if one was not provided.
170
+ - Do not change production code beyond what is needed to make tests pass.
171
+ - Report final pass/fail counts before declaring done.
172
+
173
+ ### log-reader
174
+ **Tier:** Fast
175
+ **Purpose:** Stage 1 of bug fix mode. Gathers logs, error messages, and diagnostics from the environment or provided context.
176
+ **Rules:**
177
+ - Read-only. Collect all relevant logs, stack traces, error messages, and diagnostic output.
178
+ - Synthesize findings into a concise diagnostic report.
179
+ - Pass all findings and context to the triage agent for classification.
180
+ - Do not speculate on fixes — focus on accurate data collection and presentation.
181
+
182
+ ### triage
183
+ **Tier:** Standard
184
+ **Purpose:** Stage between log-reader and investigate in CI fix mode. Classifies the failure as easy (fix is immediately obvious and targeted) or hard (requires deeper investigation).
185
+ **Rules:**
186
+ - Receive the diagnostic report from log-reader.
187
+ - Explore the codebase as needed to understand the failing code.
188
+ - Output EASY with a specific file/line fix suggestion, or HARD with starting points for the investigate agent.
189
+ - Never implement the fix.
190
+ - Classify as EASY only when confident the fix is a single targeted change.
191
+
192
+ ### investigate
193
+ **Tier:** High
194
+ **Purpose:** Stage 2 of bug fix mode. Analyzes diagnostics from log-reader and pinpoints root cause.
195
+ **Rules:**
196
+ - Receive and analyze the diagnostic report from log-reader.
197
+ - Explore the codebase to understand the affected systems and call paths.
198
+ - Produce a concise root-cause analysis and recommended fix strategy.
199
+ - Stop before implementation — hand off to the code agent to apply the fix.
200
+ - Do not implement the fix yourself.
package/src/HUMAN.md ADDED
@@ -0,0 +1,31 @@
1
+ # Human Guide
2
+
3
+ A quick reference for working with the AI agent network in this repository.
4
+
5
+ ## First-time setup
6
+
7
+ Fastest path — use the `marcos-ai-bootstrap` CLI (no AI turn required, works in any repo, any OS):
8
+
9
+ ```powershell
10
+ npx marcos-ai-bootstrap --copilot # or --claude, --codex, or --all
11
+ ```
12
+
13
+ This instantly writes `AGENTS.md`, `HUMAN.md`, and the fully materialised agent/skill
14
+ files for the tool(s) you chose into the current directory. That's it — the agents and
15
+ skills are ready to use immediately. See the root `README.md` for all flags (`--force`,
16
+ `--dry-run`, `--dest`).
17
+
18
+ Once the files are written:
19
+
20
+ 1. Confirm `AGENTS.md`, `HUMAN.md`, and your tool's agent/skill files are present in the repo.
21
+ 2. Switch to your most powerful model at medium effort using **`/model`** e.g. opus 4.8 @ medium effort
22
+ 3. Run the **`/initialize`** skill once to reconcile MCP servers, plan-document location, and model IDs with your environment.
23
+ 4. **`/clear`** — Clear the context window.
24
+ 5. use **`/model`** to switch your model to your most powerful model @ low effort (to save tokens)
25
+
26
+ ## Basic workflow
27
+
28
+ 1. **`/planner`** — Give a basic outline of what you want to build. The agent asks clarifying questions and iterates until it has a complete plan for the feature, bugfix, or chore.
29
+ 2. **`/clear`** — Clear the context window.
30
+ 3. **`/implement`** — Paste the path to the plan that was created, e.g. `documents/plans/20260101-plan.md`.
31
+ 4. **`/watch-ci`** — Paste the PR or GitHub Actions run. It watches the build to make sure everything passes, fixing bugs in real time if needed.
@@ -0,0 +1,115 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const path = require("path");
5
+ const { materialize, TOOLS } = require("../lib/materialize");
6
+
7
+ const TOOL_NAMES = Object.keys(TOOLS);
8
+
9
+ const HELP = `
10
+ marcos-ai-bootstrap - materialise a tool-agnostic AI agent/skill network into any repository
11
+
12
+ Usage:
13
+ marcos-ai-bootstrap [--claude] [--codex] [--copilot] [--all] [options]
14
+
15
+ Tool flags (combine as many as you like):
16
+ --claude Claude Code agents (.claude/agents), skills (.claude/skills), CLAUDE.md
17
+ --codex Codex agents (.codex/agents), skills (.agents/skills)
18
+ --copilot GitHub Copilot CLI agents (.github/agents), skills (.github/skills),
19
+ .github/copilot-instructions.md
20
+ --all All of the above
21
+
22
+ Always written alongside any tool flag:
23
+ AGENTS.md, HUMAN.md (tool-agnostic rules + human guide)
24
+
25
+ Options:
26
+ --dest <path> Target directory (default: current working directory)
27
+ --force Overwrite files that already exist (default: skip existing files)
28
+ --dry-run Show what would be written without writing anything
29
+ -h, --help Show this help text
30
+
31
+ Examples:
32
+ npx marcos-ai-bootstrap --copilot
33
+ npx marcos-ai-bootstrap --claude --codex --dry-run
34
+ npx marcos-ai-bootstrap --all --force
35
+ `;
36
+
37
+ function parseArgs(argv) {
38
+ const opts = { tools: [], dest: undefined, force: false, dryRun: false, help: false };
39
+ for (let i = 0; i < argv.length; i++) {
40
+ const arg = argv[i];
41
+ switch (arg) {
42
+ case "--all":
43
+ opts.tools = TOOL_NAMES.slice();
44
+ break;
45
+ case "--claude":
46
+ case "--codex":
47
+ case "--copilot":
48
+ opts.tools.push(arg.slice(2));
49
+ break;
50
+ case "--dest":
51
+ opts.dest = argv[++i];
52
+ break;
53
+ case "--force":
54
+ opts.force = true;
55
+ break;
56
+ case "--dry-run":
57
+ opts.dryRun = true;
58
+ break;
59
+ case "-h":
60
+ case "--help":
61
+ opts.help = true;
62
+ break;
63
+ default:
64
+ console.error(`Unknown argument: ${arg}\n`);
65
+ opts.help = true;
66
+ opts.unknown = true;
67
+ }
68
+ }
69
+ opts.tools = Array.from(new Set(opts.tools));
70
+ return opts;
71
+ }
72
+
73
+ function main() {
74
+ const opts = parseArgs(process.argv.slice(2));
75
+
76
+ if (opts.help || opts.tools.length === 0) {
77
+ console.log(HELP);
78
+ process.exit(opts.unknown || opts.tools.length === 0 ? 1 : 0);
79
+ }
80
+
81
+ const destRoot = path.resolve(opts.dest || process.cwd());
82
+ const { results } = materialize(opts.tools, {
83
+ destRoot,
84
+ force: opts.force,
85
+ dryRun: opts.dryRun,
86
+ });
87
+
88
+ const toolLabels = opts.tools.map((t) => TOOLS[t].label).join(", ");
89
+ console.log(
90
+ `${opts.dryRun ? "[dry-run] " : ""}Materialising ${toolLabels} into ${destRoot}\n`
91
+ );
92
+
93
+ const byStatus = { created: [], overwritten: [], "skipped-exists": [], "missing-source": [] };
94
+ for (const r of results) {
95
+ (byStatus[r.status] || (byStatus[r.status] = [])).push(r.relPath);
96
+ }
97
+
98
+ for (const r of byStatus.created) console.log(` created ${r}`);
99
+ for (const r of byStatus.overwritten) console.log(` overwritten ${r}`);
100
+ for (const r of byStatus["skipped-exists"]) console.log(` skipped ${r} (already exists, use --force to overwrite)`);
101
+ for (const r of byStatus["missing-source"]) console.log(` MISSING ${r} (not bundled in this package)`);
102
+
103
+ console.log(
104
+ `\n${byStatus.created.length} created, ${byStatus.overwritten.length} overwritten, ` +
105
+ `${byStatus["skipped-exists"].length} skipped, ${results.length} total.`
106
+ );
107
+
108
+ if (!opts.dryRun) {
109
+ console.log(
110
+ `\nDone. Open AGENTS.md / HUMAN.md, then start your AI tool in ${destRoot} to begin.`
111
+ );
112
+ }
113
+ }
114
+
115
+ main();