ai-gains 1.3.0 → 1.3.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-gains",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "Interactive browser dashboard for AI development session tracking",
5
5
  "main": "src/server.js",
6
6
  "bin": {
@@ -9,13 +9,13 @@ description: Manages the AI gains session log. Session initialization and user p
9
9
 
10
10
  Session tracking is managed automatically via hooks configured in `.claude/settings.json`:
11
11
 
12
- - **SessionStart hook**: Reads Claude Code's `session_id` from stdin and creates `.ai-gains/<session_id>.json` with `start_time` and `author`.
12
+ - **SessionStart hook**: Reads Claude Code's `session_id` from stdin and creates `.ai-gains/<start_time>_<session_id>.json` with `start_time` and `author`. The timestamp uses `-` instead of `:` for cross-platform filename compatibility (e.g. `2026-03-02T09-00-00Z_<session_id>.json`).
13
13
  - **UserPromptSubmit hook**: Reads the `session_id` from stdin and echoes it into context with a lightweight reminder for Claude to prompt the user to update the log at the end of each response. The skill itself is not loaded automatically — only when the user invokes `/ai-gains`.
14
- - **Stop hook**: Reads the `session_id` from stdin and updates `end_time` in `.ai-gains/<session_id>.json` after every Claude response.
14
+ - **Stop hook**: Reads the `session_id` from stdin, locates the matching `.ai-gains/*_<session_id>.json` file, and updates `end_time` after every Claude response.
15
15
 
16
16
  `duration_minutes` is the wall-clock time from `start_time` to `end_time`. This intentionally includes human review time, approval of actions, reading diffs, etc. — giving a true picture of total time spent with AI vs. without.
17
17
 
18
- Files are named by `session_id` so concurrent sessions never conflict.
18
+ Files are named `<start_time>_<session_id>.json` so they sort chronologically and concurrent sessions never conflict.
19
19
 
20
20
  Claude should note the Session ID echoed by each UserPromptSubmit hook and use it to locate the session file.
21
21
 
@@ -33,12 +33,12 @@ When the user invokes `/ai-gains` or confirms they want to update the log:
33
33
 
34
34
  1. Get the current UTC time:
35
35
  ```bash
36
- date -u +%Y-%m-%dT%H:%M:%SZ
36
+ node -e "console.log(new Date().toISOString().replace(/\.\d{3}Z$/, 'Z'))"
37
37
  ```
38
38
 
39
39
  2. Use the Session ID echoed by the UserPromptSubmit hook (present in context) to locate the session file:
40
40
  ```
41
- .ai-gains/<session_id>.json
41
+ .ai-gains/*_<session_id>.json
42
42
  ```
43
43
 
44
44
  3. Read the session file to get `start_time` and `end_time`.