phasespace-labs / phasespace-labs/palinode

Cowork hook integration for SessionEnd capture

Open
#37 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
39
Forks
42
Avg merge
1d 1h
Merged PRs (30d)
37

Description

## What

Mirror the Claude Code SessionEnd hook integration (shipped in #32) for Cowork. When a Cowork session ends — including `/clear`, logout, or normal exit — auto-capture a snapshot to palinode-api.

## Context

#32 landed `palinode init` which scaffolds `.claude/CLAUDE.md`, `.claude/settings.json`, `.claude/hooks/palinode-session-end.sh`, and `.mcp.json` in a project. Claude Code has a documented hook surface with a `SessionEnd` event and `matcher: \"clear\"` value that fires on `/clear`, so the integration is straightforward.

Cowork's hook model is different and, as of 2026-04, not fully documented:
- The official help center documents **global instructions**, **folder instructions**, **plugins**, **scheduled tasks**, and **connectors** — but no first-class SessionEnd-style hook API.
- A GitHub issue (anthropics/claude-code#27398) suggests plugin hooks via \`hooks/hooks.json\` may exist but are unreliable in Cowork Desktop sessions.
- Practical integration path today is probably via plugin skills / global instructions that remind the agent to call \`palinode_session_end\` rather than a lifecycle hook.

## Scope

- [ ] Verify current Cowork hook surface (read docs, test \`hooks/hooks.json\` in a Cowork plugin)
- [ ] If lifecycle hooks work: add a Cowork branch to \`palinode init\` that writes the equivalent config
- [ ] If not: ship a Cowork-flavored skill or global-instructions template that prompts \`palinode_session_end\` before \`/clear\`
- [ ] Add a \`--surface cowork\` flag to \`palinode init\` (or auto-detect)
- [ ] Document in \`examples/hooks/\` and \`docs/INSTALL-CLAUDE-CODE.md\` (rename to \`INSTALL.md\`?)

## Depends on

- #32 (shipped) — reuse the Claude Code hook script as-is if Cowork's hook schema is compatible

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.