codegraph
The built-in Policy codegraph, against a checkout that loads another checkout’s packages, a stale worktree, a full disk: its defaults, its options and a configuration that writes it.
To learn what it guards against and see it at work, read the guide: Session start.
Defaults
| Default | Value |
|---|---|
| On by default | no: an entry turns it on |
| Fail mode | open |
| Timeout | 9000 ms |
| Events | PreToolUse, SessionStart |
| Tools | mcp__codegraph__codegraph_explore |
| Agent types | every agent, or as its options set |
Options
| Option | Type | Default | Description |
|---|---|---|---|
bin | string | — | The codegraph command, relative to the checkout the session works in or absolute; node_modules/.bin/codegraph, the checkout's own, when absent. |
context | boolean | — | Whether a synced index adds the context that tells the agent to ask CodeGraph first (true when absent); a skipped or failed sync is reported either way. |
deadlineMillis | integer | — | How long the sync may take, in milliseconds, before the session starts (or stops) without it (6000 when absent). |
debounceMillis | integer | — | How long after a sync at a stop the next stop of the session skips the sync, in milliseconds (60000 when absent); it applies only with syncAtStop. |
installCommand | string | — | The command the skip note tells the agent to run; the project's package manager's (npm ci, pnpm install --frozen-lockfile) when absent. |
syncAtStop | boolean | — | Whether a stop of a session that touched files syncs the checkout's index, so the next session or subagent reads it current without a CodeGraph MCP server watching it (false when absent); a failed sync lets the stop through. |
Example
A configuration that writes every option, a comment above each:
import { defineConfig } from '@microeinhundert/harness-kit';
export default defineConfig({
// The Policy entries, in the order their Decisions merge in.
policies: [
{
// The Policy's name, unique in the configuration; messages and logs name the Policy by it.
id: 'codegraph',
// The constructor's options, which it decodes.
options: {
// The `codegraph` command, relative to the checkout the session works in or absolute;
// `node_modules/.bin/codegraph`, the checkout's own, when absent.
bin: 'node_modules/.bin/codegraph',
// Whether a synced index adds the context that tells the agent to ask CodeGraph first
// (`true` when absent); a skipped or failed sync is reported either way.
context: true,
// How long the sync may take, in milliseconds, before the session starts (or stops) without
// it (6000 when absent).
deadlineMillis: 1,
// How long after a sync at a stop the next stop of the session skips the sync, in
// milliseconds (60000 when absent); it applies only with `syncAtStop`.
debounceMillis: 1,
// The command the skip note tells the agent to run; the project's package manager's
// (`npm ci`, `pnpm install --frozen-lockfile`) when absent.
installCommand: 'npm ci',
// Whether a stop of a session that touched files syncs the checkout's index, so the next
// session or subagent reads it current without a CodeGraph MCP server watching it (`false`
// when absent); a failed sync lets the stop through.
syncAtStop: true,
},
// The name of the kit's Policy constructor that builds the Policy.
use: 'codegraph',
},
],
});tracker-fields
The built-in Policy tracker-fields, against a turn that ends with failing lint, unsaved work or an incomplete hand-off: its defaults, its options and a configuration that writes it.
workspace-links
The built-in Policy workspace-links, against a checkout that loads another checkout’s packages, a stale worktree, a full disk: its defaults, its options and a configuration that writes it.