Governed autonomy

Keep agent work bounded, auditable, and evidence-backed.

MARS does not treat autonomy as a single on/off switch. Users govern agents through guardrails, role tool allowlists, trust levels, blast-radius checks, secret scanning, scoring, telemetry, and repo-visible quality artifacts. This guide explains what each surface does and how operators use it safely.

Governance route: this page explains trust and quality controls. For control-boundary evaluation, start with security and governance; for canonical operating records, use documentation map.

Guardrails

Guardrails are runtime rules that constrain agent output and repo mutation. They live in the target harness, are attached through the manifest, and can be hard-blocking or advisory. For the full YAML schema, matching behavior, secret-scan details, hook behavior, stale-rule rules, and troubleshooting, open the Guardrails Reference.

SurfaceWhere users configure itBehavior
Rule files.harness/guardrails/*.yamlYAML rules with IDs, messages, severity, scope, patterns, and stale-rule policy.
Role attachment.harness/manifest.yamlEach role names the guardrail files that apply to its run.
Hard guardrailsseverity: hardBlock an operation until the violation is repaired or an explicit override path exists.
Advisory guardrailsseverity: advisoryInject guidance into role context without blocking a tool call.
Built-in policyMARS tool executor and runtimeBlocks unsafe shell, ticket, file, dependency, validation, deletion, and release operations before mutation.
Fail closed: invalid guardrail files should stop a job with an actionable parse error instead of letting an agent run under unknown policy.

Rule Authoring

Start with narrow, explainable rules. A useful guardrail tells the agent exactly what was blocked and what a safe next action looks like. The Guardrails Reference documents exact field defaults and matching semantics.

Attach a rule file to a role

roles:
  engineer:
    guardrails:
      - guardrails/safety.yaml
      - guardrails/conventions.yaml

Block a content pattern

rules:
  - id: no-hardcoded-secrets
    name: No hardcoded secrets
    severity: hard
    scope: global
    pattern: '(?i)(password|secret|api_key|token)'
    message: Use environment variables or local secret storage.

Give role-scoped guidance

rules:
  - id: require-tests
    name: New code needs tests
    severity: advisory
    scope: engineer
    message: Add or update tests before asking for review.
  • Prefer role-scoped rules when only one role needs the policy.
  • Use file_pattern to keep broad regex checks from firing on unrelated files.
  • Set realistic stale_days values and review stale rules during doctor.
  • Keep secret values, credentials, and private customer data out of rule files.

Secret Scanning

Secret scanning is available as an operator command and as an optional git hook. Findings are redacted and should be treated as blockers until the secret is removed and rotated if necessary. The Authentication And Credentials Reference explains where credential values should live.

Scan a repo

mars guardrails secret-scan --repo ~/my-project
mars guardrails secret-scan --repo ~/my-project --json

Scan staged files

mars guardrails secret-scan --repo ~/my-project --staged

Install the optional hook

mars guardrails install-hooks --repo ~/my-project
git commit

The managed pre-commit hook runs mars guardrails secret-scan --staged.

Blast Radius And Workspace Hygiene

MARS keeps agent changes small enough to inspect. Built-in policies classify generated output, dependency churn, ticket lifecycle moves, source writes, validation artifacts, and destructive commands before they can turn into confusing repo state.

Generated output

Dependency folders, build output, root validation scripts, and dirty generated trees are blocked or routed through explicit cleanup guidance.

Ticket lifecycle moves

Moving the same ticket ID between lifecycle directories is allowed as a bounded deletion exception; unpaired deletions remain blocked.

Source writes need docs

Audited source roots require valid top-of-file MarsDocSync metadata so code and docs stay connected.

Validation binaries stay outside repos

Use external temp outputs such as /tmp/project-validation instead of writing build artifacts into a target checkout.

Trust Levels

Trust controls what roles and external clients may do. Manual overrides are allowed, but they require a reason so the audit trail explains why capability changed. Execution profile is an independent outer ceiling: mutation also requires acknowledged host execution, and target trust cannot grant it.

LevelMeaningUser guidance
observerRead-only or inspection-oriented access.Default for external MCP clients and early target evaluation.
contributorCan perform governed mutation through allowed tools only inside acknowledged-host execution.Use for trusted roles or clients doing bounded repo work; trust alone does not grant host authority.
autonomousHigher-trust autonomy earned through evidence and policy.Reserve for roles with proven outcomes and explicit operating rules.

Inspect trust state

mars trust --repo ~/my-project
mars trust --repo ~/my-project --db ~/.mars/db/my-project/mars.db

Set a trust override

mars trust set engineer ~/my-project contributor \
  --reason "Human approved bounded ticket delivery"

The reason is required and should say what evidence or approval justified the change.

Scores

Scores turn job outcomes into role health signals. They are not vanity numbers; they help operators understand whether roles are delivering real value, stalling, hitting guardrails, or needing self-improvement work.

SignalExamplesUser outcome
Terminal outcomesSuccess, partial, failure, timeout, no-op, revert, human follow-up.Feeds rolling score and trust decisions.
Validation evidenceTests, builds, runtime probes, check results, ticket evidence.Shows whether work actually shipped behavior.
Guardrail outcomesPolicy blocks, secret findings, unsafe shell, dirty workspace.Identifies safety friction or real unsafe behavior.
Factory paceTurns, tool calls, LLM calls, wall time, limit stops.Finds roles that are slow, looping, or under-instrumented.
mars scores --repo ~/my-project
mars scores --repo ~/my-project --db ~/.mars/db/my-project/mars.db

Quality Score Export

docs/QUALITY_SCORE.md is the repo-visible quality artifact. It summarizes score evidence, telemetry, ticket state, dogfood findings, guardrails, check outcomes, no-op signals, human follow-up, convergence failures, and factory pace while preserving manual notes.

Refresh the artifact

mars scores export --repo ~/my-project
mars scores export --repo ~/my-project --window-days 30

Create intervention-debt tickets deliberately

mars scores export \
  --repo ~/my-project \
  --create-intervention-debt

Ticket creation is opt-in unless the signal is clearly target-owned.

Use explicit DB evidence

mars scores export \
  --repo ~/my-project \
  --db ~/.mars/db/my-project/mars.db

Record a check first

mars checks run --repo ~/my-project --name go-test -- go test ./...
mars scores export --repo ~/my-project --window-days 30

Use this when a test, build, lint, smoke, or release command should count in the quality record.

Open the local checks guide

Opt-In Aggregate Telemetry

Telemetry is local-first and off by default. When enabled, MARS can preview, enqueue, send, collect, and triage sanitized aggregate reports. Raw target details stay local under the current allowlist; foundation triage works from repeated minimized patterns. The configured anonymous mode does not make the network transport anonymous: the collector and network path can observe ordinary transport metadata.

CommandPurposeNetwork behavior
mars telemetry statusShows reporting mode, collector endpoint, DB path, and outbox counts.No report sent.
mars telemetry previewPrints the exact allowlisted aggregate payload for review.No report sent.
mars telemetry export --anonymousEnqueues a sanitized report in the local outbox.No collector call by itself.
mars telemetry sendSends pending reports only when reporting is configured as anonymous.Calls configured collector.
mars telemetry collectRuns a SQLite-backed collector.Defaults to 127.0.0.1:9092 and rejects every non-loopback or DNS address before opening the collector database. Remote collection is unavailable.
mars telemetry triage-foundationCreates MARS source tickets from repeated minimized collector patterns.Reads collector DB only.
mars telemetry send requires telemetry.reporting: anonymous and telemetry.endpoint. Environment overrides are MARS_TELEMETRY_REPORTING, MARS_TELEMETRY_ENDPOINT, MARS_TELEMETRY_TOKEN, and MARS_TELEMETRY_INTERVAL.
A local foundation collector writes SQLite data to ~/.mars/db/foundation-telemetry/intake.db unless you pass --db. Use the same explicit path for mars telemetry collect and mars telemetry triage-foundation when turning repeated minimized aggregate patterns into source work.

Operator Recipes

Run a pre-commit safety check

mars guardrails secret-scan --repo ~/my-project --staged
mars docsync audit --repo ~/my-project
mars scores export --repo ~/my-project

Investigate a role that keeps stalling

mars scores --repo ~/my-project
mars scores export --repo ~/my-project --window-days 14
mars telemetry preview --repo ~/my-project

Prepare a read-only external client

mars mcp serve \
  --repo ~/my-project \
  --trust observer \
  --allowlist file_read,file_search,grep,git_status

Troubleshooting

SymptomLikely causeUser action
A hard guardrail blocks a role.The attempted operation matched a blocking rule or built-in safety policy.Read the message, repair the specific issue, or record a deliberate override path if your policy allows it.
Secret scan reports a finding.A staged or repo file looks like a credential.Remove the value, rotate the secret if it was real, and rerun the scan.
scores says no scores are recorded.The selected DB has no scoring evidence yet or the wrong DB was selected.Use mars start --repo to generate per-repo evidence or pass the expected --db.
Quality export says evidence is insufficient.There are not enough score, trace, ticket, or validation inputs for a claim.Run real roles, tests, and validation; do not treat sparse data as healthy state.
Telemetry send does nothing.Aggregate telemetry reporting is off or no collector endpoint is configured.Use mars telemetry status and configure reporting intentionally before sending.