Skip to content

feat(tool): port openclaude context primitives - #252

Merged
Patel230 merged 1 commit into
mainfrom
feat/openclaude-adoptions
Aug 24, 2026
Merged

feat(tool): port openclaude context primitives#252
Patel230 merged 1 commit into
mainfrom
feat/openclaude-adoptions

Conversation

@Patel230

Copy link
Copy Markdown
Contributor

Summary

Adopts four self-contained, stdlib-only context/robustness mechanisms from the OpenClaude coding agent (github.com/Gitlawb/openclaude), ported to idiomatic Go with full tests. None existed in hawk before.

1. internal/circuitbreaker — closed/open/half-open circuit breaker with cooldown (port of OpenClaude's auto-compact breaker: 3 failures -> cooldown -> half-open probe that a single failure re-opens, a single success closes). Time-injected, concurrency-safe. hawk's AutoCompactor already has a simpler consecutive-failure guard; this is the generalized primitive with cooldown + auto half-open retry.

2. internal/smartrouting — deterministic simple/strong turn classifier (port of OpenClaude smart routing): cheap model for trivial turns, strong for anything non-trivial, always fail-toward-strong so a misroute never degrades a hard answer. Pure function, word-boundary keyword matching.

3. internal/conversationarc — durable sidecar memory of goals/decisions/milestones/phase (init->exploring->implementing->reviewing->completed), persisted to .arc.json, with a byte-stable model-visible summary (volatile timestamps normalized so unchanged arcs don't rewrite).

4. internal/relevanceprune — token-budgeted context pruning that scores older messages by keyword overlap with the task context, keeps highest-relevance groups up to budget, and always preserves the recent tail + tool calls + errors.

All boundary-compliant (zero eyrie/client imports, stdlib-only). README adopted-capabilities table updated.

Verification

  • 30+ new tests across the four packages
  • go build ./..., go vet, full ./internal/{circuitbreaker,smartrouting,conversationarc,relevanceprune} suites green
  • All pre-push boundary guards + govulncheck + full test suite green

@Patel230
Patel230 merged commit 3883e6b into main Aug 24, 2026
26 checks passed
@Patel230
Patel230 deleted the feat/openclaude-adoptions branch August 24, 2026 08:35
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