explicit-identity
npx machina-cli add skill parcadei/Continuous-Claude-v3/explicit-identity --openclawExplicit Identity Across Boundaries
Never rely on "latest" or "current" when crossing process or async boundaries.
Pattern
Pass explicit identifiers through the entire pipeline. "Most recent" is a race condition.
DO
- Pass
--session-id $IDwhen spawning processes - Store IDs in state files for later correlation
- Use full UUIDs, not partial matches
- Keep different ID types separate (don't collapse concepts)
DON'T
- Query for "most recent session" at execution time
- Assume the current context will still be current after await/spawn
- Collapse different ID types:
session_id= Claude Code session (human-facing)root_span_id= Braintrust trace (query key)turn_span_id= Braintrust turn within session
Example
// BAD: race condition at session boundaries
spawn('analyzer', ['--learn']) // defaults to "most recent"
// GOOD: explicit identity
spawn('analyzer', ['--learn', '--session-id', input.session_id])
Source Sessions
- 1c21e6c8: Defined session_id vs root_span_id distinction
- 6a9f2d7a: Fixed wrong-session attribution via explicit passing
- a541f08a: Confirmed pattern prevents race at session boundaries
Source
git clone https://github.com/parcadei/Continuous-Claude-v3/blob/main/.claude/skills/explicit-identity/SKILL.mdView on GitHub Overview
This skill enforces carrying explicit identifiers through every step of a pipeline to prevent race conditions when crossing process or async boundaries. It emphasizes not relying on the latest or current context and instead uses full IDs to correlate actions reliably.
How This Skill Works
The pattern is to pass explicit identifiers through the entire pipeline (e.g., include --session-id when spawning processes). IDs are stored in state for later correlation, and full UUIDs are used rather than partial matches. Different ID types are kept separate to avoid collapsing concepts, ensuring accurate cross-boundary correlation.
When to Use It
- Crossing process boundaries or spawning worker processes where context can drift
- Async/await boundaries where the current context may not survive execution
- Environments with multiple ID types (session_id, root_span_id, turn_span_id) that must remain distinct
- Situations requiring reliable correlation across steps for auditing or tracing
- Attempting to prevent race conditions caused by relying on the most recent context
Quick Start
- Step 1: Identify explicit IDs to carry (session_id, root_span_id, turn_span_id) and ensure they are full UUIDs
- Step 2: Pass identifiers at every boundary (e.g., spawn with --session-id, --root-span-id, --turn-span-id)
- Step 3: Persist IDs in a state file or data store for later correlation and auditing
Best Practices
- Always pass full IDs, not partial matches
- Use full UUIDs for all identity tokens
- Store IDs in state files or a persistent store for later correlation
- Keep different ID types separate and do not collapse them into a single concept
- Avoid querying for the 'most recent' session at execution time
Example Use Cases
- BAD: race condition at session boundaries by relying on the most recent session
- GOOD: explicit identity using --session-id input.session_id to tie actions to a specific session
- Distinct IDs: use session_id for human-facing context, root_span_id for Braintrust trace, and turn_span_id for a turn within the session
- Stateful correlation: persist IDs in a state file and reuse them to correlate steps later
- Context boundary: after an await/spawn, rely on the carried explicit IDs rather than assuming current context persists