@automagik/genie 4.260331.1 → 4.260331.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.
@@ -10,7 +10,7 @@
10
10
  "plugins": [
11
11
  {
12
12
  "name": "genie",
13
- "version": "4.260331.1",
13
+ "version": "4.260331.2",
14
14
  "source": "./plugins/genie",
15
15
  "description": "Human-AI partnership for Claude Code. Share a terminal, orchestrate workers, evolve together. Brainstorm ideas, wish them into plans, make with parallel agents, ship as one team. A coding genie that grows with your project."
16
16
  }
@@ -1,199 +1,29 @@
1
- ---
2
- name: metrics-updater
3
- description: Self-improving daily metrics agent — updates README.md with live project metrics, refines its own prompt, and generates optimization tools
4
- version: 2
5
- created: 2026-03-24
6
- last_refined: null
7
- ---
1
+ # metrics-updater Agent
8
2
 
9
- # Metrics Updater Agent
3
+ Fetches live GitHub metrics daily and updates the README metrics table.
10
4
 
11
- ## Purpose
5
+ ## Metrics Collected
12
6
 
13
- Update README.md with live project metrics daily. After each run, analyze performance, call `/refine` to improve this prompt, and generate tools to optimize future runs. The goal: measurably faster execution every day.
7
+ - **Releases/day** releases published in the last 24h
8
+ - **Avg merge time** — mean lead time (created→merged) for PRs closed in last 7d
9
+ - **SHIP rate** — merged / total closed PRs in last 7d (%)
10
+ - **Merged PRs (7d)** — count of merged PRs in the rolling 7-day window
14
11
 
15
- ## Repository
12
+ ## README Markers
16
13
 
17
- - **Owner:** automagik-dev
18
- - **Repo:** genie
19
- - **Branch:** dev (metrics commits go here)
14
+ The agent updates the block between `<!-- METRICS:START -->` and `<!-- METRICS:END -->` in README.md.
20
15
 
21
- ## Metrics to Fetch
16
+ If markers are missing, insert the table after the badges block, before `## What is Genie?`.
22
17
 
23
- | Metric | Source | Calculation |
24
- |--------|--------|-------------|
25
- | Releases/day | `gh api repos/{owner}/{repo}/releases` | Count releases created in last 24h |
26
- | Avg bug-fix time | `gh api repos/{owner}/{repo}/pulls?state=closed` | Mean time from PR open → merge for bug-fix PRs (last 7 days) |
27
- | SHIP rate | `gh api repos/{owner}/{repo}/pulls?state=closed` | % of PRs that shipped without FIX-FIRST (merged on first review cycle) |
28
- | Lines changed (24h) | `git log --since="24 hours ago" --stat` | Total insertions + deletions in the last 24 hours |
29
- | Commits (24h) | `git log --since="24 hours ago" --oneline` | Count of commits in the last 24 hours |
30
- | Pull requests (24h) | `gh api search/issues` | Count of PRs created in the last 24 hours |
31
- | Parallel agents | `genie status` or process count | Number of active genie workers at time of run |
18
+ ## Commit Convention
32
19
 
33
- ## Execution Steps
34
-
35
- Run these steps in order. Time each step for performance tracking.
36
-
37
- ### Phase 1: Metrics Update (run-metrics.sh)
38
-
39
- 1. **Load state** — Read `state.json` for last_metrics (fallback if API fails)
40
- 2. **Fetch metrics** — Call GitHub API via `gh` CLI for each metric
41
- - Use `tools/cached-fetch.sh` if available (avoids redundant API calls)
42
- 3. **Calculate** — Parse API responses, compute aggregated numbers
43
- - Use `tools/fast-parse.py` if available (single-pass optimization)
44
- 4. **Update README** — Find or create metrics table in README.md, update values
45
- 5. **Commit** — `chore: update live metrics (X/day, Yh avg, Z% SHIP)`
46
- - Use `tools/batch-commit.sh` if available (batched git operations)
47
- 6. **Log run** — Append structured JSON to `runs.jsonl` with step timings
48
-
49
- ```bash
50
- # Full run (fetch, update README, commit, log):
51
- bash tools/run-metrics.sh
52
-
53
- # Dry run (no commit):
54
- bash tools/run-metrics.sh --dry-run
55
20
  ```
56
-
57
- ### Phase 2: Self-Refinement
58
-
59
- After the metrics update completes:
60
-
61
- 7. **Analyze performance** — Run perf-analyzer to identify bottlenecks
62
- ```bash
63
- python3 tools/perf-analyzer.py --format text
64
- ```
65
-
66
- 8. **Generate tools** — Create optimization tools for slow steps
67
- ```bash
68
- python3 tools/generate-tools.py
69
- ```
70
-
71
- 9. **Prepare refinement context** — Build context from performance data
72
- ```bash
73
- bash tools/self-refine.sh
74
- ```
75
-
76
- 10. **Refine prompt** — Call `/refine` in file mode to optimize this prompt
77
- ```
78
- /refine @.genie/agents/metrics-updater/AGENT.md
79
- ```
80
-
81
- 11. **Verify** — Confirm AGENT.md was updated and state.json has `last_refined_at`
82
-
83
- ## README Metrics Table Format
84
-
85
- Insert after the badges block, before "## What is Genie?". The table uses HTML comment signature markers with an ISO 8601 timestamp — no "Updated" column needed.
86
-
87
- ```markdown
88
- <!-- METRICS:START — Updated by Genie Metrics Agent at 2026-03-24T23:45:00Z -->
89
- | Metric | Value |
90
- |--------|-------|
91
- | Releases/day | 17 |
92
- | Avg bug-fix time | 1.7h |
93
- | SHIP rate | 100% |
94
- | Lines changed (24h) | 12,450 |
95
- | Commits (24h) | 34 |
96
- | Pull requests (24h) | 8 |
97
- | Parallel agents | 5 |
98
- <!-- METRICS:END — 🧞 automagik/genie -->
21
+ chore: update live metrics (X/day, Yh avg, Z% SHIP)
99
22
  ```
100
23
 
101
- ### Quality Expectations
102
-
103
- - The table MUST have exactly 7 metric rows — no more, no less
104
- - Values MUST be real data from GitHub API and git log — never hardcoded placeholders
105
- - The ISO timestamp in the START marker MUST reflect the actual update time in UTC
106
- - The bottom marker includes the Genie signature (`🧞 automagik/genie`) for attribution
107
- - Numbers should be human-readable: use comma separators for LoC (e.g., `12,450`)
108
-
109
- ## Tools Available
110
-
111
- Source tools from `tools/` directory before executing:
112
-
113
- ### Core Tools (Wave 1 — always present)
114
- - `tools/run-metrics.sh` — **Main orchestrator** (fetch → parse → update README → commit → log with step timing)
115
- - `tools/github-api.sh` — GitHub API wrapper with caching and retry
116
- - `tools/parse-metrics.py` — Metrics parser and calculator
117
- - `tools/update-readme.py` — README metrics table updater (finds METRICS:START/END markers)
118
- - `tools/commit-formatter.sh` — Clean commit message formatter
119
-
120
- ### Self-Improvement Tools (Wave 2 — refinement loop)
121
- - `tools/perf-analyzer.py` — Analyzes runs.jsonl for bottlenecks, trends, and optimization recommendations
122
- - `tools/self-refine.sh` — Prepares refinement context and triggers `/refine` on AGENT.md
123
- - `tools/generate-tools.py` — Analyzes perf data and generates optimization tools for slow steps
124
-
125
- ### Auto-Generated Tools (created by generate-tools.py)
126
- - `tools/cached-fetch.sh` — Cached GitHub API fetcher with TTL (generated when fetch steps are slow)
127
- - `tools/fast-parse.py` — Optimized single-pass metrics parser (generated when parse steps are slow)
128
- - `tools/batch-commit.sh` — Batched git operations (generated when commit steps are slow)
129
-
130
- New tools may be generated after each run. Check `tools/` for the latest inventory.
131
-
132
- ## Constraints
133
-
134
- - **MUST** call `/refine` after each run with performance data
135
- - **MUST** log every run to `runs.jsonl` with: timestamp, duration_ms, api_calls, tools_generated, errors, steps, slowest_step
136
- - **MUST** fall back to `state.json` last_metrics if GitHub API fails
137
- - **MUST NOT** push directly to main — commit to dev branch only
138
- - **MUST NOT** run more than once per day
139
- - **SHOULD** generate new tools when identifying slow operations (>500ms average)
140
- - **SHOULD** use cached API responses when available (tools/cached-fetch.sh)
141
- - **SHOULD** use fast-parse.py when available for metrics calculation
142
-
143
- ## Performance Tracking
144
-
145
- After each run, `runs.jsonl` captures:
146
- - `timestamp` — When the run started
147
- - `duration_ms` — Total execution time
148
- - `api_calls` — Number of GitHub API calls
149
- - `tools_generated` — Tools created this run
150
- - `tools_available` — Total tools in tools/ directory
151
- - `errors` — Array of error messages
152
- - `status` — success | no_changes | failed
153
- - `fallback` — Whether fallback metrics were used
154
- - `slowest_step` — Name of the step that took longest
155
- - `steps` — Array of `{name, duration_ms}` for each execution step
156
- - `metrics` — The computed metrics values
157
-
158
- ### Step Names (for performance analysis)
159
- - `load_state` — Reading state.json
160
- - `fetch_releases` — GitHub API call for releases
161
- - `fetch_prs` — GitHub API call for PRs
162
- - `count_agents` — Counting parallel agents
163
- - `parse_metrics` — Computing metrics from API data
164
- - `update_readme` — Updating README.md
165
- - `update_state` — Writing state.json
166
- - `commit` — Git add + commit
167
-
168
- ## Self-Refinement Protocol
169
-
170
- After completing the metrics update (Phase 1), execute Phase 2:
171
-
172
- 1. **Run perf-analyzer.py** to get a performance report with bottleneck analysis
173
- 2. **Run generate-tools.py** to create optimization tools for slow steps
174
- 3. **Run self-refine.sh** to prepare refinement context and append it to AGENT.md
175
- 4. **Call `/refine @AGENT.md`** to optimize the prompt based on performance data
176
- 5. **Verify** the refined prompt preserves:
177
- - Core metrics (releases/day, bug-fix time, SHIP rate, parallel agents)
178
- - The self-refinement protocol section
179
- - Tool references and execution steps
180
- - Version number incremented in frontmatter
181
-
182
- The refined prompt replaces this file for the next run. Tools persist in `tools/`.
183
-
184
- ## Graceful Degradation
185
-
186
- If GitHub API is unavailable:
187
- 1. Read `state.json` for `last_metrics`
188
- 2. Use yesterday's values in README (do not update the timestamp in the START marker)
189
- 3. Log the error to `runs.jsonl` with step timings
190
- 4. Skip commit (no changes to README)
191
- 5. Still call `/refine` to analyze the failure and improve error handling
24
+ Push to `dev` branch only. Never push to `main`.
192
25
 
193
- ## Improvement Targets
26
+ ## State Files
194
27
 
195
- Track these across runs (visible in perf-analyzer.py output):
196
- - **Day 1 Day 7 execution time**: Target 50% reduction
197
- - **API calls per run**: Target ≤2 (with caching)
198
- - **Tools generated**: Target ≥3 by Day 2
199
- - **Error rate**: Target 0% after initial stabilization
28
+ - `state.json` last successful metrics run
29
+ - `runs.jsonl` append-only log of every run
@@ -12,3 +12,4 @@
12
12
  {"timestamp":"2026-03-28T00:00:00Z","duration_ms":45000,"api_calls":3,"tools_generated":0,"errors":[],"metrics":{"releases_24h":0,"avg_merge_time_hours":2.9,"ship_rate_pct":94,"merged_prs_7d":47}}
13
13
  {"timestamp":"2026-03-29T00:00:00Z","duration_ms":52000,"api_calls":2,"tools_generated":0,"errors":[],"metrics":{"releases_24h":0,"avg_merge_time_hours":3.0,"ship_rate_pct":92,"merged_prs_7d":46}}
14
14
  {"timestamp":"2026-03-30T00:00:00Z","duration_ms":5000,"api_calls":3,"tools_generated":0,"errors":0,"metrics":{"releases_24h":0,"releases_per_day":0,"avg_merge_time_hours":0.3,"ship_rate_pct":84,"merged_prs_7d":32,"closed_prs_7d":38}}
15
+ {"timestamp":"2026-03-31T00:00:00Z","duration_ms":5002,"api_calls":2,"tools_generated":4,"errors":0,"metrics":{"releases_24h":0,"merged_prs_7d":35,"avg_merge_time_h":0.3,"ship_rate_pct":85}}
@@ -1,11 +1,9 @@
1
1
  {
2
- "last_run": "2026-03-30T00:00:00Z",
2
+ "last_run": "2026-03-31T00:00:00Z",
3
3
  "last_metrics": {
4
4
  "releases_24h": 0,
5
- "releases_per_day": 0,
6
- "avg_merge_time_hours": 0.3,
7
- "ship_rate_pct": 84,
8
- "merged_prs_7d": 32,
9
- "closed_prs_7d": 38
5
+ "merged_prs_7d": 35,
6
+ "avg_merge_time_h": 0.3,
7
+ "ship_rate_pct": 85
10
8
  }
11
9
  }
package/README.md CHANGED
@@ -17,10 +17,10 @@
17
17
 
18
18
  | Metric | Value | Updated |
19
19
  |--------|-------|---------|
20
- | Releases/day | **0** | 2026-03-30 |
21
- | Avg merge time | **0.3h** | 2026-03-30 |
22
- | SHIP rate | **84%** | 2026-03-30 |
23
- | Merged PRs (7d) | **32** | 2026-03-30 |
20
+ | Releases/day | **0** | 2026-03-31 |
21
+ | Avg merge time | **0.3h** | 2026-03-31 |
22
+ | SHIP rate | **85%** | 2026-03-31 |
23
+ | Merged PRs (7d) | **35** | 2026-03-31 |
24
24
 
25
25
  <!-- METRICS:END -->
26
26
 
@@ -2,7 +2,7 @@
2
2
  "id": "genie",
3
3
  "name": "Genie",
4
4
  "description": "Skills, agents, and hooks for the Genie CLI terminal orchestration toolkit",
5
- "version": "4.260331.1",
5
+ "version": "4.260331.2",
6
6
  "configSchema": {
7
7
  "type": "object",
8
8
  "additionalProperties": false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automagik/genie",
3
- "version": "4.260331.1",
3
+ "version": "4.260331.2",
4
4
  "description": "Collaborative terminal toolkit for human + AI workflows",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "genie",
3
- "version": "4.260331.1",
3
+ "version": "4.260331.2",
4
4
  "description": "Human-AI partnership for Claude Code. Share a terminal, orchestrate workers, evolve together. Brainstorm ideas, turn them into wishes, execute with /work, validate with /review, and ship as one team.",
5
5
  "author": {
6
6
  "name": "Namastex Labs"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "genie-plugin",
3
- "version": "4.260331.1",
3
+ "version": "4.260331.2",
4
4
  "private": true,
5
5
  "description": "Runtime dependencies for genie bundled CLIs",
6
6
  "type": "module",