@nodeint/migent 0.1.5 → 0.1.6

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,249 @@
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
+ <strong>Autonomous, multi-stage engineering pipelines for your coding agents.</strong><br>
5
+ Repeatable workflows. Multi-agent orchestration. Native CLI execution. Full observability.
6
+ </p>
50
7
 
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
- ```
8
+ <p align="center">
9
+ <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
+ <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
+ <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
+ </p>
14
+
15
+ ---
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.
58
18
 
59
- ## Supported CLIs
19
+ ### 🌟 Why Migent?
60
20
 
61
- Migent drives each provider through its headless CLI. Install and sign in to the
62
- ones your configuration names.
21
+ - 🔁 **Automate Recurring Tasks (Workflows & Stages):** Package routine engineering work—bug fixes, refactors, migrations, test authoring—into structured, multi-stage pipelines with deterministic verification gates.
22
+ - 🤖 **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.
23
+ - 📊 **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
24
 
64
- | Provider | CLI |
65
- | -------------------| -------- |
66
- | Google Antigravity | `agy` |
67
- | Claude | `claude` |
68
- | Codex | `codex` |
69
- | Grok | `grok` |
25
+ ---
70
26
 
71
27
  ## Quickstart
72
28
 
73
- Requires Node.js 22+ (macOS, Linux, or Windows) and the provider CLIs your
74
- config uses, already signed in.
29
+ ### Option A: Agent-Assisted via `/migent` (Recommended)
75
30
 
76
- ### Install
31
+ Let your coding agent handle the initial configuration using Migent's official Skill.
77
32
 
78
33
  ```bash
34
+ # 1. Install Migent globally
79
35
  npm install -g @nodeint/migent
80
- migent --version
36
+
37
+ # 2. Install the Migent Skill in your repo
38
+ migent skill install
39
+ ```
40
+
41
+ Now open your favorite coding agent CLI (such as Google Antigravity `agy`, Anthropic `claude`, Cursor, or Windsurf) in this repository and type:
42
+
43
+ ```text
44
+ /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
45
  ```
82
46
 
83
- Upgrade with `npm install -g @nodeint/migent@latest`.
47
+ > **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
48
 
85
- ### Create a project
49
+ ---
86
50
 
87
- From the repository where agents will work:
51
+ ### Option B: Terminal CLI (Direct Control)
52
+
53
+ Prefer setting it up yourself? Get started in three commands:
88
54
 
89
55
  ```bash
90
- migent init
56
+ # 1. Initialize a workflow preset and validate environment
57
+ migent init --preset plan
58
+ migent doctor
59
+
60
+ # 2. Run your engineering task
61
+ migent session run --workflow plan --task "Implement JWT authentication with refresh tokens"
62
+
63
+ # 3. Stream real-time events or inspect performance metrics
64
+ migent session follow <session-id>
65
+ migent session metrics <session-id> --json
91
66
  ```
92
67
 
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.
68
+ ---
97
69
 
98
- It creates:
70
+ ## What Migent Solves
99
71
 
100
- ```text
101
- .migent/
102
- ├── config.yaml # models and roles
103
- ├── .gitignore # keeps sessions/ untracked
104
- └── workflows/
105
- └── plan.yaml # plan-and-review workflow
72
+ | Without Migent | With Migent |
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. |
106
80
 
107
- .agents/skills/migent/ # only if you install the skill
81
+ ---
82
+
83
+ ## How It Works
84
+
85
+ A typical software engineering workflow breaks down into structured, verifiable stages:
86
+
87
+ ```mermaid
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"]
108
97
  ```
109
98
 
110
- Commit `config.yaml` and `workflows/`. To add the skill later, run
111
- `migent skill install`.
99
+ 1. **Plan:** A high-reasoning model analyzes the codebase and generates an actionable `plan.md`.
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.
112
103
 
113
- ### Run
104
+ ---
114
105
 
115
- From the project or any subdirectory:
106
+ ## Core Capabilities
116
107
 
117
- ```bash
118
- migent session run --workflow plan --task "Plan the account settings redesign"
119
- ```
108
+ ### 1. Repeatable Workflows as Code
109
+ Define stages, dependencies, artifacts, and routing decisions in declarative YAML stored under `.migent/workflows/`. Version control your engineering processes alongside your application code.
120
110
 
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:
111
+ ### 2. Multi-Agent Orchestration & BYO CLIs
112
+ Decouple **what** a stage does from **which model** executes it. Migent drives the agent CLIs already installed and authenticated on your machine:
123
113
 
