AncrelDocumentationv0.3.0

Search documentation

    Documentation / backend

    Prompt Studio

    The reference host turns a support-summary template into an editable draft. A reviewer can inspect the unified diff, ask for a deterministic evaluation and publish the exact bytes tied to an approved preview. The CLI and reference console share the HTTP service. Same-process MCP tools receive a scoped command handler.

    Run a review

    Start uv run ancrel-prompt-studio serve from packages/backend/python. Run uv run ancrel-prompt-studio draft open to open a draft, then use prompt synthesize_candidate with its bundle. The initial template fails six next-action checks. A revised draft can pass all twelve cases. The CLI exposes the complete workflow through ancrel-prompt-studio skill.

    Adapt a new studio

    AdapterResponsibility
    OntologyNormalize files, validate references, hash material and produce a reviewable diff.
    Evidence and evaluatorFreeze cases and candidate digests, report verdict, trust and coverage.
    Domain verbsDescribe and authorize tools for inspecting and modifying a candidate.
    Commit and policyVerify the external pre-image, authorize evidence and atomically replace the target.

    Runtime profile

    The default host runs a fenced SQLite task worker and stores accepted revisions, command receipts and release approvals in a local kernel database. The evaluator processes a pinned artifact in a bounded subprocess. Restart with the same workspace to resume questions or reconcile a file write interrupted before its database commit.

    Inspect release status PREVIEW after a restart. A reconciled release retains its original approval. A held conflict preserves the third-party target for review. The reference console follows the durable task cursor across disconnects. The example README lists storage paths, the loopback actor convention and enforceable sandbox limits.

    Runnable example

    examples/be.rsi-studio-template/walkthrough.sh

    #!/bin/sh
    # Run against a fresh local host. Every mutation travels through its HTTP client.
    set -eu
    cli() { ancrel-prompt-studio "$@" --json; }
    draft=$(cli draft open)
    draft_id=$(printf '%s\n' "$draft" | jq -er '.data.draft_id')
    base=$(printf '%s\n' "$draft" | jq -er '.data.base_revision')
    payload=$(printf '%s\n' "$draft" | jq -c '{bundle:.data.bundle}')
    candidate=$(cli prompt synthesize_candidate --body "$payload" | jq -ec '.data')
    cli draft patch "$draft_id" --base-revision "$base" --expected-draft-revision 1 --body "$candidate" >/dev/null
    cli draft diff "$draft_id" | jq -r '.data.diff'
    code=0
    waiting=$(cli eval run --draft-id "$draft_id" --ask) || code=$?
    test "$code" -eq 1
    printf '%s\n' "$waiting" | jq -e '.error.code == "WAITING_INPUT"' >/dev/null
    question=$(printf '%s\n' "$waiting" | jq -er '.data.intervention_id')
    target=$(printf '%s\n' "$waiting" | jq -er '.data.target_revision')
    result=$(cli intervention respond "$question" --target-revision "$target" --response continue --actor reviewer)
    printf '%s\n' "$result" | jq -e '.data.evaluation | .verdict == "passed" and .unique_case_count == 12' >/dev/null
    eval_id=$(printf '%s\n' "$result" | jq -er '.data.evaluation.eval_run_id')
    task_id=$(printf '%s\n' "$result" | jq -er '.receipt.task_id')
    cli task events "$task_id" --follow
    preview=$(cli release preview --draft-id "$draft_id" --eval-run-id "$eval_id")
    preview_id=$(printf '%s\n' "$preview" | jq -er '.data.preview_id')
    cli release publish --preview-id "$preview_id" --actor reviewer --reason 'Reviewed twelve synthetic summaries'
    

    Command

    sh examples/be.rsi-studio-template/walkthrough.sh
    Wire contract

    Expected behavior

    Walkthrough output

    On a fresh host the diff adds {{next_step}} to system.md. The question pauses the evaluation with exit 1. After the reviewer replies continue, all 12 cases pass. The events command prints ordered JSON records ending in a terminal event and a successful CLI envelope.

    The final envelope contains a release ID, the material digest, and an approval attributed to reviewer. The target at prompts/support-summary.yaml contains the reviewed bundle. Identifiers and timestamps vary per run.

    Capability and contract

    Run a synthetic support-summary review through an HTTP agent CLI, event stream and reviewer console.

    Validate messages against schemas/cli-envelope.v1.json.

    Single-Node Durable Profile

    SQLite WAL and local durable storage support recovery on one host. Multi-node failover requires a shared storage adapter, cross-node notification and independent failover testing.

    Constraints

    • Run the offline demonstration on a trusted loopback host.
    • Pin the draft, evidence and target digest before reviewer approval.

    Anti-patterns

    • Treating the caller-supplied actor label as shared-service authentication.
    • Treating skipped or untrusted evaluations as verified passes.