Repository navigation
Description
What this is
Not urgent — capturing the idea and what's already been verified about it, not a fully-specified task yet.
The conflict journal (ADR-068) and its pull-based CLI/agent query surface (#2537) let an agent check for open sync conflicts if it thinks to ask. This issue is about a push complement: proactively surfacing "NodeSpace has open sync conflicts" into an agent's session at start, via each harness's own session-lifecycle hook mechanism, piggybacking on the skill installer's existing footprint in each harness's config directory.
Mechanism, precisely (verified against real harness docs, not guessed): this is not a persistent event listener or a live callback connection. It's a spawn-and-inject callback — you register a shell command in the harness's own config file (e.g. .claude/settings.json's SessionStart hooks array), the harness spawns that command as a one-shot subprocess whenever the lifecycle event fires (session start/resume/clear/etc.), the subprocess does its check and writes a result to stdout, and the harness injects that stdout directly into the agent's context for that turn. Stateless per invocation — no daemon-side listener, no persistent connection.
Verified harness support (real documentation, not inferred)
- Claude Code — confirmed.
SessionStartevent, config at~/.claude/settings.json(user) or.claude/settings.json(project, committable), hooks merge across levels rather than requiring exclusive ownership, stdout explicitly documented as injected into context. - Codex CLI — confirmed. Full lifecycle hook set including
SessionStart, config viahooks.jsonorconfig.toml, stdout added as "extra developer context." Reached general availability per OpenAI's announcement. - Antigravity CLI (the harness NodeSpace is migrating to per Replace Gemini CLI with Antigravity CLI as a supported PTY agent #2473, superseding Gemini CLI) — confirmed absent. Its documented hook set is
PreToolUse/PostToolUse/PreInvocation/PostInvocation/Stop— no session-start-equivalent at all. Not weaker, genuinely missing. (Gemini CLI, the predecessor, does have a realSessionStarthook — irrelevant since NodeSpace is moving away from it.) - OpenCode — confirmed no, not just unverified. The exact feature was requested (
anomalyco/opencode#5409) and closed by maintainers as "not planned." The closest existing event (session.created) fires lazily on first prompt, not process start, and has open reliability issues. - Pi — has a real
session_startevent and a plausible context-injection API (pi.sendMessage()), less thoroughly verified than the above two. Excluded here regardless, since Pi isn't in the skill installer'sAGENTSlist at all yet (Pi is a spawnable PTY agent but gets no skill install (missing from AGENTS list) #2539) — hook support on a harness without base skill install would be solving things out of order.
Scope this to Claude Code and Codex only, when it's picked up. Revisit Antigravity/OpenCode/Pi individually if their situations change (a documented hook lands, a maintainer reverses course, #2539 ships).
Key risks that must shape the design, not be left to implementation-time judgment
- Global hook, unrelated work. These hooks register at the user/global config level, not per-project. The hook script itself must cheaply check NodeSpace relevance (is this a NodeSpace project? is
nodespaceon PATH? does CWD or an ancestor have a NodeSpace marker?) and exit silently (no output, exit 0) if not relevant — first thing it does, before anything else. - Latency on every session start, including sessions with nothing to do with NodeSpace. The relevance check must short-circuit before spawning the
nodespacebinary where possible. The actual conflict-check call needs a hard, short timeout (~1-2s, not the ~30s pattern used elsewhere) and must fail silent/open on timeout — never block or error session start. - Multiple local NodeSpace databases (per ADR-053, one daemon can serve several DBs). The hook must resolve the same DB the CLI/daemon would resolve for the current working directory/session context — reuse that resolution, don't invent a separate one. Otherwise it'll surface conflicts from an unrelated database.
- Naming collision:
packages/skill/src/agents.ts's Claude Code shim already has a file callednodespace-hook.ts, which means something different (ReAct-loop tool registration, not a lifecycle hook). Whatever this becomes must not be named "hook" in a way that collides with that existing concept in the same directory. - Opt-in, off by default. This is a real behavior change (uninvited proactive output into sessions unrelated to NodeSpace) versus the existing skill install (passive, zero session-start cost). Should be an explicit install flag (e.g.
nodespace skill install --with-hooks), not silently bundled into the default install path.
Explicitly not decided yet
- Exact CLI flag/prompt shape for opt-in
- Exact hook script naming and location within the shim structure
- Whether this shells out to CLI + agent tool surface for the conflict journal (read + resolve), per ADR-068 §6 #2537's CLI surface directly, or needs its own lighter-weight check
- Uninstall handling (removing a hook entry from
settings.json/config.tomlwithout disturbing a user's other hooks — this is new surface, the installer doesn't currently write to these particular config keys)
References
- ADR-068:
nodespace-docs/decisions/068-convergence-conflicts-are-records-not-flags.md(the journal this would query) - CLI + agent tool surface for the conflict journal (read + resolve), per ADR-068 §6 #2537 (the CLI/agent query surface this would shell out to)
- Pi is a spawnable PTY agent but gets no skill install (missing from AGENTS list) #2539 (Pi's missing base skill-install support — a prerequisite if Pi is ever added here)
packages/skill/src/agents.ts/packages/skill/src/installer.ts(where this would live)
Activity
malibio commentedon Sep 9, 2026
Verified detail on Claude Code's SessionStart timing, for whoever picks this up:
session.created, which was disqualified partly for firing on first prompt rather than at true start).startup,resume,clear,compact,fork. A naive hook with no matcher filter re-runs on all five, which the "relevance check must be cheap and first" requirement above already anticipates, but worth being explicit that "SessionStart" really means "session-boundary event."No change to scope or priority — just recording the answer so it doesn't need re-deriving later.
malibio commentedon Oct 4, 2026
The mechanism this needs is now planned as a harness plugin: ADR-093 (https://github.com/NodeSpaceAI/nodespace-docs/blob/main/decisions/093-coding-agents-receive-skills-and-task-context-through-harness-plugins.md) §5 and #3545 (Claude Code), #3546 (Pi, OpenCode, and an instructions block for Codex and Antigravity). Each plugin already runs at session start and adds a section to the system prompt, so an open-conflicts notice is one more line there, from one more CLI call, with no separate hook registration in the user's settings. This issue should be picked up after #3545 and scoped as an addition to that plugin.
malibio commentedon Oct 11, 2026
Closing as not planned in a backlog triage. This was an idea captured loosely, not a scoped task. The harness plugins it would build on have shipped; refile as a scoped change to them if a session-start notice for open conflicts is wanted.