Target repository lifecycle

Move a repo from plain git checkout to a MARS target.

Start with a normal git repository. MARS adds its harness files, registers local state, runs roles through the queue, checks health, fills missing defaults after upgrades, and removes its files with a dry-run-first uninstall path.

Action boundary: lifecycle commands can move from read-only inspection to target-file writes and autonomous work. Use security and governance for ownership boundaries and adoption guide before piloting important repos.

Decision Map

Use this table to choose the right command before touching a target repo. For exact flags, use the CLI Reference or mars <command> --help.

User intentCommandWrites target files?Primary output
Create the harness deliberately.mars init --repo /path/to/repoYes..harness/, operating docs, release files, tickets, goals, quality score.
Register a repo for orchestration.mars register --repo /path/to/repoMaybe; auto-inits if missing.Repo record in the per-repo SQLite database.
Run the full scoped autonomous loop.mars start --repo /path/to/repo --execution-profile host --acknowledge-host-executionYes; acknowledged host may initialize and agents may later mutate.Dashboard, workers, queue, lifecycle reconciliation, role execution.
Preview or execute one role.mars run engineer --repo /path/to/repoObserver default does not mutate; acknowledged host may initialize and mutate. --dry-run --no-init retains the missing-harness preview.One assembled role context or one role execution.
Find repo gaps and starter work.mars scan --repo /path/to/repo --ticketsMaybe; auto-inits if missing and can write tickets.Findings and optional backlog tickets.
Check health without broad mutation.mars doctor --repo /path/to/repo --jsonNo expected target writes.Machine, model, database, harness, plan, and config diagnostics.
Check tool and harness drift.mars update check --repo /path/to/repo --jsonNo.Installed tool, target metadata, and operating-model drift report.
Fill missing defaults after an upgrade.mars upgrade --repo /path/to/repoYes, missing defaults only.Restored default files without overwriting user-owned harness state.
Remove MARS from a target.mars eject --repo /path/to/repoDry-run by default.Removal plan; apply requires --apply --confirm <repo-name>.

Before You Touch A Repo

  1. Confirm it is the target project

    The target project is the application, service, library, or docs repo MARS should manage. Do not point ordinary target agents at the MARS source repo.

  2. Confirm git state

    git -C /path/to/repo status --short --branch

    The repo is the system of record. Generated harness files, tickets, docs, release state, and later agent commits are meant to be reviewed through git.

  3. Pick the inspection level

    Use mars init when you want generated files. Use mars run <role> --dry-run --no-init when you need an observer-safe preview against an uninitialized repo.

  4. Keep runtime artifacts out of the target repo

    Per-repo databases default to ~/.mars/db/{repo}/mars.db. Command logs and traces default under ~/.mars/traces/. Do not put runtime SQLite databases or trace logs inside the target worktree.

Initialize

mars init is the deliberate way to scaffold the deployed harness before running agents. It requires a git checkout and writes repo-owned files users should inspect and commit.

mars init --repo /path/to/repo
git -C /path/to/repo status --short
git -C /path/to/repo diff --stat
Init outputUser meaningWhere to read more
.harness/manifest.yamlExecutable role, tool, routing, trust, schedule, guardrail, and knowledge contract.Bundle reference
.harness/roles/Editable role prompts generated as starter defaults.Roles guide
.harness/guardrails/Safety policy attached to roles.Guardrails reference
.harness/knowledge/Context routes from recurring situations to durable docs.DocSync guide
.harness/skills/Reusable workflow instructions. Skills guide behavior but do not grant tools.Tools and MCP guide
AGENTS.mdFirst file agents and humans read in the target.Harness guide
docs/goals/, docs/features/, docs/tickets/, docs/exec-plans/Operating-model artifacts that turn intent into planned, verifiable work.Planning guide
VERSION, CHANGELOG.mdTarget semantic version and generated patch notes.Release guide
.gitignoreHost metadata and local secret files such as .harness/.env.local stay out of git.Files reference
Model routing during init: use --model-routing local, cloud, or defer. Non-interactive runs should add --yes --json so missing required inputs fail with machine-readable remediation.

Automatic Scaffolding

register and scan use the same scaffold path as mars init when the manifest is missing. run and start use it only in acknowledged-host mode; observer rejects a missing target before writes apart from the explicit no-init dry-run preview.

Auto-init writes files

