mars-agents 0.2.8

Agent package manager for .agents/ directories
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
# Agent Profile Reference

An agent profile is a markdown file with a YAML frontmatter block. The frontmatter declares identity, routing, and runtime policy fields. The markdown body becomes the agent's system prompt (instructions).

```yaml
---
name: coder
description: Implementation agent for code changes
model: gpt55
harness: claude
mode: subagent
approval: auto
effort: high
autocompact: 50
skills: [dev-principles, shared-workspace]
tools: [Bash, Write, Edit, Read]
disallowed-tools: [Agent, Bash(git revert:*)]
harness-overrides:
  codex:
    effort: medium
    sandbox: workspace-write
model-policies:
  - match:
      alias: opus
    override:
      effort: high
fanout:
  - alias: opus
  - alias: codex
---

# Coder

You turn approved blueprints into working code. Focus on correctness, then clarity.
Commit after each passing step.
```

## File Location

| Context | Path |
|---|---|
| Source package | `agents/<name>.md` |
| Project-local | `.mars-src/agents/<name>.md` |

The filename stem is the agent's canonical name — this is what `mars list`, `mars why`, and harness-native directories use to identify the agent.

## File Format

```
---
name: coder
description: Implementation agent for code changes
model: gpt55
harness: claude
skills: [dev-principles, shared-workspace]
tools: [Bash, Write, Edit]
---

# Coder

You turn approved plans into working code. Focus on correctness, then clarity.
```

Everything before the first `---` fence, or files with no frontmatter, is treated as a body-only agent with no profile fields set.

---

## Fields

### `name`

| | |
|---|---|
| Type | string |
| Required | no |
| Default | none (filename stem is used as fallback) |

Human-readable display name. Appears in `mars list` output and is preserved in compiled artifacts. If omitted, the filename stem serves as the agent's identity everywhere.

```yaml
name: coder
```

---

### `description`

| | |
|---|---|
| Type | string |
| Required | no |
| Default | none |

One-line summary of the agent's purpose. Shown in `mars list` and passed through to harness-native artifacts.

```yaml
description: Implementation agent for code changes
```

---

### `model`

| | |
|---|---|
| Type | string |
| Required | no |
| Default | none (harness default) |

Model alias or concrete model ID. Aliases defined in `[models]` in `mars.toml` are resolved per-target during compilation. If omitted, the harness uses its default model.

```yaml
model: gpt55        # alias
model: claude-opus-4-6  # concrete ID
```

---

### `harness`

| | |
|---|---|
| Type | string |
| Required | no |
| Allowed values | `claude`, `codex`, `opencode`, `pi` |
| Default | none (universal agent) |

Execution target. When set, mars compiles a harness-native artifact in addition to the canonical `.mars/` artifact. Universal agents (no `harness:`) are installed to `.mars/agents/` only and launched by Meridian against any harness.

```yaml
harness: claude
```

See [agent-compilation.md](agent-compilation.md) for what each harness target produces.

---

### `mode`

| | |
|---|---|
| Type | string |
| Required | no |
| Allowed values | `primary`, `subagent` |
| Default | none |

Execution mode hint. `primary` agents are launched interactively (full TUI, session-level approval). `subagent` agents are spawned programmatically by orchestrators. Some harnesses use this to select default approval behavior.

```yaml
mode: subagent
```

---

### `approval`

| | |
|---|---|
| Type | string |
| Required | no |
| Allowed values | `default`, `auto`, `confirm`, `yolo` |
| Default | none (unset; harness decides) |

Permission approval policy for tool calls.

| Value | Behavior |
|---|---|
| `default` | Explicitly requests harness-default approval behavior |
| `auto` | Auto-approve safe operations (edits, reads); prompt for destructive ops |
| `confirm` | Prompt before every tool call |
| `yolo` | Approve all tool calls without prompting |

Omitting `approval` leaves it unset. `default` is an accepted explicit value, but it is not the same as an omitted field in the parsed profile.

```yaml
approval: auto
```

---

### `sandbox`

| | |
|---|---|
| Type | string |
| Required | no |
| Allowed values | `default`, `read-only`, `workspace-write`, `danger-full-access` |
| Default | none (unset; harness decides) |

Filesystem access restriction level. Primarily meaningful for Codex. Other harnesses may drop this field — see [agent-compilation.md](agent-compilation.md).

| Value | Behavior |
|---|---|
| `default` | Explicitly requests harness-default sandbox behavior |
| `read-only` | Read filesystem; no writes |
| `workspace-write` | Write within the project workspace |
| `danger-full-access` | Full filesystem access |

Omitting `sandbox` leaves it unset. `default` is an accepted explicit value, but it is not the same as an omitted field in the parsed profile.

```yaml
sandbox: workspace-write
```

---

### `effort`

| | |
|---|---|
| Type | string |
| Required | no |
| Allowed values | `low`, `medium`, `high`, `xhigh`, `max` |
| Default | none (harness model default) |

