Vapora/reflection/modes/create_agent_task.ncl
Jesús Pérez 75e5ebd9a2
Some checks failed
Documentation Lint & Validation / Markdown Linting (push) Has been cancelled
Documentation Lint & Validation / Validate mdBook Configuration (push) Has been cancelled
Documentation Lint & Validation / Content & Structure Validation (push) Has been cancelled
mdBook Build & Deploy / Build mdBook (push) Has been cancelled
Nickel Type Check / Nickel Type Checking (push) Has been cancelled
Rust CI / Security Audit (push) Has been cancelled
Rust CI / Check + Test + Lint (nightly) (push) Has been cancelled
Rust CI / Check + Test + Lint (stable) (push) Has been cancelled
Documentation Lint & Validation / Lint & Validation Summary (push) Has been cancelled
mdBook Build & Deploy / Documentation Quality Check (push) Has been cancelled
mdBook Build & Deploy / Deploy to GitHub Pages (push) Has been cancelled
mdBook Build & Deploy / Notification (push) Has been cancelled
chore: ontology sync + 4 NCL ADRs + landing page update
on+re:
  - core.ncl: 5 new Practice nodes (notification-channels,
    vapora-capabilities, agent-hot-reload-stable-identity,
    merkle-audit-trail, notification-channels) + 5 new edges;
    knowledge-graph-execution-history updated with HNSW+BM25+RRF
  - state.ncl: production-readiness blocker/catalyst updated (hot-reload
    complete, BudgetManager/LLMRouter still require restart);
    ontoref-integration catalyst updated (vapora-ontology/reflection
    crates, api-catalog.json, nickel contracts)

  ADRs (NCL):
  - adr-013: KG hybrid search — HNSW+BM25+RRF, rejected in-process scan
  - adr-014: capability packages — AgentDefinition→vapora-shared,
    DashMap shard-before-await constraint
  - adr-015: Merkle audit trail — SHA-256 hash chain, rejected HMAC
  - adr-016: agent hot-reload — stable_id=role, learning_profiles survive
    drain, BudgetManager excluded from reload scope

  landing page:
  - 2 new feature boxes: VCS-Agnostic Worktree (jj/git), Ontology Protocol
  - KG box: 20→28 tests, HNSW+BM25+RRF description
  - Agents box: 71→82 tests, hot-reload + stable_id
  - tech stack: Rust 21→23 crates, added jj, Radicle, ontoref badges
  - status badge: 620→691 tests
2026-04-07 21:06:48 +01:00

68 lines
2.6 KiB
Text

let s = import "reflection/schema.ncl" in
{
id = "create_agent_task",
trigger = "manual | NATS:ecosystem.reflection.request",
preconditions = [
"vapora-agents service is running",
"budget-boundary axiom enforced (BudgetEnforcer middleware active)",
"provider-abstraction: LLMClient trait in use at all call sites",
],
steps = [
{
id = "validate_task_params",
action = "Validate task parameters against agent capability schema",
cmd = "nickel export --format json {vapora_dir}/schemas/agent-task.ncl | jq --exit-status '.capabilities | contains([{capability}])'",
actor = 'Agent,
on_error = { strategy = 'Stop },
depends_on = [],
},
{
id = "check_budget",
action = "Verify current budget balance allows this task execution",
cmd = "curl -sf http://localhost:8080/api/v1/budget/{tenant_id}/check?estimate=true | jq --exit-status '.allowed == true'",
actor = 'Agent,
on_error = { strategy = 'Stop },
depends_on = [{ step = "validate_task_params", kind = 'OnSuccess }],
},
{
id = "check_gate",
action = "Verify the agent capability gate is open for this signal type",
cmd = "nu {vapora_dir}/scripts/check-gate.nu --ontology {vapora_dir}/.ontology --signal {signal_type}",
actor = 'Agent,
on_error = { strategy = 'Stop },
depends_on = [{ step = "validate_task_params", kind = 'OnSuccess }],
},
{
id = "dispatch_task",
action = "Dispatch validated task to the agent dispatcher",
cmd = "curl -sf -X POST http://localhost:8080/api/v1/tasks -H 'Content-Type: application/json' -d '{\"capability\": \"{capability}\", \"tenant_id\": \"{tenant_id}\", \"payload\": {task_payload}}'",
actor = 'Agent,
on_error = { strategy = 'Stop },
depends_on = [
{ step = "check_budget", kind = 'OnSuccess },
{ step = "check_gate", kind = 'OnSuccess },
],
},
{
id = "capture_to_kogral",
action = "Record task dispatch as an Execution node in the knowledge graph",
cmd = "nu {stratumiops_dir}/scripts/kogral-bridge.nu --mode create_agent_task --project {project_name} --file /dev/stdin",
actor = 'Agent,
on_error = { strategy = 'Continue },
depends_on = [{ step = "dispatch_task", kind = 'OnSuccess }],
},
],
postconditions = [
"Task is visible in syntaxis-core task tracker",
"Budget ledger updated with estimated cost",
"Execution node created in kogral shared graph",
],
} | (s.Mode String)