EnsoDynamics/enso-method / skills/continuation-prompt
continuation-prompt
VerifiedProduce the copy-paste prompt that starts the next chat. Line one is a short chat name; then the lineage block (the PRD and phase this chat serves, or an honest "no lineage found"); then the skill to use, the goal, where to work, pointers into the governing documents, and the single first action. Before writing the prompt it moves every fact the repo should own out of the prompt and into the governing document, so the prompt stays a pointer. Use whenever the user asks for "a prompt for a new chat", "the prompt to continue this", "hand this off to a fresh session", or when any skill reaches the point of handing work to a fresh chat (phase-split, implement-from-requirements wrap-up). NOT for a "context package", or anything that passes information back to a chat that is already running. Re-run it to regenerate a prompt that came out wrong. At the end of a track it produces no prompt and says so. Ships a UserPromptSubmit hook that turns that first line into the session title.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 43.2 KB |
| hooks/session-title-from-chat-line.pyexecutable | script | 5.3 KB |
hooks/session-title-from-chat-line.py
View on GitHub#!/usr/bin/env python3
"""Claude Code UserPromptSubmit hook: name the session from the prompt's first line.
The `continuation-prompt` skill puts the chat name alone on line one of every
prompt that starts a new chat, e.g.
PROJ-2718 api logs impl
Use implement-from-discovery. PROJ-2718: ...
Claude Code cannot rename its own session from inside a conversation, but a
UserPromptSubmit hook may return `sessionTitle` (Claude Code 2.1.94 and later),
which is what `/rename` would have set. Two rules, checked in order:
1. `Chat: <name>` as the first non-blank line sets the title on ANY prompt. This
is the explicit form: use it to rename a session mid-conversation.
2. On the FIRST prompt of a session only, a bare first line that looks like a
name (at most 40 characters, no trailing punctuation, not a slash command,
an @-mention or a pasted attachment tag, followed by a blank line and then
the body of the prompt) becomes the title. A one-line
prompt is never a name, and later prompts never match this rule, so
"yes\\n\\ngo ahead" mid-session renames nothing.
Both rules look inside a leading `<pasted_content id="...">` tag: the VS Code
extension wraps pasted text in one, so a pasted prompt's name line is the line
after the tag, not the tag itself. Both rules also skip whole context blocks the
client puts ahead of the user's text, such as the `<browser_instruction>` block the
VS Code extension prepends to a session's first message when Claude in Chrome is
enabled (Claude Code 2.1.287 and later).
Why not always require the `Chat:` prefix: the VS Code extension seeds a new
tab's label from the raw first prompt and does not pick up a hook-set title
until its session list refreshes, so the first characters of line one are what
the user sees in the tab. A prefix there wastes the only real estate that matters.
Any other prompt passes through untouched, and the hook never blocks a prompt:
bad input exits 0 silently.
Install (once) in ~/.claude/settings.json:
{
"hooks": {
"UserPromptSubmit": [
{ "hooks": [ { "type": "command",
"command": "python3 ~/.claude/skills/continuation-prompt/hooks/session-title-from-chat-line.py",
"timeout": 5 } ] }
]
}
}
Adjust the path if this skills repo is not linked under ~/.claude/skills.
Test without Claude Code (printf, not echo: zsh and sh `echo` turn the \\n into a
real newline, which strict JSON rejects):
printf '%s' '{"prompt":"ph2 orderN impl\\n\\nUse implement-from-requirements."}' \\
| python3 session-title-from-chat-line.py
"""
import json
import os
import re
import sys
MAX_LEN = 60 # hard cap on the title we return
BARE_NAME_MAX = 40 # a bare first line longer than this is a sentence, not a name
PASTE_OPEN = re.compile(r'<pasted_content\b[^>\n]*>[ \t]*\n')
# A whole context block a client prepends to the user's text, e.g.
# <browser_instruction>...</browser_instruction>; never the paste wrapper.
INJECTED_BLOCK = re.compile(
r'<(?!pasted_content\b)([A-Za-z_][\w-]*)\b[^>\n]*>.*?</\1\s*>\s*', re.DOTALL)
def is_first_prompt(event: dict) -> bool:
"""True when the session transcript has no user message yet.
Claude Code passes `transcript_path`; before the first prompt is written the
file is absent or holds no `"type":"user"` line. When the field is missing
(an older Claude Code, or a hand-built test event) assume first prompt.
"""
path = event.get("transcript_path")
if not isinstance(path, str) or not path:
return True
try:
with open(os.path.expanduser(path), "rb") as fh:
for line in fh:
if b'"type":"user"' in line:
return False
except OSError:
return True
return True
def main() -> int:
try:
event = json.load(sys.stdin)
except (ValueError, OSError):
return 0 # not JSON; never block the prompt
if not isinstance(event, dict):
return 0
prompt = event.get("prompt")
if not isinstance(prompt, str):
return 0
text = prompt.lstrip()
# The VS Code extension (2.1.287 and later) prepends a
# <browser_instruction> block to the first message; skip any such blocks.
while (block := INJECTED_BLOCK.match(text)):
text = text[block.end():]
# The VS Code extension (2.1.280 and later) wraps a pasted prompt in
# <pasted_content id="..."> ... </pasted_content id="...">; the name line
# is the first line inside it.
wrapper = PASTE_OPEN.match(text)
if wrapper:
text = text[wrapper.end():].lstrip()
lines = text.split("\n")
first = lines[0].rstrip()
title = None
explicit = re.match(r"^Chat:\s*(.+?)\s*$", first)
if explicit:
title = explicit.group(1)
elif (
first
and len(first) <= BARE_NAME_MAX
and not first.endswith((".", "?", "!", ":", ","))
and not first.startswith(("/", "@", "[", "<"))
and len(lines) > 2
and lines[1].strip() == ""
and any(l.strip() for l in lines[2:])
and is_first_prompt(event)
):
title = first
if not title:
return 0
print(json.dumps({
"hookSpecificOutput": {
"hookEventName": "UserPromptSubmit",
"sessionTitle": title[:MAX_LEN],
}
}))
return 0
if __name__ == "__main__":
sys.exit(main())
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |