@nodeint/migent 0.1.7 → 0.1.8

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
@@ -1,253 +1,341 @@
1
1
  # Migent
2
2
 
3
3
  <p align="center">
4
- <img src="assets/stylized-m.svg" alt="Migent logo" width="150" /><br>
5
- <strong>Autonomous, multi-stage engineering pipelines for your coding agents.</strong><br>
6
- Repeatable workflows. Multi-agent orchestration. Native CLI execution. Full observability.
4
+ <img src="https://raw.githubusercontent.com/nodeint/migent/main/assets/stylized-m.svg" alt="Migent logo" width="150" /><br>
5
+ <strong>Compose AI coding agents into repeatable engineering workflows.
6
+ </strong>
7
7
  </p>
8
8
 
9
9
  <p align="center">
10
10
  <a href="https://www.npmjs.com/package/@nodeint/migent"><img src="https://img.shields.io/npm/v/@nodeint/migent.svg?style=flat-square" alt="npm version" /></a>
11
11
  <a href="https://github.com/nodeint/migent/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="License: MIT" /></a>
12
12
  <a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E%3D22.0.0-brightgreen.svg?style=flat-square" alt="Node.js 22+" /></a>
13
- <img src="https://img.shields.io/badge/agents-Multi--Agent_Ready-orange.svg?style=flat-square" alt="Multi-Agent Ready" />
14
13
  </p>
15
14
 
16
15
  ---
17
16
 
18
- Migent coordinates the coding-agent CLIs you already have into **reusable, verified engineering pipelines**. Instead of juggling tabs, manually copying plans, and pasting test errors back and forth, you define the pipeline as code. Migent orchestrates the handoffs, runs strict local verification gates, handles review loops, and captures deep execution metrics.
19
17
 