A missing manifest causes register, scan, or acknowledged-host run/start to create the deployed harness before continuing.

Git checkout required

MARS needs git because generated files, later changes, tickets, and release state are reviewed through the repository.

Baseline commit when possible

Auto-initializing commands commit the generated harness baseline when the surrounding git state allows it.

Observer-safe preview

Use mars run engineer --repo /path/to/repo --dry-run --no-init to inspect without scaffolding.

Register

mars register records a local repo so the orchestrator can manage it. The default database is isolated per target at ~/.mars/db/{repo}/mars.db.

mars register --repo /path/to/repo --remote owner/repo --branch main
mars register --repo /path/to/repo --db /private/tmp/mars-demo.db
FlagUser behavior
--repoTarget repository path. Defaults to the current directory.
--remoteOptional GitHub owner/repo label used by orchestration and integrations.
--branchDefault branch name. Defaults to main.
--dbSQLite database path. Must be outside the target repo so runtime state does not dirty the worktree.

Start

Acknowledged-host mars start is the scoped one-repo autonomous loop. It initializes when needed, registers the repo, reconciles resumable lifecycle state, starts the dashboard and workers, and executes the delivery operating model.

mars start --repo /path/to/repo --execution-profile host --acknowledge-host-execution
mars start --repo /path/to/repo --concurrency 1 --execution-profile host --acknowledge-host-execution
mars start --repo /path/to/repo --debug --log-file /private/tmp/mars-start.log --execution-profile host --acknowledge-host-execution

All five agent entry points default to observer, which independently caps trust and blocks every target mutator. Host has the current OS user's full authority and is not containment; isolated is unavailable.

ConceptUser behavior
Bootstrap orderExec plan first, feature contracts second, tickets third, delivery fourth.
Lifecycle reconciliationExisting resumable state is preferred. Use --new-lifecycle only when intentionally reseeding CEO work.
Concurrency--concurrency 1 runs sequentially. Higher values allow multiple workers.
Dashboard ports--addr controls webhook/control listen address. --dashboard-addr controls the dashboard listen address.
LogsVerbose command logs default to ~/.mars/traces/logs/. --debug streams inline output.
Model endpoint--model-endpoint can point at a live OpenAI-compatible endpoint and skip local llama-server startup.

Open the Operations Guide for dashboard controls, pause/resume, restart, scan, stop, queue, and database recovery behavior.

Run One Role

mars run loads the target bundle and executes one role. Use it for deliberate single-role work, dry-run inspection, and debugging role context.

Preview role context

mars run engineer --repo /path/to/repo --dry-run

Prints the assembled system prompt and exits before calling the model.

Inspect an uninitialized repo without writes

mars run engineer --repo /path/to/repo --dry-run --no-init

Useful for observer-safe review before deciding whether to scaffold MARS into the target.

Bound one execution

mars run engineer --repo /path/to/repo --max-turns 20 --budget 120000 --execution-profile host --acknowledge-host-execution

Use turn and token budgets to constrain local experiments or risky roles.

Scan

mars scan walks the repo for starter gaps such as TODOs, missing tests, missing CI, and large functions. With --tickets, it writes deduplicated backlog tickets under docs/tickets/backlog/.

mars scan --repo /path/to/repo
mars scan --repo /path/to/repo --tickets
Scan is target-owned evidence: findings should become tickets only when they represent work the target repo actually owns. Foundation-owned runtime failures belong in MARS source evidence, not the target backlog.

Health And Drift

Use health and drift commands before asking an agent to fix something mysterious. They separate machine setup, local runtime, target harness, update, active-plan, and integration problems.

Machine and target health

mars doctor --repo /path/to/repo
mars doctor --repo /path/to/repo --json

Checks config, models, database, private-release auth readiness, harness health, active-plan hygiene, and optional integration config.

Tool and harness drift

mars update check --repo /path/to/repo --json
mars update check --repo /path/to/repo --skip-remote

Reports installed tool status, deployed harness metadata status, and operating-model drift without mutating target files.

Runtime evidence

mars scores --repo /path/to/repo
mars scores export --repo /path/to/repo

Reads stored outcomes and can refresh the repo-visible quality score from local evidence.

Upgrade

mars upgrade fills missing target harness defaults after the installed tool changes. It preserves user-owned files such as manifest, role prompts, knowledge routes, guardrails, tickets, exec plans, design docs, references, and target AGENTS.md.

