feat(hook+lockdown): first-class Claude Code SessionStart support #100

Closed
opened 2026-06-07 04:07:44 +00:00 by coilysiren · 1 comment
Owner

Extraction candidate from the coily cmd/coily/ generic-code audit (2026-06-06). Source pinned at coily commit c7c17cb (canonical: forgejo.coilysiren.me/coilyco-bridge/coily). cli-guard is mid-refactor, so the "suggested home" below is the pre-refactor package layout - land this in whatever the post-refactor equivalent is, not necessarily the named package. The durable principle: the classifiers / argv-transforms are generic and move; the policy decisions and message copy stay in coily.

Two related moves; this issue covers both.

1. SessionStart envelope -> hook. cmd/coily/session_start.go builds the Claude Code SessionStart payload (hookSpecificOutput.additionalContext). The envelope types (sessionStartHookOutput/sessionStartHookSpecific) are a pure Claude Code contract and belong next to hook.PreToolUse, which already owns the PreToolUse side.

2. SessionStart-hook injection -> lockdown.BuildSettings. cmd/coily/lockdown_driver.go wraps lockdown's BuildSettings by hand to inject a SessionStart hook entry into settings.json (injectSessionStartHook/sessionStartHookPresent). Fold idempotent SessionStart-hook installation into lockdown.BuildSettings (config-driven command string) so consumers stop wrapping-and-re-marshaling the framework's builder.

Stays in coily (policy, do not extract): the capability-index content - serviceGroups, capabilityDoctrine, and the render strings. Only the envelope + injection mechanics are generic.

Consumer seams to parameterize: the injected command string (coily hook session-start); for the renderer, if extracted later, serviceGroups/doctrine/bin-name (it depends on the clitree extraction, cli-guard#95).

Suggested home (pre-refactor): hook (envelope) + lockdown (injection).

Done when:

  • generic logic lives in cli-guard with zero coily/Kai/Forgejo identifiers or defaults
  • behavior-covered tests (table tests where the source has them)
  • godoc-current.txt regenerated (scripts/check-godoc-current.sh --update)
  • coily migrated onto the extracted API, its local copy deleted, make test green both sides
  • closes this issue
> Extraction candidate from the coily `cmd/coily/` generic-code audit (2026-06-06). Source pinned at coily commit `c7c17cb` (canonical: `forgejo.coilysiren.me/coilyco-bridge/coily`). **cli-guard is mid-refactor**, so the "suggested home" below is the pre-refactor package layout - land this in whatever the post-refactor equivalent is, not necessarily the named package. The durable principle: **the classifiers / argv-transforms are generic and move; the policy decisions and message copy stay in coily.** Two related moves; this issue covers both. **1. SessionStart envelope -> `hook`.** `cmd/coily/session_start.go` builds the Claude Code SessionStart payload (`hookSpecificOutput.additionalContext`). The envelope types (`sessionStartHookOutput`/`sessionStartHookSpecific`) are a pure Claude Code contract and belong next to `hook.PreToolUse`, which already owns the PreToolUse side. **2. SessionStart-hook injection -> `lockdown.BuildSettings`.** `cmd/coily/lockdown_driver.go` wraps `lockdown`'s `BuildSettings` by hand to inject a SessionStart hook entry into settings.json (`injectSessionStartHook`/`sessionStartHookPresent`). Fold idempotent SessionStart-hook installation into `lockdown.BuildSettings` (config-driven command string) so consumers stop wrapping-and-re-marshaling the framework's builder. **Stays in coily (policy, do not extract):** the capability-index *content* - `serviceGroups`, `capabilityDoctrine`, and the render strings. Only the envelope + injection mechanics are generic. **Consumer seams to parameterize:** the injected command string (`coily hook session-start`); for the renderer, if extracted later, `serviceGroups`/doctrine/bin-name (it depends on the `clitree` extraction, cli-guard#95). **Suggested home (pre-refactor):** `hook` (envelope) + `lockdown` (injection). **Done when:** - [ ] generic logic lives in cli-guard with zero coily/Kai/Forgejo identifiers or defaults - [ ] behavior-covered tests (table tests where the source has them) - [ ] `godoc-current.txt` regenerated (`scripts/check-godoc-current.sh --update`) - [ ] coily migrated onto the extracted API, its local copy deleted, `make test` green both sides - [ ] `closes` this issue
Author
Owner

Backlog burndown 2026-06-17: closing low-priority (P3/P4) to bring the open count to a manageable level. Nothing lost — reopen if this resurfaces. Batch tag: burndown-2026-06.

Backlog burndown 2026-06-17: closing low-priority (P3/P4) to bring the open count to a manageable level. Nothing lost — reopen if this resurfaces. Batch tag: `burndown-2026-06`.
coilysiren 2026-06-17 08:23:21 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
coilyco-flight-deck/cli-guard#100
No description provided.