Skip to main content

Module coder

Module coder 

Source
Expand description

Built-in coding agent (“CAR Coder”).

The user states an intent; the coder turns it into a verifiable outcome contract (shell commands that must pass), gets it confirmed, then works in a throwaway git worktree until every check is green — natively (CAR inference + policy-gated tools) or by delegating to an installed external CLI (Claude Code, Codex, Gemini), with CAR re-running the contract either way. Results are published as a car/coder/<id> branch in the user’s repo; the user’s checkout is never touched.

§Module map

  • contractOutcomeContract derivation (inference, repair loop) and evaluation (runs checks through the policy-gated shell tool)
  • session — session state machine, event stream (CoderEvent), JSON snapshots under ~/.car/coder/
  • shell_toolWorktreeExecutor: file tools + a host shell tool, all rooted/clamped at the worktree and gated by the inspector chain
  • policy — the coder inspector set (no pushes, no privilege escalation, no writes outside the worktree, …)
  • native_loop — the plan→edit→verify→repair loop driving CAR inference
  • router — engine selection between the native loop and external CLIs
  • merge — squash-commit the worktree and deliver it: a local branch, a managed project’s main, or (headless) an append-only push plus one reconciled pull request
  • discuss — repo-grounded, strictly READ-ONLY conversation that can be distilled into a run intent (coder.discuss.*); it never starts a session
  • fix_issues — files a dogfooding round’s durable-fix proposals as
  • heal_config / heal_intake / heal_select / heal_claims / heal_gate / heal_tick / heal_service — the self-healing loop: read a repository’s open issues and pull requests, pick one, hand it to a coder session, and open a pull request only if the outcome contract AND an independent multi-model panel both pass. Never closes an issue; a human does. See docs/proposals/self-healing-issue-loop.md. issues on the (public) releases tracker: the reporting half of self-correction
  • provenance — trust tiers for tracker text: every issue resolves to runtime / maintainer / public from its author account before its text is readable at all, and a public body can neither seed a session nor source an outcome contract. Live today for deduplication; the session and contract gates are the types the future tracker consumer must use

§Security boundary (read this before extending)

The shell tool executes on the host with the daemon’s privileges and (deliberately) the real toolchain + network. The inspector chain blocks the known-dangerous verbs (git push, sudo, destructive ops outside the worktree, credential reads) plus every route that would publish the work around the merge gate — the forge CLIs (gh, glab, hub) are cut to a read-only allowlist and the registry publish subcommands (npm publish, cargo publish, docker push) are denied — and the executor pins the working directory to the worktree. But this is policy hardening, not a sandbox: a model determined to misbehave can, e.g., pipe curl to sh inside the worktree, or reach gh through a wrapper script. The hard stops are the contract confirmation gate before any work starts and the merge approval gate before anything reaches the user’s repo.

Anything that reads a tracker adds a second boundary: the report target is public, so an issue body is attacker-controlled text. provenance resolves every issue to a trust tier from its author account — never from anything in the body — and its types are the reason a caller cannot read tracker text without one.

Re-exports§

