ai-gains 1.3.0 → 1.3.2

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/README.md CHANGED
@@ -5,7 +5,7 @@ Track the time you save using AI in your development workflow. AI Gains automati
5
5
  ## How it works
6
6
 
7
7
  1. **Hooks** record each Claude Code session — start time, author, end time
8
- 2. **A skill** prompts Claude to log achievements and estimate how long the work would have taken without AI
8
+ 2. **A skill** reminds you to log achievements at natural stopping points; run `/ai-gains` whenever you want to capture what was done and estimate how long it would have taken without AI
9
9
  3. **A dashboard** visualises sessions, time saved, and speedup across your project
10
10
 
11
11
  ## Setup
@@ -32,17 +32,15 @@ To use a different port:
32
32
  PORT=4000 npx ai-gains
33
33
  ```
34
34
 
35
- ## Logging a session
35
+ ## Logging achievements
36
36
 
37
- At the end of a Claude Code session, run:
37
+ After completing a meaningful piece of work — a feature, a bug fix, a refactor — run:
38
38
 
39
39
  ```
40
40
  /ai-gains
41
41
  ```
42
42
 
43
- Claude will reflect on the work done, estimate how long it would have taken a human, and write the session log to `.ai-gains/`.
44
-
45
- You can also run `/ai-gains` mid-session to log a checkpoint.
43
+ Claude will reflect on what was done, estimate how long it would have taken a human, and write the achievement to the session log. Run it as many times as you like within a session to capture checkpoints, or once at the end to log everything in one go. The hooks handle start and end time automatically — `/ai-gains` is purely for recording what was accomplished.
46
44
 
47
45
  ## Dashboard features
48
46
 
@@ -74,7 +72,7 @@ Each session file (`.ai-gains/<session-id>.json`) contains:
74
72
 
75
73
  ## Committing session logs
76
74
 
77
- Add `.ai-gains/` to your repository to share gains across your team. Each file is named by session ID so concurrent sessions never conflict.
75
+ Add `.ai-gains/` to your repository to share gains across your team. Each file is named `<timestamp>_<session-id>.json` so files sort chronologically and concurrent sessions never conflict.
78
76
 
79
77
  ## Requirements
80
78
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-gains",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
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`.