20
- ### 🌟 Why Migent?
18
+ Migent connects coding-agent CLIs from different providers through explicit,
19
+ repository-defined workflows. One model can plan, another can review, and the
20
+ first can revise—while Migent carries artifacts between them and remembers
21
+ where the process is.
22
+
23
+ ## Contents
24
+
25
+ - [Migent](#migent)
26
+ - [Contents](#contents)
27
+ - [Why Migent?](#why-migent)
28
+ - [Supported CLIs](#supported-clis)
29
+ - [Quickstart](#quickstart)
30
+ - [Install](#install)
31
+ - [Install agent skill](#install-agent-skill)
32
+ - [Create a project](#create-a-project)
33
+ - [Option 1: Ask your AI agent](#option-1-ask-your-ai-agent)
34
+ - [Option 2: Run `migent init`](#option-2-run-migent-init)
35
+ - [Run](#run)
36
+ - [Workflow as code](#workflow-as-code)
37
+ - [How decisions work](#how-decisions-work)
38
+ - [Beyond planning: code and verify](#beyond-planning-code-and-verify)
39
+ - [Concepts](#concepts)
40
+ - [Artifact handoff vs session resume](#artifact-handoff-vs-session-resume)
41
+ - [Built-in safeguards](#built-in-safeguards)
42
+ - [Current scope](#current-scope)
43
+ - [Documentation](#documentation)
44
+ - [Development](#development)
45
+ - [License](#license)
46
+
47
+ ## Why Migent?
48
+
49
+ Calling two agent CLIs from a shell script is easy. Reliably coordinating them
50
+ across reviews, revisions, failures, and resumed sessions is not.
51
+
52
+ Migent is built around three ideas:
53
+
54
+ - **Use models for what they do best.** Assign each role to a provider and model
55
+ suited to the work, rather than asking one agent to do everything.
56
+ - **Treat AI engineering process as code.** Keep stages, handoffs, review gates,
57
+ and revision policies in version control beside the project they govern.
58
+ - **Keep orchestration explicit.** The team defines the process; models execute
59
+ roles inside it. A supervisor model does not invent or dynamically control
60
+ the workflow.
61
+
62
+ **Models describe execution. Roles describe intent.** Changing the model behind
63
+ a role does not require rewriting the workflow.
64
+
65
+ **Common workflow model, native provider capabilities.** Migent coordinates
66
+ the process, while each provider CLI remains responsible for authentication,
67
+ agent execution, and its own tools and options.
21
68
 
22
- - 🔁 **Automate Recurring Tasks (Workflows & Stages):** Package routine engineering work—bug fixes, refactors, migrations, test authoring—into structured, multi-stage pipelines with deterministic verification gates.
23
- - 🤖 **Multi-Agent Orchestration & Flexibility:** Assign the best model to each role (`claude` for planning, `codex` for implementation, `grok` for independent review). Run directly through your installed agent CLIs without custom wrappers or API lock-in.
24
- - 📊 **Observability & Continuous Improvement:** Live-stream running pipelines with `session follow`, and collect token spend, wall-time, and revision counts with `session metrics` to measure and refine your team's workflows.
69
+ ```mermaid
70
+ flowchart TD
71
+ A[Task] --> B[Planner - Codex]
72
+ B -->|plan.md| C[Reviewer - Grok]
73
+ C -->|revise| B
74
+ C -->|approved| D[Complete]
75
+ ```
25
76
 
26
- ---
77
+ ## Supported CLIs
78
+
79
+ Migent drives each provider through its headless CLI. Install and sign in to the
80
+ ones your configuration names.
81
+
82
+ | Provider | CLI |
83
+ | -------------------| -------------|
84
+ | Google Antigravity | `agy` |
85
+ | Claude | `claude` |
86
+ | Codex | `codex` |
87
+ | Grok | `grok` |
88
+ | BytePlus | `opencode` |
89
+ | OpenCode | `opencode` |
27
90
 
28
91
  ## Quickstart
29
92
 
30
- ### Option A: Agent-Assisted via `/migent` (Recommended)
93
+ Requires Node.js 22+ (macOS, Linux, or Windows) and the provider CLIs your
94
+ config uses, already signed in.
31
95
 
32
- Let your coding agent handle the initial configuration using Migent's official Skill.
96
+ ### Install
33
97
 
34
98
  ```bash
35
- # 1. Install Migent globally
36
99
  npm install -g @nodeint/migent
37
-
38
- # 2. Install the Migent Skill in your repo
39
- migent skill install
100
+ migent --version
40
101
  ```
41
102
 
42
- Now open your favorite coding agent CLI (such as Google Antigravity `agy`, Anthropic `claude`, Cursor, or Windsurf) in this repository and type:
103
+ Upgrade with `npm install -g @nodeint/migent@latest`.
43
104
 
44
- ```text
45
- /migent Set up a workflow for this repo: Claude for planning, Codex for coding, Grok for review. Then run a pipeline to resolve issue #42.
105
+ ### Install agent skill
106
+
107
+ From your project repository:
108
+
109
+ ```bash
110
+ migent skill install
46
111
  ```
47
112
 
48
- > **How it works:** `migent skill install` creates `.agents/skills/migent/` containing Migent's schema rules and CLI definitions. Using the `/migent` slash command instructs your agent to inspect your repo, generate valid configuration files under `.migent/`, validate them with `migent doctor`, and launch the workflow.
113
+ Installs `.agents/skills/migent/` so your AI agent knows how to configure, run,
114
+ and inspect Migent workflows.
49
115
 
50
- ---
116
+ ### Create a project
51
117
 
52
- ### Option B: Terminal CLI (Direct Control)
118
+ Choose one:
53
119
 
54
- Prefer setting it up yourself? Get started in three commands:
120
+ #### Option 1: Ask your AI agent
55
121
 
56
- ```bash
57
- # 1. Initialize a workflow preset and validate environment
58
- migent init --preset plan
59
- migent doctor
122
+ Paste this prompt into your agent (Claude Code, Antigravity, Cursor, etc.):
60
123
 
61
- # 2. Run your engineering task
62
- migent session run --workflow plan --task "Implement JWT authentication with refresh tokens"
124
+ ```text
125
+ Load skill migent: Read and follow .agents/skills/migent/SKILL.md.
63
126
 
64
- # 3. Stream real-time events or inspect performance metrics
65
- migent session follow <session-id>
66
- migent session metrics <session-id> --json
127
+ Instructions: Initialize Migent for this project using the installed provider CLIs, set up .migent/config.yaml and .migent/workflows/plan.yaml, and run `migent doctor` to verify.
67
128
  ```
68
129
 
69
- ---
130
+ #### Option 2: Run `migent init`
70
131
 
71
- ## What Migent Solves
132
+ ```bash
133
+ migent init
134
+ ```
72
135
 
73
- | Without Migent | With Migent |
74
- | :--- | :--- |
75
- | **Manual handoffs:** Copying plans and pasting stack traces across conversations. | **Automated handoffs:** Upstream artifacts and diffs pass automatically into downstream stages. |
76
- | **Single-agent bottleneck:** One model handles planning, coding, and review, accumulating context bloat. | **Specialized roles:** Multi-agent pipeline with dedicated models per role (e.g., Planner $\rightarrow$ Coder $\rightarrow$ Reviewer). |
77
- | **Vendor lock-in & wrappers:** Restricted to one provider or requiring custom API providers. | **Native CLI execution:** Drives your installed agent CLIs (`agy`, `claude`, `codex`, `grok`) directly in your workspace. |
78
- | **Blind trust:** Agents claim "all tests pass" without actually running project commands. | **Verification gates:** Real local checks (`pnpm test`, `pytest`, `cargo test`) must succeed before advancing. |
79
- | **Fragile one-off prompts:** Team members execute tasks with inconsistent, ad-hoc instructions. | **Process as code:** Workflows live in Git (`.migent/workflows/`), making best practices versioned and repeatable. |
80
- | **No execution visibility:** No record of how long tasks took, why checks failed, or how many retries occurred. | **Telemetry & Metrics:** Append-only event logs, live streaming, and full JSON metrics for duration, retries, and token cost. |
136
+ Follow the interactive prompts to select providers and models.
81
137
 
82
- ---
138
+ Both options generate:
83
139
 
84
- ## How It Works
140
+ ```text
141
+ .migent/
142
+ ├── config.yaml # models and roles
143
+ ├── config.local.yaml # optional per-machine override, not committed
144
+ ├── .gitignore # keeps sessions/ untracked
145
+ └── workflows/
146
+ └── plan.yaml # plan-and-review workflow
147
+ ```
85
148
 
86
- A typical software engineering workflow breaks down into structured, verifiable stages:
149
+ Commit `config.yaml` and `workflows/`. `config.local.yaml` overrides `config.yaml` on one machine and is ignored by git.
87
150
 
88
- ```mermaid
89
- flowchart TD
90
- Task["Task: Fix OAuth Callback"] --> Plan["1. Plan\n(Claude)"]
91
- Plan -->|"artifact: plan.md"| Implement["2. Implement\n(Codex)"]
92
- Implement --> Verify{"3. Verification Gate\n(pnpm test)"}
93
- Verify -->|"Fails (retry <= max)"| Implement
94
- Verify -->|"Retry limit reached"| Blocked["Stop for inspection"]
95
- Verify -->|"Passes"| Review["4. Review\n(Grok)"]
96
- Review -->|"Revise + feedback"| Implement
97
- Review -->|"Approved"| Done["Workflow Complete"]
98
- ```
151
+ ### Run
99
152
 
100
- 1. **Plan:** A high-reasoning model analyzes the codebase and generates an actionable `plan.md`.
101
- 2. **Implement:** A coding model applies changes to the working tree according to the plan.
102
- 3. **Verify Gate:** Migent runs your repository's native verification commands (tests, typecheck, lint).
103
- 4. **Review & Revision Loop:** An independent reviewer evaluates the git diff against the plan. If changes are requested, feedback routes back to the implementation stage.
153
+ Start a workflow from your project directory:
104
154
 
105
- ---
155
+ ```bash
156
+ $ migent session run --workflow plan --task "Plan the account settings redesign"
106
157
 
107
- ## Core Capabilities
158
+ stage plan · attempt 1 · 10:15:30 · codex/gpt-5 · complete.
159
+ stage review-plan · attempt 1 · 10:16:15 · grok/grok-4 · complete decision=revise.
160
+ stage plan · attempt 2 · 10:17:00 · codex/gpt-5 · complete.
161
+ stage review-plan · attempt 2 · 10:17:45 · grok/grok-4 · complete decision=approved.
108
162
 
109
- ### 1. Repeatable Workflows as Code
110
- Define stages, dependencies, artifacts, and routing decisions in declarative YAML stored under `.migent/workflows/`. Version control your engineering processes alongside your application code.
163
+ Session completed in 2m 15s.
164
+ .migent/sessions/20261022-101530--wave-1/outputs/plan.md
165
+ ```
111
166
 
112
- ### 2. Multi-Agent Orchestration & BYO CLIs
113
- Decouple **what** a stage does from **which model** executes it. Migent drives the agent CLIs already installed and authenticated on your machine:
167
+ Inspect sessions or resume a stopped run:
114
168
 
115
- | Provider | CLI | Typical Role in Pipeline |
116
- | :--- | :--- | :--- |
117
- | **Anthropic Claude** | `claude` | High-reasoning architecture planning & refactoring |
118
- | **Google Antigravity** | `agy` | Deep repository analysis, plan generation & review |
119
- | **OpenAI Codex** | `codex` | Fast, focused implementation & unit test authoring |
120
- | **xAI Grok** | `grok` | Independent logic review & edge case discovery |
121
- | **OpenCode** | `opencode` | Multi-vendor models behind one CLI, for any role |
122
- | **BytePlus ModelArk** | none (set `client` per model) | BytePlus models run through another installed CLI, e.g. `opencode` |
169
+ ```bash
170
+ migent session list
171
+ migent session continue <session-id>
172
+ ```
123
173
 
124
- Switch models anytime in `.migent/config.yaml` without touching your workflow logic.
174
+ ## Workflow as code
125
175
 
126
- ### 3. Observability, Telemetry & Continuous Improvement
127
- Migent treats engineering runs as first-class observable processes:
128
- - **Live Monitoring:** `migent session follow <session-id>` streams execution events, stage heartbeats, and runner turns in real time.
129
- - **Detailed Metrics:** `migent session metrics <session-id> --json` outputs execution wall-time, active runner seconds, verify durations, revision counts, and token usage.
130
- - **Continuous Refinement:** Use hard metrics from past sessions to optimize prompts, tune retry limits, and pick the most cost-effective models.
131
- - **Session Recovery:** When rate limits or network issues strike, `migent session continue <session-id>` resumes right where the pipeline stopped.
176
+ Workflows live in `.migent/workflows/` and models in `.migent/config.yaml`.
132
177
 
133
- ---
178
+ A standard plan-and-review workflow:
134
179
 
135
- ## Configuration Example
180
+ ```yaml
181
+ # .migent/workflows/plan.yaml
182
+ schema_version: 2
183
+ stages:
184
+ - id: plan
185
+ role: planner
186
+ max_revisions: 3
187
+ instructions:
188
+ - Read task.md and write plan.md into artifacts.
189
+ produces:
190
+ artifact: plan.md
136
191
 
137
- Migent separates model/role assignments from pipeline control flow.
192
+ - id: review-plan
193
+ role: reviewer
194
+ depends_on: [plan]
195
+ instructions:
196
+ - Verify plan.md against the codebase.
197
+ - Approve only if implementation can proceed without ambiguity.
198
+ decision:
199
+ values: [approved, revise]
200
+ routes:
201
+ approved: complete
202
+ revise: plan
203
+ ```
138
204
 
139
- ### 1. Configure Models and Roles (`.migent/config.yaml`)
205
+ And the roles backed by your chosen provider CLIs:
140
206
 
141
207
  ```yaml
208
+ # .migent/config.yaml
142
209
  schema_version: 2
143
-
144
210
  models:
145
- planning-model:
146
- provider: claude
147
- model: opus
148
-
149
- coding-model:
211
+ codex-model:
150
212
  provider: codex
151
- model: default
152
-
153
- review-model:
213
+ model: gpt-5
214
+ grok-model:
154
215
  provider: grok
155
- model: grok-4.7
216
+ model: grok-4
217
+ options:
218
+ reasoning-effort: high
156
219
 
157
220
  roles:
158
221
  planner:
159
- default_model: planning-model
160
- instructions:
161
- - Analyze the repository and create an actionable plan with file paths.
222
+ default_model: codex-model
223
+ reviewer:
224
+ default_model: grok-model
225
+ ```
162
226
 
163
- coder:
164
- default_model: coding-model
165
- instructions:
166
- - Implement changes according to the plan and write regression tests.
227
+ ### How decisions work
167
228
 
168
- reviewer:
169
- default_model: review-model
170
- instructions:
171
- - Review the git diff against the plan for correctness, security, and edge cases.
229
+ Migent enforces a clean, lightweight protocol. Stages communicate outcomes
230
+ through standard RFC-style response headers injected into the prompt:
231
+
232
+ ```text
233
+ status: complete
234
+ decision: approved
235
+
236
+ The implementation plan covers all requirements and test cases.
172
237
  ```
173
238
 
174
- ### 2. Define the Pipeline (`.migent/workflows/feature.yaml`)
239
+ When a stage completes, Migent routes execution based on the `decision` header.
240
+ Review prose remains human-readable feedback passed directly to the next stage.
175
241
 
176
- ```yaml
177
- schema_version: 2
178
- id: feature
242
+ ### Beyond planning: code and verify
179
243
 
180
- stages:
181
- - id: plan
182
- role: planner
183
- produces:
184
- artifact: plan.md
244
+ Stages are not limited to generating documents. A stage can modify repository files
245
+ and declare automated `verify` commands:
185
246
 
247
+ ```yaml
248
+ stages:
186
249
  - id: implement
187
- role: coder
188
- depends_on: [plan]
250
+ role: developer
251
+ instructions:
252
+ - Implement the approved plan.
189
253
  verify:
254
+ - pnpm build
190
255
  - pnpm test
191
256
  max_verify: 3
257
+ ```
192
258
 
193
- - id: review
194
- role: reviewer
195
- depends_on: [implement]
196
- decision:
197
- values: [approved, revise]
198
- routes:
199
- approved: complete
200
- revise: implement
259
+ Migent runs the verification commands in the workspace POSIX shell. If tests fail,
260
+ Migent returns the command tail to the agent for an automated repair loop (up to
261
+ `max_verify` attempts) before handing off to review.
201
262
 
202
- outputs:
203
- - name: plan
204
- from_stage: plan
205
- artifact: plan.md
206
- ```
263
+ ## Concepts
207
264
 
208
- ---
265
+ A workflow connects stages through dependencies and explicit decision routes.
209
266
 
210
- ## CLI Cheatsheet
267
+ - A **model** identifies a provider model and its execution options.
268
+ - A **role** names a kind of work and selects its default model.
269
+ - A **stage** assigns work to a role and may declare dependencies, an artifact,
270
+ a decision, or verification commands.
271
+ - An **artifact** is a named file produced by a successful stage and stored with
272
+ the workflow session.
273
+ - A **decision** selects the next route, including a route back for revision.
274
+ - A **session** records executions, events, decisions, and artifacts so work can
275
+ be inspected or resumed.
211
276
 
212
- ```bash
213
- # Setup & Health
214
- migent init --preset plan # Initialize starter configuration
215
- migent doctor # Validate configuration, schemas, and CLI availability
216
- migent provider list # List registered provider providers and their available models
217
- migent skill install # Install the Migent Skill for coding agents (.agents/skills/migent/)
218
-
219
- # Execution
220
- migent session run --workflow <id> --task "<task>" # Run a workflow
221
- migent session continue <session-id> # Resume an interrupted or blocked session
222
-
223
- # Monitoring & Telemetry
224
- migent session list # List recorded sessions and statuses
225
- migent session follow <session-id> # Live-stream session events and progress
226
- migent session metrics <session-id> --json # View token spend, duration, and retry metrics
227
- migent session show <session-id> # Inspect session state and artifact status
228
- ```
277
+ ### Artifact handoff vs session resume
229
278
 
230
- ---
279
+ - `depends_on: [stage]`: Makes the upstream stage's artifacts available to the
280
+ current stage while starting a fresh provider agent. Best for clean context
281
+ handoffs between different roles and models.
282
+ - `session.resume_from: <stage>`: Continues the upstream stage's provider conversation
283
+ thread. Best when an agent needs to keep its conversation memory and tool history.
284
+
285
+ ### Built-in safeguards
286
+
287
+ Engineering workflows have explicit cost and execution guardrails:
288
+
289
+ - **Revision limits (`max_revisions`)**: Prevents infinite critique loops between
290
+ agents.
291
+ - **Dispatch circuit breaker (`--max-dispatches`)**: Halts execution if a run
292
+ exceeds the configured dispatch limit (default 20).
293
+ - **Verification bounds (`max_verify`, `verify_timeout`)**: Limits automated
294
+ test/repair attempts.
295
+ - **Session metrics (`metrics.json`)**: Tracks tokens, turns, and cost per execution
296
+ and session.
297
+
298
+ ## Current scope
299
+
300
+ Migent is a local, file-backed orchestration layer for provider CLIs. It does
301
+ not replace their agent runtimes, and it does not hide their distinctive
302
+ capabilities behind a lowest-common-denominator API.
303
+
304
+ Today, Migent supports explicit stage routing, review loops, local session
305
+ history, provider-session resume, prerequisite workflows, and standalone role
306
+ execution. A machine-local registry service records workspaces
307
+ so another tool can ask which projects exist.
308
+
309
+ Workflows can be run directly from the command line, or driven autonomously by your
310
+ coding agent when the project has the Migent skill installed.
231
311
 
232
312
  ## Documentation
233
313
 
234
- - [Writing Workflows](https://github.com/nodeint/migent/blob/main/docs/workflows.md) — Stages, dependencies, artifacts, and routing decisions.
235
- - [Providers and Model Configuration](https://github.com/nodeint/migent/blob/main/docs/providers.md) — Configuring CLIs, models, options, and fallback models.
236
- - [Sessions and State](https://github.com/nodeint/migent/blob/main/docs/sessions.md) — Manifests, append-only event logs, and recovery.
237
- - [CLI Reference](https://github.com/nodeint/migent/blob/main/docs/cli.md) — Full command catalog, flags, and JSON modes.
314
+ - [Writing workflows](https://github.com/nodeint/migent/blob/main/docs/workflows.md)
315
+ - [Providers and model configuration](https://github.com/nodeint/migent/blob/main/docs/providers.md)
316
+ - [Sessions and workflow composition](https://github.com/nodeint/migent/blob/main/docs/sessions.md)
317
+ - [CLI commands and execution controls](https://github.com/nodeint/migent/blob/main/docs/cli.md)
318
+
319
+ Run `migent <command> --help` for the exact command contract, output fields,
320
+ and exit codes.
238
321
 
239
- ## Contributing
322
+ ## Development
240
323
 
241
- Migent is built with TypeScript in a pnpm workspace:
324
+ The pnpm workspace contains four packages: the `@nodeint/migent` CLI and its
325
+ internal libraries `@nodeint/migent-kernel`, `@nodeint/migent-adapters`, and
326
+ `@nodeint/migent-registry`. The libraries have no stable API; depend on
327
+ `@nodeint/migent`.
242
328
 
243
329
  ```bash
244
330
  pnpm install
245
331
  pnpm build
246
332
  pnpm test
333
+ pnpm migent --help # run the local build
247
334
  ```
248
335
 
249
- See [CONTRIBUTING.md](https://github.com/nodeint/migent/blob/main/CONTRIBUTING.md) for details.
336
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for testing rules, platform notes, and
337
+ the release process.
250
338
 
251
339
  ## License
252
340
 
253
- Migent is open source under the [MIT License](https://github.com/nodeint/migent/blob/main/LICENSE).
341
+ Migent is licensed under the [MIT License](https://github.com/nodeint/migent/blob/main/LICENSE).
@@ -1,6 +1,6 @@
1
1
  import { readFileSync } from "node:fs";
2
2
  import path from "node:path";
3
- import { AgentToolRunner, CancellationRequested, ConfigurationError, ProviderEventReporter, SessionStore, createAgentSession, loadRoleInstructions, loadYamlMapping, log, prependRoleInstructions, requireAgentSession, isSessionLockLost, repairSessionUnlocked, SessionLock, stringOptions, resolveRoleTarget, waitUntil, } from "@nodeint/migent-kernel";
3
+ import { AgentToolRunner, CancellationRequested, ConfigurationError, ProviderEventReporter, SessionStore, createAgentSession, loadRoleInstructions, loadYamlMapping, log, prependRoleInstructions, requireAgentSession, isSessionLockLost, repairSessionUnlocked, SessionLock, stringOptions, loadWorkspaceConfig, resolveRoleTarget, waitUntil, } from "@nodeint/migent-kernel";
4
4
  import { printAgent, printError, printNotice, printResumeCommand } from "../display.js";
5
5
  import { cliHooks } from "../hooks.js";
6
6
  import { requireCurrentSchema } from "../migrate.js";
@@ -100,7 +100,7 @@ export async function dispatchAgent(workspace, args) {
100
100
  resumedMany = finished;
101
101
  }
102
102
  else {
103
- const prompt = prependRoleInstructions(loadRoleInstructions(loadYamlMapping(path.join(workspace, ".migent", "config.yaml")), args.role), resolvePrompt({
103
+ const prompt = prependRoleInstructions(loadRoleInstructions(loadWorkspaceConfig(workspace), args.role), resolvePrompt({
104
104
  prompt: args.prompt ?? null,
105
105
  promptFile: args.promptFile ?? null,
106
106
  promptStdin: args.promptStdin ?? false,
@@ -385,7 +385,7 @@ function finishRole(sessionId, code) {
385
385
  return code;
386
386
  }
387
387
  function rolePrompt(workspace, role, text) {
388
- return prependRoleInstructions(loadRoleInstructions(loadYamlMapping(path.join(workspace, ".migent", "config.yaml")), role), text);
388
+ return prependRoleInstructions(loadRoleInstructions(loadWorkspaceConfig(workspace), role), text);
389
389
  }
390
390
  function executionProfile(directory, executionId) {
391
391
  const raw = JSON.parse(readFileSync(path.join(directory, "execution.json"), "utf8"));
@@ -1,7 +1,7 @@
1
1
  import { readFileSync, writeFileSync } from "node:fs";
2
2
  import path from "node:path";
3
3
  import { confirm as clackConfirm, isCancel, select as clackSelect, text as clackText } from "@clack/prompts";
4
- import { ConfigEditError, ConfigurationError, assignRoles, describeChange, diagnose, inspectConfig, loadModelTarget, loadWorkflowCatalog, loadYamlMapping, matchingModelName, patchConfigText, placeRoleModel, isRoleStage, resolveStageSpec, setRoleOptions, upsertModel, whichSync, } from "@nodeint/migent-kernel";
4
+ import { ConfigEditError, ConfigurationError, LOCAL_CONFIG_FILE, assignRoles, configPath, describeChange, diagnose, hasLocalConfig, inspectConfig, loadModelTarget, loadWorkflowCatalog, loadWorkspaceConfig, loadYamlMapping, matchingModelName, patchConfigText, placeRoleModel, isRoleStage, resolveStageSpec, setRoleOptions, stringifyConfig, upsertModel, whichSync, } from "@nodeint/migent-kernel";
5
5
  import { printError } from "../display.js";
6
6
  import { PromptCancelled } from "../errors.js";
7
7
  import { cliHooks } from "../hooks.js";
@@ -11,8 +11,13 @@ import { runDoctor } from "./doctor.js";
11
11
  const NEW = "__new__";
12
12
  const UNSET = Symbol("unset");
13
13
  export function runConfigShow(workspace) {
14
- const text = readFileSync(path.join(workspace, ".migent", "config.yaml"), "utf8");
15
- process.stdout.write(text);
14
+ if (!hasLocalConfig(workspace)) {
15
+ process.stdout.write(readFileSync(configPath(workspace), "utf8"));
16
+ return 0;
17
+ }
18
+ process.stdout.write(stringifyConfig(loadWorkspaceConfig(workspace)));
19
+ process.stderr.write(`Merged with .migent/${LOCAL_CONFIG_FILE}.
20
+ `);
16
21
  return 0;
17
22
  }
18
23
  export async function runConfigModel(workspace, options = {}) {
@@ -262,7 +267,8 @@ async function confirmAndCommit(workspace, change, prompter, asJson, which) {
262
267
  return commit(workspace, change, { asJson, which, echo: false });
263
268
  }
264
269
  async function commit(workspace, change, args) {
265
- const filePath = path.join(workspace, ".migent", "config.yaml");
270
+ // Edits patch config.yaml only, so config.local.yaml values never reach the committed file.
271
+ const filePath = configPath(workspace);
266
272
  const original = readFileSync(filePath, "utf8");
267
273
  const updated = patchConfigText(original, change.config);
268
274
  if (updated === original) {
@@ -395,7 +401,8 @@ async function selectProvider(prompter, providers, which, message, defaultValue)
395
401
  }
396
402
  function loaded(workspace) {
397
403
  requireCurrentSchema(workspace);
398
- const config = loadYamlMapping(path.join(workspace, ".migent", "config.yaml"));
404
+ // Base file only: this snapshot feeds validation and patching of config.yaml.
405
+ const config = loadYamlMapping(configPath(workspace));
399
406
  const workflows = Object.values(loadWorkflowCatalog(workspace).documents);
400
407
  return [config, workflows, inspectConfig(config, workflows)];
401
408
  }
@@ -21,6 +21,7 @@ function payload(checks) {
21
21
  ok: check.ok,
22
22
  items: [...check.items],
23
23
  problems: [...check.problems],
24
+ warnings: [...check.warnings],
24
25
  })),
25
26
  };
26
27
  }
@@ -168,7 +168,7 @@ function writeProject(workspace, preset, primary) {
168
168
  writeFileSync(path.join(root, "config.yaml"), renderConfig(preset, primary), "utf8");
169
169
  const workflowName = `${preset}.yaml`;
170
170
  writeFileSync(path.join(workflows, workflowName), renderWorkflow(preset), "utf8");
171
- writeFileSync(path.join(root, ".gitignore"), "sessions/\n", "utf8");
171
+ writeFileSync(path.join(root, ".gitignore"), "sessions/\nconfig.local.yaml\n", "utf8");
172
172
  return [".migent/config.yaml", `.migent/workflows/${workflowName}`, ".migent/.gitignore"];
173
173
  }
174
174
  function renderConfig(preset, primary) {
package/dist/display.js CHANGED
@@ -41,6 +41,8 @@ export function printDoctor(checks) {
41
41
  }
42
42
  for (const problem of check.problems)
43
43
  process.stdout.write(` ${problem}\n`);
44
+ for (const warning of check.warnings)
45
+ process.stdout.write(` warning: ${warning}\n`);
44
46
  }
45
47
  }
46
48
  export function printSessions(rows) {
@@ -21,6 +21,9 @@ This skill is already in the prompt. Do not open its file again.
21
21
  and `schema-workflow.yaml` in the same folder. A key absent from them is
22
22
  ignored. Then run `migent doctor --json`; if it reports an outdated schema,
23
23
  run `migent migrate --yes`.
24
+ - `.migent/config.local.yaml`, when present, overrides `config.yaml` on this
25
+ machine. It is not committed. Read both, and edit shared settings in
26
+ `config.yaml`, not the local file.
24
27
  - You have no terminal for prompts. Pass `--no-input` (or set
25
28
  `MIGENT_NO_INPUT=1`) to `init`, `config model`, and `config role`, and give
26
29
  every value as a flag.
@@ -6,6 +6,15 @@ Run `migent provider list --json` to see which provider CLIs are available
6
6
  and what model ids each supports. Use that output to pick a provider and
7
7
  model id before using `config model` or `init`.
8
8
 
9
+ ## Per-machine override
10
+
11
+ `.migent/config.local.yaml` is an optional, uncommitted file with the same keys
12
+ as `config.yaml`. Mappings merge key by key; scalars and lists, such as
13
+ `instructions`, replace the value from `config.yaml`. Its `schema_version` is
14
+ ignored. Runs, `doctor`, and `config show` read the merged result.
15
+ `config model` and `config role` edit `config.yaml` only, never the local file.
16
+ `doctor` warns if git tracks the local file.
17
+
9
18
  ## Run one role
10
19
 
11
20
  Without `--workflow`, `session run` runs a single role:
@@ -1,5 +1,8 @@
1
1
  # A missing schema_version is 0. Commands refuse the file while it is older than this Migent.
2
2
  schema_version: 2
3
+ # .migent/config.local.yaml is an optional per-machine override with the same keys. It is not committed.
4
+ # Mappings merge key by key; scalars and lists replace the value from config.yaml. Its schema_version is ignored.
5
+ # config model and config role edit config.yaml only.
3
6
 
4
7
  # models.<name>.model is the provider model id.
5
8
  # models.<name>.client is optional: the CLI client id (agy, claude-code, codex, grok, opencode); required for provider byteplus
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodeint/migent",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Compose AI coding agents into repeatable engineering workflows.",
5
5
  "keywords": [
6
6
  "ai",
@@ -43,9 +43,9 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@clack/prompts": "^1.8.1",
46
- "@nodeint/migent-adapters": "0.1.7",
47
- "@nodeint/migent-kernel": "0.1.7",
48
- "@nodeint/migent-registry": "0.1.7",
46
+ "@nodeint/migent-adapters": "0.1.8",
47
+ "@nodeint/migent-kernel": "0.1.8",
48
+ "@nodeint/migent-registry": "0.1.8",
49
49
  "commander": "^14.0.2",
50
50
  "picocolors": "^1.1.1"
51
51
  },