Claude Code

Semantica captures Claude Code session data automatically, with no manual setup beyond semantica enable.


How it works

When you run semantica enable, Semantica detects Claude Code by checking for its configuration directory and installs a lightweight hook in .claude/settings.json. This hook fires at two points in every Claude Code session:

  • user-prompt-submit: records the current position in the session transcript so Semantica knows where to start reading after the session ends
  • stop: reads the new transcript content since the last position, parses tool calls (file writes, reads, edits), and routes that data to the local repo store

Semantica never modifies session logs, conversation history, or any Claude Code data files. The hook only reads.


Attribution quality

Claude Code provides the highest attribution fidelity of any supported provider. Because Claude Code exposes exact file content from Write and Edit tool calls, Semantica can perform line-level exact matching:

  • Lines written verbatim by Claude are marked as exact
  • Lines that were AI-generated but lightly edited are marked as modified
  • Lines with only formatting or whitespace changes are marked as formatted

This results in the most accurate attribution percentages of any provider.


Setup

Claude Code is detected and configured automatically during semantica enable. If you install Claude Code after enabling Semantica, re-run with --force:

semantica enable --force

Or add just the Claude Code provider:

semantica enable --providers claude-code

To verify Claude Code hooks are installed:

semantica agents --json

MCP integration

Semantica also provides an MCP server that Claude Code can call natively. This lets Claude Code search past playbooks and commit explanations during a session, so knowledge from previous work is available in real time.

semantica mcp enable

This adds Semantica's MCP server to .mcp.json in your repo. Claude Code will automatically discover and use the following tools:

ToolWhat it does
semantica_searchSearch past playbooks for solutions relevant to the current task
semantica_playbook_useRecord that a playbook solution was applied
semantica_explainGet attribution and session details for any commit

Hook configuration location

.claude/settings.json

Semantica adds entries under the hooks key. If you need to inspect what was installed:

cat .claude/settings.json

Troubleshooting

Sessions not being captured

  1. Confirm the hook is installed: semantica agents --json
  2. Confirm Semantica is enabled: semantica status
  3. Check .semantica/worker.log for error messages after your next commit
  4. Re-run semantica enable --force to reinstall hooks

Attribution shows 0% even though I used Claude

The session data is ingested after the commit by the background worker. If you run semantica blame HEAD immediately after committing, the worker may not have finished yet. Wait a moment and run it again.