syntaur 0.45.0 → 0.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,84 +5,36 @@ description: Use when the user asks to track, register, or log this Claude Code
5
5
 
6
6
  # Track Session
7
7
 
8
- Register the current Claude Code session as an agent session in the Syntaur dashboard. Works standalone or linked to a project/assignment.
8
+ Attach a description and/or a project+assignment link to the current agent session's row in the Syntaur dashboard.
9
9
 
10
- Only real Claude Code session IDs are accepted no synthesis. The real id is written to `.syntaur/context.json` by the SessionStart hook, with `~/.claude/sessions/<pid>.json` as the fallback source.
10
+ Plain registration is automatic now — the SessionStart hook registers every session (and the background scanner backfills any the hook missed), so this skill only matters for the one remaining manual case: adding a description or an explicit project/assignment link. The CLI self-resolves the calling session's id (env → process-tree markers → transcript scan); never pass a synthesized id.
11
11
 
12
12
  ## Usage
13
13
 
14
14
  User arguments: `$ARGUMENTS`
15
15
 
16
- - (no args) — register a standalone session
17
- - `--description "<text>"` — with a description
18
- - `--project <slug> --assignment <slug>` — linked to a project
16
+ - (no args) — upsert the session row as-is (rarely needed; the hook already did this)
17
+ - `--description "<text>"` — attach a description
18
+ - `--project <slug> --assignment <slug>` — link to a project assignment
19
19
  - `--description "<text>" --project <slug> --assignment <slug>` — both
20
20
 
21
21
  ## Workflow
22
22
 
23
- ### Step 1: Parse arguments
24
-
25
- Extract optional flags from the argument string:
26
- - `--description "<text>"` or `--description <text>` — session description
27
- - `--project <slug>` — project to link to
28
- - `--assignment <slug>` — assignment to link to
29
-
30
- ### Step 2: Source the real session id + transcript path
31
-
32
- Resolve the session id from *your* running process, in priority order:
33
-
34
- 1. `$CLAUDE_CODE_SESSION_ID` (or the peer `OPENCODE_SESSION_ID` / `PI_SESSION_ID`) if your runtime injects it.
35
- 2. Otherwise, read the most-recently-modified file under `~/.claude/sessions/<pid>.json` whose `cwd` matches `$(pwd)` and use its `sessionId` field. The transcript path is conventionally `~/.claude/projects/<encoded-cwd>/<sessionId>.jsonl`; include it if the file exists, otherwise omit.
36
- 3. Only as a last resort, fall back to the `sessionId` scalar in `.syntaur/context.json` (and the companion `transcriptPath` if present). This scalar is a shared, legacy hint a co-tenant sharing this workspace can clobber — never treat it as authoritative.
37
- 4. If no source yields an id, abort with: "Could not resolve a real Claude Code session id. Restart the Claude session so the SessionStart hook can populate `.syntaur/context.json`, or run `/rename <slug>` then try again."
38
-
39
- DO NOT generate a UUID. `syntaur track-session` rejects missing session IDs.
40
-
41
- ### Step 3: Run the CLI command
42
-
43
- Run the track-session CLI via Bash (use `dangerouslyDisableSandbox: true` since it writes to `~/.syntaur/`):
23
+ Run one Bash call (use `dangerouslyDisableSandbox: true` since it writes to `~/.syntaur/`), passing through whatever optional flags the user gave:
44
24
 
45
25
  ```bash
46
- syntaur track-session \
47
- --agent claude \
48
- --session-id "$SESSION_ID" \
49
- --transcript-path "$TRANSCRIPT_PATH" \
50
- --path "$(pwd)" \
51
- --pid "$(ps -o ppid= -p $$ | tr -d ' ')" \
26
+ syntaur track-session --agent claude \
52
27
  [--description "<text>"] \
53
- [--project <slug>] \
54
- [--assignment <slug>]
28
+ [--project <slug>] [--assignment <slug>]
55
29
  ```
56
30
 
57
- Omit `--transcript-path` entirely (don't pass an empty string) if no transcript path could be resolved. The `--pid` value is the shell PID that owns the Claude process — the dashboard uses it to disable Resume while this session may still be writing the transcript, forcing users to Fork instead. If `ps` is unavailable, omit `--pid` too.
31
+ The CLI resolves the session id, transcript-derived path, owning pid, and HEAD sha itself, and prints one of:
58
32
 
59
- The CLI prints one of:
60
33
  - `Registered standalone agent session <sessionId>.`
61
34
  - `Registered agent session <sessionId> for <assignment> in <project>.`
62
35
 
63
- Registration is idempotent — re-running the command with the same session id safely upserts project/assignment/description onto the existing row.
64
-
65
- ### Step 4: Merge context.json
66
-
67
- Ensure `.syntaur/context.json` has the session fields (so SessionEnd and future `track-session` runs find them). Merge, don't overwrite:
68
-
69
- ```bash
70
- mkdir -p .syntaur
71
- if [ -f .syntaur/context.json ]; then
72
- jq --arg sid "$SESSION_ID" --arg tp "$TRANSCRIPT_PATH" \
73
- '. + {sessionId: $sid} + (if ($tp | length) > 0 then {transcriptPath: $tp} else {} end)' \
74
- .syntaur/context.json > .syntaur/context.json.tmp \
75
- && mv .syntaur/context.json.tmp .syntaur/context.json
76
- else
77
- jq -n --arg sid "$SESSION_ID" --arg tp "$TRANSCRIPT_PATH" \
78
- '{sessionId: $sid} + (if ($tp | length) > 0 then {transcriptPath: $tp} else {} end)' \
79
- > .syntaur/context.json
80
- fi
81
- ```
36
+ Registration is idempotent — re-running with the same session id safely upserts the description/link onto the existing row.
82
37
 
83
- ### Step 5: Confirm
38
+ If it errors with "Could not resolve a session id", restart the Claude session so the SessionStart hook can register it (or pass `--session-id <id>` with a real agent-generated id — never synthesize one).
84
39
 
85
- Tell the user:
86
- - The session was registered (include the short session id).
87
- - It will be auto-stopped when this conversation ends via the SessionEnd hook.
88
- - If linked to a project, mention which project/assignment.
40
+ Confirm to the user: the row was updated (include the short session id), it auto-stops at SessionEnd, and which project/assignment it is linked to, if any.