Pharaoh Agentic Engineer

CLI VS Code Experimental

Added in version 0.31.0.

The concepts and configuration below are stable enough to try on a real project; the ubc agent subcommands, options and output shapes, and the VS Code surfaces, may still change between releases.

Pharaoh is ubCode’s agentic engineer. You describe your engineering process once — the stages a requirement passes through, and the evidence each stage needs. From then on, AI does the writing and the engine does the judging: it computes what is done, what is missing, and what to do next — the same answer every time, on your laptop or in CI — and holds a stage you mark for review until its needs carry a fresh, passing review.

Reviews are separate steps from authoring, and nothing enters your history without your approval. And your requirements are not a list in a Markdown file: they are typed needs in your real reStructuredText or MyST documents. In VS Code, ubCode’s Rust engine checks each file as you type, and the whole project each time you save, or as you type with auto-save after a delay (see what runs when and what it supports).

AI authors. The graph judges — AI speed, with traceability the engine checks.

What’s in the name?

Pharaoh is a nod to our lineage: ubCode mirrors Sphinx and Sphinx-Needs, and just as the pharaohs ruled the land the Great Sphinx keeps watch over, Pharaoh oversees and commands the needs your docs describe.

Every Sphinx needs a Pharaoh.

The mental model

If you have used make, you already have it: ubc agent next is make for your requirements. It looks at what exists and names the single next thing to build. You — or your AI assistant — build exactly that one step; the engine re-checks the graph and names the next. Repeat until nothing is left.

        flowchart LR
    next["`🎯 **1 · ask**
    ubc agent next`"]
    author["`🤖 **2 · author**
    you or your AI build one step`"]
    check["`🚦 **3 · check**
    ubc agent gaps`"]
    done(["`🏁 **done**
    release-check`"])

    next --> author
    author --> check
    check -- "still gaps" --> next
    check -- "all covered" --> done
    

Ask for the next step

Point the engine at the feature you are working on and ask what to do next:

$ ubc agent next --id US_LOGIN

It returns at most one stage — the first actionable step in your declared order — as JSON built for an agent to read:

{
  "ok": true,
  "arm": "author",
  "stage": {
    "id": "reqs",
    "produces": "req",
    "skill": "draft-requirement",
    "review": "review-requirement",
    "route": {
      "scope": "stream",
      "granularity": "per-root",
      "path": "specs/{stream}/requirements.rst",
      "feature": "login",
      "id_prefix": "REQ_",
      "resolved_path": "specs/login/requirements.rst"
    },
    "gates_to_pass": ["trace"],
    "gate": {
      "link": "traces_to",
      "up_type": "user_story",
      "min": 1,
      "direction": "both"
    },
    "id_prefix": "REQ_",
    "default_status": "draft",
    "verdicts_dir": "/work/acme/.pharaoh/verdicts"
  }
}

In plain words: arm is the one action the engine chose (author, review, refix to re-author needs whose verdict failed, fix_diagnostics, or none), the same choice ubc agent prompt acts on, so a driver reads it rather than working it out from gates_to_pass. Here the next step is to author req needs (ids prefixed REQ_) with the draft-requirement skill, writing them to specs/login/requirements.rst — the route resolved for this stream — and the gate still to satisfy is the trace edge spelled out under gate: at least one traces_to link up to a user_story, covered in both directions. default_status is the :status: a brand-new req opens in, the first entry of the project’s ordered [workflow.lifecycle] states. It is omitted when the project declares no states, and the engine then dictates draft, so a driver that finds no key uses draft rather than reading the fact as unanswered. verdicts_dir is where this stage’s review verdicts live; when a review holds the stage, the payload also carries the review_needs to re-review and their review fingerprints, so a reviewer needs no second lookup. When there is nothing to do, stage is null and a reason tells you why: empty (the workflow configuration derives no stages, which a fully populated project reports too), gaps (the stream carries gaps no stage owns, listed in unattributed_gaps, because no stage produces those needs’ type), done (no open stage remains on this stream, so check open_streams before calling the project finished), or blocked (a dependency stage is not ready).

The --id anchors the work on one need’s stream — that story plus everything traced beneath it — which is the deterministic choice for scripts and agents. Drop it and the engine infers the stream from your git working tree instead.

You rarely read this JSON yourself: it runs where you already work. Your AI assistant polls next to drive the loop one stage at a time; a CodeLens on each requirement shows its coverage and next action in VS Code; and because every gate is a command with an honest exit code, the same checks run in CI.

Vocabulary

The engine is smaller than its glossary — six words cover the whole system:

stage

One step of your process, declared as a [[workflow.stages]] entry. A stage produces a need type (or gates code coverage) and depends on other stages.

gate

A per-stage rule that must pass — trace links present, code covered, lifecycle valid, reported diagnostics clear, review done. The gates_to_pass list above names the ones still open. A diagnostics token means ubc reports a diagnostic on one of the stage’s needs (see Diagnostics gate): the pending action is to fix it in place, before any authoring or review. A synthetic review token in that list means the artefact is already authored: when review is the only remaining entry the pending action is to review it rather than author again, and when it sits alongside other gates those structural gates close first, on the author path.

gap

A specific unmet obligation, attributed to a stage — for example REQ_42 has no satisfying architecture. Gaps are what make a stage ready: there is work to do.

heartbeat

The one deterministic evaluation that resolves every stage’s state (done / ready / blocked) from the graph. Every report and gate is a projection of it, so they can never disagree.

stream

One feature’s slice of the graph: an entry root (a user story, say) plus everything traced beneath it. ubc agent next drives one stream at a time.

verdict

A review record for a need, stored in .pharaoh/verdicts/ — per-axis scores against a rubric, judged pass/fail at read time against the floors you set. A review-required stage is held — never reported done — until its needs carry a fresh, passing verdict. Reviews and quality analysis covers it.

Why it holds up

  • Deterministic, not vibes. Completeness is computed from your requirements graph, and no LLM decides pass or fail: on a stage you mark for review, a model’s scores are one input, and the engine applies your floors to them. The answer is reproducible and auditable.

  • Your process, your ontology. The V-model is only the default profile; rename the types and links, or model a completely different process. Configuring the workflow shows how.

  • Brownfield-ready. Adopt it on a project you already have: accept today’s gaps as a baseline and gate only on the new ones.

Pharaoh’s surfaces

Pharaoh is one product that you reach from several places.

Command line

ubc agent is Pharaoh’s engine: every verb, for you, your AI assistant and CI.

The ubc agent command
VS Code panels

The Pharaoh Agent, Pharaoh Workflows, Pharaoh Gaps and Pharaoh Intent from Code panels.

In VS Code
Chat entry point

@pharaoh in GitHub Copilot Chat: Pharaoh’s chat entry point in VS Code.

Chat participant
MCP server and documentation grounding

Your project’s graph and the product documentation, for any AI assistant that speaks MCP.

Model Context Protocol (MCP) server
Quality reviews

Scored reviews of each need, configured in the [quality] table.

Reviews and quality analysis
Workflow configuration

The [workflow] table: your stages, the traceability each one needs, and the lifecycle states.

Workflow
Intent from Code

Recover user stories, requirements and architecture from an existing codebase.

Recovering intent from code

Dive in

🚀 Quick start

From zero — or from an existing project — to a driven loop in minutes.

Quick start
🔧 Configuring the workflow

The ontology, the stages, the routes, and the AI runner — explained.

Configuring the workflow
✅ Reviews & quality

The substance gate: AI-scored reviews, per-axis floors, and freshness.

Reviews and quality analysis
⚙️ The ubc agent command

Every verb of the engine, and the conventions behind them.

The ubc agent command
🧭 In VS Code

Panels, graph colouring, gap overlay, and CodeLenses.

In VS Code