Guides
Sync & advise
The start-of-session sync call, what it returns, how to present it — and advise, which proposes setup changes for your harness.
Sync — once per session
codexguild_sync (MCP) / POST /agents/me/sync (REST) answers one question: what changed that matters to this project since I last looked?
curl -s -X POST https://api.codexguild.com/v1/agents/me/sync \
-H "Authorization: Bearer $CODEXGUILD_API_KEY" -H "content-type: application/json" \
-d '{
"stack": [{"name":"next","version":"15.3.0"},{"name":"@prisma/client","version":"6.19.0"}],
"installedSkills": ["frontend-design","mcp-builder"]
}'| Field | Type | Notes |
|---|---|---|
stack | {name, version?, ecosystem?, runtime?}[] (≤300) | Dependency names and versions only — the exact installed version from the lockfile, not the range in package.json. A range (^15.3.0, >=2.31) is checked at its floor and its vulnerabilities come back as unconfirmed (rangeFloor: true). The local MCP server reads the lockfiles for you. ecosystem is npm (default), pypi, go or cargo — send pypi for Python packages so PyPI openai gets the Python SDK's releases, not the npm one's. runtime: true marks the Node/Python version from .nvmrc/.tool-versions/engines. A package may appear once per version (monorepo apps on different lines). Omit stack to reuse the last reported one. |
installedSkills | string[] (≤500) | Names of skills in your skills folders. |
since | ISO date or datetime | Defaults to your last refresh of this project; 30 days on the first one. Implies a refresh. |
force | boolean | Full refresh now, regardless of the refresh frequency (before a dependency upgrade, or when you ask): the last 30 days, not just what changed since the previous call. |
project | string (≤120) | Which project this is — e.g. the repository name. Each project keeps its own window, stack and refresh schedule, so one agent can switch between repositories without missing releases. The local MCP server sends <repo>#<path hash>. |
Refresh frequency
Call sync at the start of every session. You choose per agent, in the dashboard (Agents → Refresh), how often it
gets a full refresh: every session, daily (default), weekly, every 15 days or monthly. Between refreshes sync answers
"mode": "up_to_date" with nextRefreshAt and only urgent items (urgent.advisories: new security advisories;
urgent.flaggedSkills: installed skills that are flagged) — so it costs a few tokens and no
freshness quota. A new dependency in stack, since or force
triggers a refresh early. Independently, the dashboard Alerts inbox gets new advisories, breaking releases and
flagged skills that match your agents' stacks within the hour.
Package names are normalized to topics: next → nextjs, @nestjs/core → nestjs, @prisma/client → prisma.
Client libraries never borrow a server's topic (ioredis is not the Redis server), @types/* say nothing about the
runtime version, and a scope maps only when it is one product (@nestjs/* yes, @tanstack/* or @microsoft/* no).
Knowledge and recommended skills come only from topics CodexGuild tracks or maps on purpose — a utility package such as
compression is not what your project is "about".
Response
{
"mode": "refresh", "reason": "due", "frequency": "DAILY", "nextRefreshAt": "2026-09-30T08:00:00.000Z",
"syncedAt": "2026-09-29T08:00:00.000Z",
"since": "2026-08-30T08:00:00.000Z",
"firstSync": false,
"project": "web#2de98254",
"stack": { "deps": 42, "exactVersions": 40, "rangeVersions": 2, "trackedTopics": ["nextjs", "prisma"], "untrackedTopics": ["zod"] },
"freshness": [{
"topic": "nextjs", "yourVersion": "15.3.0", "total": 12, "breaking": 1,
"changes": [{ "title": "v16.0.0", "versionTag": "v16.0.0", "breaking": true, "asOf": "…", "url": "…" }],
"deprecations": [{ "kind": "removed", "text": "…", "replacement": "…", "versionTag": "v16.0.0" }]
}],
"security": {
"installedSkills": [{ "slug": "…", "name": "mcp-builder", "securityStatus": "passed", "counts": {}, "stale": false }],
"unknownSkills": ["my-private-skill"],
"advisories": [{ "slug": "…", "title": "…", "summaryMd": "…", "asOfDate": "…" }],
"vulnerabilities": [{
"package": "next", "ecosystem": "npm", "version": "16.2.6", "rangeFloor": false,
"advisories": [{ "id": "GHSA-2xp9-vwfh-vxw4", "aliases": ["CVE-…"], "severity": "critical", "published": "2026-09-08T…",
"fixedIn": "16.3.3", "noFix": false, "malicious": false, "summary": "Unauthenticated RCE in Image Optimization…", "url": "https://osv.dev/…" }]
}]
},
"kb": [{ "slug": "…", "title": "…", "asOfDate": "…" }],
"recommendedSkills": [{ "slug": "…", "name": "…", "category": "frontend", "matches": ["nextjs"], "installCommand": "…" }],
"securitySkills": [{ "name": "codexguild-secure-nextjs", "reason": "…", "matches": ["nextjs"], "installed": false, "url": "…" }]
}How your agent should present it
Keep it short and actionable:
- Vulnerabilities in installed versions — the fix version is for the line the project is on (
16.2.6→16.3.3, not15.5.24);noFixmeans there is no fixed release at all (pick a maintained alternative). Entries withrangeFloor: trueare unconfirmed: check the lockfile before reporting them. - Possibly-breaking releases for the project's stack, with
yourVersionso the user can tell "patch for my line" from "next major". - Installed skills that are
flaggedorwarn, orstale(its source repository has had no commits for roughly ten months or more — likely unmaintained). - New advisories for coding agents.
- Recommendations only if the user asks — install them with
codexguild_skill_install, which gives a byte-verified recipe — never install automatically.
Tip: unknownSkills are skills CodexGuild has never seen (private or local). Run codexguild_scan_skills from the local MCP server to audit them offline.
A sync refresh counts as one freshness call against your daily quota; an "up_to_date" answer is free. Advise also counts as one freshness call.
Advise — set the agent up
codexguild_advise / POST /agents/me/advise returns proposals, never changes:
curl -s -X POST https://api.codexguild.com/v1/agents/me/advise \
-H "Authorization: Bearer $CODEXGUILD_API_KEY" -H "content-type: application/json" \
-d '{"harness":"claude-code","existingInstructionFiles":["CLAUDE.md"]}'{
"approvalRequired": true,
"howToApply": ["…"],
"proposals": [
{ "kind": "mcp-server", "file": ".mcp.json", "snippet": "…", "cli": "claude mcp add …" },
{ "kind": "skill-install", "skill": "codexguild", "targetDir": "~/.claude/skills", "command": "…" },
{ "kind": "instructions-block", "file": "CLAUDE.md", "begin": "<!-- codexguild:begin v1 …", "end": "<!-- codexguild:end -->", "content": "…" },
{ "kind": "hooks", "file": "~/.claude/settings.json", "snippet": "{ \"hooks\": { … } }" }
]
}| Proposal | What applying it means |
|---|---|
mcp-server | add the CodexGuild server to the harness's MCP config |
skill-install | the codexguild skill, scan-passed skills that match the stack, and the must-have kit on every stack: caveman (token saver) and Cloudflare's security-audit (full security audit on request) — each only while its scan passes |
instructions-block | a marked section for the instruction file your harness actually loads |
hooks | Claude Code / OpenClaude only: hooks that make CodexGuild automatic — see below |
Warning: Your agent must show each proposal to the user and apply only the approved ones. instructions-block replaces only the text between the markers; if the markers are missing it appends at the end. Identity files (SOUL.md, IDENTITY.md, USER.md, MEMORY.md) are never targets.
Automatic hooks (Claude Code, OpenClaude)
Instructions ask the agent to call CodexGuild; hooks make sure it happens. codexguild_advise proposes these for
~/.claude/settings.json (OpenClaude: ~/.openclaude/settings.json):
{
"hooks": {
"SessionStart": [{ "matcher": "startup|resume|clear|compact", "hooks": [{ "type": "command", "command": "npx -y @codexguild/mcp@latest hook session-start", "timeout": 30 }] }],
"PostToolUseFailure": [{ "matcher": "Bash", "hooks": [{ "type": "command", "command": "npx -y @codexguild/mcp@latest hook tool-failure", "timeout": 30 }] }],
"PreCompact": [{ "hooks": [{ "type": "command", "command": "npx -y @codexguild/mcp@latest hook pre-compact", "timeout": 10 }] }],
"Stop": [{ "hooks": [{ "type": "command", "command": "npx -y @codexguild/mcp@latest hook stop", "timeout": 10 }] }],
"PreToolUse": [
{ "matcher": "Bash|Write|Edit|MultiEdit", "hooks": [{ "type": "command", "command": "npx -y @codexguild/mcp@latest guard", "timeout": 20 }] },
{ "matcher": "Write|Edit|MultiEdit", "hooks": [{ "type": "command", "command": "npx -y @codexguild/mcp@latest hook pre-write", "timeout": 20 }] }
]
}
}| Hook | What the agent gets |
|---|---|
hook session-start | the sync digest and this repository's agent notes at the start of every session — and again right after the context is compacted, with a reminder to save the session's lessons as notes |
hook pre-write | before a file is written: an API removed in the versions the project runs blocks the write, with the replacement and the release notes — the agent rewrites it instead of finding out from a failed build. Deprecated APIs only add a warning. Only APIs the write introduces count, and the same block happens once per session (a deliberate retry goes through with a warning). The project's deprecation list is cached for 6 hours, so the check is local and fast. It also warns on vulnerability patterns the write adds, and the first time a session writes an endpoint, a query, auth code, an upload or an outbound request it gets the short checklist for that kind of code and the security skill to read (local, works without a key) |
hook tool-failure | when a shell command fails with a real error, the known causes and fixes for your versions (codexguild_debug) — at most 3 lookups a session, never the same error twice, nothing when there's no known fix. The third time the same error comes back it also says stop: the commands that hit it, try another approach or ask you (works without a key) |
hook stop | first the done-gate: when the agent changed project code and ran nothing that checks it after the last change, it is asked once to run the project's checks (named for it) or say what it couldn't verify (tune-up, from 1.12.0; CODEXGUILD_DONE_GATE=off disables it). Otherwise, at the end of a turn that hit real errors: asks once whether what fixed them is worth an agent note (saved with the original error, which can feed the shared fix pool). Local only, at most twice a session |
hook pre-compact | tells the summarizer to keep corrections, decisions and exact versions (OpenClaude passes this to its summarizer; Claude Code doesn't) |
guard | package and destructive-command checks before a command runs (command guard) |
The hooks use CODEXGUILD_API_KEY from the environment, or the key in your harness's MCP config. Like the MCP server,
they send package names and versions, the repository's git remote and (for a failed command) the error text — never
file contents (pre-write checks the new code on your machine). Set CODEXGUILD_HOOK_DEBUG=1 to see on stderr why a hook stayed silent. If anything fails, they stay silent and the session carries on. Automatic lookups count against your
daily error lookups.