Skip to content

Task-core compaction migration (intel routine #2)#5

Merged
ReidenXerx merged 1 commit into
mainfrom
feat/task-core-compaction-migration
Jul 16, 2026
Merged

Task-core compaction migration (intel routine #2)#5
ReidenXerx merged 1 commit into
mainfrom
feat/task-core-compaction-migration

Conversation

@ReidenXerx

Copy link
Copy Markdown
Owner

A dense, AI-facing task-core save-state that survives context compaction without drift — the intel-enhancement layer's second cognitive routine (after microscope).

Problem

Claude Code auto-compacts (summarizes + drops the transcript) when the window fills. The generic summary keeps the gist but loses load-bearing detail — a decision's why, a ruled-out dead-end, the exact file:line mid-edit — so the agent drifts: re-litigates settled calls, repeats failed approaches, forgets constraints.

Mechanism

  • .gnkit/lib/context-pressure.mjs — estimate window fullness from the transcript: accurate (last assistant message's usage.input + cache = the real prompt size), cheap (128KB tail-read), byte-size fallback.
  • .claude/hooks/gitnexus-context-pressure.mjs (PostToolUse) — at ≥ contextPressureThreshold (default 0.9) × contextWindowTokens (default 200k; 1M-context sessions set 1000000), nudge the agent to write/refresh .gnkit/.gitnexus-task-core.md. Once per pressure zone (re-arms when a compaction shrinks the transcript); keeps nudging while no core exists (compacting core-less = data loss). PreCompact can't inject context or make the agent act — so this PostToolUse hook is the pre-compaction trigger.
  • SessionStart(compact) recovery brief now reads the task-core first.
  • gitnexus-taskcore skill — the dense format (GOAL/CONSTRAINTS/DECISIONS+why/STATE/ANCHORS/GOTCHAS/OPEN-Qs/USER-PREFS) + density rules (for the model, not humans) + recovery routine. Contract + workspace router + pack/sync manifests wired; contextPressureNudges scorecard counter; config knobs in .gnkit/gitnexus-hooks.json.

The task-core lives at .gnkit/.gitnexus-task-core.md — gitignored, survives compaction and new sessions (a task can span both). Claude-only trigger (compaction is a Claude Code concept); the core + contract are runtime-agnostic.

v1 is a nudge (not a hard block). Tests: 59/59; fresh-install integration verified (hook wired, files land, contract present).

🤖 Generated with Claude Code

…ompaction without drift

New intel-layer routine. Claude Code auto-compacts (summarizes + drops the transcript) when the
window fills; the generic summary loses load-bearing detail -> the agent drifts (re-litigates
settled calls, repeats dead-ends, forgets constraints). This lets the agent decide what survives:
a dense, AI-facing TASK-CORE written before the compaction boundary and read back after.

- .gnkit/lib/context-pressure.mjs: estimate window fullness from the transcript — accurate (the
  last assistant message's input+cache usage = the real prompt size) + cheap (128KB tail-read),
  byte-size fallback.
- .claude/hooks/gitnexus-context-pressure.mjs (PostToolUse): at >= contextPressureThreshold
  (default 0.9) of contextWindowTokens (default 200k; set 1000000 for 1M-context sessions), nudge
  the agent to write/refresh .gnkit/.gitnexus-task-core.md. Once per pressure zone (re-arms when
  pressure drops after a compaction); keeps nudging while NO core exists (compacting coreless is
  data loss). PreCompact can't inject context or make the agent act, so this is the pre-compaction
  trigger.
- SessionStart(compact) recovery brief now READS the task-core FIRST.
- task-core at .gnkit/.gitnexus-task-core.md — gitignored, survives compaction AND new sessions
  (a task can span both; agent overwrites it when the task changes; clearSessionState re-arms the
  nudge but leaves the core).
- gitnexus-taskcore skill: the format (GOAL/CONSTRAINTS/DECISIONS/STATE/ANCHORS/GOTCHAS/OPEN-Qs/
  USER-PREFS) + density rules (for the model, not humans) + recovery routine. Contract + workspace
  router + pack/sync manifests wired; contextPressureNudges scorecard counter.

Claude-only trigger (compaction is a Claude Code concept); the task-core file + contract teaching
are runtime-agnostic, so Cursor/Zed agents can keep one by hand. 59/59 tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ReidenXerx
ReidenXerx merged commit 8894b50 into main Jul 16, 2026
1 check passed
@ReidenXerx
ReidenXerx deleted the feat/task-core-compaction-migration branch July 16, 2026 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant