pi-extensions 0.1.9

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.
Files changed (135) hide show
  1. package/.ralph/import-cc-codex.md +31 -0
  2. package/.ralph/import-cc-codex.state.json +14 -0
  3. package/.ralph/mario-not-impl.md +69 -0
  4. package/.ralph/mario-not-impl.state.json +14 -0
  5. package/.ralph/mario-not-spec.md +163 -0
  6. package/.ralph/mario-not-spec.state.json +14 -0
  7. package/LICENSE +21 -0
  8. package/README.md +65 -0
  9. package/RELEASING.md +34 -0
  10. package/agent-guidance/CHANGELOG.md +4 -0
  11. package/agent-guidance/README.md +102 -0
  12. package/agent-guidance/agent-guidance.ts +147 -0
  13. package/agent-guidance/package.json +22 -0
  14. package/agent-guidance/setup.sh +75 -0
  15. package/agent-guidance/templates/CLAUDE.md +5 -0
  16. package/agent-guidance/templates/CODEX.md +92 -0
  17. package/agent-guidance/templates/GEMINI.md +5 -0
  18. package/arcade/CHANGELOG.md +4 -0
  19. package/arcade/README.md +85 -0
  20. package/arcade/assets/picman.png +0 -0
  21. package/arcade/assets/ping.png +0 -0
  22. package/arcade/assets/spice-invaders.png +0 -0
  23. package/arcade/assets/tetris.png +0 -0
  24. package/arcade/mario-not/README.md +30 -0
  25. package/arcade/mario-not/boss.js +103 -0
  26. package/arcade/mario-not/camera.js +59 -0
  27. package/arcade/mario-not/collision.js +91 -0
  28. package/arcade/mario-not/colors.js +36 -0
  29. package/arcade/mario-not/constants.js +97 -0
  30. package/arcade/mario-not/core.js +39 -0
  31. package/arcade/mario-not/death.js +77 -0
  32. package/arcade/mario-not/effects.js +84 -0
  33. package/arcade/mario-not/enemies.js +31 -0
  34. package/arcade/mario-not/engine.js +171 -0
  35. package/arcade/mario-not/fireballs.js +98 -0
  36. package/arcade/mario-not/items.js +24 -0
  37. package/arcade/mario-not/levels.js +403 -0
  38. package/arcade/mario-not/logic.js +104 -0
  39. package/arcade/mario-not/mario-not.ts +297 -0
  40. package/arcade/mario-not/player.js +244 -0
  41. package/arcade/mario-not/render.js +257 -0
  42. package/arcade/mario-not/spec.md +548 -0
  43. package/arcade/mario-not/state.js +246 -0
  44. package/arcade/mario-not/tests/e2e.test.js +855 -0
  45. package/arcade/mario-not/tests/engine.test.js +888 -0
  46. package/arcade/mario-not/tests/fixtures/story0-frame.txt +4 -0
  47. package/arcade/mario-not/tests/fixtures/story1-camera.txt +4 -0
  48. package/arcade/mario-not/tests/fixtures/story1-glyphs.txt +4 -0
  49. package/arcade/mario-not/tests/fixtures/story10-item.txt +4 -0
  50. package/arcade/mario-not/tests/fixtures/story11-hazards.txt +4 -0
  51. package/arcade/mario-not/tests/fixtures/story12-used-block.txt +4 -0
  52. package/arcade/mario-not/tests/fixtures/story13-pipes.txt +4 -0
  53. package/arcade/mario-not/tests/fixtures/story14-goal.txt +4 -0
  54. package/arcade/mario-not/tests/fixtures/story15-hud-narrow.txt +2 -0
  55. package/arcade/mario-not/tests/fixtures/story16-unknown-tile.txt +4 -0
  56. package/arcade/mario-not/tests/fixtures/story17-mix.txt +4 -0
  57. package/arcade/mario-not/tests/fixtures/story18-hud-score.txt +2 -0
  58. package/arcade/mario-not/tests/fixtures/story19-cue.txt +4 -0
  59. package/arcade/mario-not/tests/fixtures/story2-enemy.txt +4 -0
  60. package/arcade/mario-not/tests/fixtures/story20-camera-offset.txt +4 -0
  61. package/arcade/mario-not/tests/fixtures/story21-hud-zero.txt +2 -0
  62. package/arcade/mario-not/tests/fixtures/story22-big-viewport.txt +4 -0
  63. package/arcade/mario-not/tests/fixtures/story23-camera-negative.txt +4 -0
  64. package/arcade/mario-not/tests/fixtures/story24-camera-width.txt +4 -0
  65. package/arcade/mario-not/tests/fixtures/story25-camera-positive.txt +4 -0
  66. package/arcade/mario-not/tests/fixtures/story26-hud-lives.txt +2 -0
  67. package/arcade/mario-not/tests/fixtures/story27-hud-coins.txt +2 -0
  68. package/arcade/mario-not/tests/fixtures/story28-item-viewport.txt +4 -0
  69. package/arcade/mario-not/tests/fixtures/story29-enemy-viewport.txt +4 -0
  70. package/arcade/mario-not/tests/fixtures/story3-hud.txt +2 -0
  71. package/arcade/mario-not/tests/fixtures/story30-hud-score.txt +2 -0
  72. package/arcade/mario-not/tests/fixtures/story31-particles-viewport.txt +4 -0
  73. package/arcade/mario-not/tests/fixtures/story32-paused-frame.txt +4 -0
  74. package/arcade/mario-not/tests/fixtures/story4-big.txt +4 -0
  75. package/arcade/mario-not/tests/fixtures/story5-resume-hud.txt +2 -0
  76. package/arcade/mario-not/tests/fixtures/story6-particles.txt +4 -0
  77. package/arcade/mario-not/tests/fixtures/story6-paused.txt +4 -0
  78. package/arcade/mario-not/tests/fixtures/story7-powerup.txt +4 -0
  79. package/arcade/mario-not/tests/fixtures/story8-hud-time.txt +2 -0
  80. package/arcade/mario-not/tests/fixtures/story9-hud-level.txt +2 -0
  81. package/arcade/mario-not/tiles.js +79 -0
  82. package/arcade/mario-not/tsconfig.json +14 -0
  83. package/arcade/mario-not/types.js +225 -0
  84. package/arcade/package.json +26 -0
  85. package/arcade/picman.ts +328 -0
  86. package/arcade/ping.ts +594 -0
  87. package/arcade/spice-invaders.ts +1104 -0
  88. package/arcade/tetris.ts +662 -0
  89. package/code-actions/CHANGELOG.md +4 -0
  90. package/code-actions/README.md +65 -0
  91. package/code-actions/actions.ts +107 -0
  92. package/code-actions/index.ts +148 -0
  93. package/code-actions/package.json +22 -0
  94. package/code-actions/search.ts +79 -0
  95. package/code-actions/snippets.ts +179 -0
  96. package/code-actions/ui.ts +120 -0
  97. package/files-widget/CHANGELOG.md +90 -0
  98. package/files-widget/DESIGN.md +452 -0
  99. package/files-widget/README.md +122 -0
  100. package/files-widget/TODO.md +141 -0
  101. package/files-widget/browser.ts +922 -0
  102. package/files-widget/comment.ts +5 -0
  103. package/files-widget/constants.ts +18 -0
  104. package/files-widget/demo.svg +1 -0
  105. package/files-widget/file-tree.ts +224 -0
  106. package/files-widget/file-viewer.ts +93 -0
  107. package/files-widget/git.ts +107 -0
  108. package/files-widget/index.ts +140 -0
  109. package/files-widget/input-utils.ts +3 -0
  110. package/files-widget/package.json +22 -0
  111. package/files-widget/types.ts +28 -0
  112. package/files-widget/utils.ts +26 -0
  113. package/files-widget/viewer.ts +424 -0
  114. package/import-cc-codex/research/import-chats-from-other-agents.md +135 -0
  115. package/import-cc-codex/spec.md +79 -0
  116. package/package.json +29 -0
  117. package/ralph-wiggum/CHANGELOG.md +7 -0
  118. package/ralph-wiggum/README.md +96 -0
  119. package/ralph-wiggum/SKILL.md +73 -0
  120. package/ralph-wiggum/index.ts +792 -0
  121. package/ralph-wiggum/package.json +25 -0
  122. package/raw-paste/CHANGELOG.md +7 -0
  123. package/raw-paste/README.md +52 -0
  124. package/raw-paste/index.ts +112 -0
  125. package/raw-paste/package.json +22 -0
  126. package/tab-status/CHANGELOG.md +4 -0
  127. package/tab-status/README.md +61 -0
  128. package/tab-status/assets/tab-status.png +0 -0
  129. package/tab-status/package.json +22 -0
  130. package/tab-status/tab-status.ts +179 -0
  131. package/usage-extension/CHANGELOG.md +17 -0
  132. package/usage-extension/README.md +120 -0
  133. package/usage-extension/index.ts +628 -0
  134. package/usage-extension/package.json +22 -0
  135. package/usage-extension/screenshot.png +0 -0
