Repository navigation
Closed
Description
Problem
Some routines must run in every agent session, or whenever a prompt matches a pattern, no matter what the model decides. Two real cases:
- A session-wide routine (here: a time-tracking skill that starts a timer at the start of every work session, served by a pool MCP upstream). A skill fires on the model's judgement only. On 2026-11-04 a session started with a long, step-by-step task prompt; the skill was listed but not loaded, and no timer ran. Two things added to it: the upstream was still connecting when the first prompt was read (its tools were not there yet, so the skill's condition "if the tools are there" was false), and its tools were deferred behind a tool search. The upstream's
instructions(passed on bydevstack mcpsince 0.39.0) help, but they are still text the model weighs. - A per-repository routine: a repository ships a
UserPromptSubmithook (.claude/settings.json+ a shell script) that recognises a ticket reference in the prompt (ABC-123, a tracker link,#123) and injects a short checklist into the context, once per session and ticket. It exists because a bare ticket URL as the whole message regularly did not trigger the matching skill. It works, but only for Claude Code, and only where the repository commits it.
Agent harnesses run hooks mechanically (Claude Code: SessionStart, UserPromptSubmit, ...; Codex and others have or are getting similar mechanisms). devstack already distributes skills from the pool into the agents' folders and registers its MCP server; hooks are the missing third piece.
Proposal
Let devstack distribute agent hooks the way it distributes skills:
- Source: a skill set may carry hooks, e.g. a
hooks/folder next toskills/<name>/or ahookssection in the skill's frontmatter / a manifest: event (session-start,prompt-submitwith an optional regex), a command or a static context text, a timeout.- A static text (
additionalContext) covers most cases and needs no script on the member's machine.
- A static text (
- Install: the hub writes them into each enabled agent's configuration (Claude Code:
hooksin~/.claude/settings.json, or in the worktree's.claude/settings.local.jsonformetadata.repos-bound sets), marked as devstack's so it can update and remove them without touching the user's own hooks. Same accept/confirm setting as skills. - Gate on an upstream: a hook may name the MCP upstream it belongs to and is only active while the member accepted that upstream (no timer reminder for someone not in the test).
- Visibility: the skills page /
devstack pool skills statuslists hooks with their source;devstack doctorreports a hook whose agent does not support the event.
Example (session-start reminder)
hooks:
- event: session-start
upstream: nuts-timetrack
context: >
Work session: load the skill nuts-work-session now, before the first task.
If the nuts_timetrack tools are not listed yet, search for them (tool search);
if they are still missing, tell the user that this session is not tracked.Example (prompt pattern, per repository)
hooks:
- event: prompt-submit
match: '(^|\W)ABC-[0-9]+(\W|$)'
once_per: [session, match]
context_file: hooks/ticket-checklist.mdOpen questions
- Hooks run with the agent's rights; a command hook from the pool is code on every member's machine. Static context only for a first step?
once_per(session / match) needs state per session; keep it in the hub, or leave it to the command?- Which agents besides Claude Code can be served now; skip the rest with a doctor note?
Metadata
Metadata
Assignees
Labels
No labels
Activity
feat(pool): a skill carries hooks that give text to the agents (ADR-0…