Skip to content

About

Canonical machine-native development environment for assembling work intent, repository state, services, capabilities, triggers, memory, and execution context into a coherent agent entry point.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

mncs-environment

Project entry

mncs-environment owns session composition, authority projection, and campaign lifecycle orchestration.

./scripts/mncs-env enter --consumer my-agent

Declared capabilities (declarations do not establish execution health):

  • ambient-projection-coherence/2 — session-bound semantic projection lifecycle and interpretation; read/write effects require Environment authority (experimental)
  • campaign-state-inspection/2 — read the complete durable campaign evidence and delivery ledger for the authorized session with a bounded 128 KiB capture budget (experimental)
  • workspace-discovery/1 — read-only-workspace-discovery (experimental)
  • workspace-readiness/1 — read-only-workspace-readiness (experimental)

Semantic sources and ownership: .mncs/projections.json.

Canonical machine-native development environment for assembling work intent, repository state, services, capabilities, triggers, memory, authority, provenance, and execution context into a coherent entry point for agents and other MNCS consumers.

Temporary experiment outputs can use mncs-env scratch <session> --allocate <label>. Environment records the private workspace and cleans it on completion or failure; checkpoint and handoff retain it. The context exposes actions.scratch, and scratch <session> --clean retries deferred cleanup. See disposable workspace lifecycle.

Enter from this checkout (or a subdirectory):

./scripts/mncs-env enter --consumer my-agent

Entry discovers .mncs/environment.json, inspects its bounded selection of MNCS providers, creates or reuses durable work, reconciles declared services, and returns JSON context with identity, projects, toolchain, readiness, and callable actions. Repeat the same command to continue. No PATH installation or setup environment variables are required in the standard sibling layout. See the entry contract for selection, recovery, and provider readiness declarations. To require resident Forge, use ./scripts/mncs-env enter --consumer my-agent --definition samples/forge-resident.environment.json. The selected Forge must publish its resident descriptors. Provider effects still require the session's applicable rights and fresh scope eligibility; isolated selected non-main linked worktree effects do not require a persistent claim, while shared main and whole-tree Doctor remediation remain claim-gated. Retirement requires writable rights and an exact branch, registered-worktree, or metadata-prune operation; its adapter checks reachability, checkout state, and applicable live claim conflicts. Environment-mediated provider writes to one checkout are serialized by a kernel-scoped lock for the invocation and exposed with release evidence; separate worktrees can progress independently.

First contact

MNCS is a family of services; Environment composes their project-scoped working context, authority and durable sessions. In an authenticated Control/MCP client, use mncs_environment with your project and operation: continuation to find existing work, or operation: enter for a new Work Intent. Control supplies the consumer identity. Read configuration, workspace_root, work_intent, writable_repositories, readiness and continuation before acting. A session ID or available executable does not grant effect permission.

Standalone CLI entry uses the closest .mncs/environment.json. Protected Control entry prefers the owner-controlled .mncs/project-environment.json when present; these can intentionally select different providers and intent. To inspect the same project definition locally, with your own standalone session:

./scripts/mncs-env enter --definition .mncs/project-environment.json --consumer my-agent

The returned actions work from another directory. Start with the bounded capability_summary action; follow its pages and retrieve one binding's full detail by identity. workspace retrieves the full checkout inventory using lossless references; selected writable work and selected providers appear first in the automatic project list. claims exposes coordination detail and health probes live readiness. Context/status are recorded observations. The existing inspect action remains the full historical inspection.

Through MCP, use capabilities with summary: true, then capability: ID for one complete binding; preflight: ID explains effect and claim requirements. Use inspect with section: workspace and compact: true for checkout detail. No arbitrary CLI arguments or principal/claim bypass is added. See entry and detail selection for supported navigation.

Atlas owns ecosystem orientation and relationships; Language Service owns live semantic observations; Forge owns retained execution; Environment composes the selected session. Their related context surfaces serve distinct responsibilities. Use a bound provider capability or its owning documentation for deeper questions.

Why this exists

MNCS increasingly has the machinery needed to compile, plan, admit, execute, observe, verify, diagnose, automate, persist, and reason about work. What has been missing is the coherent boundary through which a consumer enters that machinery.

mncs-environment owns that boundary.

An agent should not need a giant prompt explaining which repositories exist, what is running, what state the workspace is in, which services are authoritative, what it may modify, what work is already active, or how to receive events. It should enter an environment and receive a machine-readable working world.

The long-term interaction should be conceptually simple:

enter environment
  -> receive environment/session context
  -> submit or inherit work intent
  -> use bound MNCS capabilities
  -> observe events and triggers
  -> checkpoint, hand off, or complete

Architectural role