@@ -0,0 +1,31 @@
1
+ # import-cc-codex implementation loop
2
+
3
+ ## Goals
4
+ - Implement Phase 1 `pi --import <path>` CLI flow.
5
+ - Build Claude Code + Codex transcript parsing + mapping.
6
+ - Add usage exclusion + context estimate for imported ranges.
7
+ - Preserve metadata, ordering, and labels per spec.
8
+ - Prepare for Phase 2 `/import` selector (no UI changes yet unless required).
9
+
10
+ ## Checklist (interleaved)
11
+ 1. Wire CLI flags + import entrypoint (imp-001)
12
+ 2. Implement parsers + mapping utilities (imp-002)
13
+ 3. Add import metadata + labeling (imp-004)
14
+ 4. Implement usage exclusion + context estimate (imp-003)
15
+ 5. Add tool-output redaction (imp-005)
16
+ 6. **Reflection**: summarize what works/doesn’t, adjust plan
17
+ 7. **Cleanup**: refactor/simplify, remove redundancy, improve clarity
18
+ 8. **Testing**: targeted tests for parsers/mapping
19
+ 9. Repeat (1–5) as needed
20
+ 10. **Reflection** (periodic)
21
+ 11. **Cleanup** (periodic)
22
+ 12. **Testing**: broaden scope; move toward E2E once CLI flow is stable
23
+
24
+ ## Acceptance
25
+ - `pi --import <path>` creates a valid Pi session JSONL and opens it.
26
+ - Imported sessions are labeled, metadata preserved, and usage excluded.
27
+ - Deterministic context % works before first new assistant response.
28
+ - Tests cover key parsing and mapping behavior.
29
+
30
+ ## Progress Log
31
+ - 2026-01-13: Wired `--import`/`--source` CLI flags, added core import module for CC/Codex parsing + mapping, updated README CLI docs, and added startup status banner plumbing. Pending: tests, usage exclusion/context estimate, redaction opt-out.
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "import-cc-codex",
3
+ "taskFile": ".ralph/import-cc-codex.md",
4
+ "iteration": 1,
5
+ "maxIterations": 50,
6
+ "itemsPerIteration": 3,
7
+ "reflectEvery": 3,
8
+ "reflectInstructions": "REFLECTION CHECKPOINT\n\nPause and reflect on your progress:\n1. What has been accomplished so far?\n2. What's working well?\n3. What's not working or blocking progress?\n4. Should the approach be adjusted?\n5. What are the next priorities?\n\nUpdate the task file with your reflection, then continue working.",
9
+ "active": false,
10
+ "status": "completed",
11
+ "startedAt": "2026-01-13T13:32:49.696Z",
12
+ "lastReflectionAt": 0,
13
+ "completedAt": "2026-01-13T13:33:21.479Z"
14
+ }
@@ -0,0 +1,69 @@
1
+ # Badlogic Game Implementation
2
+
3
+ ## Goal
4
+ Implement `/badlogic-game` per `badlogic-game/spec.md` with deterministic core logic, reliable tests (unit + integration + E2E), and incremental milestones.
5
+
6
+ ## Loop Protocol
7
+ - Work on 1 feature per iteration (small, shippable, testable).
8
+ - Each iteration MUST:
9
+ - Add or extend at least 1 regression test (unit or integration).
10
+ - Add or extend at least 1 E2E scripted scenario (headless run with golden frame or state snapshot).
11
+ - Record verification evidence (commands + results) in Reflection.
12
+ - After each story, do a quick refactor pass to keep code concise and modular.
13
+ - Keep diffs small; commit once the feature passes verification.
14
+ - Self-reflect every iteration and adjust plan if needed.
15
+
16
+ ## Refactor Principles
17
+ - Keep files under ~400 LOC; split by responsibility (engine, render, entities, input, levels).
18
+ - Prefer pure functions and deterministic state updates; avoid hidden globals.
19
+ - Consolidate constants (tiles, glyphs, physics) in one place.
20
+ - Eliminate duplication by extracting helpers and data tables.
21
+
22
+ ## Typing Strategy
23
+ - Use `// @ts-check` + JSDoc types for strict checks without a build step.
24
+ - Add `badlogic-game/tsconfig.json` with `checkJs`, `strict`, `noEmit`.
25
+ - Typecheck command: `npx tsc --noEmit -p badlogic-game/tsconfig.json` (record results).
26
+
27
+ ## Verifiability Standard
28
+ - Unit tests: physics tick, jump apex, collision resolution, serialization.
29
+ - Integration tests: deterministic input sequences -> expected positions/collisions/state transitions.
30
+ - E2E tests: scripted input -> render frames or HUD/state snapshots; compare to golden fixtures.
31
+ - Manual checks: milestone smoke test in a live TUI session (M1..M4).
32
+
33
+ ## Feature Checklist
34
+ - [x] Story 0: Test harness + engine/core separation
35
+ - Decide runner (node:test vs custom) and structure
36
+ - Deterministic RNG + headless renderer
37
+ - [x] Quality: strict typing setup (tsconfig + @ts-check)
38
+ - [x] Story 1: Core loop (map, movement, gravity, collision, camera clamp, Level 1)
39
+ - [x] Story 2: Enemies + stomp + hazards
40
+ - [x] Story 3: Blocks + coins + scoring + HUD
41
+ - [x] Story 4: Power-ups (mushroom) + big state
42
+ - [x] Story 5: Save/resume + pause/quit
43
+ - [x] Story 6: Polish (particles, text cues, camera dead-zone)
44
+ - [x] Docs + wiring: `/badlogic-game` command registration and README update
45
+ - [ ] Final: full test run + manual E2E checks; update harness logs
46
+
47
+ ## Milestone Gates
48
+ - [x] M1: Story 1 + test harness + E2E scenario
49
+ - [x] M2: Story 2 + tests + E2E scenario
50
+ - [x] M3: Story 3/4 + tests + E2E scenario
51
+ - [ ] M4: Story 5/6 + tests + manual run
52
+
53
+ ## References
54
+ - Spec: `badlogic-game/spec.md`
55
+ - Existing WIP: `arcade/wip/badlogic-game.ts`
56
+
57
+ ## Reflection (Iteration 35)
58
+ 1. What has been accomplished so far?
59
+ - Added invuln save regression test and paused cue frame E2E fixture.
60
+ - Verification: `node --test badlogic-game/tests/*.test.js` -> 77 pass; `npx tsc --noEmit -p badlogic-game/tsconfig.json` -> ok.
61
+ 2. What's working well?
62
+ - Invuln persistence and paused cue overlay are covered deterministically.
63
+ 3. What's not working or blocking progress?
64
+ - Manual M4 run still pending (interactive UI required).
65
+ 4. Should the approach be adjusted?
66
+ - No; keep manual run as final gate.
67
+ 5. What are the next priorities?
68
+ - M4 manual run.
69
+ - Final: update harness logs.
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "badlogic-game-impl",
3
+ "taskFile": ".ralph/badlogic-game-impl.md",
4
+ "iteration": 35,
5
+ "maxIterations": 80,
6
+ "itemsPerIteration": 1,
7
+ "reflectEvery": 1,
8
+ "reflectInstructions": "REFLECTION CHECKPOINT\n\nPause and reflect on your progress:\n1. What has been accomplished so far?\n2. What's working well?\n3. What's not working or blocking progress?\n4. Should the approach be adjusted?\n5. What are the next priorities?\n\nUpdate the task file with your reflection, then continue working.",
9
+ "active": false,
10
+ "status": "completed",
11
+ "startedAt": "2026-01-09T03:55:16.633Z",
12
+ "lastReflectionAt": 35,
13
+ "completedAt": "2026-01-09T09:09:36.947Z"
14
+ }
@@ -0,0 +1,163 @@
1
+ # Badlogic Game Spec
2
+
3
+ ## Goal
4
+ Create a comprehensive Mario-style TUI extension spec in `badlogic-game/spec.md` with list-based outline and detailed, verifiable content. Each sub-subsection must include design intent + implementation guidance so it is directly actionable for engineering.
5
+
6
+ ## Requirements
7
+ - Use list items + subitems for the outline and content.
8
+ - Draft section-by-section via ralph loop iterations.
9
+ - Iterate at the level of every sub-subsection (e.g., target size, scroll rules).
10
+ - After completing each sub-section (e.g., Player Experience & Feel), reflect on coherence and adjust if needed.
11
+ - Final coherence reflection at end of doc; adjust as needed.
12
+ - Commit after each major section: Core Gameplay, Presentation, Tech + Delivery.
13
+
14
+ ## Planned Sections
15
+ 1) Core Gameplay
16
+ - Player Experience & Feel
17
+ - Time-to-fun / quick boot
18
+ - Pace / difficulty ramp
19
+ - Failure/respawn cadence
20
+ - Feel targets vs SMB1
21
+ - Controls & Input
22
+ - Key mapping
23
+ - Input buffering
24
+ - Pausing/quitting/restart
25
+ - Game Loop & States
26
+ - State machine
27
+ - Transitions
28
+ - Level Design
29
+ - Tile palette
30
+ - Layout rules
31
+ - Level 1 (short)
32
+ - Entities & Interactions
33
+ - Player
34
+ - Blocks
35
+ - Items
36
+ - Enemies
37
+ - Hazards
38
+ - Physics & Movement
39
+ - Gravity / accel / friction
40
+ - Jump (variable)
41
+ - Collision resolution
42
+
43
+ 2) Presentation
44
+ - Camera & Viewport
45
+ - Target size
46
+ - Scroll rules
47
+ - Bounds/edges
48
+ - Rendering & Palette
49
+ - 256-color plan
50
+ - Glyphs / tiles
51
+ - HUD & Scoring
52
+ - HUD layout
53
+ - Score/lives/time/coins
54
+ - FX & Feedback (optional)
55
+ - Particles
56
+ - Text cues
57
+
58
+ 3) Tech + Delivery
59
+ - Save/Resume
60
+ - Autosave cadence
61
+ - Persisted fields
62
+ - Resume behavior
63
+ - Technical Architecture
64
+ - Data model
65
+ - Update order
66
+ - Collision handling
67
+ - Input handling
68
+ - Serialization
69
+ - Feature Stories & Sequencing
70
+ - Test Plan
71
+ - Milestones
72
+ - Open Questions
73
+
74
+ ## Checklist
75
+ - [x] Create `badlogic-game/spec.md` with list-based scaffold
76
+ - [x] Draft Core Gameplay subsections (reflect + adjust after each)
77
+ - [x] Player Experience & Feel > Time-to-fun / quick boot
78
+ - [x] Player Experience & Feel > Pace / difficulty ramp
79
+ - [x] Player Experience & Feel > Failure/respawn cadence
80
+ - [x] Player Experience & Feel > Feel targets vs SMB1
81
+ - [x] Controls & Input > Key mapping
82
+ - [x] Controls & Input > Input buffering
83
+ - [x] Controls & Input > Pausing/quitting/restart
84
+ - [x] Game Loop & States > State machine
85
+ - [x] Game Loop & States > Transitions
86
+ - [x] Level Design > Tile palette
87
+ - [x] Level Design > Layout rules
88
+ - [x] Level Design > Level 1 (short)
89
+ - [x] Entities & Interactions > Player
90
+ - [x] Entities & Interactions > Blocks
91
+ - [x] Entities & Interactions > Items
92
+ - [x] Entities & Interactions > Enemies
93
+ - [x] Entities & Interactions > Hazards
94
+ - [x] Physics & Movement > Gravity / accel / friction
95
+ - [x] Physics & Movement > Jump (variable)
96
+ - [x] Physics & Movement > Collision resolution
97
+ - [x] Commit Core Gameplay section
98
+ - [x] Draft Presentation subsections (reflect + adjust after each)
99
+ - [x] Camera & Viewport > Target size
100
+ - [x] Camera & Viewport > Scroll rules
101
+ - [x] Camera & Viewport > Bounds/edges
102
+ - [x] Rendering & Palette > 256-color plan
103
+ - [x] Rendering & Palette > Glyphs / tiles
104
+ - [x] HUD & Scoring > HUD layout
105
+ - [x] HUD & Scoring > Score/lives/time/coins
106
+ - [x] FX & Feedback > Particles
107
+ - [x] FX & Feedback > Text cues
108
+ - [x] Commit Presentation section
109
+ - [x] Draft Tech + Delivery subsections (reflect + adjust after each)
110
+ - [x] Save/Resume > Autosave cadence
111
+ - [x] Save/Resume > Persisted fields
112
+ - [x] Save/Resume > Resume behavior
113
+ - [x] Technical Architecture > Data model
114
+ - [x] Technical Architecture > Update order
115
+ - [x] Technical Architecture > Collision handling
116
+ - [x] Technical Architecture > Input handling
117
+ - [x] Technical Architecture > Serialization
118
+ - [x] Feature Stories & Sequencing
119
+ - [x] Test Plan
120
+ - [x] Milestones
121
+ - [x] Open Questions
122
+ - [x] Commit Tech + Delivery section
123
+ - [x] Final coherence reflection; adjust doc as needed
124
+
125
+ ## Reflection (Iteration 46)
126
+ 1. What has been accomplished so far?
127
+ - Completed final coherence pass; clarified player glyph sizing.
128
+ 2. What's working well?
129
+ - All sections align on sizes, timings, and rendering constraints.
130
+ 3. What's not working or blocking progress?
131
+ - Nothing blocked.
132
+ 4. Should the approach be adjusted?
133
+ - No; spec is complete.
134
+ 5. What are the next priorities?
135
+ - None; ready to stop loop.
136
+
137
+ ## Coherence Checks
138
+ - Physics & Movement: collision ordering aligns with stomp and head-bump rules.
139
+
140
+ ## Tech + Delivery Coherence Check (Iteration 45)
141
+ - Save cadence aligns with resume behavior and pause/quit rules.
142
+ - Data model fields cover persisted fields list.
143
+ - Serialization versioning aligns with SaveState schema.
144
+ - Stories/milestones reflect the same delivery order.
145
+
146
+ ## Final Coherence Check (Iteration 46)
147
+ - Glyph sizing clarified for player big state (1x3 tiles).
148
+ - Run modifier, jump buffer, and physics values are consistent.
149
+ - Save/resume flow matches input and state machine rules.
150
+
151
+ ## Presentation Coherence Check (Iteration 32)
152
+ - Viewport size supports HUD lines and 2-char tile grid without wrap.
153
+ - Camera rules align with bounds clamp and no vertical scroll assumption.
154
+ - Glyphs/tiles use ASCII and 2-char width consistent with rendering plan.
155
+ - HUD fields (score/coins/lives/time) match scoring spec values.
156
+ - FX cues are lightweight and don't conflict with HUD overlays.
157
+
158
+ ## Core Gameplay Coherence Check (Iteration 22)
159
+ - Consistency: run modifier defined in Controls; referenced in Physics and feel targets.
160
+ - Timing: coyote/jump buffer values consistent between Input and Jump sections.
161
+ - Level 1: pacing, layout rules, and hazards align with speed/jump targets.
162
+ - Death loop: hazards, enemies, and respawn cadence agree on invuln timing and lives.
163
+ - Tile palette: blocks/items/hazards align with symbols; ensure rendering uses same glyphs.
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "badlogic-game-spec",
3
+ "taskFile": ".ralph/badlogic-game-spec.md",
4
+ "iteration": 46,
5
+ "maxIterations": 60,
6
+ "itemsPerIteration": 1,
7
+ "reflectEvery": 1,
8
+ "reflectInstructions": "REFLECTION CHECKPOINT\n\nPause and reflect on your progress:\n1. What has been accomplished so far?\n2. What's working well?\n3. What's not working or blocking progress?\n4. Should the approach be adjusted?\n5. What are the next priorities?\n\nUpdate the task file with your reflection, then continue working.",
9
+ "active": false,
10
+ "status": "completed",
11
+ "startedAt": "2026-01-08T22:35:44.127Z",
12
+ "lastReflectionAt": 46,
13
+ "completedAt": "2026-01-08T23:04:52.947Z"
14
+ }
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Thomas Mustier
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # pi-extensions
2
+
3
+ Personal extensions for the [Pi coding agent](https://github.com/badlogic/pi-mono).
4
+
5
+ ## Extensions
6
+
7
+ | Extension | Description |
8
+ |-----------|-------------|
9
+ | [/files](files-widget/) | In-terminal file browser and viewer. Navigate files, view diffs, select code, send comments to agent - all without leaving Pi |
10
+ | [tab-status](tab-status/) | Manage as many parallel sessions as your mind can handle. Terminal tab indicators for <br>✅ done / 🚧 stuck / 🛑 timed out |
11
+ | [ralph-wiggum](ralph-wiggum/) | Run arbitrarily-long tasks without diluting model attention. Flat version without subagents like [ralph-loop](https://github.com/anthropics/claude-plugins-official/tree/main/plugins/ralph-loop) |
12
+ | [agent-guidance](agent-guidance/) | Switch between Claude/Codex/Gemini with model-specific guidance (CLAUDE.md, CODEX.md, GEMINI.md) |
13
+ | [/usage](usage-extension/) | 📊 Usage statistics dashboard. See cost, tokens, and messages by provider/model across Today, This Week, All Time |
14
+ | [/paste](raw-paste/) | Paste editable text, not [paste #1 +21 lines]. Running `/paste` with optional keybinding |
15
+ | [/code](code-actions/) | Pick code blocks or inline snippets from assistant messages to copy, insert, or run with `/code` |
16
+ | [arcade](arcade/) | Play minigames while your tests run: 👾 sPIce-invaders, 👻 picman, 🏓 ping, 🧩 tetris, 🍄 mario-not |
17
+
18
+ ## Install (pi package manager)
19
+
20
+ ```bash
21
+ pi install git:github.com/tmustier/pi-extensions
22
+ ```
23
+
24
+ To enable only a subset, replace the package entry in `~/.pi/agent/settings.json` with a filtered one:
25
+
26
+ ```json
27
+ {
28
+ "packages": [
29
+ {
30
+ "source": "git:github.com/tmustier/pi-extensions",
31
+ "extensions": ["files-widget/index.ts"]
32
+ }
33
+ ]
34
+ }
35
+ ```
36
+
37
+ ## Quick Setup
38
+
39
+ If you keep a local clone, add extensions to your `~/.pi/agent/settings.json`:
40
+
41
+ ```json
42
+ {
43
+ "extensions": [
44
+ "~/pi-extensions/files-widget",
45
+ "~/pi-extensions/tab-status/tab-status.ts",
46
+ "~/pi-extensions/arcade/spice-invaders.ts",
47
+ "~/pi-extensions/arcade/ping.ts",
48
+ "~/pi-extensions/arcade/picman.ts",
49
+ "~/pi-extensions/arcade/tetris.ts",
50
+ "~/pi-extensions/arcade/mario-not/mario-not.ts",
51
+ "~/pi-extensions/ralph-wiggum",
52
+ "~/pi-extensions/agent-guidance/agent-guidance.ts",
53
+ "~/pi-extensions/raw-paste",
54
+ "~/pi-extensions/code-actions",
55
+ "~/pi-extensions/usage-extension"
56
+ ]
57
+ }
58
+ ```
59
+
60
+ For agent-guidance, also run the setup script:
61
+ ```bash
62
+ cd ~/pi-extensions/agent-guidance && ./setup.sh
63
+ ```
64
+
65
+ See each extension's README for details.
package/RELEASING.md ADDED
@@ -0,0 +1,34 @@
1
+ # Releasing
2
+
3
+ This repo hosts multiple extensions. Releases are per extension, not per repo.
4
+
5
+ ## Tag Format
6
+
7
+ Use `extension-name/vX.Y.Z` (example: `usage-extension/v0.1.2`).
8
+
9
+ ## Steps
10
+
11
+ 1. Update the extension's `CHANGELOG.md`.
12
+ 2. Optionally refresh compatibility notes in the extension README.
13
+ 3. Bump the extension version in its `package.json` and bump the repo version in the root `package.json` (ensure it is not marked `private` when publishing).
14
+ 4. Publish to npm (both packages):
15
+
16
+ ```bash
17
+ # Extension-specific package
18
+ cd <extension-dir>
19
+ npm publish --access public
20
+
21
+ # Repo-wide pi-extensions package
22
+ cd <repo-root>
23
+ npm publish --access public
24
+ ```
25
+
26
+ 5. Tag and push the release:
27
+
28
+ ```bash
29
+ git tag -a usage-extension/v0.1.2 -m "usage-extension v0.1.2"
30
+ git push origin usage-extension/v0.1.2
31
+ ```
32
+
33
+ 4. Create a GitHub release from the tag and paste the notes from the changelog.
34
+
@@ -0,0 +1,4 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 - 2026-01-13
4
+ - Initial release.
@@ -0,0 +1,102 @@
1
+ # agent-guidance
2
+
3
+ Loads provider-specific context files (CLAUDE.md, CODEX.md, GEMINI.md) based on current model, supplementing Pi's AGENTS.md loading.
4
+
5
+ ## How It Works
6
+
7
+ ```mermaid
8
+ flowchart LR
9
+ S1["~/.pi/agent/"] --> B
10
+ S2["project/"] --> B
11
+
12
+ subgraph Core ["Pi Core"]
13
+ B["Load all AGENTS.md<br/><sub>(CLAUDE.md as fallback)</sub>"]
14
+ end
15
+
16
+ subgraph Ext ["agent-guidance extension"]
17
+ B --> C{Which provider?}
18
+ C -->|Anthropic| D[+ CLAUDE.md]
19
+ C -->|OpenAI/Codex| E[+ CODEX.md]
20
+ C -->|Google| F[+ GEMINI.md]
21
+ end
22
+
23
+ D --> G[System Prompt]
24
+ E --> G
25
+ F --> G
26
+ ```
27
+
28
+ | Provider | File |
29
+ |----------|------|
30
+ | Anthropic | CLAUDE.md |
31
+ | OpenAI / Codex | CODEX.md |
32
+ | Google | GEMINI.md |
33
+
34
+ ### Pi Core behavior
35
+
36
+ Pi Core loads `AGENTS.md` from `~/.pi/agent/` and project directories (walking up from cwd). Falls back to `CLAUDE.md` if no `AGENTS.md` exists.
37
+
38
+ ### What this extension adds
39
+
40
+ For each directory, loads the provider-specific file if:
41
+ - `AGENTS.md` exists (so core didn't load the provider file as fallback)
42
+ - Content differs from `AGENTS.md` (handles copy scenario)
43
+
44
+ ## Install
45
+
46
+ ### Pi package manager
47
+
48
+ ```bash
49
+ pi install npm:@tmustier/pi-agent-guidance
50
+ ```
51
+
52
+ ```bash
53
+ pi install git:github.com/tmustier/pi-extensions
54
+ ```
55
+
56
+ Then filter to just this extension in `~/.pi/agent/settings.json`:
57
+
58
+ ```json
59
+ {
60
+ "packages": [
61
+ {
62
+ "source": "git:github.com/tmustier/pi-extensions",
63
+ "extensions": ["agent-guidance/agent-guidance.ts"]
64
+ }
65
+ ]
66
+ }
67
+ ```
68
+
69
+ ### Local clone (setup script)
70
+
71
+ ```bash
72
+ ./setup.sh
73
+ ```
74
+
75
+ Links the extension to `~/.pi/agent/extensions/` and helps you set up `AGENTS.md`.
76
+
77
+ ## Templates
78
+
79
+ Starter templates in `templates/`:
80
+ - `CLAUDE.md` - Claude-specific guidelines
81
+ - `CODEX.md` - OpenAI guidelines (from [steipete/agent-scripts](https://github.com/steipete/agent-scripts))
82
+ - `GEMINI.md` - Gemini guidelines
83
+
84
+ Install with:
85
+ ```bash
86
+ ln -s ~/pi-extensions/agent-guidance/templates/CLAUDE.md ~/.pi/agent/
87
+ ```
88
+
89
+ ## Configuration (Optional)
90
+
91
+ Create `~/.pi/agent/agent-guidance.json`:
92
+
93
+ ```json
94
+ {
95
+ "providers": { "anthropic": ["CLAUDE.md"] },
96
+ "models": { "claude-3-5*": ["CLAUDE-3-5.md"] }
97
+ }
98
+ ```
99
+
100
+ ## Changelog
101
+
102
+ See `CHANGELOG.md`.
@@ -0,0 +1,147 @@
1
+ /**
2
+ * agent-guidance - Provider-specific context loading
3
+ *
4
+ * Loads CLAUDE.md, CODEX.md, or GEMINI.md based on current model provider,
5
+ * supplementing Pi Core's AGENTS.md loading.
6
+ *
7
+ * Deduplication:
8
+ * - Skips if core already loaded the file (CLAUDE.md fallback case)
9
+ * - Skips if AGENTS.md has identical content
10
+ */
11
+
12
+ import * as fs from "node:fs";
13
+ import * as path from "node:path";
14
+ import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
15
+
16
+ const PROVIDER_FILES: Record<string, string[]> = {
17
+ anthropic: ["CLAUDE.md"],
18
+ openai: ["CODEX.md"],
19
+ "openai-codex": ["CODEX.md"],
20
+ "github-copilot": ["CODEX.md"],
21
+ google: ["GEMINI.md"],
22
+ "google-gemini-cli": ["GEMINI.md"],
23
+ "google-antigravity": ["GEMINI.md"],
24
+ "google-vertex": ["GEMINI.md"],
25
+ };
26
+
27
+ interface Config {
28
+ providers?: Record<string, string[]>;
29
+ models?: Record<string, string[]>;
30
+ }
31
+
32
+ function loadConfig(agentDir: string): Config {
33
+ const configPath = path.join(agentDir, "agent-guidance.json");
34
+ if (fs.existsSync(configPath)) {
35
+ try {
36
+ return JSON.parse(fs.readFileSync(configPath, "utf-8"));
37
+ } catch {
38
+ return {};
39
+ }
40
+ }
41
+ return {};
42
+ }
43
+
44
+ function globMatch(pattern: string, value: string): boolean {
45
+ return new RegExp(`^${pattern.replace(/\*/g, ".*")}$`, "i").test(value);
46
+ }
47
+
48
+ function getCandidateFiles(modelId: string | undefined, provider: string, config: Config): string[] {
49
+ // Model-specific patterns take priority
50
+ if (modelId && config.models) {
51
+ for (const [pattern, files] of Object.entries(config.models)) {
52
+ if (globMatch(pattern, modelId)) return files;
53
+ }
54
+ }
55
+ // Then provider config, then defaults
56
+ return config.providers?.[provider] ?? PROVIDER_FILES[provider] ?? [];
57
+ }
58
+
59
+ function shouldLoad(dir: string, providerFile: string): boolean {
60
+ const providerPath = path.join(dir, providerFile);
61
+ if (!fs.existsSync(providerPath)) return false;
62
+
63
+ const agentsPath = path.join(dir, "AGENTS.md");
64
+ const agentsExists = fs.existsSync(agentsPath);
65
+ const claudeExists = fs.existsSync(path.join(dir, "CLAUDE.md"));
66
+
67
+ // What did core load? (prefers AGENTS.md, falls back to CLAUDE.md)
68
+ const coreLoaded = agentsExists ? "AGENTS.md" : claudeExists ? "CLAUDE.md" : null;
69
+ if (coreLoaded === providerFile) return false;
70
+
71
+ // Skip if identical to AGENTS.md
72
+ if (agentsExists) {
73
+ try {
74
+ const agentsContent = fs.readFileSync(agentsPath, "utf-8");
75
+ const providerContent = fs.readFileSync(providerPath, "utf-8");
76
+ if (agentsContent === providerContent) return false;
77
+ } catch {
78
+ // Proceed with loading
79
+ }
80
+ }
81
+
82
+ return true;
83
+ }
84
+
85
+ function getDirectories(cwd: string, agentDir: string): string[] {
86
+ const dirs: string[] = [];
87
+ const seen = new Set<string>();
88
+
89
+ // Global agent dir first
90
+ if (fs.existsSync(agentDir)) {
91
+ dirs.push(agentDir);
92
+ seen.add(agentDir);
93
+ }
94
+
95
+ // Walk up from cwd to root
96
+ let current = cwd;
97
+ const ancestors: string[] = [];
98
+ while (true) {
99
+ if (!seen.has(current)) {
100
+ ancestors.unshift(current);
101
+ seen.add(current);
102
+ }
103
+ const parent = path.resolve(current, "..");
104
+ if (parent === current) break;
105
+ current = parent;
106
+ }
107
+
108
+ dirs.push(...ancestors);
109
+ return dirs;
110
+ }
111
+
112
+ export default function agentGuidance(pi: ExtensionAPI) {
113
+ const agentDir = path.join(process.env.HOME || "", ".pi", "agent");
114
+ const config = loadConfig(agentDir);
115
+
116
+ pi.on("before_agent_start", async (_event, ctx) => {
117
+ const provider = ctx.model?.provider;
118
+ if (!provider) return;
119
+
120
+ const candidates = getCandidateFiles(ctx.model?.id, provider, config);
121
+ if (candidates.length === 0) return;
122
+
123
+ const files: Array<{ path: string; content: string }> = [];
124
+
125
+ for (const dir of getDirectories(ctx.cwd, agentDir)) {
126
+ for (const filename of candidates) {
127
+ if (shouldLoad(dir, filename)) {
128
+ const filePath = path.join(dir, filename);
129
+ try {
130
+ files.push({ path: filePath, content: fs.readFileSync(filePath, "utf-8") });
131
+ } catch {
132
+ // Skip unreadable files
133
+ }
134
+ }
135
+ }
136
+ }
137
+
138
+ if (files.length === 0) return;
139
+
140
+ let append = "\n\n# Provider-Specific Context\n\n";
141
+ for (const { path: p, content } of files) {
142
+ append += `## ${p}\n\n${content}\n\n`;
143
+ }
144
+
145
+ return { systemPromptAppend: append };
146
+ });
147
+ }