Reasoning effort level. Maps to model-specific effort controls (`--effort` for Claude, `model_reasoning_effort` for Codex). `max` is accepted as an alias for `xhigh`; Claude lowering normalizes `xhigh` to `max`.

```yaml
effort: high
```

---

### `autocompact`

| | |
|---|---|
| Type | integer |
| Required | no |
| Range | 0–4294967295 |
| Default | none |

Context window compaction threshold. Consumed by Meridian's session manager — no harness-native equivalent. Specifies the context percentage at which Meridian triggers compaction.

```yaml
autocompact: 50
```

---

### `skills`

| | |
|---|---|
| Type | string[] |
| Required | no |
| Default | empty |

Skill names this agent loads. Skill files are read from the `skills/` directory in the agent's resolved package tree. Mars installs transitive skill dependencies automatically during sync.

```yaml
skills: [dev-principles, shared-workspace]
```

---

### `tools`

| | |
|---|---|
| Type | string[] |
| Required | no |
| Default | empty (harness default tool set) |

Tool allowlist. Only these tools are available to the agent. Supports scoped patterns for fine-grained control. Native support varies by harness — see [agent-compilation.md](agent-compilation.md).

```yaml
tools: [Bash, Write, Edit]
tools: [Bash(git status), Write, Read]   # scoped pattern
```

---

### `disallowed-tools`

| | |
|---|---|
| Type | string[] |
| Required | no |
| Default | empty |

Tool denylist. These tools are blocked even if they'd otherwise be available. Supports scoped patterns. Native support varies by harness.

```yaml
disallowed-tools: [Agent]
disallowed-tools: [Bash(git revert:*), Bash(git reset:*)]
```

---

### `mcp-tools`

| | |
|---|---|
| Type | string[] |
| Required | no |
| Default | empty |

MCP server references for this agent. Entries are config file references for Claude (`--mcp-config`). Codex uses a different format (`-c mcp.servers.<name>.command`). Behavior varies by harness.

```yaml
mcp-tools: [context7, memory-bank]
```

---

### `harness-overrides`

Per-harness override table. Overrides top-level field values when a specific harness compiles the agent. Only the fields relevant to the target harness are applied; the rest are ignored.

**Overridable fields:** `effort`, `autocompact`, `approval`, `sandbox`, `skills`, `tools`, `disallowed-tools`, `mcp-tools`

**Non-overridable fields (warning if present; field is skipped):** `name`, `description`, `model`, `harness`, `mode`, `harness-overrides`

```yaml
harness-overrides:
  claude:
    approval: auto
    skills: [dev-principles, shared-workspace]
  codex:
    effort: high
    sandbox: workspace-write
```

Override semantics are **replace**: if a field is set in the override block, it fully replaces the top-level value. If it's absent from the override block, the top-level value is used.

At compile time, the matching override block is merged into the lowered artifact. At runtime, Meridian applies the full override table when launching the agent.

---

### `model-policies`

Runtime routing rules consumed by Meridian. Each entry specifies a `match` condition and an `override` to apply when the condition is true.

```yaml
model-policies:
  - match:
      alias: opus
    override:
      effort: high
  - match:
      model: gpt-5.5
    override:
      harness: codex
      effort: medium
```

`model-policies` is Meridian-only — it is preserved in the `.mars/` artifact but stripped from all harness-native compiled outputs.

Mars currently preserves entries as opaque metadata. The `match`/`override` structure above is the Meridian-consumed schema, but mars only validates that `model-policies` is a sequence; it does not validate each entry's internal shape.

---

### `fanout`

Declares additional model candidates for inventory display in `meridian spawn --list`. Entries describe fallback or alternative models the agent can run on.

```yaml
fanout:
  - alias: opus
  - alias: codex
  - model: gpt-5.5
```

`fanout` is Meridian-only — preserved in `.mars/` but stripped from harness-native artifacts.

Mars currently preserves fanout entries as opaque metadata and only validates that `fanout` is a sequence; it does not validate each entry's internal shape.

---

## Validation

Mars validates agent profiles at compile time and emits diagnostics:

| Condition | Severity |
|---|---|
| Invalid field value (e.g. `effort: ultra`) | Error — field is skipped |
| Unknown harness name | Warning — field is skipped |
| Non-overridable field in override block | Warning — field is skipped |
| Legacy `models:` field | Warning — deprecated; use `fanout:` for display/inventory candidates and `model-policies:` for per-model overrides |
| Unknown top-level fields | Tolerated (forward compatibility) |

Diagnostics are emitted during `mars sync` and `mars validate`. Errors in a field skip that field; the rest of the profile is used.

---

## Examples

### Minimal profile

```yaml
---
name: planner
---

# Planner

You produce structured plans from requirements.
```

### Universal agent (no harness)

An agent without `harness:` is installed to `.mars/agents/` only. Meridian selects the harness at spawn time based on model resolution and project config.

```yaml
---
name: reviewer
description: Adversarial review of designs and code changes
model: gpt-5.4
mode: subagent
skills: [review-principles]
---

# Reviewer

You review designs and code for correctness, regressions, and structural soundness.
Report findings with severity. Read-only — do not edit.
```