@g3nomaly/g3n-mods 0.0.0-stage → 0.1.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.
Files changed (45) hide show
  1. package/.claude-plugin/marketplace.json +68 -0
  2. package/LICENSE +95 -0
  3. package/mods/agents-panel/.claude-plugin/plugin.json +9 -0
  4. package/mods/agents-panel/hooks/hooks.json +1 -0
  5. package/mods/agents-panel/hooks/register.tsx +277 -0
  6. package/mods/agents-panel/types/index.d.ts +24 -0
  7. package/mods/context-bar/.claude-plugin/plugin.json +9 -0
  8. package/mods/context-bar/hooks/hooks.json +1 -0
  9. package/mods/context-bar/hooks/register.tsx +215 -0
  10. package/mods/context-bar/types/index.d.ts +25 -0
  11. package/mods/custom-crab-agents/.claude-plugin/plugin.json +9 -0
  12. package/mods/custom-crab-agents/hooks/hooks.json +1 -0
  13. package/mods/custom-crab-agents/hooks/register.tsx +508 -0
  14. package/mods/custom-crab-agents/types/index.d.ts +45 -0
  15. package/mods/delete-guard/.claude-plugin/plugin.json +9 -0
  16. package/mods/delete-guard/hooks/hooks.json +1 -0
  17. package/mods/delete-guard/hooks/register.ts +151 -0
  18. package/mods/delete-guard/types/index.d.ts +14 -0
  19. package/mods/focus-mode/.claude-plugin/plugin.json +17 -0
  20. package/mods/focus-mode/hooks/hooks.json +1 -0
  21. package/mods/focus-mode/hooks/register.tsx +184 -0
  22. package/mods/focus-mode/types/index.d.ts +14 -0
  23. package/mods/handoff/.claude-plugin/plugin.json +9 -0
  24. package/mods/handoff/hooks/hooks.json +1 -0
  25. package/mods/handoff/hooks/register.tsx +156 -0
  26. package/mods/handoff/types/index.d.ts +15 -0
  27. package/mods/hide-personal-data/.claude-plugin/plugin.json +17 -0
  28. package/mods/hide-personal-data/hooks/hooks.json +1 -0
  29. package/mods/hide-personal-data/hooks/register.tsx +196 -0
  30. package/mods/hide-personal-data/types/index.d.ts +17 -0
  31. package/mods/mini-game/.claude-plugin/plugin.json +9 -0
  32. package/mods/mini-game/hooks/hooks.json +1 -0
  33. package/mods/mini-game/hooks/register.tsx +273 -0
  34. package/mods/mini-game/types/index.d.ts +21 -0
  35. package/mods/tool-timeline/.claude-plugin/plugin.json +9 -0
  36. package/mods/tool-timeline/hooks/hooks.json +1 -0
  37. package/mods/tool-timeline/hooks/register.tsx +311 -0
  38. package/mods/tool-timeline/types/index.d.ts +25 -0
  39. package/mods/tsconfig.json +17 -0
  40. package/mods/you-should-know/.claude-plugin/plugin.json +23 -0
  41. package/mods/you-should-know/hooks/hooks.json +1 -0
  42. package/mods/you-should-know/hooks/register.tsx +116 -0
  43. package/mods/you-should-know/types/index.d.ts +15 -0
  44. package/package.json +25 -4
  45. package/README.md +0 -3
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "g3n-mods",
3
+ "owner": {
4
+ "name": "g3ntrovert"
5
+ },
6
+ "plugins": [
7
+ {
8
+ "name": "agents-panel",
9
+ "source": "./mods/agents-panel",
10
+ "description": "The agents in .claude/agents with their model and a run button.",
11
+ "version": "0.1.0"
12
+ },
13
+ {
14
+ "name": "context-bar",
15
+ "source": "./mods/context-bar",
16
+ "description": "Context window use as one bar split by source, with the total and the compaction point.",
17
+ "version": "0.1.0"
18
+ },
19
+ {
20
+ "name": "custom-crab-agents",
21
+ "source": "./mods/custom-crab-agents",
22
+ "description": "Each subagent as a crab with a hat: effort tier, model, steps, context, tokens, cost and time.",
23
+ "version": "0.1.0"
24
+ },
25
+ {
26
+ "name": "delete-guard",
27
+ "source": "./mods/delete-guard",
28
+ "description": "Denies rm -rf and other permanent deletes and points Claude to the trash.",
29
+ "version": "0.1.0"
30
+ },
31
+ {
32
+ "name": "focus-mode",
33
+ "source": "./mods/focus-mode",
34
+ "description": "A timed focus block with a countdown, a progress bar and an end button.",
35
+ "version": "0.1.0"
36
+ },
37
+ {
38
+ "name": "handoff",
39
+ "source": "./mods/handoff",
40
+ "description": "Writes a handoff with the handoff skill, clears the session, and starts the fresh one with your next prompt.",
41
+ "version": "0.1.0"
42
+ },
43
+ {
44
+ "name": "hide-personal-data",
45
+ "source": "./mods/hide-personal-data",
46
+ "description": "Masks names, emails and other personal data in replies; hover to show them.",
47
+ "version": "0.1.0"
48
+ },
49
+ {
50
+ "name": "mini-game",
51
+ "source": "./mods/mini-game",
52
+ "description": "Minesweeper to play while Claude works.",
53
+ "version": "0.1.0"
54
+ },
55
+ {
56
+ "name": "tool-timeline",
57
+ "source": "./mods/tool-timeline",
58
+ "description": "Each tool call with its duration; a denied call is struck through next to the call that replaced it.",
59
+ "version": "0.1.0"
60
+ },
61
+ {
62
+ "name": "you-should-know",
63
+ "source": "./mods/you-should-know",
64
+ "description": "A card under long replies that flags their key point: a headline and one supporting line.",
65
+ "version": "0.1.0"
66
+ }
67
+ ]
68
+ }
package/LICENSE ADDED
@@ -0,0 +1,95 @@
1
+ Copyright (c) 2026 G3NTs - G3nomaly
2
+
3
+ Elastic License 2.0
4
+
5
+ URL: https://www.elastic.co/licensing/elastic-license
6
+
7
+ ## Acceptance
8
+
9
+ By using the software, you agree to all of the terms and conditions below.
10
+
11
+ ## Copyright License
12
+
13
+ The licensor grants you a non-exclusive, royalty-free, worldwide,
14
+ non-sublicensable, non-transferable license to use, copy, distribute, make
15
+ available, and prepare derivative works of the software, in each case subject to
16
+ the limitations and conditions below.
17
+
18
+ ## Limitations
19
+
20
+ You may not provide the software to third parties as a hosted or managed
21
+ service, where the service provides users with access to any substantial set of
22
+ the features or functionality of the software.
23
+
24
+ You may not move, change, disable, or circumvent the license key functionality
25
+ in the software, and you may not remove or obscure any functionality in the
26
+ software that is protected by the license key.
27
+
28
+ You may not alter, remove, or obscure any licensing, copyright, or other notices
29
+ of the licensor in the software. Any use of the licensor’s trademarks is subject
30
+ to applicable law.
31
+
32
+ ## Patents
33
+
34
+ The licensor grants you a license, under any patent claims the licensor can
35
+ license, or becomes able to license, to make, have made, use, sell, offer for
36
+ sale, import and have imported the software, in each case subject to the
37
+ limitations and conditions in this license. This license does not cover any
38
+ patent claims that you cause to be infringed by modifications or additions to
39
+ the software. If you or your company make any written claim that the software
40
+ infringes or contributes to infringement of any patent, your patent license for
41
+ the software granted under these terms ends immediately. If your company makes
42
+ such a claim, your patent license ends immediately for work on behalf of your
43
+ company.
44
+
45
+ ## Notices
46
+
47
+ You must ensure that anyone who gets a copy of any part of the software from you
48
+ also gets a copy of these terms.
49
+
50
+ If you modify the software, you must include in any modified copies of the
51
+ software prominent notices stating that you have modified the software.
52
+
53
+ ## No Other Rights
54
+
55
+ These terms do not imply any licenses other than those expressly granted in
56
+ these terms.
57
+
58
+ ## Termination
59
+
60
+ If you use the software in violation of these terms, such use is not licensed,
61
+ and your licenses will automatically terminate. If the licensor provides you
62
+ with a notice of your violation, and you cease all violation of this license no
63
+ later than 30 days after you receive that notice, your licenses will be
64
+ reinstated retroactively. However, if you violate these terms after such
65
+ reinstatement, any additional violation of these terms will cause your licenses
66
+ to terminate automatically and permanently.
67
+
68
+ ## No Liability
69
+
70
+ *As far as the law allows, the software comes as is, without any warranty or
71
+ condition, and the licensor will not be liable to you for any damages arising
72
+ out of these terms or the use or nature of the software, under any kind of
73
+ legal claim.*
74
+
75
+ ## Definitions
76
+
77
+ The **licensor** is the entity offering these terms, and the **software** is the
78
+ software the licensor makes available under these terms, including any portion
79
+ of it.
80
+
81
+ **you** refers to the individual or entity agreeing to these terms.
82
+
83
+ **your company** is any legal entity, sole proprietorship, or other kind of
84
+ organization that you work for, plus all organizations that have control over,
85
+ are under the control of, or are under common control with that
86
+ organization. **control** means ownership of substantially all the assets of an
87
+ entity, or the power to direct its management and policies by vote, contract, or
88
+ otherwise. Control can be direct or indirect.
89
+
90
+ **your licenses** are all the licenses granted to you for the software under
91
+ these terms.
92
+
93
+ **use** means anything you do with the software requiring one of your licenses.
94
+
95
+ **trademark** means trademarks, service marks, and similar rights.
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "agents-panel",
3
+ "version": "0.1.0",
4
+ "description": "The agents in .claude/agents with their model and a run button.",
5
+ "author": {
6
+ "name": "g3ntrovert"
7
+ },
8
+ "types": "./types/index.d.ts"
9
+ }
@@ -0,0 +1 @@
1
+ { "modules": ["./register.tsx"] }
@@ -0,0 +1,277 @@
1
+ // packages/g3n-mods/mods/agents-panel/hooks/register.tsx
2
+ import { atom, read, update } from 'claude-code'
3
+ import type { EngineInterface, Register } from 'claude-code'
4
+
5
+ import type { AgentDef, RunningAgent } from '../types'
6
+
7
+ const PANE = 'agents-panel'
8
+ const TITLE = 'Agents'
9
+ const agents = atom({ plugin: 'agents-panel', key: 'agents' } as const, [])
10
+ const running = atom({ plugin: 'agents-panel', key: 'running' } as const, [])
11
+ const task = atom({ plugin: 'agents-panel', key: 'task' } as const, '')
12
+
13
+ const AGENTS_DIR = '.claude/agents'
14
+ const DEFAULT_TASK = 'Do the job your instructions describe for this project, then report what you did and what you found.'
15
+ const DOT_COLORS = ['#6b8fd6', '#5fb3c4', '#e6c167', '#e0775a', '#b48ead', '#e06c6c', '#7cc47f', '#9b87f5']
16
+ const NAMED_COLORS: Readonly<Record<string, string>> = {
17
+ red: '#e06c6c', blue: '#6b8fd6', green: '#7cc47f', yellow: '#e6c167',
18
+ purple: '#b48ead', orange: '#e0775a', pink: '#f09bb5', cyan: '#5fb3c4',
19
+ }
20
+ const SPINNER = ['◐', '◓', '◑', '◒']
21
+ const DONE_STATUSES = new Set(['completed', 'failed', 'killed', 'idle'])
22
+
23
+ /**
24
+ * Parses the frontmatter of a Markdown file into flat `key: value` pairs.
25
+ *
26
+ * @param text - Full Markdown text, which starts with a `---` block when it has frontmatter.
27
+ * @returns Fields by key with surrounding quotes stripped, or `{}` when there is no frontmatter.
28
+ */
29
+ export function frontmatter(text: string): Record<string, string> {
30
+ const match = /^---\r?\n([\s\S]*?)\r?\n---/.exec(text)
31
+ if (match === null) return {}
32
+ const fields: Record<string, string> = {}
33
+ for (const line of (match[1] ?? '').split(/\r?\n/)) {
34
+ const pair = /^([A-Za-z][\w-]*):\s*(.*)$/.exec(line)
35
+ if (pair === null) continue
36
+ fields[pair[1] ?? ''] = (pair[2] ?? '').trim().replace(/^(['"])(.*)\1$/, '$2')
37
+ }
38
+ return fields
39
+ }
40
+
41
+ /**
42
+ * Picks the dot color of an agent: its own color when it names one, else a palette color by position.
43
+ *
44
+ * @param agent - Definition whose `color` is tried first.
45
+ * @param index - Position of the agent in its list, used to pick a palette color.
46
+ * @returns CSS hex color.
47
+ */
48
+ function dotColor(agent: AgentDef, index: number): string {
49
+ const named = agent.color === undefined ? undefined : NAMED_COLORS[agent.color] ?? agent.color
50
+ return named ?? DOT_COLORS[index % DOT_COLORS.length] ?? '#8a8f98'
51
+ }
52
+
53
+ /**
54
+ * Reads every agent definition in one agents folder.
55
+ *
56
+ * @param $ - Engine handle the hook received, see `EngineInterface`.
57
+ * @param dir - Folder to read, e.g. `<root>/.claude/agents`.
58
+ * @param scope - Where the folder lives, as `project` or `user`.
59
+ * @returns Definitions sorted by name, or `[]` when the folder does not exist.
60
+ */
61
+ async function readAgentsDir($: EngineInterface, dir: string, scope: AgentDef['scope']): Promise<AgentDef[]> {
62
+ if (!(await $.fs.exists(dir))) return []
63
+ const found: AgentDef[] = []
64
+ for (const entry of await $.fs.list(dir)) {
65
+ if (entry.kind !== 'file' || !entry.name.endsWith('.md')) continue
66
+ const fields = frontmatter(await $.fs.read(`${dir}/${entry.name}`))
67
+ found.push({
68
+ name: fields.name ?? entry.name.replace(/\.md$/, ''),
69
+ description: fields.description ?? '',
70
+ model: fields.model ?? 'inherit',
71
+ color: fields.color,
72
+ scope,
73
+ })
74
+ }
75
+ return found.sort((a, b) => a.name.localeCompare(b.name))
76
+ }
77
+
78
+ /**
79
+ * Reloads the project's and the user's agent definitions into state.
80
+ *
81
+ * A user agent is dropped when the project has one with the same name.
82
+ *
83
+ * @param $ - Engine handle the hook received, see `EngineInterface`.
84
+ */
85
+ async function loadAgents($: EngineInterface): Promise<void> {
86
+ const root = await $.session.root()
87
+ const home = await $.env.get('HOME')
88
+ const project = await readAgentsDir($, `${root}/${AGENTS_DIR}`, 'project')
89
+ const user = home === undefined ? [] : await readAgentsDir($, `${home}/${AGENTS_DIR}`, 'user')
90
+ const names = new Set(project.map(agent => agent.name))
91
+ await update($, agents, () => [...project, ...user.filter(agent => !names.has(agent.name))])
92
+ }
93
+
94
+ /**
95
+ * Starts one agent with the task typed in the panel, or its standing job when none was typed.
96
+ *
97
+ * @param $ - Engine handle the hook received, see `EngineInterface`.
98
+ * @param agent - Definition of the agent to start.
99
+ */
100
+ async function runAgent($: EngineInterface, agent: AgentDef): Promise<void> {
101
+ const typed = (await read($, task)).trim()
102
+ const started = await $.agent.spawn({
103
+ prompt: typed.length > 0 ? typed : DEFAULT_TASK,
104
+ subagentType: agent.name,
105
+ description: `Run ${agent.name} from the agents panel`,
106
+ })
107
+ if ('deny' in started) {
108
+ $.ui.toast(`Could not start ${agent.name}: ${started.deny}`)
109
+ return
110
+ }
111
+ const startedAt = await $.clock.now()
112
+ await update($, running, list => [...list, { name: agent.name, agentId: started.agentId ?? '', startedAt }])
113
+ $.ui.toast(`Started ${agent.name}`)
114
+ }
115
+
116
+ /**
117
+ * Drops the agents that finished from the running list and says which ones did.
118
+ *
119
+ * @param $ - Engine handle the hook received, see `EngineInterface`.
120
+ */
121
+ async function pollRunning($: EngineInterface): Promise<void> {
122
+ const list = await read($, running)
123
+ if (list.length === 0) return
124
+ const known = await $.agent.list()
125
+ const finished = list.filter(run => {
126
+ const info = known.find(agent => agent.id === run.agentId)
127
+ return info !== undefined && DONE_STATUSES.has(info.status)
128
+ })
129
+ if (finished.length > 0) {
130
+ await update($, running, current => current.filter(run => !finished.some(done => done.agentId === run.agentId)))
131
+ for (const run of finished) $.ui.toast(`${run.name} finished`)
132
+ } else {
133
+ $.ui.invalidate('ui.render')
134
+ }
135
+ }
136
+
137
+ /**
138
+ * Puts a finished agent's answer in the transcript as a notice the model does not read.
139
+ *
140
+ * Answers longer than 4000 characters are cut to 4000.
141
+ *
142
+ * @param $ - Engine handle the hook received, see `EngineInterface`.
143
+ * @param run - Agent that finished, from the running list.
144
+ * @param answer - Final text of the agent's reply.
145
+ */
146
+ async function reportAnswer($: EngineInterface, run: RunningAgent, answer: string): Promise<void> {
147
+ const text = answer.length > 4000 ? `${answer.slice(0, 4000)}…` : answer
148
+ await $.session.append({ message: { type: 'system', content: [{ type: 'text', text: `${run.name} finished:\n\n${text}` }] } })
149
+ }
150
+
151
+ /**
152
+ * Registers this mod's `agents-panel` command, its session and turn hooks, and its pane.
153
+ *
154
+ * @param on - Hook registration function the engine passes in.
155
+ */
156
+ export const register: Register = on => {
157
+ on('session.start', async ($, e, next) => {
158
+ await $.command.register({ name: 'agents-panel', description: 'Show or hide the agents panel' })
159
+ await loadAgents($)
160
+ $.clock.every(1000, () => void pollRunning($))
161
+ return next(e)
162
+ })
163
+
164
+ on('command.run', { command: 'agents-panel' }, async $ => {
165
+ if ((await $.ui.panes()).some(pane => pane.id === PANE)) {
166
+ await $.ui.close({ id: PANE })
167
+ return { text: 'Agents panel hidden.' }
168
+ }
169
+ await loadAgents($)
170
+ await $.ui.open({ id: PANE, title: TITLE })
171
+ return { text: 'Agents panel shown.' }
172
+ })
173
+
174
+ on('turn.complete', async ($, e, next) => {
175
+ const result = await next(e)
176
+ if (e.agentId === undefined) return result
177
+ const run = (await read($, running)).find(one => one.agentId === e.agentId)
178
+ if (run !== undefined) {
179
+ await update($, running, list => list.filter(one => one.agentId !== e.agentId))
180
+ await reportAnswer($, run, e.answer)
181
+ $.ui.toast(`${run.name} finished`)
182
+ }
183
+ return result
184
+ }).catch(($, e, next) => next(e))
185
+
186
+ on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
187
+ const { Box, Text, Button } = $.ui.resolve(e)
188
+ const list = await read($, agents)
189
+ const runs = await read($, running)
190
+ const now = await $.clock.now()
191
+ const frame = SPINNER[Math.floor(now / 250) % SPINNER.length] ?? '◐'
192
+
193
+ const header = (
194
+ <Box flexDirection="row" justifyContent="space-between">
195
+ <Text>
196
+ <Text color="#e0775a">◆ </Text>
197
+ <Text bold>Agents</Text>
198
+ <Text dimColor> in this project</Text>
199
+ </Text>
200
+ <Text dimColor>{runs.length > 0 ? `${frame} ${runs.length} running` : ''}</Text>
201
+ </Box>
202
+ )
203
+
204
+ if (list.length === 0) {
205
+ return (
206
+ <Box flexDirection="column" gap={1}>
207
+ {header}
208
+ <Text dimColor>No agents in {AGENTS_DIR} or ~/{AGENTS_DIR}. Add one with /agents.</Text>
209
+ </Box>
210
+ )
211
+ }
212
+
213
+ /**
214
+ * Renders the agents of one scope under a heading, or nothing when the scope has none.
215
+ *
216
+ * @param scope - Scope to render, as `project` or `user`.
217
+ * @returns The section element, or `''` when no agent has that scope.
218
+ */
219
+ const section = (scope: AgentDef['scope']) => {
220
+ const members = list.filter(agent => agent.scope === scope)
221
+ if (members.length === 0) return ''
222
+ return (
223
+ <Box flexDirection="column" gap={1}>
224
+ <Text>
225
+ <Text bold color="#8fa1d6">{scope === 'project' ? 'PROJECT' : 'USER'}</Text>
226
+ <Text dimColor> {scope === 'project' ? AGENTS_DIR : `~/${AGENTS_DIR}`} · {members.length}</Text>
227
+ </Text>
228
+ {members.map((agent, index) => {
229
+ const run = runs.find(one => one.name === agent.name)
230
+ return (
231
+ <Box flexDirection="column" paddingLeft={1}>
232
+ <Box flexDirection="row" justifyContent="space-between">
233
+ <Text>
234
+ <Text color={dotColor(agent, index)}>● </Text>
235
+ <Text bold>{agent.name}</Text>
236
+ <Text dimColor> {agent.model}</Text>
237
+ </Text>
238
+ {run === undefined
239
+ ? <Button key={`run:${agent.name}`} label="▶ run" onPress={() => runAgent($, agent)} />
240
+ : <Text color="#8fa1d6">{frame} running · {Math.round((now - run.startedAt) / 1000)}s</Text>}
241
+ </Box>
242
+ <Box paddingLeft={2}>
243
+ <Text dimColor wrap="truncate-end">{agent.description}</Text>
244
+ </Box>
245
+ </Box>
246
+ )
247
+ })}
248
+ </Box>
249
+ )
250
+ }
251
+
252
+ const input = e.surface === 'mobile'
253
+ ? ''
254
+ : (() => {
255
+ const { Input } = $.ui.resolve(e)
256
+ return (
257
+ <Input
258
+ key="task"
259
+ label="Task"
260
+ placeholder="what the next run should do (optional)"
261
+ onInput={value => update($, task, () => value)}
262
+ onSubmit={value => update($, task, () => value)}
263
+ />
264
+ )
265
+ })()
266
+
267
+ return (
268
+ <Box flexDirection="column" gap={1}>
269
+ {header}
270
+ {input}
271
+ {section('project')}
272
+ {section('user')}
273
+ <Text dimColor>click ▶ run to start one · /agents-panel to hide</Text>
274
+ </Box>
275
+ )
276
+ })
277
+ }
@@ -0,0 +1,24 @@
1
+ // packages/g3n-mods/mods/agents-panel/types/index.d.ts
2
+
3
+ /** One agent definition found in an agents folder, read from its frontmatter. */
4
+ export type AgentDef = {
5
+ name: string
6
+ description: string
7
+ /** `sonnet`, `opus`, `haiku`, a model id, or `inherit` */
8
+ model: string
9
+ color?: string
10
+ scope: 'project' | 'user'
11
+ }
12
+
13
+ /** An agent this panel started that has not finished; `startedAt` is milliseconds since the epoch. */
14
+ export type RunningAgent = {
15
+ name: string
16
+ agentId: string
17
+ startedAt: number
18
+ }
19
+
20
+ declare module 'claude-code' {
21
+ interface PluginState {
22
+ 'agents-panel': { agents: AgentDef[]; running: RunningAgent[]; task: string }
23
+ }
24
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "context-bar",
3
+ "version": "0.1.0",
4
+ "description": "Context window use as one bar split by source, with the total and the compaction point.",
5
+ "author": {
6
+ "name": "g3ntrovert"
7
+ },
8
+ "types": "./types/index.d.ts"
9
+ }
@@ -0,0 +1 @@
1
+ { "modules": ["./register.tsx"] }