pub use ab::attribute_round;
pub use ab::run_ab_suite;
pub use ab::AbArmRunner;
pub use ab::AbCell;
pub use ab::AbReport;
pub use ab::AbTask;
pub use ab::ArmEngine;
pub use ab::ArmOutcome;
pub use ab::ArmSpec;
pub use ab::PairedStats;
pub use ab::RoundAttribution;
pub use ab_fixer::mutations_from_interventions;
pub use ab_fixer::EvolutionAbFixer;
pub use ab_fixer::HarnessApply;
pub use ab_learnings::render_proposals;
pub use ab_learnings::synthesize_proposals;
pub use ab_learnings::Confidence;
pub use ab_learnings::DurableFixProposal;
pub use ab_learnings::ProposalKind;
pub use ab_loop::run_improvement_loop;
pub use ab_loop::AbFixer;
pub use ab_loop::FixResult;
pub use ab_loop::ImprovementRun;
pub use ab_loop::LoopConfig;
pub use ab_loop::LoopStop;
pub use ab_loop::RoundRecord;
pub use config::config_path;
pub use config::CoderConfig;
pub use config::DEFAULT_MAX_ITERATIONS;
pub use contract::evaluate_contract;
pub use contract::CheckResult;
pub use contract::ContractCheck;
pub use contract::OutcomeContract;
pub use discuss::DiscussEvent;
pub use discuss::DiscussEventKind;
pub use discuss::DiscussionEntry;
pub use discuss::DiscussionMap;
pub use external_loop::run_external_loop;
pub use external_loop::CliInvoker;
pub use external_loop::ExternalLoopConfig;
pub use external_loop::LiveInvoker;
pub use fix_issues::clears_reporting_bar;
pub use fix_issues::parse_signature_marker;
pub use fix_issues::proposal_signature;
pub use fix_issues::render_issue_body;
pub use fix_issues::render_report;
pub use fix_issues::report_proposals;
pub use fix_issues::signature_marker;
pub use fix_issues::GhIssues;
pub use fix_issues::IssueApi;
pub use fix_issues::ReportOutcome;
pub use fix_issues::ReportRecord;
pub use fix_issues::DEFAULT_REPORT_REPO;
pub use merge::commit_to_main;
pub use merge::deliver_pr;
pub use merge::deliver_pr_with;
pub use merge::publish_branch;
pub use merge::publish_branch_headless;
pub use merge::validate_branch_name;
pub use merge::AzureDevOpsCli;
pub use merge::CiCheck;
pub use merge::CiState;
pub use merge::CiSummary;
pub use merge::DeliveryFailure;
pub use merge::ForgeClient;
pub use merge::ForgeError;
pub use merge::ForgeKind;
pub use merge::GhCli;
pub use merge::GhCli;
pub use merge::GhError;
pub use merge::GitHubApi;
pub use merge::PrAction;
pub use merge::PrDelivery;
pub use merge::PrDeliveryOutcome;
pub use merge::PrRecord;
pub use merge::PrState;
pub use merge::FORGE_OVERRIDE_ENV;
pub use native_loop::model_tool_catalog;
pub use native_loop::run_native_loop;
pub use native_loop::LoopFailure;
pub use native_loop::LoopOutcome;
pub use native_loop::NativeLoopConfig;
pub use no_change::baseline_completed;
pub use no_change::evaluate_nomination;
pub use no_change::head_commit;
pub use no_change::worktree_fingerprint;
pub use no_change::worktree_is_pristine;
pub use no_change::MutationLedger;
pub use no_change::NominationContext;
pub use no_change::NominationRefusal;
pub use no_change::NominationVerdict;
pub use no_change::MAX_FINDING_TEXT;
pub use project::list_projects;
pub use project::resolve_or_create_project;
pub use project::slugify;
pub use project::CoderProject;
pub use project::ProjectKind;
pub use project_context::agent_instructions;
pub use project_context::dot_car_knowledge;
pub use project_context::project_context;
pub use project_context::MAX_INSTRUCTIONS_BYTES;
pub use project_context::MAX_KNOWLEDGE_BYTES;
pub use provenance::resolve_tier;
pub use provenance::ContractSource;
pub use provenance::GhPermissions;
pub use provenance::LocalSignatures;
pub use provenance::PermissionOracle;
pub use provenance::ProvenanceRecord;
pub use provenance::ProvenanceRefusal;
pub use provenance::ProvenanceTier;
pub use provenance::RawIssue;
pub use provenance::RepoPermission;
pub use provenance::SessionSeed;
pub use provenance::TieredIssue;
pub use provenance::UntrustedText;
pub use provenance::MAX_TIER_AGE;
pub use router::detect_ready_agents;
pub use router::resolve_engine;
pub use router::DetectedAgent;
pub use router::EngineChoice;
pub use router::ResolvedEngine;
pub use session::adopt_orphaned_sessions;
pub use session::default_state_dir;
pub use session::gc_sessions;
pub use session::needs_you_from;
pub use session::AdoptionOutcome;
pub use session::CancelFlag;
pub use session::CoderEvent;
pub use session::CoderEventKind;
pub use session::CoderSession;
pub use session::CoderState;
pub use session::EventEmitter;
pub use session::EventSink;
pub use session::NeedsYou;
pub use session::SessionRetention;
pub use shell_tool::WorktreeExecutor;
pub use skill_memory::FailureSignature;
pub use skill_memory::RepairMemory;