124
- ```bash
125
- migent session prepare wave-3 --workflow plan
126
- migent session run --session wave-3 --workflow plan
127
- ```
114
+ | Provider | CLI | Typical Role in Pipeline |
115
+ | :--- | :--- | :--- |
116
+ | **Anthropic Claude** | `claude` | High-reasoning architecture planning & refactoring |
117
+ | **Google Antigravity** | `agy` | Deep repository analysis, plan generation & review |
118
+ | **OpenAI Codex** | `codex` | Fast, focused implementation & unit test authoring |
119
+ | **xAI Grok** | `grok` | Independent logic review & edge case discovery |
128
120
 
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:
121
+ Switch models anytime in `.migent/config.yaml` without touching your workflow logic.
134
122
 
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
- ```
123
+ ### 3. Observability, Telemetry & Continuous Improvement
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.
141
129
 
142
- `session list --json` and a JSON snapshot omit the task text.
130
+ ---
143
131
 
144
- ### Next
132
+ ## Configuration Example
145
133
 
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)
134
+ Migent separates model/role assignments from pipeline control flow.
150
135
 
151
- ## Concepts
136
+ ### 1. Configure Models and Roles (`.migent/config.yaml`)
152
137
 
153
- A workflow connects stages through dependencies and explicit decision routes.
138
+ ```yaml
139
+ schema_version: 2
154
140
 
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.
141
+ models:
142
+ planning-model:
143
+ provider: claude
144
+ model: opus
164
145
 
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.
146
+ coding-model:
147
+ provider: codex
148
+ model: default
168
149
 
169
- ## Current scope
150
+ review-model:
151
+ provider: grok
152
+ model: grok-4.7
170
153
 
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.
154
+ roles:
155
+ planner:
156
+ default_model: planning-model
157
+ instructions:
158
+ - Analyze the repository and create an actionable plan with file paths.
174
159
 
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.
160
+ coder:
161
+ default_model: coding-model
162
+ instructions:
163
+ - Implement changes according to the plan and write regression tests.
179
164
 
180
- ## Documentation
165
+ reviewer:
166
+ default_model: review-model
167
+ instructions:
168
+ - Review the git diff against the plan for correctness, security, and edge cases.
169
+ ```
181
170
 
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)
171
+ ### 2. Define the Pipeline (`.migent/workflows/feature.yaml`)
172
+
173
+ ```yaml
174
+ schema_version: 2
175
+ id: feature
176
+
177
+ stages:
178
+ - id: plan
179
+ role: planner
180
+ produces:
181
+ artifact: plan.md
182
+
183
+ - id: implement
184
+ role: coder
185
+ depends_on: [plan]
186
+ verify:
187
+ - pnpm test
188
+ max_verify: 3
189
+
190
+ - id: review
191
+ role: reviewer
192
+ depends_on: [implement]
193
+ decision:
194
+ values: [approved, revise]
195
+ routes:
196
+ approved: complete
197
+ revise: implement
198
+
199
+ outputs:
200
+ - name: plan
201
+ from_stage: plan
202
+ artifact: plan.md
203
+ ```
204
+
205
+ ---
206
+
207
+ ## CLI Cheatsheet
208
+
209
+ ```bash
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
+ ```
225
+
226
+ ---
227
+
228
+ ## Documentation
186
229
 
187
- Run `migent <command> --help` for the exact command contract, output fields,
188
- and exit codes.
230
+ - [Writing Workflows](https://github.com/nodeint/migent/blob/main/docs/workflows.md) — Stages, dependencies, artifacts, and routing decisions.
231
+ - [Providers and Model Configuration](https://github.com/nodeint/migent/blob/main/docs/providers.md) — Configuring CLIs, models, options, and fallback models.
232
+ - [Sessions and State](https://github.com/nodeint/migent/blob/main/docs/sessions.md) — Manifests, append-only event logs, and recovery.
233
+ - [CLI Reference](https://github.com/nodeint/migent/blob/main/docs/cli.md) — Full command catalog, flags, and JSON modes.
189
234
 
190
- ## Development
235
+ ## Contributing
191
236
 
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`.
237
+ Migent is built with TypeScript in a pnpm workspace:
196
238
 
197
239
  ```bash
198
240
  pnpm install
199
241
  pnpm build
200
242
  pnpm test
201
- pnpm migent --help # run the local build
202
243
  ```
203
244
 
204
- See [CONTRIBUTING.md](CONTRIBUTING.md) for testing rules, platform notes, and
205
- the release process.
245
+ See [CONTRIBUTING.md](https://github.com/nodeint/migent/blob/main/CONTRIBUTING.md) for details.
206
246
 
207
247
  ## License
208
248
 
209
- Migent is licensed under the [MIT License](https://github.com/nodeint/migent/blob/main/LICENSE).
249
+ 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>;