Quick start

CLI Experimental

This walkthrough takes you from an empty (or existing) project to a graph the engine can drive. It assumes you have the ubc CLI installed and an AI coding assistant available, such as GitHub Copilot, Claude Code, or Mistral Vibe.

Run ubc agent --help to see the subcommands.

Start a new project

ubc agent install bootstraps a project into the loop from a named profile (the default profile, vmodel, is the V-model described in the overview):

ubc agent install                 # scaffold the default `vmodel` profile
ubc agent install --profile vmodel

# Opt-in: also register the ubCode MCP server with a terminal harness's own
# CLI, so an agent running in your terminal gets the ubCode tools.
ubc agent install --register-mcp claude-code-cli

In one non-destructive pass this:

  1. writes the [workflow] process model and the need-type/link ontology into ubproject.toml (existing files are never clobbered without --overwrite);

  2. installs the profile’s AI-asset bundle into the host integration directories, so whichever coding agent you use finds it at its own conventional path: authoring and review skills plus a driver command under .claude/, a copy of every skill as a GitHub Copilot custom agent under .github/agents/ beside the workflow-author agent, and the same skills at .agents/skills/ (the harness-neutral Agent Skills location, read by agents that do not look in .claude/);

  3. records every file it owns in an install manifest at .pharaoh/agent/install-manifest, so a later update can tell your edits from the profile’s.

Tip

Commit .pharaoh/ to version control. It holds ubc’s per-project agent state — the install manifest above, and (once you start reviewing) the review verdicts under .pharaoh/verdicts/. Both are durable, shared records, so commit the folder like any other source. A leading-dot directory is easy to overlook, but leaving it untracked — or gitignoring it — loses your team’s review history and makes ubc agent update and ubc agent doctor report the install as missing. Nothing rebuildable lives there: the build cache is the separate .ub_cache/ directory, which should stay gitignored.

Before you spend any tokens driving the loop, run the pre-flight check:

ubc agent doctor          # config validity + required-tool probes, as JSON

doctor fails closed on a misconfiguration (an invalid [workflow], a missing diagram renderer, a mis-wired code-trace gate) so you catch setup problems before the first authoring run.

Drive the loop

Ask the engine what to do next, author that one artefact, then confirm it closed its obligation. Repeat until next reports done.

$ ubc agent next          # no --id: infer the active stream from your git diff

It names at most one stage as JSON. Here the engine picked the reqs stage and resolved its route for the login stream it inferred from your working tree:

{
  "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"
  }
}

So the next step is concrete: author req needs (ids prefixed REQ_, opened in the default_status the project’s lifecycle declares) with the draft-requirement skill at the resolved_path, and the gate still to close is the trace link up to the story. The overview breaks this payload down field by field. On a fresh install with no needs yet, the first answer is the user_stories stage instead, which names no authoring skill: capture the stories first (for example with Capture intent in VS Code), and once they are reviewed next moves on to reqs.

There are three ways to author the stage the engine names:

With your AI assistant (recommended).

In your agent (Copilot, Claude Code, Mistral Vibe, or another), invoke the driver: the installed drive-workflow skill (or the /ubc-agent-next command). It runs ubc agent prompt, which resolves this same stage and prints the instruction for the one next action as plain text, then follows it: author the artefact at the reported route with the trace links the stage requires. The result is left uncommitted for you to review.

In VS Code the same step is one click from the Pharaoh panels, routed to the agent named by ubcode.agent.id. See In VS Code.

Headless, engine-driven.

ubc agent run assembles a prompt (the recommended skill + the anchor need’s context briefing + the resolved route) and executes it through the configured runner, then rebuilds and reports what was produced. Use --id <NEED_ID> to pick a stream when your working tree’s changed need files cannot seed one, for example right after a review when only verdict files changed:

ubc agent run --id US_LOGIN     # author the next stage for this stream
By hand.

Nothing stops you writing the .rst directive (or the one-line code marker) yourself. The engine only cares about the resulting graph.

After each step, confirm the gap closed and watch the heartbeat:

ubc agent gaps --scope US_LOGIN   # structural gaps for one stream (exits non-zero if any)
ubc agent status                  # one row per stage: done / ready / blocked

When every stage is done, the feature is finished only once the combined gate is green:

ubc agent release-check --with-verdicts

Onboard an existing project

If you already have a Sphinx-Needs graph, --detect (brownfield mode) derives a drivable [workflow] from the graph you already have — the links your needs actually use, the schema, and your declared [needs.links] — instead of the blank profile defaults:

ubc agent install --detect

Each structural edge it finds becomes a trace gate; what it cannot infer from the structure alone it raises as an open question carrying the evidence — whether a metadata-only type is a real stage or just a label, which parent types a fan-in should gate on, or whether a low-coverage backward edge is a genuine gap or noise. Preview the proposal as JSON without writing anything:

ubc agent install --detect --plan

Apply your choices with --answers <file> (an id-to-choice map); the recommended default resolves every question, so answering always converges.

The derived [workflow] (with its [quality] defaults) is added to your project’s ubproject.toml below a marker line, # --- [workflow] derived by `ubc agent install --detect` ---, and the file is edited in place, never rewritten:

  • A re-run replaces that block in place, and only it. The block is the marker line and the [workflow…] and [quality…] tables directly after it, with the comment lines directly below its last table (no blank line between). Everything else you put before or after it stays as you wrote it.

  • Everything in the block is regenerated on a re-run, including [workflow…] or [quality…] tables placed directly after it, which are part of it. A table there that the new block does not write is named in a warning; edits to the derived tables, extra [[workflow.stages]] entries and tables nested inside a stage entry are replaced without one. Keep your own tables above the marker line.

  • A workflow you wrote yourself anywhere else in the file is left alone, and the command says so. Add --overwrite to replace it: it is removed with the comments directly above and below it (a comment after a blank line stays), and the derived block goes in place of an earlier derived block, or at the end of the file.

  • A [quality] you already declare outside the block is kept, the derived one is left out, and a warning says so.

  • The block uses the file’s own line endings.

  • If ubproject.toml is not valid TOML, it is left as it is, and the hint names the line and column where it stops parsing.