Modules§

ab
Paired A/B comparator: two arms — each an (ArmSpec) engine on a backbone — over the same task and the same OutcomeContract.
ab_fixer
The live AbFixer: apply the coder A/B’s harness-addressable interventions through the SAME governed path evolution.run uses (car_memgine::harness_evolution), HITL-gated on the shared ApprovalLedger.
ab_learnings
Turn a coder A/B round into ranked, evidence-backed durable code-fix proposals — the “learn what durable fix to make to CAR” step.
ab_loop
The self-improvement loop: A/B → attribute → CAR fix → A/B, until CAR’s coder clears the quality bar or no harness lever remains.
budget
One absolute wall-clock deadline for a whole coder session.
config
Operator config for the coder, loaded from ~/.car/coder.toml.
contract
Outcome contracts — the verifiable definition of “done” for a coder session.
declarative
In-daemon execution of declarative agents, and the coder→agent build loop.
discuss
coder.discuss.* — a repo-grounded, strictly read-only conversation that can be distilled into a run intent.
external_loop
Delegation to an external agentic CLI (Claude Code, Codex, Gemini).
fix_issues
File DurableFixProposals as issues on the releases repo — the reporting half of self-correction.
foreman_loop
Foreman delegation: verified parallel coding inside a coder session.
heal_claims
Which items this daemon is already working on.
heal_config
Which repositories the self-healing loop watches, from ~/.car/heal.toml.
heal_gate
The review gate for an unattended fix: N independent verdicts, a threshold.
heal_intake
Reading the work queue for the self-healing loop.
heal_live
The real TickIo: live GitHub, live provenance, live coder session.
heal_review
The review panel, made of real models.
heal_runner
Running a real coder session for one healed item, and reviewing it.
heal_select
Choosing what the self-healing loop works on next.
heal_service
The thing that actually runs the self-healing loop.
heal_tick
One pass of the self-healing loop.
merge
Merge-back: deliver the worktree’s changes.
multiplayer
Multiplayer development: a work item moves Build → Improve → Polish through different developers before it may merge. Design and rationale: docs/proposals/multiplayer-development.md.
native_loop
The native coding loop: plan → edit → verify → repair, on CAR inference.
no_change
The gate behind CoderState::Reported — when a session may conclude that no code should change, and when it may not.
overlap
Does this session’s diff touch the files its own contract executes?
policy
The coder’s inspector chain — policy hardening for host tool execution.
project
CAR-managed projects — the non-developer’s unit of work.
project_context
What the repository itself says about how to work in it.
provenance
Trust tiers for tracker text — the consuming half of self-correction.
router
Engine selection: native CAR loop vs. delegation to an external CLI.
rpc
The coder.* JSON-RPC surface — session registry, orchestration, fanout.
session
Coder session state machine, event stream, and persistence.
shell_tool
WorktreeExecutor — the coder’s host-side tool executor.
skill_memory
Durable repair learning for the native loop — the “gets better over time” half.
steering
Operator guidance delivered at native model-turn boundaries. The session snapshot owns durability; this inbox only coordinates the live loop.
watchdog
Live coder-session liveness watchdog.