Command Plugin

/dr-orchestrate

Self-driving Datarim pipeline with snapshot-first resume, fail-closed routing, and operator-confirmed learned rules.

Overview

/dr-orchestrate runs the Datarim pipeline through a terminal pane. The command, autonomy floor, and action policy are part of Datarim core. The tmux runner, subagent inference chain, bot/HTTP transport, and audit backends are supplied by the optional dr-orchestrate plugin.

Phase 3 (autonomy baseline L4) adds operator-confirmed learned rules on top of Phase 2 subagent inference. Known prompts follow deterministic rules. Unknown prompts enter a bounded resolver chain and may proceed only when confidence and space policy both allow the proposed action. Everything else is escalated, and the immutable hard-gated floor stays authoritative.

Usage

# Enable the plugin once (from the framework's plugins/ directory)
/dr-plugin enable /path/to/plugins/dr-orchestrate

# Optional: copy the plugin's user-config.template.yaml to user-config.yaml,
# set mode 0600, and set key_injection: true to allow send-keys
# (default fail-closed)

# One cycle: parse → gate → execute → optional Save-as-rule proposal
dr-orchestrate run

# Log decisions without executing
dr-orchestrate run --dry-run

# Resolve a pasted parser-miss prompt through the subagent inference chain
dr-orchestrate run --unknown-prompt "operator paste: > /dr-prd strategy gate"

--interval sets the poll cycle in seconds (default 5).

One Cycle

  1. Capture the current tmux pane.
  2. If a task ID is present and datarim/snapshots/{TASK-ID}.snapshot.md validates, read it before classification and pass its recommended_next value to the resolver as a hint, not a constraint. An absent or malformed snapshot is skipped silently.
  3. Run the rule-based semantic parser. Learned matches are exact and must still name an action in the bundled or user trust registry.
  4. On a hit, apply the immutable action gate, write a cycle checkpoint, execute through the controlled pane seam, and append schema-v2 audit evidence.
  5. On a miss, call subagent_resolver.sh. Its bounded fallback chain is coworker, then claude, then codex, 15 seconds per backend.
  6. Require the configured confidence threshold (default 0.80) and the space autonomy policy. Operator-gated or invalid policy results are escalated, never executed. A successful resolution emits a Save as rule? [Y/N] proposal bound to the authenticated actor and session.
  7. Y persists or renews the exact learned match; N, replay, expiry, wrong context, or malformed input fails closed. Learned rules become due for re-validation after 24 hours and expire after seven days; a due rule is never executed.

Core and Plugin Boundary

  • Core: command contract, space-autonomy resolver, FB policy loader, hard-gated safety rules, and action-to-policy mapping. These resolve without enabling the plugin.
  • Plugin: tmux runner, subagent inference chain, HTTP/bot transport, Redis or callback integration, HMAC audit, and operational tooling.

The command can describe and enforce its policy without a plugin. dr-orchestrate run requires the plugin.

Context-Window Self-Clearing

Optional and default-off. With explicit same-UID runtime trust and key injection enabled, the runner checkpoints the active task and last completed snapshot phase before fixed Claude Code or Codex /compact or /clear instructions, and resumes a full clear only through snapshot-first /dr-next <TASK-ID>. See the context-window-self-clearing skill.

Security Floor

  • Every action passes through the space policy and fail-closed action gate.
  • Pane text is represented in audit records by SHA-256, never stored raw.
  • Potential credentials in reasons are redacted before logging.
  • Key injection rejects escape bytes and characters outside the allowlist.
  • Per-pane micro-cooldown (500 ms) and decision-cooldown (60 s) prevent repeated sends; Linux uses flock for atomicity, macOS falls back to non-atomic semantics with a one-time warning.

Audit

Schema-v2 events record the stage, outcome, confidence, selected backend, escalation backend, and a redacted reason. Rule-hit schema-v1 events remain readable for backward compatibility. Resolver failure, low confidence, cooldown rejection, and policy rejection are explicit terminal outcomes.

Configuration

key_injection: false
context_window:
  enabled: false
  trust_same_uid_runtime: false
  policy_label: ""
subagent:
  fallback_chain: ["coworker-deepseek", "claude", "codex"]
  timeout_s: 15
  confidence_threshold: 0.80
escalation:
  backend: "mock"
  mock_log: ~/.local/share/dr-orchestrate/escalation.jsonl

Current Limits

Learned rules never expand the trust registry and require operator confirmation. The default escalation sink is a local JSONL record; the dev-bot backend remains a stub until a real consumer service is configured. Network transports belong to the plugin and must retain loopback or approved private-network exposure.

Reporting the result

Apply Human Outcome Reporting before a human-facing update or result. Explain the user-visible outcome, the original conditions, checks and evidence, and open limitations. A stage result does not mean the entire task is complete. Keep exact protocols and technical records intact. To explain again without continuing work, use /dr-explain.