@floh-solutions/pharos-cli
v0.37.1
Published
Azure DevOps from a headless shell, for an agent: the whole context of a task in one call, and the wiki/comment verbs Microsoft's MCP server does not ship.
Readme
pharos
Azure DevOps from a headless shell, built for an agent to drive.
npm i -g @floh-solutions/pharos-cli
export ADO_ORG=your-org ADO_PROJECT=YourProject ADO_PAT=…
pharos task 210Why it exists
Microsoft's @azure-devops/mcp server is missing capabilities that matter once
Claude is doing real work on a board. Enumerated against its shipped tool list,
not assumed:
| | | |---|---| | wiki comments — list, add, edit, delete, react | no tool at all | | work item comments — delete, react/unreact | absent (it has add and update only) | | wiki page delete | absent | | service hook subscriptions | absent |
And it authenticates with an interactive browser login, so an unattended agent blocks on a modal nobody is there to answer.
The command it exists for
pharos task 210One call returns the work item, its fields, its comments, its attachments, its relations with their titles, and the full content of every linked wiki page plus the discussion on those pages.
Assembled by hand that is five or six round trips across two different tools, and one of them is impossible. It is what an agent needs in order to start: the plan a colleague wrote on a wiki page, the argument underneath it, and the dependency that says this cannot begin yet. Anything forgotten is context the agent silently works without.
It gathers; it does not summarise or rank. Whatever could not be fetched lands
in problems[] rather than being quietly dropped — a context with an invisible
hole in it is worse than a short one, because it gets reasoned from
confidently.
Add --pretty for a human-readable brief.
The output is the interface
Success is JSON on stdout. Failure is JSON on stderr with a non-zero exit. An empty array and exit 0 is a query that matched nothing; that is a different fact from a 403, and prose makes it a guess.
| exit | meaning | what to do |
|---|---|---|
| 0 | it worked | carry on |
| 1 | the call failed | maybe retry — check kind, and retryAfterMs if rate-limited |
| 2 | called wrong, or not configured | never retry unchanged |
| 3 | refused by a guard here | re-run with --yes, or raise --max-writes |
Errors carry what you need to act:
{ "error": { "kind": "conflict", "expectedRev": 4, "actualRev": 5,
"hint": "Re-read the item and re-apply…" } }A bad token exits 2, not 1 — retrying it is pure noise. A conflict carries
both revisions, and says out loud that posting a comment bumps System.Rev, so
a rev mismatch is not proof that somebody edited the same field.
A failure that came from GitHub says so — "platform": "github" — because
pharos issue touches two platforms in one call and which one refused is the
first thing to know. Its absence means Azure DevOps or this tool, as before.
Guards
Every verb here is one an agent can call in a loop against a board real people depend on.
Destructive verbs refuse by default.
pharos wiki delete /Plans/Old # exit 3, nothing changed, preview attached
pharos wiki delete /Plans/Old --dry-run # exit 0 — the preview IS the request
pharos wiki delete /Plans/Old --yes # doneThe bare form exits non-zero on purpose. Exiting 0 with "applied": false
reads as success to anything that checks only the status, and an agent that
quietly does less looks identical to one that succeeded. --dry-run beats
--yes: the safe reading of a contradiction is the one that changes nothing.
Replacing a wiki page needs --yes; creating one does not. Creating adds,
replacing can destroy somebody's text. The read that decides which is also
where the If-Match version comes from, so the concurrency guard is not
something a caller can skip.
A write budget, counted at the transport. Default 20 per invocation, so a
runaway loop becomes a clean refusal rather than 500 work items. --max-writes 0
is read-only: reads work, every write is refused before it is sent.
It counts both platforms. pharos issue writes to Azure DevOps and to
GitHub in one invocation, and a cap that covered one of them because the other
left by a different transport would be a cap in name only.
It is not security — anything that can run this holds the token and can make the same REST calls directly. It shapes intent and catches accidents. A capability that must be impossible has to be withheld at the token.
Commands
task <id> the whole context, in one call
search <terms...> WHERE it is written — full text over work
items AND wiki pages, with the matching line
wiki list | tree | read | write | delete
comment list | add | edit | delete | react | unreact | reactors
comment hide | unhide | pin | unpin GitHub only
issue adopt | link | say | trail | drift | backfill | close
a GitHub issue and a work item, joined —
and kept honest
plan <file> an implementation plan becomes a work item treecomment takes any of three targets: a work item is its number (210), a wiki
page is an absolute path (/Plans/Foo), a GitHub issue is
owner/name#45. The leading slash is required by the wiki API itself — it
answers 404 without one — so the spelling that tells them apart is also the only
spelling that works, and the three grammars cannot collide.
A URL where an id is taken
Every verb that takes a work item id takes the item's Azure DevOps URL too —
task, update, history, attach, detach, download, link/unlink
and their --parent-style flags, create --parent, delete, restore,
wiki link --item, comment, and the issue verbs — and every wiki verb that
takes a page path takes the page's URL, by page id or by pagePath. A
pharos:// link reads as the https URL it stands for.
The URL is read by the link rules of navarch-protocol 0.6.0 ("Integrations
and links", #1561) — src/links.ts, a second reader of that contract proven
against its own table, links.json, read from the vendored copy under
apps/Pharos/Vendor/navarch-protocol (test/links.test.ts). It is not
new URL(): a raw space, a non-ASCII character or a password in a URL is
refused rather than repaired.
Only the configured organisation. Work item ids are unique per
organisation, so …/fabrikam/_workitems/edit/214 handed to a CLI configured for
contoso names a real item this CLI would read as contoso's #214. It is
refused by name, and nothing is read. A wiki page URL must be in the configured
project too — by name, or by the GUID its wikis report — and in a wiki that
project has; the page's wiki is the one acted in.
A refusal is exit 2 with a stable reason, the contract's own spelling where it
has one:
| reason | |
|---|---|
| not-a-url too-long scheme credentials | the contract refused the URL |
| no-organisation incomplete unknown-route | a pharos:// link that does not read whole |
| not-a-work-item not-a-wiki-page not-a-comment-target | the URL names something else — type, itemKind and key say what |
| other-organisation other-project other-wiki | not this configuration's — organisation/project/wiki and configured say whose |
Azure DevOps Server URLs (https://server/tfs/…) are not recognised in
0.6.0 — nothing in a URL says a host is one — so on such an install pass the id.
Long text does not belong on a command line:
pharos comment add 210 --file review.md
pharos wiki write /Plans/Sprint-4 --stdin < plan.mdcomment on a GitHub issue — the surface gh half has and half has not
pharos comment list contoso/widgets#45 # ids, state, and what you MAY do
pharos comment edit contoso/widgets#45 900 --file fixed.md
pharos comment delete contoso/widgets#45 900 --yes
pharos comment react contoso/widgets#45 900 thumbs-up
pharos comment hide contoso/widgets#45 900 off-topic
pharos comment pin contoso/widgets#45 900This is the one place pharos reaches past the join, and it is two arguments
rather than one. Editing or deleting a comment can destroy the link record,
which nothing outside this repo knows to protect. And hide and pin have no
gh verb at all — they are GraphQL mutations with no REST route, so they pass
the same "nothing else can do this" test the issue verbs pass. Posting a new
comment is still gh issue comment or pharos issue say, and comment add on
a GitHub issue is refused with both of those named.
list is the load-bearing verb, and it is not one the macOS app needed: the
app has a window, an agent has this. Before it there was no way to learn a
GitHub comment id from this CLI at all, so nothing else here was addressable. It
prints both ids per comment — the REST number that edit, delete and reactions
address, and the node id that hide and pin take, because neither is derivable
from the other — plus a may object read from GitHub's own viewerCan… fields.
For a window those grey out a menu item; for an agent they turn a write that
would 403 into a fact known beforehand.
An edit cannot double or strip the pharos:v1 trailer. Send prose with no
trailer and the existing one is restored, with markerPreserved: true saying
so; send two, or one naming a different work item, or one on a comment that
never had one, and the edit is refused with the reason and the repair. The rule
lives in gh-core, not here, because it is a rule about the link record rather
than about this command — and the macOS app edits through the same package.
Deleting the comment that carries the trailer is allowed and never silent.
The --yes refusal names the work item about to lose its GitHub end and hands
over the pharos issue link that puts it back; --dry-run prints the same
preview and exits 0. Both read the comment first, because a preview that could
not say which of the two deletes this is would be a preview of the wrong thing.
Reactions are not one vocabulary across the two platforms. Azure DevOps
takes like dislike heart hooray smile confused; GitHub takes thumbs-up
thumbs-down laugh hooray confused heart rocket eyes. Passing one platform's
name to the other is refused rather than translated. The CLI spelling is words
because GitHub's own names for the first two are +1 and -1, and -1 as a
positional is read as a flag by every argument parser including this one.
issue — the GitHub edge, and only the edge
pharos issue adopt contoso/widgets#45 --parent 39
pharos issue link contoso/widgets#45 4821
pharos issue say contoso/widgets#45 --file reply.md
pharos issue trail 4821 # …or trail contoso/widgets#45
pharos issue drift # where the two platforms disagree
pharos issue backfill contoso/widgets --limit 25 --yes
pharos issue close 4821 --text "Shipped in 1.4.0."
pharos issue edit contoso/widgets#45 --title "Crash on resize" --yesAzure DevOps already has a GitHub integration and the link it makes carries nothing: title, body, comments, labels and state stay on their own island, and the transition only ever fires from a commit or a PR merge, never from closing an issue. That is the gap, and it is the whole pitch — not "there is no integration".
Eight verbs, because gh already exists. Listing, viewing and commenting on
an issue is gh's job and it is better at it — closing one end is gh issue
close, and closing the pair is pharos issue close; a second GitHub CLI
would be the drifting duplicate this repo has been bitten by three times.
Pharos owns what gh cannot see: the join.
edit is the one verb that overlaps gh head on, and it earns that by
refusing. gh issue edit writes the same fields and writes them well; what it
cannot do is notice that somebody changed the thing you are overwriting. It is
last-write-wins — if a colleague renamed the issue while you were composing,
their rename is gone and neither of you is told. Fine for a human at a terminal,
wrong for an agent that reads, thinks for a minute, and writes into a world that
moved. Want an unguarded edit? gh issue edit is right there.
The guard is a value compare, because GitHub offers nothing better:
PATCH /repos/{o}/{r}/issues/{n} answers 400 to If-Match (measured), and
updated_at and the ETag both move when somebody merely comments, so a
timestamp guard would refuse a good edit for a change that touched nothing. So
edit re-reads immediately before sending and refuses only if the text it is
about to overwrite moved. Pass --if-title / --if-body / --if-body-file to
guard against what you saw rather than against this command's own read; the
output says which, as fields.guard.window. It narrows the race to one round
trip and does not close it, and it says so.
Two things GitHub does quietly, which edit reports:
POST …/labels creates a repository label that does not exist (so an unknown
one is refused with near misses — --create-label is how you mean it), and
POST …/assignees ignores a login it will not assign while still answering
201 (so read assignees.ignored). Labels and assignees go through their own
add/remove endpoints, never the whole-issue PATCH, which carries them as whole
arrays and would overwrite every label on every write.
adopt creates the work item and writes both ends of the link:
| | where | |
|---|---|---|
| 1 | a Hyperlink relation on the work item | measured, not chosen — _apis/githubconnections answers 401 on Pharos's PAT scopes while a control call answers 200, so the connection id a native vstfs:///GitHub/Issue/… link needs cannot be read at all |
| 2 | one comment on the issue: AB#4821 and <!-- pharos:v1 repo=… issue=… ado=… --> | AB# is free official linking wherever the Azure Boards app happens to be installed and harmless text where it is not. The trailer is what every machine reads, including the loop guard |
The marker goes in a comment, never the issue body. Editing a reporter's body collides with them, is rude on a public repo, and needs write access we may not have on a community issue. A comment is append-only and needs none of that.
The relation and the parent ride in the same patch as the fields, so a work item is never briefly pointing at nothing. Azure DevOps is written first because the work item id does not exist until it lands — so the one failure this can leave is always the same shape, and it is reported rather than swallowed:
{ "error": { "createdWorkItem": 4821, "halfLinked": true, "wrote": ["hyperlink"],
"recover": "pharos issue link contoso/widgets#45 4821" } }link writes only the half that is missing, which makes it both the way to join
an existing pair and the repair for exactly that state.
Adopting an issue twice never makes a second work item, and there are three different answers behind that one sentence. Which one you get says what state the pair was in:
| the issue carries a marker | exit 0, created: false — the work item it names, and nothing written. The state you asked for already holds |
| a work item links the issue and the issue says nothing | exit 3, halfLinked: true, carrying recover — the same pharos issue link … command the failure above handed over. Finishing that link is the repair; a second work item is not |
| two work items claim one issue | exit 3, both named, and no recover — picking one would be inventing an answer to the question this feature exists to answer |
The middle row is the one that used to be a duplicate. The marker is the index
and in that state it was never posted, so before creating anything adopt also
asks this machine — an adoption is written to ~/.config/pharos/half-links.json
between the create and the comment, and removed when the comment lands — and
then the board, narrowing on [System.HyperLinkCount] and matching the
relation URLs client-side, which is the only way round Azure DevOps having no
query over them. The board is the stronger of the two — it sees a half-link
left on another machine — and the local record covers what it cannot: a board
query that is refused, a half-link older than that scan's cap, and a refusal
that costs no round trip. Every run reports boardCheck, because "the board
says nobody has adopted this" and "the board could not be asked" are different
facts and only one of them means the check happened.
trail is read-only and answers from either end — the output shape does not
depend on which you passed. Read evidence: ["hyperlink","marker"] is a
complete link, and either one alone is a link that only half exists.
say — one message, two audiences
pharos issue say contoso/widgets#45 --file reply.md
pharos issue say contoso/widgets#45 --stdin --summary "Fixed in 1.4.2; asked for a crash log"| | GitHub | Azure DevOps | |---|---|---| | who reads it | the reporter, who does not have an Azure DevOps account and never will | the team | | what they get | the full explanation, in their register | a summary, and the URL of the comment carrying the rest |
The asymmetry is the verb. The same words in both places is gh issue
comment followed by pharos comment add, and neither of those knows the other
happened. Without --summary the board gets the first paragraph cut to 200
characters — a guess, and allowed to be one only because the comment's URL
travels with it. The board is never the record of what was said; GitHub is.
The loop guard keys on content, never on sender.login. GitHub events carry
an actor and Azure DevOps events do not, which makes the actor look like the easy
answer and is the trap: every client writes with its own gh credential, so
sender.login == me is also true of the human typing into the web UI, and
suppressing on it silently swallows their real comments. So the guard is the
pharos:v1 trailer, in two halves:
- Every comment
sayposts carries it, because the read sweep is only safe ifisPharosAuthoredis total. One unmarked Pharos comment anywhere is one the sweep reads as a human's, and the loop that starts from it does not stop. - A message that already carries one is refused. That is Pharos's own output being handed back — a mirrored body, a copy-paste, a script re-posting what it read — and it is the loop starting one step before any sweep could see it. The macOS app's queue refuses exactly the same thing.
GitHub is written first here, the opposite of adopt, because the board's
comment carries the GitHub comment's URL and that does not exist until the POST
returns. The work item is read before anything is published, since the GitHub
half lands on a repository that may not be ours. If the board half then fails:
{ "error": { "halfSaid": true, "wrote": ["github-comment"],
"github": { "commentUrl": "https://github.com/…#issuecomment-950" },
"recover": "pharos comment add 4821 --stdin", "adoComment": "…" } }Do not re-run it. A comment is an append, so a second say posts a second
public comment; the error carries the exact text and the command that writes the
half that is missing.
say starts from the issue end only. A work item may hyperlink several issues,
so that end names no single reporter — pharos issue trail <id> is how you find
out which issue you meant.
Pull requests are out of scope for v1 and are refused by name rather than
half-supported: on GitHub's API every PR is also an issue, so adopt on a PR
number would otherwise mirror something the rest of this does not model.
drift — the report no other tool can produce
pharos issue drift
pharos issue drift --repo contoso/widgets --limit 50gh can list issues; Azure DevOps can list work items; neither holds both
sides, so neither can say these two disagree. A link nobody checks decays
quietly — an issue gets closed on GitHub and the board still shows the work in
progress, or a work item is marked done and the reporter, who has no Azure
DevOps account and never will, is still waiting.
Four kinds, because they want four different actions:
| kind | what it means |
|---|---|
| state | both ends exist and disagree about whether the work is finished |
| missing-issue | the work item names an issue GitHub does not have |
| one-sided | the board has the link and the issue does not — what a failed adopt leaves. Carries the pharos issue link … that repairs it |
| unreadable | the GitHub end could not be read, so nothing about this pair is known |
It scans links, not issues. An unadopted issue is not drift — on a repo with
four hundred of them, counting "not linked" as a problem buries three real
findings under three hundred and eighty-eight rows of noise. What is missing
from the bridge is backfill's question; what is wrong inside it is this one.
"Finished" is read from the project, never guessed. A process template
renames every state, and Resolved is terminal on a Bug and open on a User
Story — so each work item is judged against its own type's categories and the
report says which source it used. When the catalogue cannot be read the stock
names are used and said out loud, because a row is uninterpretable without
knowing what was counted as finished.
An unreadable repository is information, not a fault, and never fails the command: a work item can hyperlink a repo somebody else adopted on a machine configured differently.
backfill — the adoption path, for the repo everybody actually has
pharos issue backfill contoso/widgets # previews, then REFUSES
pharos issue backfill contoso/widgets --dry-run # the same preview, exit 0
pharos issue backfill contoso/widgets --limit 25 --max-writes 50 --yes
pharos issue backfill contoso/widgets --label bug --parent 39 --yesWithout a bulk route the bridge only works on a greenfield repository, which is not where anybody is. A team with four hundred open issues cannot adopt them one command at a time.
Deciding what is already adopted costs two requests, not four hundred. The
board is the enumerable side: a work item carries its Hyperlink relations on
its own row, so one WIQL and one workitemsbatch return every link at once.
GitHub cannot answer the equivalent question at all — the marker lives in a
comment, so asking costs a request per issue. That subtraction is correct
because adopt writes the Azure DevOps end first, so the half-state it can
leave is a hyperlink with no comment and never the reverse. The mirror image is
still possible if somebody deletes a relation by hand, so the marker is re-read
per issue at adoption time — on the handful being written — and an issue
that turns out to be claimed already is skipped rather than adopted twice.
It is resumable and needs no state file to be. The link is the progress record: a second run reads the board again, finds the ones the first run adopted already linked, and carries on. Candidates are ordered by issue number ascending so that is true in the obvious way as well as the technical one.
The write budget is the throttle, on purpose. Each adoption is two writes, so four hundred issues is eight hundred against a default cap of twenty. That cost is worked out before anything is written and a run that cannot finish is refused, naming both ways forward — rather than stopping at write nineteen, which is the outcome a caller can reason about least.
A bare invocation previews and refuses (exit 3); --dry-run is the same
preview at exit 0. The preview names the repository, the gh account it would
be reached as, and the Azure DevOps organisation and project the work items
would land on. Nothing in the design pairs a repo with a board, and a
mis-aimed adopt is one work item where a mis-aimed backfill --yes is four
hundred — each with a public comment naming a board its reporter has nothing to
do with.
--state defaults to open: a closed issue is history, and adopting it creates
a work item that is finished before anybody looks at it.
close — the ending of the trail
pharos issue close 4821 # …or close contoso/widgets#45
pharos issue close 4821 --to Removed --reason not-planned
pharos issue close 4821 --file release-note.mdCloses both ends, comments on each pointing at the other, then re-reads
both and reports what actually moved. Two 200s are not proof: a workflow rule
can refuse a transition on a field the API happily accepted, so verified is
what was there afterwards rather than what was sent.
It does not compose Closes #45 / Fixes AB#123 into a PR body. Those fire
on a PR merge and pull requests are out of scope for v1 — so there would be
nothing to compose into and nothing to verify.
There is no hardcodable Closed. The state written comes from the project's
own categories: exactly one terminal state for that work item type is used,
several is a refusal naming them and --to, because Done and Removed are
both finished and mean opposite things. If the catalogue cannot be read at all it
refuses rather than guessing — drift degrades to the stock names because a
misclassified row is a question somebody can dismiss, and the same guess here
would be a write.
--to, not --state: --state already means open|closed|all on backfill,
and one flag with two meanings across two verbs of one command is a bug that only
shows up when somebody runs it.
Closing an already-closed pair writes nothing and exits 0. A work item linking
several issues is refused unless --all says so — "close 4821" should not read
as "close four strangers' issues".
Configuration
| | |
|---|---|
| ADO_ORG | your organisation — the first path component of your dev.azure.com URL |
| ADO_PROJECT | the project inside it |
| ADO_PAT | a Personal Access Token |
From the environment, and nowhere else. No keychain, no credential helper, no config file — that is what lets this run headless, in CI, or under an agent with nobody there to answer a prompt. There is deliberately no built-in organisation either: a default would let a misconfigured run succeed quietly against somebody else's board.
Scopes are separate and both are needed for full use: vso.work_write for work
items, vso.wiki_write for the wiki.
Every person uses their own token. Board attribution is per-person, and a shared token makes everyone's work read as one account.
GitHub, which follows a different rule for a measured reason
The rule above is about ADO_PAT and it has not moved. GitHub is a separate
thing, and it needs two facts that an environment variable cannot carry.
The credential comes from gh, so there is no fourth secret to manage.
gh auth token --user <account> resolves it and the API calls are ordinary
HTTPS from there; revoking GitHub access never touches the Azure DevOps token.
Pass --user or nothing else: a bare gh auth token returns whatever GH_TOKEN
happens to be exported and ignores the keyring entirely, so an exported token in
somebody's shell would silently become the identity of a sweep.
The account is bound per repository, in ~/.config/pharos/repos.json.
pharos setup --repo contoso/widgets --gh-account alisina-tibataBoth flags or neither — a repository is a (repo, account) pair, and there
is deliberately no fallback to whichever account gh has active. Azure DevOps
binds a project to one GitHub identity; gh holds many at once with one active
machine-wide, and on the machine this was measured on the active account was not
the one owning the repository behind the project being worked. The failure is
not a clean error either: two accounts can each see a repository of the same
name, so the wrong one answers 200 for a different repository. That is what
pharos doctor --verify compares owners for.
$PHAROS_REPOS_FILE and $XDG_CONFIG_HOME both move the file. gh is optional
— without it every pharos issue verb is refused by name with the reason, and
the Azure DevOps verbs are untouched.
And it runs in the other direction too: a verb whose target is a GitHub issue
needs no ADO_PAT. pharos comment list contoso/widgets#45 reads over gh's
credential and touches Azure DevOps at no point, so it works on a machine that
has never had a PAT. The Azure DevOps configuration is resolved when something
actually needs Azure DevOps, and not before — which means the kind: "config"
error naming ADO_PAT now arrives only from a verb that would have used it.
pharos issue is the exception and honestly so: it writes to both platforms in
one invocation, so it needs both credentials.
half-links.json sits beside it, and it is the only thing this CLI remembers
between runs. An adoption is written there between the work item create and
the GitHub comment and removed when the comment lands, so what survives is
exactly the set of adoptions that half-happened — the state neither platform can
be asked about, and the one a retry follows. It is never consulted for what a
link is: the marker and the hyperlink are read fresh every time, and an entry
is checked against Azure DevOps before it is believed. Delete it and you lose
nothing but one guard; $PHAROS_HALF_LINKS_FILE moves it.
Checking a machine
pharos doctor # three tiers, with a stable id per check
pharos doctor --verify # prove the credentials with real calls
pharos setup --install gh # or ask|all|libreoffice,poppler,…doctor is read-only and works before anything is configured, which is what
makes it the right first move when something behaves oddly. It prints the PATH
it searched, because a GUI-launched app inherits a minimal one and would
otherwise be told a fully provisioned machine is bare.
It is offline apart from one probe, and that probe is named rather than glossed:
gh auth status validates every token against github.com, with no flag to
stop it, so it runs only when gh is installed. Measured on gh 2.87.3, it also
reports an unreachable host as The token in keyring is invalid — a
connectivity fault worded as a credential fault. gh-auth therefore never tells
you that you are signed out; it reports both causes, because from here they are
genuinely indistinguishable.
The skill serves both agents
pharos setup --install skill installs the skill from the floh-skills
marketplace into every coding agent on the machine: Claude Code, Codex, or
both when both are found. Codex reads the same Claude-format
.claude-plugin/marketplace.json and generates its own .codex-plugin/plugin.json
from it, so one publish reaches both.
doctor reports them as two rows — skill for Claude Code, skill-codex for
Codex — and emits each only when that agent is on PATH, so a machine running one
of them does not get a column of red about the other. Publishing a new version
does not update an installed one, and the command that picks one up differs:
| agent | update |
|---|---|
| Claude Code | claude plugin update pharos@floh-skills |
| Codex | codex plugin marketplace upgrade floh-skills then codex plugin add pharos@floh-skills |
Codex needs the two because codex plugin marketplace add is a no-op once the
marketplace is configured and does not refresh the snapshot it fetched the
first time — so plugin add alone reinstalls whatever was published back then.
--install skill runs the refresh for you, and reports per agent which got it.
pharos setup --skill is something else and stays Claude-only: a personal copy
in ~/.claude/skills/, which shadows the marketplace one and stops receiving
corrections. It is for a machine that cannot use plugins, and Codex has no such
machine — codex plugin ships with the CLI.
Delegating a work item to a coding agent
pharos delegate --host vscode-insiders --agent claude \
--folder ~/Developer/widgets --text "Fetch Azure DevOps work item #4821 …"
pharos delegate --host terminal --agent codex --folder … --text … --dry-run
pharos delegate --list --host terminal --agent claude --folder … # what is running
pharos delegate --list --host all --agent claude --folder … # …in every host
pharos delegate --session 6844 --host terminal --agent claude --folder … --text …
pharos delegate --host navarch --agent claude --folder … --text … # a worker in NavarchPharos.app's Ask Agent is a GUI over this verb, the way its Command line
wizard is a GUI over doctor and setup: one detector, one launcher, and the
app renders the decoded outcome rather than parsing ps or speaking
AppleScript itself. It finds the session already running on that folder in
that host — claude agents --json for Claude, ps and lsof for Codex, the
process tree for which application owns it — and types the prompt into it, or
starts one with the prompt as its first message.
| host | how the prompt gets in |
|---|---|
| terminal | Apple Events: do script … in the tab whose tty the session holds, else a new window. macOS asks once whether the calling app may control Terminal. |
| vscode, vscode-insiders | a vscode[-insiders]://floh-solutions.pharos/delegate?… URI handled by the Pharos bridge extension — pharos setup --install vscode-bridge. Nothing else can put a prompt into VS Code from outside; the Claude Code and Codex extensions take none. |
| navarch | one JSON line on argusd's board socket — {"op":"delegate"}, the verb that needs no board todo. The daemon finds a worker on the folder, Navarch starts one if there is none, waits for a screen that can take text, and types. See below: it is the one route that can answer pending. |
Several sessions on one folder
A folder can carry more than one session of the same agent in the same app,
and only the person knows which they meant. --list is the inventory and
--session is the pick, and both read the same ranking — so the row marked
recommended is not a claim about what a plain delegate would do, it is the
row a plain delegate takes.
{ "ok": true, "sessions": [
{ "id": "6844", "name": "team-sync-6c", "agent": "claude", "host": "terminal",
"status": "idle", "detail": "Terminal tab ttys003", "recommended": true } ] }--list sends nothing, needs no prompt, and is scoped to the requested
--host — or to every host, with --host all (below). Every key on a row is
always present and never null — the app decodes
a row into a menu item, and an absent field is a decoder somebody gets wrong
once and then only on the machine where it is missing. (profile, below, is
the one deliberate exception.) id is a string
even though it is a pid today, because a Navarch id will be a worker UUID.
detail is the locator only and never repeats the status, so a caller composes
its second line as status + detail. No sessions is a normal answer: exit 0 with
[]. Only host-not-installed, agent-not-installed and folder-missing
refuse a list — notably not bridge-not-installed, because listing is
claude agents --json and ps and reads the same on a VS Code with no
extensions at all. --dry-run carries the same array.
Every host at once: --list --host all
A person with a Claude session in Terminal and another in VS Code wants both in
one list, whichever host they would start a new one in. --host all answers for
every installed host in one listing, and it is the union of --list --host
<h>: the same rows, the same ranking inside each host, hosts in the fixed
order terminal, vscode, vscode-insiders, navarch. Each row carries its
own host, and recommended is on the head of each host — the row a plain
delegate to that host would take, since there is no plain delegate to "every
host". Beside the rows, hosts says what each host answered:
{ "ok": true, "host": "all", "sessions": [ … ], "incomplete": false, "source": "daemon",
"hosts": [
{ "host": "terminal", "sessions": 2, "incomplete": false, "detail": "…" },
{ "host": "vscode", "sessions": 0, "incomplete": false,
"reason": "host-not-installed", "detail": "…" },
{ "host": "vscode-insiders", "sessions": 1, "incomplete": false, "detail": "…" },
{ "host": "navarch", "sessions": 4, "incomplete": false, "source": "daemon", "detail": "…" } ] }A host that contributed nothing it could have carries the reason its own
--list would have refused with — host-not-installed, agent-not-installed,
or whatever the Argus socket said — so there is no new vocabulary. A host whose
list may be short is incomplete on its own entry (the three pid hosts share one
detection, so a failed probe marks all three; a broken socket conversation marks
only Navarch), and the top-level incomplete is true when any is. The listing
refuses only where no host could be asked: the folder is missing, nothing is
installed, or every installed host refused for the same reason — and then with
that reason. The three pid hosts cost one ps and one claude agents --json per
registry between them, and the Navarch read runs beside it.
It is a list, and only a list. A send, a --session pick and a --status
read each go to one host, so --host all with any of them is a usage error. A
pick is sent back with the row's own host; --session new and a plain
delegate go to whichever host a new session should start in. A pharos older than
this refuses all with a usage error naming --host and the value, which is
what an app built against this one falls back on.
Sessions that run as another login
claude agents --json lists ONE config directory's sessions, and a machine has
several: the default ($CLAUDE_CONFIG_DIR, or ~/.claude), every Argus agent
account (~/.config/argus/auth/claude/<name>), and whatever CLAUDE_CONFIG_DIR
a VS Code or a session was started with — an editor opened from a shell inside
an Argus worker gives every terminal that worker's login. So Claude sessions are
read from all of them, one claude agents --json each, merged and de-duplicated
by pid, and a session found outside the default carries "profile": "floh" and
· profile floh in its detail (both absent for the default, so its rows read
as they always did). Every registry past the default is asked only when it
already holds sessions/*.json: asking one that has never run a session writes
a first-start .claude.json into it, and those directories are the fleet's
credentials. Starting a session is unchanged — the host's own environment
decides the account — but when a VS Code carries a non-default
CLAUDE_CONFIG_DIR, --list, a launch and doctor's host row all say so, with
the fix (relaunch it from the Dock). Terminal cannot be asked the same: it is an
Apple platform binary, and macOS shows ps -E none of its environment, so its
sessions are found through their own and a new window says nothing about a
login it cannot read.
Navarch, over argusd's own socket
pharos delegate --host navarch --agent claude --folder ~/Developer/widgets --text "Fetch …"
pharos delegate --host navarch --agent claude --folder … --list
pharos delegate --host navarch --agent claude --folder … --session 1958E897-… --text "…"
pharos delegate --host navarch --agent claude --folder … --gh-account alisina-tibata --text "…"
pharos delegate --host navarch --agent claude --folder … --status 89933CD2-…In Navarch neither half of the job belongs to the application alone. A worker's
terminal is held by argusd, a daemon that outlives the app; only the app
can watch a screen settle before typing into it. So the route is one JSON line
on ~/.config/argus/argus-board.sock — {"op":"delegate"} — and the two halves
split where the knowledge is: the daemon validates and finds a worker on the
folder, Navarch starts one if there is none, waits for an input box and types.
It is also the one route that needs no board todo, which every other operator
action in Argus does. That is the whole reason the verb exists: the work item
is the todo, and it lives in Azure DevOps. The hand-off is recorded on a
hidden scratch pad instead, reported as delegation.todo.
pending is a successful answer, and a --status read is the other half of
it. On the default autonomy dial the first hand-off on a machine raises an
approval card in Navarch, and the daemon answers the moment it goes up rather
than holding a CLI on somebody who is in another app:
{ "ok": true, "action": "pending", "host": "navarch", "session": null,
"detail": "Navarch is asking you to approve this hand-off …",
"delegation": { "request": "270005F8-…", "worker": null, "name": null,
"created": false, "todo": 2 } }worker and name are null rather than "" because nothing has been typed
yet — "we have not got a worker" and "the worker is the empty string" are
different facts. Pass delegation.request back as --status <request> to turn
that into sent, launched, declined or delivery-failed; argus keeps the
row for an hour, sized for a person at lunch rather than for a poll.
The socket adds ten reason ids, and they are separate because each names a
different fix:
| reason | what is true | the fix |
|---|---|---|
| argusd-not-running | nothing is listening on the socket | open Navarch; argusd comes with it |
| argusd-outdated | argusd is running and predates the verb | reload it — deliberately, it ends every live session |
| navarch-not-running | argusd is up, the app is not | open Navarch |
| unsupported | Navarch is running and is an older build | update it (make-app.sh --install) |
| declined | a person said no at the card | nothing to fix |
| delivery-failed | Navarch reached the worker and nothing landed — a trust dialog, a blank screen | look at the pane, then delegate again |
| rate-limited | twelve operator writes a minute, and this was the thirteenth | wait a minute |
| not-an-operator | the gate refused the stamp pharos sets on every request | almost always a daemon that predates it |
| request-unknown | --status for an id this core does not hold | it aged out, or was made elsewhere |
| gh-account-unknown | --gh-account named an identity this core has never heard of, and a worker would be started | add it in Navarch ▸ Accounts, or pass a spelling it knows — the refusal lists them |
argusd-outdated is the one to expect first, and it is not a bug: argusd
outliving the app is the feature that keeps sessions alive across a restart, so
master, the installed app and the running daemon drift independently. It is also
the one that has to be inferred rather than read. reason arrived with the
verb, so a daemon too old to serve delegate is too old to stamp one — and it
says three different things, two of which blame the caller:
{"ok":false,"error":"unknown op 'delegate' — see argus-board help …"}
{"ok":false,"error":"delegate requires a \"todo\" (id) — the work it serves"}The second is the trap. An old daemon forwards any verb the attached app claims
it can run, and that forwarder demands the board todo this verb exists to do
without — so a correct delegation is refused for not carrying one, and a caller
that believed the message would go and add it. The tell is the missing
reason key, never the prose.
--list asks delegate_candidates — the find, asked rather than
performed (argus #1402). The rows are argusd's own answer to its own
question, ranked by its own rule: not exited, the right kind, local, not
holding a board mission, and not an Argus Agent — an operator is a claude
worker with no mission sitting in a base checkout, which is exactly the folder
a person links in Pharos, and delegating into it would hand the work item to
the thing that drives the fleet. Ties break on starting last and then on
ascending UUID, never on status, so two calls a second apart name the same
pane. recommended is the daemon's own target. A row's id is the worker
UUID, its status is the contract's idle/busy/unknown — with
needs_input reported busy, because a worker on a trust dialog is idle
by every measure except the one that matters.
The answer carries source, which is not a footnote:
| source | what the list is | what --session / --gh-account do |
|---|---|---|
| daemon | delegate_candidates — a row it offered is a row it accepts | honoured |
| fleet_status | this CLI's own reading, a prediction of the find | refused argusd-outdated |
An argusd that predates #1402 answers the read unknown-op, and fleet_status
answers on every generation of argusd — so the list is still worth serving,
and it is served with source: "fleet_status" and a sentence saying the pick
cannot be honoured against that daemon. One that predates delegate itself
carries no reason key at all, and that is argusd-outdated: listing workers
a send is about to refuse to touch would hand the app a menu of picks that can
only fail.
Two things the route does not do. It never pre-checks the agent on PATH:
argusd spawns the worker from the app's own login shell, and a GUI-launched
Pharos has roughly /usr/bin:/bin, so a check here would refuse nearly every
real call while reporting a fact about the wrong process. And it never folds a
multi-line prompt into one line — the receiving TUI submits on Enter and Navarch
owns that Enter, so several lines is a usage error rather than a rewrite nobody
proof-read.
Picking a worker, and the daemon that would ignore the pick
--session <uuid> travels as the op's worker, and --session new as
worker: "new" — a fresh worker even where the find would have had one. The
CLI does not re-check the pick before sending it: argusd validates worker
against the very predicate delegate_candidates listed from, so one rule
serves the find, the list and the validation, and a second copy here could only
disagree with it. A row the read offered is a row the send accepts.
A pick it will not take comes back as session-gone, keeping argusd's own
sentence — which names which of six it was: has exited, is an Argus Agent,
is holding mission #N, is a codex worker, not claude, is on ax52, not on
this Mac, is in … , not in …. That is the same fact and the same fix as a
vanished pid on Terminal, so it is the same word. (session-not-targetable was
this route's own refusal and is gone from the closed set — it meant the op
could not express a target at all, and it can.)
A daemon that predates #1402 does not refuse these flags — it ignores them.
delegate reads the keys it knows and discards the rest, so a worker it has
never heard of is dropped, the find runs anyway, and the answer is sent about
a pane nobody chose; a gh_account is dropped the same way and the worker
starts as whoever gh was last logged in as. Nothing in the reply says either
happened. So --session and --gh-account ask delegate_candidates first —
it landed in the same change, so serving it is proof both fields are read — and
refuse argusd-outdated with nothing sent when it is not served. pharos
doctor's argus-delegate row reports the same fact before anybody hits it.
The GitHub account a started worker runs as
pharos delegate --host navarch --agent claude --folder … \
--gh-account alisina-tibata --text "Fetch Azure DevOps work item #4821 …"--gh-account takes a GitHub login, or the label of an account bound in
Navarch — argusd resolves it against its own accounts.json, label first and
then login, case-insensitively and read fresh on every call. Two spellings
because two systems name one identity differently: Navarch knows a label a
human picked, and a caller outside Argus knows the login. The flag is held to a
login-shaped token (no spaces), so a label containing a space cannot be named
through it — pass the login, which always resolves.
Three rules, all argusd's:
- A worker it STARTS runs as that account. An account it does not know is
refused
gh-account-unknown, never substituted — a worker with no binding runs as whateverghwas last logged in as, and a hand-off that commits under the wrong identity is the failure the resolution exists to prevent. The refusal lists every label and login the core holds. - A prompt that lands in a worker already running leaves its account alone, and says so in the reply: a session already on the project is already running as somebody, and re-checking would refuse hand-offs that are perfectly fine.
- There is no fallback, in either direction.
On terminal, vscode and vscode-insiders the flag is accepted, ignored,
and said to be — those hosts hand the prompt to a session in an app that is
already running as whoever this machine is logged in as, and only Navarch
starts a session on your behalf. An empty --gh-account "" is a usage error
rather than "no account asked for": a caller whose variable came out empty must
not silently get the wrong identity.
Picking one of several
--session <id> delivers to exactly that session and never falls back: a
pick that no longer matches is session-gone, not a new window. That covers
the session exiting between the list and the send, and a Terminal tab closed
while the process still reads as Terminal's — the one case no pre-check can
catch, because only Terminal knows its own tabs. The refusal says which it is,
including when the pid is alive under a different host. --session new is
the reserved opposite: start a fresh session even though live ones exist. A
malformed id is a usage error rather than session-gone, because the latter is
a fact about the machine and would tell somebody their session had died when it
never existed.
On Navarch the pick is a worker UUID and travels as the op's own worker — see
Picking a worker above. On the VS Code hosts it travels in the URI as
session=<pid>, and the bridge honours it — from 0.2.0. An older bridge refuses any query key it
does not know, so it would reject the whole URI and send nothing; --session
against one is therefore refused bridge-not-installed here rather than
reported as sent, and pharos doctor marks such a bridge not ok so the wizard
offers the upgrade. Delegating without --session works on either.
Success is { ok: true, action: "sent" | "launched" | "pending", session,
detail } — pending only on navarch, where it carries a delegation block.
A refusal is { ok: false, reason, detail } on stdout with exit 2, reason
being one of host-not-installed, agent-not-installed,
bridge-not-installed, automation-denied, folder-missing, unsupported,
session-gone, plus the Argus socket's ten tabulated above — stable ids,
because the app renders facts. session-not-targetable is no longer one of
them: it meant the delegate op could not name a worker, which stopped being
true with argus #1402, and a dead id in a closed set is a fix the app builds
for a state that cannot happen. pharos doctor carries the rows behind them:
terminal, vscode, vscode-insiders, navarch, claude, codex, per
installed VS Code flavour <host>-claude-ext, <host>-codex-ext,
<host>-bridge, and — only where Navarch is installed — argus-delegate, which
asks the running argusd whether it serves the verb, and then whether it
also reads a target worker and a GitHub account. That last one is a row
of its own because argusd outlives the app: a current Navarch in /Applications
and a daemon from last week are an ordinary state, and the daemon is what
decides. It offers no install, because the fix is a reload that ends every live
worker session and is a person's to time. The agents are reported, never installed:
a coding agent is the person's login.
Resuming an older conversation
pharos conversations # what ran in this folder, both agents
pharos conversations --all --agent codex --include-unavailable
pharos delegate --resume claude:<id> --host terminal --text "…"
pharos delegate --resume codex:<id> --host vscode-insiders --text "…" --dry-run"one thing both miss and can easily add, is fetch all conversations and resume
one from the native UI" — @user (#1520). Pharos.app's "Load conversations…"
window is a GUI over these two verbs, and Navarch's New Worker dropdown reads the
same stores in Swift. Two readers in two languages stay one reader because
they share one contract and one fixture set (#1526: canonical in argus
packages/navarch-protocol/Tests/NavarchProtocolTests/Fixtures/conversations,
vendored here by scripts/sync-navarch-protocol.sh). The record is the
contract's, spelled snake_case because conversations.list on the Navarch wire
carries it verbatim:
tool, id, name, first_prompt, cwd, created_at, updated_at, turns, git_branch?, model?,
profile {dir, source}, host, entrypoint, live, pid?, archived, resumable, reason?Optional keys are omitted, never null; reason is present exactly when
resumable is false and is the first of live, live-unknown, archived,
cwd-gone that applies; dates are whole seconds with Z.
What is read. Only the profile this shell runs as —
CLAUDE_CONFIG_DIR / CODEX_HOME, else ~/.claude / ~/.codex — because a
conversation lives in the config directory it was made under and is invisible to
a resume under another. The accounts Navarch holds are Argus's to list. Claude:
projects/<slug>/<uuid>.jsonl, the folder from the FIRST record carrying
cwd (the slug is lossy and cut at 200 characters, and a later record carries
wherever the Bash tool cd'd to), the name from the last custom-title, else
the last ai-title, else the first prompt. Codex: state_5.sqlite › threads
for every field it has, a rollout found by id under sessions/ or
archived_sessions/ (a thread whose rollout is gone is not a conversation),
thread_history_1.sqlite for turns, and session_index.jsonl for nothing. The
full rules, and the measurements behind each, are the file comments of
src/conversations/.
Live is decided one way. Claude: claude agents --json under the same
profile, and kill(pid, 0) on the pid it names — a registration whose process
is gone is stale. Codex: the process holding
<CODEX_HOME>/thread-writer-locks/<id>.lock open (lsof), and kill(pid, 0) —
a lock file nobody holds is a crash's leftover. A probe that cannot be asked
makes that store live-unknown, never resumable.
Per folder by default, --all lifts it. Hidden unless asked for, and
counted in hidden: a folder that is gone and an archived thread
(--include-unavailable), and the sdk-cli and codex exec runs
(--include-noninteractive). A live one is always listed: it is the one a
person most likely means, and the route to it is --session <pid>.
--resume opens a NEW process on the conversation — never types into a
running one — claude --resume <id> or codex resume <id>, in the recorded
folder, with the profile reproduced both ways: env sets the variable to the
string verbatim (Claude Code keys its login on a hash of it), default removes
it (a Terminal or an editor started from another account's shell would
otherwise pass that account's on). The prompt follows --. In Terminal that is
a new window; in VS Code it is the bridge, from 0.4.0, which takes
resume=<tool>:<id> and a profile= only for env — an older bridge would
reject the whole URI, so it is refused bridge-not-installed rather than
reported as opened. Success is action: "resumed" with the conversation.
The bridge runs a profile only when it is ~/.claude / ~/.codex, an Argus
account under ~/.config/argus/auth/<agent>/, the one that VS Code was started
with, or listed in its pharos.allowedProfiles User setting — a vscode://
link can be opened by anything, so a shell whose own CLAUDE_CONFIG_DIR /
CODEX_HOME is none of those allowlists it there once, and until then VS Code
refuses the resume (profile-not-allowed) and says what to add.
| refusal | what it means |
|---|---|
| conversation-live | it is running — a resume would put a second writer on one transcript. Carries route: {host, session, typeable}: send there with --session |
| live-unknown | whether it is running could not be asked, and a resume never proceeds on "could not check" |
| conversation-archived | Codex refuses an archived thread — codex unarchive <id> first |
| cwd-gone | its folder is not there. A resume from any other folder succeeds and quietly moves the conversation, so none is substituted — --folder, if given, must be the recorded one |
| conversation-unknown | no such id in this profile's store, or it is an agent's own sidechain or subagent thread |
| profile-missing | the profile this shell resolves to has no store |
Navarch is unsupported for now: its route resumes over the handover wire,
which gains a resume target in navarch-protocol 0.5.0 (#1527).
Requirements
Node 22 or later. gh for the GitHub bridge, and nothing else is required.
pharos delegate is macOS only: its hosts are macOS applications.
