@nodeint/migent 0.1.6 → 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 +246 -154
- package/dist/commands/agent.js +6 -6
- package/dist/commands/config.d.ts +3 -3
- package/dist/commands/config.js +66 -59
- package/dist/commands/doctor.js +3 -2
- package/dist/commands/execute.js +2 -2
- package/dist/commands/init.d.ts +3 -3
- package/dist/commands/init.js +21 -21
- package/dist/commands/prepare.js +1 -0
- package/dist/commands/provider.d.ts +10 -0
- package/dist/commands/provider.js +77 -0
- package/dist/commands/sessions.js +1 -0
- package/dist/display.d.ts +16 -0
- package/dist/display.js +42 -1
- package/dist/hooks.d.ts +2 -0
- package/dist/hooks.js +1 -0
- package/dist/index.js +1 -0
- package/dist/migrate.d.ts +3 -3
- package/dist/migrate.js +26 -24
- package/dist/program.js +16 -3
- package/dist/provider.d.ts +13 -11
- package/dist/provider.js +38 -33
- package/dist/session-row.d.ts +2 -0
- package/dist/session-row.js +2 -0
- package/dist/templates/migent/SKILL.md +13 -6
- package/dist/templates/migent/references/config.md +13 -0
- package/dist/templates/migent/references/schema-config.yaml +13 -1
- package/dist/templates/migent/references/schema-workflow.yaml +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,249 +1,341 @@
|
|
|
1
1
|
# Migent
|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
|
-
<
|
|
5
|
-
|
|
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>
|
|
6
7
|
</p>
|
|
7
8
|
|
|
8
9
|
<p align="center">
|
|
9
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>
|
|
10
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>
|
|
11
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>
|
|
12
|
-
<img src="https://img.shields.io/badge/agents-Multi--Agent_Ready-orange.svg?style=flat-square" alt="Multi-Agent Ready" />
|
|
13
13
|
</p>
|
|
14
14
|
|
|
15
15
|
---
|
|
16
16
|
|
|
17
|
-
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.
|
|
18
17
|
|
|
19
|
-
|
|
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.
|
|
20
68
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
+
```
|
|
24
76
|
|
|
25
|
-
|
|
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` |
|
|
26
90
|
|
|
27
91
|
## Quickstart
|
|
28
92
|
|
|
29
|
-
|
|
93
|
+
Requires Node.js 22+ (macOS, Linux, or Windows) and the provider CLIs your
|
|
94
|
+
config uses, already signed in.
|
|
30
95
|
|
|
31
|
-
|
|
96
|
+
### Install
|
|
32
97
|
|
|
33
98
|
```bash
|
|
34
|
-
# 1. Install Migent globally
|
|
35
99
|
npm install -g @nodeint/migent
|
|
36
|
-
|
|
37
|
-
# 2. Install the Migent Skill in your repo
|
|
38
|
-
migent skill install
|
|
100
|
+
migent --version
|
|
39
101
|
```
|
|
40
102
|
|
|
41
|
-
|
|
103
|
+
Upgrade with `npm install -g @nodeint/migent@latest`.
|
|
42
104
|
|
|
43
|
-
|
|
44
|
-
|
|
105
|
+
### Install agent skill
|
|
106
|
+
|
|
107
|
+
From your project repository:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
migent skill install
|
|
45
111
|
```
|
|
46
112
|
|
|
47
|
-
|
|
113
|
+
Installs `.agents/skills/migent/` so your AI agent knows how to configure, run,
|
|
114
|
+
and inspect Migent workflows.
|
|
48
115
|
|
|
49
|
-
|
|
116
|
+
### Create a project
|
|
50
117
|
|
|
51
|
-
|
|
118
|
+
Choose one:
|
|
52
119
|
|
|
53
|
-
|
|
120
|
+
#### Option 1: Ask your AI agent
|
|
54
121
|
|
|
55
|
-
|
|
56
|
-
# 1. Initialize a workflow preset and validate environment
|
|
57
|
-
migent init --preset plan
|
|
58
|
-
migent doctor
|
|
122
|
+
Paste this prompt into your agent (Claude Code, Antigravity, Cursor, etc.):
|
|
59
123
|
|
|
60
|
-
|
|
61
|
-
|
|
124
|
+
```text
|
|
125
|
+
Load skill migent: Read and follow .agents/skills/migent/SKILL.md.
|
|
62
126
|
|
|
63
|
-
|
|
64
|
-
migent session follow <session-id>
|
|
65
|
-
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.
|
|
66
128
|
```
|
|
67
129
|
|
|
68
|
-
|
|
130
|
+
#### Option 2: Run `migent init`
|
|
69
131
|
|
|
70
|
-
|
|
132
|
+
```bash
|
|
133
|
+
migent init
|
|
134
|
+
```
|
|
71
135
|
|
|
72
|
-
|
|
73
|
-
| :--- | :--- |
|
|
74
|
-
| **Manual handoffs:** Copying plans and pasting stack traces across conversations. | **Automated handoffs:** Upstream artifacts and diffs pass automatically into downstream stages. |
|
|
75
|
-
| **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). |
|
|
76
|
-
| **Vendor lock-in & wrappers:** Restricted to one provider or requiring custom API adapters. | **Native CLI execution:** Drives your installed agent CLIs (`agy`, `claude`, `codex`, `grok`) directly in your workspace. |
|
|
77
|
-
| **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. |
|
|
78
|
-
| **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. |
|
|
79
|
-
| **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.
|
|
80
137
|
|
|
81
|
-
|
|
138
|
+
Both options generate:
|
|
82
139
|
|
|
83
|
-
|
|
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
|
+
```
|
|
84
148
|
|
|
85
|
-
|
|
149
|
+
Commit `config.yaml` and `workflows/`. `config.local.yaml` overrides `config.yaml` on one machine and is ignored by git.
|
|
86
150
|
|
|
87
|
-
|
|
88
|
-
flowchart TD
|
|
89
|
-
Task["Task: Fix OAuth Callback"] --> Plan["1. Plan\n(Claude)"]
|
|
90
|
-
Plan -->|"artifact: plan.md"| Implement["2. Implement\n(Codex)"]
|
|
91
|
-
Implement --> Verify{"3. Verification Gate\n(pnpm test)"}
|
|
92
|
-
Verify -->|"Fails (retry <= max)"| Implement
|
|
93
|
-
Verify -->|"Retry limit reached"| Blocked["Stop for inspection"]
|
|
94
|
-
Verify -->|"Passes"| Review["4. Review\n(Grok)"]
|
|
95
|
-
Review -->|"Revise + feedback"| Implement
|
|
96
|
-
Review -->|"Approved"| Done["Workflow Complete"]
|
|
97
|
-
```
|
|
151
|
+
### Run
|
|
98
152
|
|
|
99
|
-
|
|
100
|
-
2. **Implement:** A coding model applies changes to the working tree according to the plan.
|
|
101
|
-
3. **Verify Gate:** Migent runs your repository's native verification commands (tests, typecheck, lint).
|
|
102
|
-
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:
|
|
103
154
|
|
|
104
|
-
|
|
155
|
+
```bash
|
|
156
|
+
$ migent session run --workflow plan --task "Plan the account settings redesign"
|
|
105
157
|
|
|
106
|
-
|
|
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.
|
|
107
162
|
|
|
108
|
-
|
|
109
|
-
|
|
163
|
+
Session completed in 2m 15s.
|
|
164
|
+
.migent/sessions/20261022-101530--wave-1/outputs/plan.md
|
|
165
|
+
```
|
|
110
166
|
|
|
111
|
-
|
|
112
|
-
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:
|
|
113
168
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
| **OpenAI Codex** | `codex` | Fast, focused implementation & unit test authoring |
|
|
119
|
-
| **xAI Grok** | `grok` | Independent logic review & edge case discovery |
|
|
169
|
+
```bash
|
|
170
|
+
migent session list
|
|
171
|
+
migent session continue <session-id>
|
|
172
|
+
```
|
|
120
173
|
|
|
121
|
-
|
|
174
|
+
## Workflow as code
|
|
122
175
|
|
|
123
|
-
|
|
124
|
-
Migent treats engineering runs as first-class observable processes:
|
|
125
|
-
- **Live Monitoring:** `migent session follow <session-id>` streams execution events, stage heartbeats, and runner turns in real time.
|
|
126
|
-
- **Detailed Metrics:** `migent session metrics <session-id> --json` outputs execution wall-time, active runner seconds, verify durations, revision counts, and token usage.
|
|
127
|
-
- **Continuous Refinement:** Use hard metrics from past sessions to optimize prompts, tune retry limits, and pick the most cost-effective models.
|
|
128
|
-
- **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`.
|
|
129
177
|
|
|
130
|
-
|
|
178
|
+
A standard plan-and-review workflow:
|
|
131
179
|
|
|
132
|
-
|
|
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
|
|
133
191
|
|
|
134
|
-
|
|
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
|
+
```
|
|
135
204
|
|
|
136
|
-
|
|
205
|
+
And the roles backed by your chosen provider CLIs:
|
|
137
206
|
|
|
138
207
|
```yaml
|
|
208
|
+
# .migent/config.yaml
|
|
139
209
|
schema_version: 2
|
|
140
|
-
|
|
141
210
|
models:
|
|
142
|
-
|
|
143
|
-
provider: claude
|
|
144
|
-
model: opus
|
|
145
|
-
|
|
146
|
-
coding-model:
|
|
211
|
+
codex-model:
|
|
147
212
|
provider: codex
|
|
148
|
-
model:
|
|
149
|
-
|
|
150
|
-
review-model:
|
|
213
|
+
model: gpt-5
|
|
214
|
+
grok-model:
|
|
151
215
|
provider: grok
|
|
152
|
-
model: grok-4
|
|
216
|
+
model: grok-4
|
|
217
|
+
options:
|
|
218
|
+
reasoning-effort: high
|
|
153
219
|
|
|
154
220
|
roles:
|
|
155
221
|
planner:
|
|
156
|
-
default_model:
|
|
157
|
-
|
|
158
|
-
|
|
222
|
+
default_model: codex-model
|
|
223
|
+
reviewer:
|
|
224
|
+
default_model: grok-model
|
|
225
|
+
```
|
|
159
226
|
|
|
160
|
-
|
|
161
|
-
default_model: coding-model
|
|
162
|
-
instructions:
|
|
163
|
-
- Implement changes according to the plan and write regression tests.
|
|
227
|
+
### How decisions work
|
|
164
228
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
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.
|
|
169
237
|
```
|
|
170
238
|
|
|
171
|
-
|
|
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.
|
|
172
241
|
|
|
173
|
-
|
|
174
|
-
schema_version: 2
|
|
175
|
-
id: feature
|
|
242
|
+
### Beyond planning: code and verify
|
|
176
243
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
role: planner
|
|
180
|
-
produces:
|
|
181
|
-
artifact: plan.md
|
|
244
|
+
Stages are not limited to generating documents. A stage can modify repository files
|
|
245
|
+
and declare automated `verify` commands:
|
|
182
246
|
|
|
247
|
+
```yaml
|
|
248
|
+
stages:
|
|
183
249
|
- id: implement
|
|
184
|
-
role:
|
|
185
|
-
|
|
250
|
+
role: developer
|
|
251
|
+
instructions:
|
|
252
|
+
- Implement the approved plan.
|
|
186
253
|
verify:
|
|
254
|
+
- pnpm build
|
|
187
255
|
- pnpm test
|
|
188
256
|
max_verify: 3
|
|
257
|
+
```
|
|
189
258
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
decision:
|
|
194
|
-
values: [approved, revise]
|
|
195
|
-
routes:
|
|
196
|
-
approved: complete
|
|
197
|
-
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.
|
|
198
262
|
|
|
199
|
-
|
|
200
|
-
- name: plan
|
|
201
|
-
from_stage: plan
|
|
202
|
-
artifact: plan.md
|
|
203
|
-
```
|
|
263
|
+
## Concepts
|
|
204
264
|
|
|
205
|
-
|
|
265
|
+
A workflow connects stages through dependencies and explicit decision routes.
|
|
206
266
|
|
|
207
|
-
|
|
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.
|
|
208
276
|
|
|
209
|
-
|
|
210
|
-
# Setup & Health
|
|
211
|
-
migent init --preset plan # Initialize starter configuration
|
|
212
|
-
migent doctor # Validate configuration, schemas, and CLI availability
|
|
213
|
-
migent skill install # Install the Migent Skill for coding agents (.agents/skills/migent/)
|
|
214
|
-
|
|
215
|
-
# Execution
|
|
216
|
-
migent session run --workflow <id> --task "<task>" # Run a workflow
|
|
217
|
-
migent session continue <session-id> # Resume an interrupted or blocked session
|
|
218
|
-
|
|
219
|
-
# Monitoring & Telemetry
|
|
220
|
-
migent session list # List recorded sessions and statuses
|
|
221
|
-
migent session follow <session-id> # Live-stream session events and progress
|
|
222
|
-
migent session metrics <session-id> --json # View token spend, duration, and retry metrics
|
|
223
|
-
migent session show <session-id> # Inspect session state and artifact status
|
|
224
|
-
```
|
|
277
|
+
### Artifact handoff vs session resume
|
|
225
278
|
|
|
226
|
-
|
|
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.
|
|
227
311
|
|
|
228
312
|
## Documentation
|
|
229
313
|
|
|
230
|
-
- [Writing
|
|
231
|
-
- [Providers and
|
|
232
|
-
- [Sessions and
|
|
233
|
-
- [CLI
|
|
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.
|
|
234
321
|
|
|
235
|
-
##
|
|
322
|
+
## Development
|
|
236
323
|
|
|
237
|
-
|
|
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`.
|
|
238
328
|
|
|
239
329
|
```bash
|
|
240
330
|
pnpm install
|
|
241
331
|
pnpm build
|
|
242
332
|
pnpm test
|
|
333
|
+
pnpm migent --help # run the local build
|
|
243
334
|
```
|
|
244
335
|
|
|
245
|
-
See [CONTRIBUTING.md](
|
|
336
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for testing rules, platform notes, and
|
|
337
|
+
the release process.
|
|
246
338
|
|
|
247
339
|
## License
|
|
248
340
|
|
|
249
|
-
Migent is
|
|
341
|
+
Migent is licensed under the [MIT License](https://github.com/nodeint/migent/blob/main/LICENSE).
|
package/dist/commands/agent.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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";
|
|
7
7
|
import { bindCancellationSignals } from "../signals.js";
|
|
8
|
-
import {
|
|
8
|
+
import { providerMap, parseOptions } from "../provider.js";
|
|
9
9
|
import { resolvePrompt } from "../workspace.js";
|
|
10
10
|
export async function dispatchAgent(workspace, args) {
|
|
11
11
|
requireCurrentSchema(workspace);
|
|
@@ -65,7 +65,7 @@ export async function dispatchAgent(workspace, args) {
|
|
|
65
65
|
let result;
|
|
66
66
|
let resumedMany = null;
|
|
67
67
|
try {
|
|
68
|
-
const runner = args.runner ?? cliHooks.runner ?? new AgentToolRunner(
|
|
68
|
+
const runner = args.runner ?? cliHooks.runner ?? new AgentToolRunner(providerMap());
|
|
69
69
|
const waitedUntil = new Map();
|
|
70
70
|
const rerun = (prompt, resumeId) => runner.run({
|
|
71
71
|
provider: target.provider,
|
|
@@ -100,7 +100,7 @@ export async function dispatchAgent(workspace, args) {
|
|
|
100
100
|
resumedMany = finished;
|
|
101
101
|
}
|
|
102
102
|
else {
|
|
103
|
-
const prompt = prependRoleInstructions(loadRoleInstructions(
|
|
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,
|
|
@@ -206,7 +206,7 @@ export async function continueAgent(workspace, args) {
|
|
|
206
206
|
printNotice(`agent ${role} · ${profile.provider}/${profile.model} (${optionLabel}).`);
|
|
207
207
|
const unbind = bindCancellationSignals();
|
|
208
208
|
try {
|
|
209
|
-
const runner = args.runner ?? cliHooks.runner ?? new AgentToolRunner(
|
|
209
|
+
const runner = args.runner ?? cliHooks.runner ?? new AgentToolRunner(providerMap());
|
|
210
210
|
if (sessionStatus === "cancelled") {
|
|
211
211
|
return await runCancelledRole(workspace, args.sessionId, role, profile, runner, false, args.waitHooks);
|
|
212
212
|
}
|
|
@@ -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(
|
|
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,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type Provider } from "@nodeint/migent-kernel";
|
|
2
2
|
import { type RunCommand, type Which } from "../provider.js";
|
|
3
3
|
export interface ConfigPrompter {
|
|
4
4
|
select(message: string, choices: ReadonlyArray<readonly [string, string]>, defaultValue?: string | null): string | Promise<string>;
|
|
@@ -14,7 +14,7 @@ export declare function runConfigModel(workspace: string, options?: {
|
|
|
14
14
|
clearOptions?: readonly string[];
|
|
15
15
|
asJson?: boolean;
|
|
16
16
|
interactive?: boolean;
|
|
17
|
-
|
|
17
|
+
providers?: Record<string, Provider> | null;
|
|
18
18
|
which?: Which | null;
|
|
19
19
|
prompter?: ConfigPrompter | null;
|
|
20
20
|
runCommand?: RunCommand | null;
|
|
@@ -28,7 +28,7 @@ export declare function runConfigRole(workspace: string, options?: {
|
|
|
28
28
|
clearOptions?: readonly string[];
|
|
29
29
|
asJson?: boolean;
|
|
30
30
|
interactive?: boolean;
|
|
31
|
-
|
|
31
|
+
providers?: Record<string, Provider> | null;
|
|
32
32
|
which?: Which | null;
|
|
33
33
|
prompter?: ConfigPrompter | null;
|
|
34
34
|
runCommand?: RunCommand | null;
|