Environment composes MNCS. It does not absorb or reimplement the services it exposes.

consumer
   |
   v
+-----------------------+
|   mncs-environment    |
|-----------------------|
| Environment           |
| EnvironmentSession    |
| WorkIntent            |
| WorkspaceView         |
| CapabilityBindings    |
| AuthorityContext      |
| EventSubscriptions    |
| Checkpoint / Handoff  |
+-----------+-----------+
            |
            v
  existing MNCS services

Expected consumers include:

  • coding agents such as Codex or Claude,
  • future MNCS-native models and model stacks,
  • specialized workers and automation,
  • CI and deterministic controllers,
  • human-facing dashboards,
  • other MNCS services.

The contract must remain consumer-agnostic. No model vendor, chat protocol, IDE, or human UI owns the environment model.

What this repository owns

  • Resolving an environment from declarative intent and available system state.
  • Constructing a coherent EnvironmentSession for a consumer.
  • Presenting relevant workspace and repository state.
  • Binding discoverable MNCS capabilities into a session without duplicating their implementation.
  • Carrying authority and constraints into the session.
  • Connecting session work to events, triggers, checkpoints, provenance, and handoff.
  • Giving consumers stable machine-native handles to the surrounding MNCS system.
  • Defining the entry and continuation contract for long-running work.

What this repository does not own

  • Language or compiler semantics.
  • Planning semantics that belong to RAVEL.
  • Execution/orchestration semantics that belong to Control, Actions, Automation, Forge, or other execution services.
  • Persistent-memory semantics that belong to the appropriate memory/store service.
  • Rights or provenance policy that belongs to rights/provenance services.
  • Debugging or health policy owned by Debug/Doctor.
  • Atlas's ecosystem knowledge model or human dashboard presentation.
  • Agent-specific prompting, model internals, or an IDE.

Environment may expose all of the above. It must not become their second implementation.

Core concepts

Environment

A resolved description of the working world: relevant workspace, state, services, capabilities, authority, event sources, and durable references required to begin work coherently.

EnvironmentSession

A persistent, scoped interaction between a consumer and an Environment. A session records identity, bound capabilities, active intent, observations, produced artifacts, decisions, events, checkpoints, and handoff state.

WorkIntent

A machine-readable declaration of desired outcomes, constraints, priorities, acceptance conditions, and protected scope. It is richer than a TODO list but does not itself become the planner or executor.

CapabilityBinding

A stable binding from a session to a capability provided by another MNCS service. Bindings identify what is available, how it is addressed, what authority is required, and how results/events relate back to the session.

AuthorityContext

The explicit limits under which the session operates: readable and writable resources, executable capabilities, protected work, actions that always require escalation, actions that require a current scoped claim, and provenance expectations. merge and publish require writable repository rights and an exact observed or explicit operation scope; they do not require a persistent claim. A repository target resolves through the selected checkout, a unique matching workspace root, or—when neither is projected—the registered checkout containing the session's .mncs definition. Each destination is freshly inspected; explicit scopes retain their named branch constraint. Overlapping claims remain coordination evidence, while Git enforces its native concurrent reference update checks. Claims still protect ordinary shared-worktree mutation; exact retirement is admitted by writable rights and checked by the retirement adapter. delete remains escalation-gated. An isolated campaign may select a different registered checkout only when it is anchored to the selected checkout's same Git common directory and repository identity.

Event / Trigger

A typed observation that can update or resume a session: verification completed, repository changed, pressure discovered, dependency satisfied, work became admissible, execution failed, and similar state transitions.

Checkpoint / Handoff

A durable continuation boundary. Another compatible consumer should be able to resume from a checkpoint without reconstructing the world from prose or rediscovering completed work.

Design principles

  1. One evolving canonical design. Do not create artificial parallel v1, v2, legacy, or compatibility implementations while MNCS remains free to evolve its consumers together.
  2. Composition over duplication. Environment binds services; it does not clone their semantics.
  3. Machine-native first. Human-readable output is useful, but contracts must be structured, addressable, and deterministic where possible.
  4. Persistent work, replaceable consumers. Sessions outlive any one model invocation or process.
  5. Explicit authority. A consumer must know what it may do before doing it.
  6. Event-aware operation. Services are not only tools to call; they may produce events that change what work is possible.
  7. Minimal prompt dependence. System state belongs in system state, not repeatedly reconstructed in natural-language prompts.
  8. Provenance by construction. Decisions, artifacts, capability calls, and handoffs should be attributable and traceable.
  9. No hidden god-service. Environment is the composition boundary, not the owner of every policy in MNCS.

Repository layout