mars upgrade --repo /path/to/repo
mars update harness --repo /path/to/repo
NeedCommandPreservation rule
Fill missing generated defaults.mars upgrade --repo /path/to/repoExisting user-owned files are preserved.
Use update verb for target harness drift.mars update harness --repo /path/to/repoRefreshes the deployed bundle without overwriting user agents.
Adopt changed starter wording.Initialize a temporary repo with the new binary and compare.Copy only the prompt or doc changes you deliberately want.

Eject

mars eject is the repo-level kill switch. It is a dry run by default. Destructive removal requires both --apply and --confirm <repo-name>.

mars eject --repo /path/to/repo
mars eject --repo /path/to/repo --apply --confirm repo
mars eject --repo /path/to/repo --apply --confirm repo --keep-db
Eject behaviorUser meaning
Dry run by default.Review the exact file and database plan before deletion.
Removes repo harness artifacts.Includes .harness/, generated planning docs, tickets, feature contracts, AGENTS.md, VERSION, and CHANGELOG.md.
Deletes associated per-repo database unless kept.Use --keep-db when preserving queue, telemetry, score, and trace-related runtime history matters.
Does not rewrite git history.Removal is visible as normal working-tree changes that users can review, commit, or discard.
Legacy shared DB deletion is guarded.--delete-shared-db is required before the legacy shared database can be deleted.

State Map

StateDefault locationLifecycle owner
Target harness files/path/to/repo/.harness/Target repo owner after init.
Target operating docs/path/to/repo/AGENTS.md, docs/, VERSION, CHANGELOG.mdTarget repo owner and agents.
Per-repo database~/.mars/db/{repo}/mars.dbLocal runtime; created by register/start paths.
Shared serve database~/.mars-harness/db/mars.dbMulti-repo orchestrator runtime.
Logs and traces~/.mars/traces/Local operator evidence; copy into repo docs only deliberately.
Secret valuesEnvironment variables or ignored .harness/.env.localOperator; never commit.
Model routing policy.harness/model-overrides.yamlCommit when policy should travel with the repo.
Integration profile.harness/integrations.yamlOptional; commit only when it contains no tenant-secret values.

Recipes

Create, review, and commit a new target harness

mars init --repo /path/to/repo
git -C /path/to/repo status --short
git -C /path/to/repo diff -- .harness AGENTS.md docs VERSION CHANGELOG.md
git -C /path/to/repo add .harness AGENTS.md docs VERSION CHANGELOG.md .gitignore
git -C /path/to/repo commit -m "chore: initialize mars harness"

Preview context before first mutation

mars run engineer --repo /path/to/repo --dry-run
mars run engineer --repo /path/to/uninitialized-repo --dry-run --no-init

Run a scoped loop with explicit local state

mars start --repo /path/to/repo --db ~/.mars/db/my-repo/mars.db --concurrency 1 --execution-profile host --acknowledge-host-execution

Recover from suspected drift

mars doctor --repo /path/to/repo --json
mars update check --repo /path/to/repo --json
mars upgrade --repo /path/to/repo

Remove MARS after review

mars eject --repo /path/to/repo
mars eject --repo /path/to/repo --apply --confirm repo

Troubleshooting

SymptomLikely causeNext action
missing .harness/ directoryThe target has not been initialized.Run mars init --repo /path/to/repo, or use mars run ... --dry-run --no-init for no-write inspection.
missing manifest.yamlThe harness is incomplete or was partially removed.Run mars upgrade --repo /path/to/repo or re-run mars init after reviewing git state.
Register writes unexpected files.Auto-init scaffolded a missing harness before registration.Review generated files with git and commit or remove them deliberately.
--db path ... is inside target repoRuntime state would dirty the project worktree.Use the default ~/.mars/db/{repo}/mars.db path or another writable path outside the repo.
Start reseeds work you expected to resume.--new-lifecycle was used or resumable state was unavailable.Check command logs, database path, and active plan before starting again.
Upgrade did not change a role prompt.Existing prompts are user-owned and preserved.Compare against a fresh temporary init and copy desired wording manually.
Eject refused to delete.Apply confirmation was missing or mismatched.Re-run the dry run, then pass --apply --confirm <repo-directory-name> only when the plan is correct.
Tool or harness version looks stale.Installed binary or target metadata is behind.Run mars update check --repo /path/to/repo --json and follow the recommended update path.