@nodeint/migent 0.1.5 โ†’ 0.1.7

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,209 +1,253 @@
1
1
  # Migent
2
2
 
3
- **Compose AI coding agents into repeatable engineering workflows.**
4
-
5
- Use the right model for each stage of the job.
6
-
7
- Migent connects coding-agent CLIs from different providers through explicit,
8
- repository-defined workflows. One model can plan, another can review, and the
9
- first can reviseโ€”while Migent carries artifacts between them and remembers
10
- where the process is.
11
-
12
- ## Contents
13
-
14
- - [Migent](#migent)
15
- - [Contents](#contents)
16
- - [Why Migent?](#why-migent)
17
- - [Supported CLIs](#supported-clis)
18
- - [Quickstart](#quickstart)
19
- - [Install](#install)
20
- - [Create a project](#create-a-project)
21
- - [Run](#run)
22
- - [Next](#next)
23
- - [Concepts](#concepts)
24
- - [Current scope](#current-scope)
25
- - [Documentation](#documentation)
26
- - [Development](#development)
27
- - [License](#license)
28
-
29
- ## Why Migent?
30
-
31
- Calling two agent CLIs from a shell script is easy. Reliably coordinating them
32
- across reviews, revisions, failures, and resumed sessions is not.
33
-
34
- Migent is built around three ideas:
35
-
36
- - **Use models for what they do best.** Assign each role to a provider and model
37
- suited to the work, rather than asking one agent to do everything.
38
- - **Treat AI engineering process as code.** Keep stages, handoffs, review gates,
39
- and revision policies in version control beside the project they govern.
40
- - **Keep orchestration explicit.** The team defines the process; models execute
41
- roles inside it. A supervisor model does not invent or dynamically control
42
- the workflow.
43
-
44
- **Models describe execution. Roles describe intent.** Changing the model behind
45
- a role does not require rewriting the workflow.
46
-
47
- **Common workflow model, native provider capabilities.** Migent coordinates
48
- the process, while each provider CLI remains responsible for authentication,
49
- agent execution, and its own tools and options.
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.
7
+ </p>
50
8
 
51
- ```mermaid
52
- flowchart TD
53
- A[Task] --> B[Planner - Codex]
54
- B -->|plan.md| C[Reviewer - Grok]
55
- C -->|revise| B
56
- C -->|approved| D[Complete]
57
- ```
9
+ <p align="center">
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
+ <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
+ <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
+ </p>
15
+
16
+ ---
17
+
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.
58
19
 
59
- ## Supported CLIs
20
+ ### ๐ŸŒŸ Why Migent?
60
21
 
61
- Migent drives each provider through its headless CLI. Install and sign in to the
62
- ones your configuration names.
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.
63
25
 
64
- | Provider | CLI |
65
- | -------------------| -------- |
66
- | Google Antigravity | `agy` |
67
- | Claude | `claude` |
68
- | Codex | `codex` |
69
- | Grok | `grok` |
26
+ ---
70
27
 
71
28
  ## Quickstart
72
29
 
73
- Requires Node.js 22+ (macOS, Linux, or Windows) and the provider CLIs your
74
- config uses, already signed in.
30
+ ### Option A: Agent-Assisted via `/migent` (Recommended)
75
31
 
76
- ### Install
32
+ Let your coding agent handle the initial configuration using Migent's official Skill.
77
33
 
78
34
  ```bash
35
+ # 1. Install Migent globally
79
36
  npm install -g @nodeint/migent
80
- migent --version
37
+
38
+ # 2. Install the Migent Skill in your repo
39
+ migent skill install
40
+ ```
41
+
42
+ Now open your favorite coding agent CLI (such as Google Antigravity `agy`, Anthropic `claude`, Cursor, or Windsurf) in this repository and type:
43
+
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.
81
46
  ```
82
47
 
83
- Upgrade with `npm install -g @nodeint/migent@latest`.
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.
84
49
 
85
- ### Create a project
50
+ ---
86
51
 
87
- From the repository where agents will work:
52
+ ### Option B: Terminal CLI (Direct Control)
53
+
54
+ Prefer setting it up yourself? Get started in three commands:
88
55
 
89
56
  ```bash
90
- migent init
57
+ # 1. Initialize a workflow preset and validate environment
58
+ migent init --preset plan
59
+ migent doctor
60
+
61
+ # 2. Run your engineering task
62
+ migent session run --workflow plan --task "Implement JWT authentication with refresh tokens"
63
+
64
+ # 3. Stream real-time events or inspect performance metrics
65
+ migent session follow <session-id>
66
+ migent session metrics <session-id> --json
91
67
  ```
92
68
 
93
- In a terminal, `init` walks you through the provider, model, and options, then
94
- offers to install the Migent skill so agents in the project know how to run it.
95
- Without a terminal, pass `--provider` and `--model` together. Pass `--skill` to
96
- install the skill without the prompt.
69
+ ---
97
70
 
98
- It creates:
71
+ ## What Migent Solves
99
72
 
100
- ```text
101
- .migent/
102
- โ”œโ”€โ”€ config.yaml # models and roles
103
- โ”œโ”€โ”€ .gitignore # keeps sessions/ untracked
104
- โ””โ”€โ”€ workflows/
105
- โ””โ”€โ”€ plan.yaml # plan-and-review workflow
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. |
106
81
 
107
- .agents/skills/migent/ # only if you install the skill
82
+ ---
83
+
84
+ ## How It Works
85
+
86
+ A typical software engineering workflow breaks down into structured, verifiable stages:
87
+
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"]
108
98
  ```
109
99
 
110
- Commit `config.yaml` and `workflows/`. To add the skill later, run
111
- `migent skill install`.
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.
112
104
 
113
- ### Run
105
+ ---
114
106
 
115
- From the project or any subdirectory:
107
+ ## Core Capabilities
116
108
 
117
- ```bash
118
- migent session run --workflow plan --task "Plan the account settings redesign"
119
- ```
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.
120
111
 
121
- `--task` is one line and is stored in the session as `task.md`. For a longer
122
- task, create the session first, write the file, then start it:
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:
123
114
 
124
- ```bash
125
- migent session prepare wave-3 --workflow plan
126
- migent session run --session wave-3 --workflow plan
127
- ```
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` |
128
123
 
129
- Migent runs each eligible stage until the workflow completes or stops. Omit
130
- `--workflow` and pass `--role` to run one role instead. A workflow run prints
131
- one JSON result with the session id, status, stop reason, decision, and output
132
- paths. A role run prints a table unless `--json`. Stderr prints one line when
133
- a stage starts and one when it finishes. Then inspect or resume:
124
+ Switch models anytime in `.migent/config.yaml` without touching your workflow logic.
134
125
 
135
- ```bash
136
- migent session list
137
- migent session list --latest --json
138
- migent session follow <session-id>
139
- migent session continue <session-id>
140
- ```
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.
141
132
 
142
- `session list --json` and a JSON snapshot omit the task text.
133
+ ---
143
134
 
144
- ### Next
135
+ ## Configuration Example
145
136
 
146
- - [Providers and model configuration](https://github.com/nodeint/migent/blob/main/docs/providers.md)
147
- - [Writing workflows](https://github.com/nodeint/migent/blob/main/docs/workflows.md#complete-example)
148
- - [CLI commands and exit codes](https://github.com/nodeint/migent/blob/main/docs/cli.md)
149
- - [Sessions and workflow composition](https://github.com/nodeint/migent/blob/main/docs/sessions.md)
137
+ Migent separates model/role assignments from pipeline control flow.
150
138
 
151
- ## Concepts
139
+ ### 1. Configure Models and Roles (`.migent/config.yaml`)
152
140
 
153
- A workflow connects stages through dependencies and explicit decision routes.
141
+ ```yaml
142
+ schema_version: 2
154
143
 
155
- - A **model** identifies a provider model and its execution options.
156
- - A **role** names a kind of work and selects its default model.
157
- - A **stage** assigns work to a role and may declare dependencies, an artifact,
158
- a decision, or both.
159
- - An **artifact** is a named file produced by a successful stage and stored with
160
- the workflow session.
161
- - A **decision** selects the next route, including a route back for revision.
162
- - A **session** records executions, events, decisions, and artifacts so work can
163
- be inspected or resumed.
144
+ models:
145
+ planning-model:
146
+ provider: claude
147
+ model: opus
164
148
 
165
- Use `depends_on` to give a stage upstream artifacts. Every visit of a stage
166
- continues that stage's provider agent. Use `session.resume_from` when a stage
167
- must continue a different stage's provider session.
149
+ coding-model:
150
+ provider: codex
151
+ model: default
168
152
 
169
- ## Current scope
153
+ review-model:
154
+ provider: grok
155
+ model: grok-4.7
170
156
 
171
- Migent is a local, file-backed orchestration layer for provider CLIs. It does
172
- not replace their agent runtimes, and it does not hide their distinctive
173
- capabilities behind a lowest-common-denominator API.
157
+ roles:
158
+ planner:
159
+ default_model: planning-model
160
+ instructions:
161
+ - Analyze the repository and create an actionable plan with file paths.
174
162
 
175
- Today, Migent supports explicit stage routing, review loops, local session
176
- history, provider-session resume, prerequisite workflows, and standalone role
177
- execution. A machine-local registry service records workspaces
178
- so another tool can ask which projects exist.
163
+ coder:
164
+ default_model: coding-model
165
+ instructions:
166
+ - Implement changes according to the plan and write regression tests.
179
167
 
180
- ## Documentation
168
+ reviewer:
169
+ default_model: review-model
170
+ instructions:
171
+ - Review the git diff against the plan for correctness, security, and edge cases.
172
+ ```
181
173
 
182
- - [Writing workflows](https://github.com/nodeint/migent/blob/main/docs/workflows.md)
183
- - [Providers and model configuration](https://github.com/nodeint/migent/blob/main/docs/providers.md)
184
- - [Sessions and workflow composition](https://github.com/nodeint/migent/blob/main/docs/sessions.md)
185
- - [CLI commands and execution controls](https://github.com/nodeint/migent/blob/main/docs/cli.md)
174
+ ### 2. Define the Pipeline (`.migent/workflows/feature.yaml`)
175
+
176
+ ```yaml
177
+ schema_version: 2
178
+ id: feature
179
+
180
+ stages:
181
+ - id: plan
182
+ role: planner
183
+ produces:
184
+ artifact: plan.md
185
+
186
+ - id: implement
187
+ role: coder
188
+ depends_on: [plan]
189
+ verify:
190
+ - pnpm test
191
+ max_verify: 3
192
+
193
+ - id: review
194
+ role: reviewer
195
+ depends_on: [implement]
196
+ decision:
197
+ values: [approved, revise]
198
+ routes:
199
+ approved: complete
200
+ revise: implement
201
+
202
+ outputs:
203
+ - name: plan
204
+ from_stage: plan
205
+ artifact: plan.md
206
+ ```
207
+
208
+ ---
209
+
210
+ ## CLI Cheatsheet
211
+
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
+ ```
229
+
230
+ ---
231
+
232
+ ## Documentation
186
233
 
187
- Run `migent <command> --help` for the exact command contract, output fields,
188
- and exit codes.
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.
189
238
 
190
- ## Development
239
+ ## Contributing
191
240
 
192
- The pnpm workspace contains four packages: the `@nodeint/migent` CLI and its
193
- internal libraries `@nodeint/migent-kernel`, `@nodeint/migent-adapters`, and
194
- `@nodeint/migent-registry`. The libraries have no stable API; depend on
195
- `@nodeint/migent`.
241
+ Migent is built with TypeScript in a pnpm workspace:
196
242
 
197
243
  ```bash
198
244
  pnpm install
199
245
  pnpm build
200
246
  pnpm test
201
- pnpm migent --help # run the local build
202
247
  ```
203
248
 
204
- See [CONTRIBUTING.md](CONTRIBUTING.md) for testing rules, platform notes, and
205
- the release process.
249
+ See [CONTRIBUTING.md](https://github.com/nodeint/migent/blob/main/CONTRIBUTING.md) for details.
206
250
 
207
251
  ## License
208
252
 
209
- Migent is licensed under the [MIT License](https://github.com/nodeint/migent/blob/main/LICENSE).
253
+ Migent is open source under the [MIT License](https://github.com/nodeint/migent/blob/main/LICENSE).
@@ -1,4 +1,4 @@
1
- import { AgentToolRunner } from "@nodeint/migent-kernel";
1
+ import { AgentToolRunner, type WaitHooks } from "@nodeint/migent-kernel";
2
2
  export declare function dispatchAgent(workspace: string, args: {
3
3
  role: string;
4
4
  task?: string | null;
@@ -11,4 +11,11 @@ export declare function dispatchAgent(workspace: string, args: {
11
11
  promptStdin?: boolean;
12
12
  asJson?: boolean;
13
13
  runner?: AgentToolRunner | null;
14
+ waitHooks?: WaitHooks;
15
+ }): Promise<number>;
16
+ export declare function continueAgent(workspace: string, args: {
17
+ sessionId: string;
18
+ reply: string | null;
19
+ runner?: AgentToolRunner | null;
20
+ waitHooks?: WaitHooks;
14
21
  }): Promise<number>;