.
├── AGENTS.md
├── README.md
├── docs/
├── examples/
│   ├── work-intent.md
│   ├── development-environment/environment.json
│   └── compiler-campaign/environment.json
├── mncs_env/            # canonical implementation (stdlib-only Python)
├── pressures/registry.json
├── rfcs/
├── scripts/mncs-env     # consumer entry point
├── scripts/vertical_proof.py
└── tests/

Implementation status

Sessions are Store-backed persistent objects: structured snapshots plus an append-only event log, so a different process or consumer resumes from state, not prose. The hardening campaign added:

  • versioned workspace claims replacing advisory leases (mncs_env/claims.py);
  • bounded claims --repository pages distinguish an unexpired lease from owner freshness and recovery eligibility; a stale recoverable scope points to retrying the exact acquisition, while live and unresolved scopes remain protected (mncs_env/cli.py). The freshness summary is timestamped and observational; normal scoped acquisition still revalidates and the summary neither mutates a claim nor asserts that an arbitrary host process stopped.
  • ownership/acquisition authority with tri-state enforcement (mncs_env/authority.py);
  • verified local branch/worktree retirement gated by writable rights and exact-target adapter checks; general delete authority remains separate;
  • rights/provenance gate over mncs-rights-provenance (mncs_env/rights.py);
  • bounded first-use Rights & Provenance context from an explicit Environment binding, with digest-based revalidation and rights.context.changed events;
  • provider-declared invocation addressing with toolchain env (mncs_env/capabilities.py);
  • generation-based Store-feed observer: own writes re-baseline, external advances become events (Session.observe_store);
  • read-only inspect plus a control-mcp tool surface (env_enter, env_inspect, env_resume, env_claim_acquire, env_claim_release, env_claims, env_status).
  • ambient Doctor remediation: validated health epochs skip redundant revalidation, entries share one Store handle, contended entries wait boundedly, and terse repaired/reconciled/degraded/blockers summaries replace repeated diagnostics (mncs_env/doctor.py, docs/DOCTOR.md).
  • ambient projection coherence: epoch-gated evaluation of declared projections, native automation proceed/defer/escalate plans, provider-owned rendering, claim-scoped whole-file application, and terse current/pending/reconciled/blockers summaries with session evidence (mncs_env/projections.py, docs/PROJECTIONS.md).
  • ambient verification coherence: epoch-gated evaluation of declared verification obligations, native reuse/selection policy, bounded suite execution through the test provider, identity-bound evidence, and terse current/executed/failed/blockers summaries with session evidence (mncs_env/verification.py, docs/VERIFICATION.md).
  • ambient diagnostic coherence: reactive explanation of structured verification FAILs, native reuse/depth/escalation policy, bounded witness capture through the debugger under the verify effect, and a diagnostic block that exists only when there is something to explain (mncs_env/diagnostics.py, docs/DIAGNOSTICS.md).
  • ambient semantic coherence: resident Language Service lifecycle through provider-owned contracts, durable per-workspace cursors, bounded poll/capsule deltas, and a semantic block that exists only for declared workspaces (mncs_env/semantics.py, docs/AMBIENT_SEMANTICS.md).
  • tooling ambience inventory: which subsystems are explicit, discoverable, reactive, continuous, or adaptive, and the campaign order for Language Service, Actions, Memory, and RAVEL (docs/AMBIENCE.md).
  • authority denials and claim-free integration preflights retain campaign and WorkIntent identities, allowing projections to relate coordination pressure to the objective it affected without copying its prose; campaign reconciliation records bounded before/after repository-ref observations and the environmental-capability projection links a later observation to an exact prior preflight without asserting causation.

Moving to the next repository

A campaign groups independently scoped Work Intents. To start work in another permitted repository, enter that project's owner-controlled Environment with the same campaign identity. Entry resolves a new session and its own rights; it does not copy the previous session's writable set. Same-owner contexts in distinct repositories may coexist in the same workspace after a checkpoint or claim release. Exact-context resume, foreign-owner fencing, rights checks and checkout conflict checks still apply. Completion releases operational claims; it does not revoke the principal's ability to enter another permitted project.

scope-grant expands or rebinds the current session. Its exact-owner-approval requirement for a new repository is separate from establishing an independent Work Intent through project entry.

A Control-verified checkout binding in an already writable repository also retargets that repository's providers. Its selection survives claim release; provider invocation refreshes stale selection before execution. Operation rights and live conflicts are still checked for each invocation.

Entering an environment

The checked-in development definition selects Environment, Language, Compiler, Test, Store, Forge, Automation, Doc, Debug, and the read-only System Monitor resource-sample capability from the sibling workspace without inspecting unselected repositories. Only Environment is in its writable intent; provider mutations still pass through action authority, while shared-worktree edits use scoped claims and merge/publish use exact operation scope plus Git's native concurrency checks. Availability and readiness are observations, not permission to modify a checkout.

