Skip to content

[skills] Auto-capture Claude Code adapter#15

Open
alanshurafa wants to merge 6 commits intomainfrom
contrib/alanshurafa/auto-capture-claude-code
Open

[skills] Auto-capture Claude Code adapter#15
alanshurafa wants to merge 6 commits intomainfrom
contrib/alanshurafa/auto-capture-claude-code

Conversation

@alanshurafa
Copy link
Copy Markdown
Owner

Summary

  • Claude Code adapter for the existing skills/auto-capture/ skill
  • Adds automatic session-end thought capture via Claude Code's Stop hook system
  • Includes session-end-capture.mjs reference implementation with:
    • Transcript parsing and formatting
    • Skip heuristics (short sessions, agent-only, restricted content)
    • REST ingest integration with retry queue and dead-letter handling
    • 25-second hard timeout to never block Claude Code shutdown
  • SKILL.md documents the behavioral protocol and installation steps
  • metadata.json declares requires_skills: ["auto-capture"]

Dependencies

  • skills/auto-capture/ (exists in repo) — base skill this adapter extends
  • Open Brain REST API or smart-ingest edge function for the ingest endpoint

Gate compliance

Rule Status
2: README + metadata.json Pass
3: Valid metadata schema Pass
6: SKILL.md present Pass
9: Prerequisites, numbered steps, expected outcome Pass
10: requires_skills entries exist, README links to them Pass
12: All files in contribution folder Pass
13: Relative links resolve Pass

Test plan

  • CI gate passes all 15 checks
  • Install hook in a test Claude Code setup and verify session-end capture fires
  • Verify skip heuristics work (< 3 turns = skipped, agent session = skipped)
  • Verify retry queue saves failed captures and retries on next session end

Adapter for the auto-capture skill that adds automatic session-end thought
capture via Claude Code hooks. Includes session-end-capture.mjs reference
implementation with transcript parsing, skip heuristics, retry queue, and
REST ingest integration.

Depends on: skills/auto-capture (requires_skills declared in metadata.json)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions bot added the skill label Apr 6, 2026
Add blank lines around headings (MD022), fenced code blocks (MD031),
and between adjacent blockquotes (MD028). Fix broken link fragment
(MD051) and remove extra blank line (MD012). No content changes.

These errors were blocking CI on all open PRs since the lint check
runs repo-wide.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions bot added documentation Improvements or additions to documentation integration recipe labels Apr 6, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 53f0823ab0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +41 to +43
const SCRIPT_DIR = path.dirname(new URL(import.meta.url).pathname.replace(/^\/([A-Z]:)/, "$1"));
const PROJECT_ROOT = path.resolve(SCRIPT_DIR, "../..");
const ENV_PATH = path.join(PROJECT_ROOT, ".env.local");
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Resolve runtime paths from session cwd

PROJECT_ROOT is computed from the hook script’s install location, not from the active Claude session. Because the README flow installs this script into an arbitrary shared scripts directory, .env.local, logs, and retry files are looked up/written in the wrong tree, so project-local captures frequently fail with error:missing_env or mix state across projects. Derive paths from the hook input cwd (or an explicit env override) instead of SCRIPT_DIR.

Useful? React with 👍 / 👎.

Comment on lines +294 to +296
// 6. Format transcript and build summary
const formattedText = formatTranscript(parsed, projectName);
const sessionSummary = buildSessionSummary(parsed, projectName);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add restricted-content gate before ingest

After parsing, the flow only checks MIN_USER_TURNS and then immediately prepares content for upload; there is no restricted-content/sensitivity filter before posting. That means sessions containing secrets or sensitive text are still sent to the ingest endpoint, despite this adapter’s documented behavior to skip restricted sessions. A sensitivity check should run before formatting/posting payloads.

Useful? React with 👍 / 👎.

Comment on lines +296 to +297
const sessionSummary = buildSessionSummary(parsed, projectName);
const importKey = buildImportKey(parsed.sessionId, formattedText);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Send the computed session summary entry

sessionSummary is calculated but never used, and only the full transcript payload is posted. As a result, the advertised separate session-summary journal capture never happens, so consumers expecting both artifacts lose that summary signal. Either submit a second capture request for sessionSummary or include it in the ingest payload contract.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation integration recipe skill

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant