The Halyard CLI scaffolds MCP client configs and syncs your coding-session logs back to Halyard as knowledge. For developers who want to wire up multiple clients at once, or feed agent sessions into the knowledge base. It is one on-ramp among several — you can also configure each client by hand from its own page.
Install
Section titled “Install”The package is @halyard/cli and the binary is halyard. Install it globally, or run it once without installing:
npm i -g @halyard/clipnpm dlx @halyard/cliAuthenticate
Section titled “Authenticate”halyard loginlogin runs a browser-based PKCE OAuth flow with a callback on 127.0.0.1, so the browser must be on the same machine; it gives up after two minutes. It stores your credentials in ~/.halyard/credentials.json (or, inside a repo that is already bound, in ~/.halyard/credentials/<orgId>.json for that organization). Credentials for a different organization than a repo’s binding are refused.
On a machine without a browser — an SSH dev box, a container, CI — use an API key instead. Mint one (it is printed once, and is bound to one organization), then set it:
halyard api-keys create --name "my-repo-devbox"export HALYARD_TOKEN=sk_halyard_…HALYARD_TOKEN takes precedence over stored logins. The upload hooks also read it from the repo’s .env. The machine needs outbound HTTPS to api.usehalyard.ai.
Set up the repo
Section titled “Set up the repo”After logging in, run this in the repo:
halyard setupsetup binds the repo to the organization you are logged in to, so you don’t need to know its slug. If you belong to several organizations it asks which one; without a terminal (scripts, CI) it lists them and you re-run with --org <your-org-slug>. Pass --org yourself to choose explicitly, or to bind before logging in. A repo that is already bound keeps its binding.
setup (alias init) merges Halyard into existing config without overwriting other entries:
| Target | What setup writes |
|---|---|
| Repo | .halyard.json with the org binding and the .halyard/hook.sh upload launcher |
| Claude Code | Adds the halyard-labs plugin marketplace and enables halyard@halyard-labs in .claude/settings.json, plus session hooks |
| Cursor | Upserts halyard in .cursor/mcp.json, preserving existing servers, plus session hooks |
| Codex | Adds [mcp_servers.halyard] to ~/.codex/config.toml (when Codex is installed), plus session hooks |
The session hooks for every client are listed under Upload every session automatically. Preview the changes without writing anything:
halyard setup --dry-run--no-hooks skips the launcher and hook files, and --force rebinds a repo already bound to a different organization. Commit the generated files so every clone gets the same setup.
Sync session logs
Section titled “Sync session logs”halyard syncsync discovers local coding-agent sessions, uploads them, and Halyard turns each one into searchable knowledge plus a per-person work imprint — cost (USD), turns, duration, token usage, and tool activity land as an agent_session_completed work event alongside your PRs and tickets. It tracks what it has already sent in ~/.halyard/sync-state.json so re-runs only pick up new or changed sessions.
Supported clients:
| Client | Where sessions are read from | Metrics captured |
|---|---|---|
| Claude Code | ~/.claude/projects/**/*.jsonl | Cost, turns, duration, tokens (incl. cache), tools |
| Codex CLI | ~/.codex/sessions/ | Cost, turns, duration, tokens, tools |
| Gemini CLI | ~/.gemini/tmp/<project>/chats/ | Cost, turns, duration, tokens (incl. cache), tools |
| OpenCode | Local OpenCode store, via opencode export | Cost (as computed by OpenCode), turns, duration, tokens, tools |
| GitHub Copilot CLI | ~/.copilot/session-store.db (needs Node ≥ 22.13) | Turns, duration, tokens, tools; cost where the model is priced |
Cost is computed server-side from per-model token counts using a maintained pricing table (the same LiteLLM catalog the wider ecosystem uses); when a client reports its own cost (OpenCode), that figure wins. Models missing from the table are surfaced in the session’s metadata rather than silently priced at zero-ish guesses.
Not supported: Cursor (its local store carries no token or cost data), Windsurf (no local transcript store), and Amp (cloud-first storage). Anything else can still be pushed with --provider other.
Flags:
--provider— limit the sync to one provider’s sessions (claude,codex,gemini,opencode,copilot)--dry-run— show what would be ingested without sending anything
Push a single session
Section titled “Push a single session”halyard push <file> --provider <provider> --session-id <id>push ingests one session file directly. Both sync and push send to the ingest endpoint /api/v1/sessions/ingest.
Upload every session automatically
Section titled “Upload every session automatically”halyard setupsetup writes a launcher, .halyard/hook.sh, and session-start / session-end hook config for Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot CLI, OpenCode and Grok Build. Each hook runs halyard hook, which uploads the transcript that just finished at session end and, at session start, sweeps the repo’s earlier transcripts that never uploaded. Commit the generated files and every clone of the repo gets the behaviour; re-running setup is idempotent.
| Client | Hook config written |
|---|---|
| Claude Code | .claude/settings.json |
| Codex | .codex/hooks.json |
| Cursor | .cursor/hooks.json |
| Gemini CLI | .gemini/settings.json |
| GitHub Copilot CLI | .github/hooks/halyard-session-upload.json |
| OpenCode | .opencode/plugins/halyard-session-upload.ts |
| Grok Build | .grok/hooks/halyard-session-upload.json |
halyard hook authenticates with HALYARD_TOKEN (environment, then the repo’s .env) or halyard login, and refuses login credentials scoped to another organization than the repo’s .halyard.json binding. It never blocks the agent and logs to ~/.halyard/hooks.log.
Upload happens at session end, not on every turn: the ingest endpoint keeps the first upload it sees for a session id, so a mid-session upload would freeze the session at that point.
The Halyard plugin for Claude Code and Codex runs the same command for any repo that enables the plugin.
Cloud and CI
Section titled “Cloud and CI”Set HALYARD_TOKEN to an API key in the environment. Keys are bound to one organization, so mint one per environment:
halyard api-keys create --name "my-repo-claude-web"| Environment | Where to set HALYARD_TOKEN |
|---|---|
| Claude Code on the web | The repo’s environment → Environment variables |
| Codex Cloud | Environment variables (not Secrets — those are removed before the agent runs) |
| Cursor cloud agents | Dashboard → Cloud Agents → Secrets |
| GitHub Copilot coding agent | Repo settings → Secrets and variables → Agents |
| GitHub Actions and other CI | secrets.HALYARD_TOKEN, plus a final if: always() step that runs halyard sync |
Write knowledge entries
Section titled “Write knowledge entries”Scripts and CI can write knowledge directly — a decision, a process note, or a work stream with its scope rules — using the same API key:
halyard knowledge create --type DECISION --title "Retry ingest 3x" --content-file decision.mdhalyard knowledge apply -f stream.json # same fields as the MCP upsert_knowledge toolRe-applying a spec never duplicates scope rules, so it’s safe to run on every deploy. Entries written with an API key wait in the inbox for review unless you pass --filed; work streams (admin keys only) are always filed.
Verify
Section titled “Verify”Check the CLI side first:
halyard whoami # your user, organization, and the repo bindinghalyard sync --dry-run # lists the sessions it would upload; fails if not authenticatedThen open a configured client and ask the agent to identify you. The MCP connection authenticates separately (OAuth on first use), so expect a sign-in prompt there even after halyard login:
Use Halyard to tell me who I am.Expect a whoami call returning your user and organization. If the tools do not appear, see Troubleshooting.