--detect exits non-zero on a project with no introspectable graph, so build your needs first.

Tip

The pharaoh-onboard skill completes this for you: an AI runs the plan, answers each open question from the structural signal, spot-checks a suspiciously empty result, and iterates to a clean, drivable workflow — onboarding interactively instead of hand-answering each question.

From there the loop is identical: ubc agent next points at whatever your graph is missing (an arch with no test, a requirement with no parent) rather than starting from an empty tree.

Keeping the profile in sync

When a new ubCode release ships an updated profile, reconcile your project against it with:

ubc agent update

For each file the manifest records as install-owned it does a three-way compare (current preset vs. recorded baseline vs. on-disk): an unedited file is updated in place, while a file you edited is preserved and reported as a conflict rather than blindly overwritten. Pass --overwrite to resolve conflicts preset-wins.

Windows: keep the agents’ shells on UTF-8

On Windows an agent’s shell tools can silently re-save a page as cp1252 or UTF-16: Python’s open() without encoding= (before Python 3.15) and Windows PowerShell 5.1’s Set-Content write the system code page, and PowerShell 5.1’s Out-File and > write UTF-16. ubc reads sources as UTF-8 only, so the needs on such a page drop out of the graph. Prevent it:

  • Before Python 3.15, set PYTHONUTF8=1 for the agents’ shells (in terminal.integrated.env.windows in VS Code, and in the agent’s own settings), so Python’s default encoding is UTF-8 whatever the code page. From Python 3.15 this UTF-8 mode is the default (PEP 686).

  • Use PowerShell 7, which writes UTF-8 without a BOM by default, rather than Windows PowerShell 5.1.

  • Ask IT to roll out the Windows setting Beta: Use Unicode UTF-8 for worldwide language support. It changes what older tools write, so check existing files after it is enabled.

If a page still ends up unreadable, the ubc agent commands stop and name the file rather than order its needs written again (the stop): re-save it as UTF-8 without changing its content, run ubc check until it reports none, and continue.

What install writes

Besides a ubproject.toml with the [workflow] and its need types, which it writes only when the project has none, ubc agent install writes the vmodel profile’s assets below, and records each file it wrote in .pharaoh/agent/install-manifest. Each skill is written three times, once for each kind of coding agent: .claude/skills/<name>/SKILL.md, .agents/skills/<name>/SKILL.md, and .github/agents/<name>.agent.md for GitHub Copilot. The command goes to .claude/commands/<name>.md, the custom agent to .github/agents/<name>.agent.md, and each criteria pack to the path in the first column, beside ubproject.toml.

Asset

Kind

What it is for

drive-workflow

skill

Author the next workflow stage, one step only, then report what is next.

draft-requirement

skill

Draft requirements from a parent, each a single “shall” traced to it.

draft-arch

skill

Draft architecture elements that trace up to the requirements they design for.

draft-impl

skill

Author an implementation need as a one-line codelinks marker in the production source.

draft-test

skill

Author a test need as a one-line codelinks marker in the test source.

record-decision

skill

Record a design decision, linked to the needs it constrains.

change-request

skill

Carry a changed need down to the stages below it, as uncommitted edits.

change-request-assess

skill

Rule on every need a change request reaches: modify, remove or exclude. Say what changes in each modified or removed need, and why each excluded one is left alone.

drive-change

skill

Take a change request one step further, then report what is next and who owns it.

pharaoh-onboard

skill

Derive a workflow for an existing project and resolve its open questions.

recover-requirement-from-code

skill

Recover requirements from what the source files do.

recover-architecture-from-code

skill

Recover the architecture elements a module already has.

recover-need-from-cluster

skill

Write the higher-level need that a cluster of recovered needs supports.

split-recovered-need

skill

Split a recovered need that holds several obligations into atomic ones.

record-recovery-ledger

skill

Record a recovery run’s result with ubc agent reverse record.

resolve-github-intent

skill

Read the GitHub issues and pull requests a recovery brief names, with gh.

review-feat

skill

Score each user story against its criteria pack and submit one verdict per need.

review-requirement

skill

Score each requirement against its criteria pack and submit one verdict per need.

review-arch

skill

Score each architecture element against its criteria pack and submit one verdict per need.

review-decision

skill

Score each decision against its criteria pack and submit one verdict per need.

ubc-agent-next

command

Resolve and act on the single next workflow action, then stop.

workflow-author

custom agent

Advance the workflow by one stage in Copilot, handing the stage to its skill’s agent.

quality/feat.toml

criteria pack

The rubric review-feat scores against.

quality/requirement.toml

criteria pack

The rubric review-requirement scores against.

quality/arch.toml

criteria pack

The rubric review-arch scores against.

quality/decision.toml

criteria pack

The rubric review-decision scores against.

Note

In a project that also parses Markdown ([parse.parsers.md]), ubc check and the editor read the skill files as documents of the project and report each one, for example as not included in any toctree. Leave them out by adding their directories to the extend_exclude of your [source] table, keeping the entries it has (add the table if your ubproject.toml has none):

[source]
extend_exclude = [
    "README.md",  # an entry the project already had
    ".claude/**", ".agents/**", ".github/**",
]