refactor(session-history): move extraction scripts behind skills#619
Merged
refactor(session-history): move extraction scripts behind skills#619
Conversation
Hoists the four session-history extraction scripts out of the ce-session-historian agent's sibling directory and into two new skills: - ce-session-inventory wraps discover-sessions.sh + extract-metadata.py for the discover-then-enrich inventory phase. - ce-session-extract wraps extract-skeleton.py + extract-errors.py for per-session deep-dives. ce-session-historian now invokes these skills via the Skill tool in fork context instead of reaching into a sibling script directory. Scripts live with skills (matching repo convention), the agent keeps its format knowledge, methodology, and synthesis role, and callers of the agent need no changes. Both new skills set user-invocable: false and context: fork so they act as agent-internal primitives: hidden from user query triggering, with clean tool-call boundaries in the caller's context. Tests updated to route to the new script locations.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ce-session-historianused to reach into a siblingsession-history-scripts/directory for its four extraction scripts. That broke the repo convention that scripts live inside skills, not beside agents. This PR moves those scripts into two new agent-internal skills —ce-session-inventoryandce-session-extract— and has the agent invoke them via the Skill tool in fork context.No behavior change for callers.
/ce-sessionsand/ce-compound's session-history phase work identically.Why two skills, not four
The agent uses the scripts in two workflow phases:
discover-sessions.sh+extract-metadata.pyce-session-inventoryextract-skeleton.py+extract-errors.pyce-session-extractOne-skill-per-script would have fragmented the primitives below the level the agent operates at. Bundling all four into one skill would have blurred the inventory vs deep-dive distinction the agent makes.
Why
user-invocable: false+context: forkBoth new skills set
user-invocable: falseso they don't auto-fire on user queries. They're agent-internal primitives, not end-user commands.Both set
context: forkso the bash-pipeline plumbing stays in the fork and only the JSONL output bubbles back. The agent's tool-call history stays clean across multiplece-session-extractinvocations during a single research task. The skills pass the "explicit instructions" test fork is designed for: positional args in, stdout verbatim out.Scope
plugins/compound-engineering/skills/, each with a smallSKILL.mdand ascripts/directory holding the relevant scripts.session-history-scripts/removed fromagents/research/.tests/session-history-scripts.test.tsrewired to the new script locations; 30 tests pass.Smoke-tested end-to-end
Both the
/ce-sessions→ agent → skills path and direct agent dispatch return clean results on Claude Code:ce-session-inventoryreturned metadata cleanly withparse_errors: 0on both tests.ce-session-extractdesign verified against the skeleton and errors scripts; not exercised live in the smoke tests (the agent correctly judged metadata alone was sufficient for the two smoke questions).Conversion notes
user-invocableandcontextaren't parsed by this plugin's TypeScript skill parser, so they pass through verbatim viacopySkillDirwhen converting to other targets. Claude Code honors both natively. Kiro dropscontext: forkper its spec. Copilot's writer hardcodesuser-invocable: true. End-to-end behavior on non-Claude-Code targets isn't verified yet.