For the focused environmental capability campaign, use .mncs/environment-observation.json. It selects Environment, Test, and the read-only Language, Compiler, Stdlib, and VM repositories referenced by Test's verification provider, alongside Store, Rights/Provenance, Automation, Commons, and the read-only System Monitor sample capability. These repositories are in workspace discovery scope; Environment remains the only repository in writable intent. The definition binds the Environment checkout containing it and starts no background services. Readiness can be checked separately when needed:

./scripts/mncs-env enter \
  --definition .mncs/environment-observation.json \
  --consumer my-agent --new-session
./scripts/mncs-env enter --consumer my-agent
./scripts/mncs-env status <session>       # historical, read-only context
./scripts/mncs-env health <session>       # live read-only probes
./scripts/mncs-env resources              # caller ancestry FD limits/counts, RSS, watchers
./scripts/mncs-env resources --pid 12345  # explicit PID observation; no Store open
./scripts/mncs-env reconcile <session>    # refresh, recover, verify, observe campaign refs
./scripts/mncs-env projections <session>  # ambient projection coherence
./scripts/mncs-env capabilities <session>
./scripts/mncs-env invoke <session> <capability> -- <args...>
./scripts/mncs-env checkpoint <session> --progress "..." --remaining ...
./scripts/mncs-env resume <session> --revalidate
./scripts/mncs-env handoff <session> --to other-consumer --next ...
./scripts/mncs-env complete <session> --outcome "..."
./scripts/mncs-env complete <session> --retry-pending

Completion publishes its request intent before changing lifecycle or releasing claims. It also publishes an idempotent checkpoint and links that checkpoint in the completion record before claim settlement. If publication is interrupted, retry the same RPC request identity or use --retry-pending from the authenticated session owner to recover the checkpoint and reconcile any incomplete claim releases.

Use the returned actions.*.argv directly when changing directories or using an isolated state root: each action preserves the executable, state directory, and persistence backend. inspect exposes detailed state; status and context are compact snapshots. Lifecycle active does not assert readiness. Optional provider gaps yield degraded readiness; required gaps yield blocked readiness and exit status 5 while preserving the session for recovery.

Outside a declared project, entry establishes a read-only orientation session for the nearest Git checkout or explicit --workspace. It never infers a family root from sibling directories. Explicit definitions remain supported:

./scripts/mncs-env --state-dir "$MNCS_ENV_STATE" enter \
    --definition examples/compiler-campaign/environment.json \
    --workspace "$MNCS_CAMPAIGN_ROOT" --consumer my-agent

Compiler campaigns deliberately require an isolated root and provider-owned worktree selection. A broad root without an explicit bounded repository selection is rejected before Git discovery or provider invocation.

Run the real-provider persistence/handoff proof with python3 scripts/vertical_proof.py. It creates temporary scoped clones of Atlas and Language by default; MNCS_VERTICAL_WORKSPACE can select an existing isolated proof workspace. Run regressions with python3 -m pytest tests/ -q. The campaign proofs are python3 scripts/campaign_proofs.py.

Initial entry contract

A useful environment entry should eventually be able to answer, structurally rather than conversationally:

  • Where am I?
  • What am I here to accomplish?
  • What state already exists?
  • Which repositories/resources are relevant?
  • Which work is protected or already active?
  • Which capabilities are available and how do I address them?
  • What authority do I have?
  • Which events can affect this work?
  • What counts as completion?
  • What must be persisted so another consumer can continue?

See ARCHITECTURE.md, MODEL.md, and RFC 0001 for the initial contract.

Status

Implemented and proven: the vertical proof resolves a real workspace, invokes a real provider capability, enforces protected scope, checkpoints, resumes in a new process, hands off across consumer identities, and completes; the campaign proofs (python3 scripts/campaign_proofs.py) cover two-agent conflicts, bypass fail-closed behavior, restart missed-event recovery, live language-service deltas, health, idle/resource bounds, brief/ack context, session reuse, and memory protection. Sessions persist on the canonical Store backend and a background reconciler maintains them with durable cursors. Remaining work is broader bindings, provider push events, Memory integration, and deeper compiler/Forge artifact propagation as owning repositories publish the needed contracts (see pressures).

Licensed under Apache-2.0.

Non-ambient bound requests now retain bounded decision-time evidence and exact operation references. Inspect them with mncs-env projections SESSION --interpret session-activity --activity-section demand. Availability, delivered responses, verified outcomes and useful work remain separate. See the observation contract and measured evidence.

About

Canonical machine-native development environment for assembling work intent, repository state, services, capabilities, triggers, memory, and execution context into a coherent agent entry point.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages