@cirtium/acent-connect 0.2.3 → 0.3.0

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 (36) hide show
  1. package/.claude-plugin/marketplace.json +10 -2
  2. package/README.md +29 -12
  3. package/acent/.claude-plugin/plugin.json +2 -2
  4. package/acent/.codex-plugin/plugin.json +4 -4
  5. package/acent/.cursor-plugin/plugin.json +2 -2
  6. package/acent/README.md +16 -7
  7. package/acent/hooks/claude.json +36 -0
  8. package/acent/hooks/codex.json +24 -0
  9. package/acent/hooks/cursor.json +5 -0
  10. package/acent/mcp-codex.json +1 -4
  11. package/acent/scripts/acent-connect.mjs +41 -8
  12. package/acent/scripts/antigravity-capture.mjs +8 -1
  13. package/acent/scripts/antigravity-hook.mjs +1 -1
  14. package/acent/scripts/capture-code-changes.mjs +407 -0
  15. package/acent/scripts/codex-capture.mjs +1 -1
  16. package/acent/scripts/host-guidance.mjs +18 -0
  17. package/acent/scripts/mcp-proxy.mjs +3 -1
  18. package/acent/scripts/memory-instructions.mjs +4 -2
  19. package/acent/skills/acent-connect/SKILL.md +16 -4
  20. package/acent/skills/acent-connect/agents/openai.yaml +4 -0
  21. package/acent/skills/acent-decisions/SKILL.md +18 -0
  22. package/acent/skills/acent-decisions/agents/openai.yaml +4 -0
  23. package/acent/skills/{acent-memory → acent-recall}/SKILL.md +13 -3
  24. package/acent/skills/acent-recall/agents/openai.yaml +4 -0
  25. package/acent/skills/acent-resume/SKILL.md +18 -0
  26. package/acent/skills/acent-resume/agents/openai.yaml +4 -0
  27. package/acent/skills/acent-trace/SKILL.md +21 -0
  28. package/acent/skills/acent-trace/agents/openai.yaml +4 -0
  29. package/antigravity/README.md +15 -6
  30. package/antigravity/build.mjs +9 -3
  31. package/antigravity/plugin.json +2 -2
  32. package/package.json +5 -2
  33. package/scripts/acent.mjs +22 -52
  34. package/scripts/choose-tool.mjs +82 -0
  35. package/scripts/install-plugin.mjs +67 -13
  36. package/scripts/local-registration.mjs +49 -0
@@ -1,5 +1,13 @@
1
1
  {
2
2
  "name": "acent",
3
- "owner": { "name": "Cirtium" },
4
- "plugins": [{ "name": "acent", "source": "./acent", "description": "Project memory with opt-in conversation saving" }]
3
+ "owner": {
4
+ "name": "Cirtium"
5
+ },
6
+ "plugins": [
7
+ {
8
+ "name": "acent",
9
+ "source": "./acent",
10
+ "description": "Recall past work, trace code changes, revisit decisions, and resume tasks with Acent."
11
+ }
12
+ ]
5
13
  }
package/README.md CHANGED
@@ -2,7 +2,8 @@
2
2
 
3
3
  Connect your coding tool to Acent to retrieve project context and optionally save
4
4
  new conversations. Requires Node.js 22 or later (with npm and npx) and your coding
5
- tool. Codex, Claude Code, and Antigravity also need their plugin-capable CLI.
5
+ tool with local plugin support. The installer writes plugin files and supported
6
+ settings directly; it does not require the tool’s command-line launcher.
6
7
 
7
8
  ## 1. Install the plugin
8
9
 
@@ -13,8 +14,8 @@ npx @cirtium/acent-connect@latest install
13
14
  ```
14
15
 
15
16
  If npm asks to download the package, confirm. Then choose Codex, Claude Code,
16
- Cursor, or Antigravity in the terminal menu. The installer checks the tool and
17
- installs its Acent plugin. No separate package download or global npm installation
17
+ Cursor, or Antigravity with ↑/↓ and press Enter. The selected tool is highlighted;
18
+ Ctrl+C cancels without installing. Basic terminals also accept a number or name. The installer prepares the selected tool’s Acent plugin. No separate package download or global npm installation
18
19
  is needed. Installation does not sign you in or authorize conversation saving.
19
20
 
20
21
  To skip the tool-selection menu, specify your tool, for example:
@@ -26,12 +27,28 @@ npx @cirtium/acent-connect@latest install --tool codex
26
27
  Tool values are `codex`, `claude`, `cursor`, and `antigravity`.
27
28
  The plugin is installed for your tool, not copied into the current project folder.
28
29
 
30
+ To install Acent for all four supported tools, including tools you have not opened yet, run:
31
+
32
+ ```sh
33
+ npx @cirtium/acent-connect@latest install --all
34
+ ```
35
+
29
36
  ## 2. Connect in your agent
30
37
 
31
- Open your project in the selected tool and reload it or start a new session.
38
+ Follow the loading instructions for your selected tool:
39
+
40
+ | Tool | After installation |
41
+ | --- | --- |
42
+ | Codex | Restart and check Acent in Plugins. Install or enable the local entry if needed. Review and trust Acent’s hooks if you enable saving. |
43
+ | Claude Code | Start a new session or run `/reload-plugins`. Respond to workspace or tool permission prompts only if shown. |
44
+ | Cursor | Restart or run `Developer: Reload Window`, then check Customize. |
45
+ | Antigravity | Check Customizations → Installed. If Acent is not loaded in the current conversation, start a new one. Enabled hooks run automatically; no separate hook approval is prescribed. |
46
+
47
+ Open your project in the selected tool.
32
48
  Send **“Connect Acent to this folder.”** in agent chat. Follow the returned link,
33
49
  sign in to Acent, choose an Acent project, and review access and optional saving.
34
- Review and allow the tool's Acent hooks before starting a new turn for saving.
50
+ Connecting does not itself require another restart. Follow only pending host-specific
51
+ steps; connection success does not verify that a conversation has been saved.
35
52
 
36
53
  No second terminal command is required. Each project folder has its own connection;
37
54
  the plugin installation is shared across projects in the same tool.
@@ -67,8 +84,9 @@ npx @cirtium/acent-connect@latest update --tool codex
67
84
  ```
68
85
 
69
86
  Updates preserve credentials, folder connections, and queued conversations.
70
- For marketplace installs, use your tool's plugin updater. After updating, start a
71
- new session and approve changed hooks if prompted.
87
+ For marketplace installs, use your tool's plugin updater. After updating, follow
88
+ the tool-specific loading instructions above. Codex may require review and trust
89
+ of changed hooks.
72
90
 
73
91
  ## Disconnect and remove
74
92
 
@@ -88,6 +106,7 @@ does not revoke server grants or delete saved Acent memories.
88
106
  | Command or option | What it does |
89
107
  | --- | --- |
90
108
  | `install` | Installs the plugin. Connect afterward in your agent. |
109
+ | `install --all` | Prepares Acent for all four supported tools. |
91
110
  | `connect` | Sets up the plugin and opens browser authorization for this folder. |
92
111
  | `update` | Updates a CLI-managed plugin without changing its Acent connection. |
93
112
  | `update --all` | Updates all plugins installed through the Acent CLI. |
@@ -95,16 +114,14 @@ does not revoke server grants or delete saved Acent memories.
95
114
  | `flush` | Retries queued conversation saving for the selected tool and folder. |
96
115
  | `--tool` | Selects `codex`, `claude`, `cursor`, or `antigravity` without a menu. |
97
116
  | `--folder` | Uses a specified project folder instead of the current directory. |
98
- | `--executable` | Uses the full path to the tool's CLI if it is not on PATH. |
117
+ | `--executable` | Legacy option; no longer needed for local installation. |
99
118
  | `--help` | Shows commands and options without installing or connecting. |
100
119
 
101
120
  Use these commands after `npx @cirtium/acent-connect@latest`, for example
102
121
  `npx @cirtium/acent-connect@latest --help`.
103
122
 
104
- An installed app may not have its CLI available in the terminal. Enable its CLI or
105
- use `--executable`. Organization policies may restrict local plugins. In Cursor,
106
- reload and check Customize; a marketplace copy can take precedence over a local
107
- plugin. These integrations do not automatically collect chats from the ordinary
123
+ Organization policies may restrict local plugins. In Cursor, reload and check
124
+ Customize; a marketplace copy can take precedence over a local plugin. These integrations do not automatically collect chats from the ordinary
108
125
  ChatGPT, Claude, or Gemini apps.
109
126
 
110
127
  [Setup guide](https://www.acent.cloud/docs/integrations) · [Website](https://www.acent.cloud) · [Privacy](https://www.acent.cloud/privacy) · [Terms](https://www.acent.cloud/terms)
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "acent",
3
- "version": "0.2.3",
4
- "description": "Open your project folder and ask \"Connect Acent\" in chat to sign in and choose an Acent project. Conversation saving is optional.",
3
+ "version": "0.3.0",
4
+ "description": "Recall past work, trace code changes, revisit decisions, and resume tasks with Acent.",
5
5
  "mcpServers": "./mcp-claude.json",
6
6
  "hooks": "./hooks/claude.json"
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "acent",
3
- "version": "0.2.3",
4
- "description": "Connect conversations across your projects and carry context into your next task.",
3
+ "version": "0.3.0",
4
+ "description": "Recall past work, trace code changes, revisit decisions, and resume tasks with Acent.",
5
5
  "skills": "./skills/",
6
6
  "mcpServers": "./mcp-codex.json",
7
7
  "hooks": "./hooks/codex.json",
@@ -12,8 +12,8 @@
12
12
  },
13
13
  "interface": {
14
14
  "displayName": "Acent",
15
- "shortDescription": "Connect conversations across your projects and carry context into your next task.",
16
- "longDescription": "Acent connects conversations across your projects so you can carry context into your next task.\n\nKeep your work conversations, revisit past decisions, and bring relevant context into your coding agent. Pick up where you left off\u2014even when you switch projects or tools\u2014without explaining everything again.\n\nGet started\n\nInstall the Acent plugin with the Acent CLI from your project folder. To connect from the agent, ask \u201cConnect Acent\u201d. Follow the link to sign in, choose an Acent project, and approve the connection and conversation saving.\n\nConversation saving\n\nSaving starts after you approve it and allow the plugin hooks in Codex. Each project folder needs its own connection. You can revoke access in Acent settings.",
15
+ "shortDescription": "Recall, Trace, Resume",
16
+ "longDescription": "Acent brings your project history into your coding agent.\n\nAcent Recall finds past conversations and context. Acent Trace follows saved code edits back to their requests and evidence. Acent Decisions retrieves prior choices and reasons. Acent Resume helps continue saved work across conversations and tools. Acent Connect links your project and manages saving consent.\n\nGet started\n\nInstall Acent from your tool’s plugin marketplace, then ask “Connect Acent” in the agent. Follow the returned link to sign in, choose an Acent project, and approve access. Conversation saving is optional.\n\nSaving requires enabled plugin hooks and your consent. Each project folder needs its own connection. You can revoke access in Acent settings.",
17
17
  "developerName": "Cirtium",
18
18
  "category": "Productivity",
19
19
  "websiteURL": "https://www.acent.cloud",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "acent",
3
- "version": "0.2.3",
4
- "description": "Connect conversations across your projects and carry context into your next task.",
3
+ "version": "0.3.0",
4
+ "description": "Recall past work, trace code changes, revisit decisions, and resume tasks with Acent.",
5
5
  "author": {
6
6
  "name": "Cirtium"
7
7
  },
package/acent/README.md CHANGED
@@ -6,27 +6,36 @@ Keep your work conversations, revisit past decisions, and bring relevant context
6
6
 
7
7
  ## Get started
8
8
 
9
- Install the Acent plugin with the Acent CLI from your project folder. Then ask **“Connect Acent”** in Agent chat. Follow the link to sign in, choose an Acent project, and approve the connection and conversation saving.
9
+ Install Acent from your tool’s plugin marketplace. Then ask **“Connect Acent”** in Agent chat. Follow the link to sign in, choose an Acent project, and approve the connection and conversation saving.
10
10
 
11
11
  In Cursor, use Agent chat in the IDE or a local Agents Window. In Codex, use a chat with your project folder open. If you close the connection page before finishing, ask **“Connect Acent”** again.
12
12
 
13
13
  ## Use your saved context
14
14
 
15
- Ask your agent to find relevant context in Acent, for example:
15
+ Use the skill name in your request:
16
16
 
17
- - “What did we decide about authentication, and why?”
18
- - “Show the original conversation behind that decision.”
19
- - “Help me pick up where I left off.”
17
+ | Skill | Purpose | Example |
18
+ | --- | --- | --- |
19
+ | **Acent Recall** | Find past conversations and project context | “Recall how we handled this error before.” |
20
+ | **Acent Trace** | Trace saved code edits to requests and evidence | “Trace what changed in this file and why.” |
21
+ | **Acent Decisions** | Find previous choices and their reasons | “Use Decisions to explain our authentication choice.” |
22
+ | **Acent Resume** | Continue saved work across tools | “Resume the task I was working on in Cursor.” |
23
+ | **Acent Connect** | Connect a project and manage saving consent | “Connect Acent to this project.” |
24
+
25
+ The skill identifiers are `acent-recall`, `acent-trace`, `acent-decisions`,
26
+ `acent-resume` and `acent-connect`. Your tool controls how these appear in its
27
+ skill picker. Saving runs through enabled hooks with your consent; invoking a
28
+ retrieval skill does not enable saving.
20
29
 
21
30
  ## Conversation saving
22
31
 
23
- Saving starts after you approve it on the Acent connection page and allow the plugin hooks in your coding tool. Codex and Cursor save submitted prompts and completed assistant responses. Each project folder needs its own connection; connecting a general chat does not connect your other project folders.
32
+ Saving requires consent on the Acent connection page and working plugin hooks. Codex additionally requires review and trust of those hooks. Other tools should follow their own loading guidance; a separate hook approval is not a universal step. Codex and Cursor save submitted prompts and completed assistant responses. Each project folder needs its own connection; connecting a general chat does not connect your other project folders.
24
33
 
25
34
  Your agent can retrieve context from the approved project and account-wide memory. You can revoke the connection in Acent settings.
26
35
 
27
36
  ## Attached files
28
37
 
29
- **Save attached files** is on by default for new connections. When you approve conversation saving, Acent also keeps accessible originals of documents, images, audio, and videos. You can turn file saving off in the connection’s settings. Existing connection settings are preserved. Files use Storage and your plan’s per-file upload limit; storing a file does not automatically extract or analyze its content.
38
+ **Save attached files** is on by default for new connections. When you approve conversation saving, Acent also keeps accessible originals of documents, images, audio, and videos. You can turn file saving off in the connection’s settings. Existing connection settings are preserved. Files use Storage, with a 50 MB limit per original on every plan and a plan-specific total storage allowance. Originals remain unchanged. Acent separately prepares reduced-size image previews and searchable text for supported PDF, DOCX, PPTX, XLSX, OpenDocument, RTF, and text files. Analysis status distinguishes queued, processing, complete text extraction, partial extraction, unsupported formats, and failures. Storing a file does not mean all its content was analyzed; scanned pages and images do not include OCR. Use `search_attachments` and `read_saved_file` to find and read available extracted text across connected tools.
30
39
 
31
40
  Codex and Cursor can save files identified in their submitted attachment events. When a host does not expose attachments in its events, the agent can use `acent_save_attachments` with the exact paths of files you attached. This tool is available in Codex, Cursor, Claude Code, and Antigravity. Files the host cannot access cannot be copied. Files saved through this tool are searchable by filename; automatic conversation linking requires an attachment event from the host.
32
41
 
@@ -21,6 +21,42 @@
21
21
  }
22
22
  ]
23
23
  }
24
+ ],
25
+ "PreToolUse": [
26
+ {
27
+ "matcher": "Edit|Write|MultiEdit",
28
+ "hooks": [
29
+ {
30
+ "type": "command",
31
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hook.mjs\" --tool \"Claude Code\"",
32
+ "timeout": 40
33
+ }
34
+ ]
35
+ }
36
+ ],
37
+ "PostToolUse": [
38
+ {
39
+ "matcher": "Edit|Write|MultiEdit",
40
+ "hooks": [
41
+ {
42
+ "type": "command",
43
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hook.mjs\" --tool \"Claude Code\"",
44
+ "timeout": 40
45
+ }
46
+ ]
47
+ }
48
+ ],
49
+ "PostToolUseFailure": [
50
+ {
51
+ "matcher": "Edit|Write|MultiEdit",
52
+ "hooks": [
53
+ {
54
+ "type": "command",
55
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hook.mjs\" --tool \"Claude Code\"",
56
+ "timeout": 40
57
+ }
58
+ ]
59
+ }
24
60
  ]
25
61
  }
26
62
  }
@@ -21,6 +21,30 @@
21
21
  }
22
22
  ]
23
23
  }
24
+ ],
25
+ "PreToolUse": [
26
+ {
27
+ "matcher": "apply_patch|Edit|Write",
28
+ "hooks": [
29
+ {
30
+ "type": "command",
31
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hook.mjs\" --tool \"Codex\"",
32
+ "timeout": 40
33
+ }
34
+ ]
35
+ }
36
+ ],
37
+ "PostToolUse": [
38
+ {
39
+ "matcher": "apply_patch|Edit|Write",
40
+ "hooks": [
41
+ {
42
+ "type": "command",
43
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hook.mjs\" --tool \"Codex\"",
44
+ "timeout": 40
45
+ }
46
+ ]
47
+ }
24
48
  ]
25
49
  }
26
50
  }
@@ -10,6 +10,11 @@
10
10
  {
11
11
  "command": "node \"${CURSOR_PLUGIN_ROOT}/scripts/hook.mjs\" --tool Cursor"
12
12
  }
13
+ ],
14
+ "afterFileEdit": [
15
+ {
16
+ "command": "node \"${CURSOR_PLUGIN_ROOT}/scripts/hook.mjs\" --tool Cursor"
17
+ }
13
18
  ]
14
19
  }
15
20
  }
@@ -2,10 +2,7 @@
2
2
  "mcpServers": {
3
3
  "acent": {
4
4
  "command": "node",
5
- "args": [
6
- "-e",
7
- "const {execFileSync}=require('node:child_process');const {join,isAbsolute}=require('node:path');const {pathToFileURL}=require('node:url');try{const list=JSON.parse(execFileSync('codex',['plugin','list','--marketplace','acent','--json'],{encoding:'utf8',stdio:['ignore','pipe','pipe']}));const root=list.installed.find(p=>p.pluginId==='acent@acent'&&p.enabled)?.source?.path;if(!root||!isAbsolute(root))throw Error('Acent plugin source unavailable. Reinstall acent@acent.');process.argv=['node','acent-mcp','--tool','Codex'];import(pathToFileURL(join(root,'scripts/mcp-proxy.mjs')).href).catch(e=>{console.error(e.message);process.exitCode=1})}catch(e){console.error(e.message);process.exitCode=1}"
8
- ]
5
+ "args": ["${PLUGIN_ROOT}/scripts/mcp-proxy.mjs", "--tool", "Codex"]
9
6
  }
10
7
  }
11
8
  }
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  /** Local connection/capture adapter. No AI calls; credentials never go to stdout. */
3
+ import { captureCodeChanges } from "./capture-code-changes.mjs"
3
4
  import { captureCodexEvent } from "./codex-capture.mjs"
4
5
  import { captureAntigravityEvent } from "./antigravity-capture.mjs"
5
6
  import { attachFiles } from "./capture-attachments.mjs"
@@ -123,7 +124,7 @@ export async function request(config, path, init) {
123
124
  if (!response.ok)
124
125
  throw Object.assign(
125
126
  new Error(body.error_description || body.error || "Acent request failed"),
126
- { status: response.status }
127
+ { status: response.status, code: body.error }
127
128
  )
128
129
  return body
129
130
  }
@@ -246,6 +247,9 @@ export async function drain(config, directory) {
246
247
  .sort()
247
248
  if (!files.length) return
248
249
  const access = await token(config, directory)
250
+ const deferred = new Set()
251
+ // A code event can race its prompt upload. Retry it after queued prompts;
252
+ // never let an early 409 permanently block the request behind it.
249
253
  for (const file of files) {
250
254
  const payload = JSON.parse(
251
255
  await readFile(join(directory, "queue", file), "utf8")
@@ -263,6 +267,11 @@ export async function drain(config, directory) {
263
267
  })() }),
264
268
  })
265
269
  } catch (error) {
270
+ if (error.status === 409 && error.code === "prompt_pending" && !deferred.has(file)) {
271
+ deferred.add(file)
272
+ files.push(file)
273
+ continue
274
+ }
266
275
  if (error.status === 401 || error.status === 403) {
267
276
  const credentials = JSON.parse(
268
277
  await readFile(join(directory, "credentials.json"), "utf8")
@@ -271,6 +280,7 @@ export async function drain(config, directory) {
271
280
  ...credentials,
272
281
  captureBlocked: true,
273
282
  })
283
+ await rm(join(directory, "code-capture"), { recursive: true, force: true })
274
284
  for (const queued of await readdir(join(directory, "queue")))
275
285
  await unlink(join(directory, "queue", queued))
276
286
  }
@@ -382,11 +392,34 @@ export async function main(args = process.argv.slice(2), eventText) {
382
392
  throw new Error("Event exceeds 2 MiB.")
383
393
  const payload = JSON.parse(content)
384
394
  if (config.tool === "Codex" && !(await captureCodexEvent(payload, directory))) return
385
- if (config.tool === "Antigravity" && !(await captureAntigravityEvent(payload, directory))) return
386
- if (Buffer.byteLength(JSON.stringify(payload)) > 2 * 1024 * 1024)
395
+ const toolEvent = ["PreToolUse", "PostToolUse", "PostToolUseFailure"].includes(payload.acent_hook || payload.hook_event_name)
396
+ if (config.tool === "Antigravity" && toolEvent) {
397
+ await captureAntigravityEvent(payload, directory).catch(error => {
398
+ payload.acent_request = null
399
+ console.error(`Acent request link unavailable: ${error.message}`)
400
+ })
401
+ }
402
+ const codeEvent = await captureCodeChanges(payload, config, directory)
403
+ if (codeEvent && !payload.acent_code_changes?.length) return
404
+ if (config.tool === "Antigravity" && !codeEvent && !(await captureAntigravityEvent(payload, directory))) return
405
+ if (codeEvent) {
406
+ // Do not forward tool arguments, absolute paths, transcripts or output.
407
+ const minimal = {
408
+ session_id: payload.session_id, conversation_id: payload.conversation_id,
409
+ conversationId: payload.conversationId, turn_id: payload.turn_id,
410
+ hook_event_name: payload.hook_event_name, acent_hook: payload.acent_hook,
411
+ acent_code_changes: payload.acent_code_changes,
412
+ }
413
+ for (const key of Object.keys(payload)) delete payload[key]
414
+ Object.assign(payload, minimal)
415
+ }
416
+ const events = codeEvent
417
+ ? payload.acent_code_changes.map(change => ({ ...payload, acent_code_changes: [change] }))
418
+ : [payload]
419
+ if (events.some(event => Buffer.byteLength(JSON.stringify(event)) > 2 * 1024 * 1024))
387
420
  throw new Error("Collected event exceeds 2 MiB.")
388
421
  const files = await readdir(join(directory, "queue"))
389
- if (files.length >= 500)
422
+ if (files.length + events.length > 500)
390
423
  throw new Error(
391
424
  "Capture queue is full. Reconnect or drain queued events before saving more."
392
425
  )
@@ -395,15 +428,14 @@ export async function main(args = process.argv.slice(2), eventText) {
395
428
  )
396
429
  if (
397
430
  sizes.reduce((sum, file) => sum + file.size, 0) +
398
- Buffer.byteLength(JSON.stringify(payload)) >
431
+ events.reduce((sum, event) => sum + Buffer.byteLength(JSON.stringify(event)), 0) >
399
432
  32 * 1024 * 1024
400
433
  )
401
434
  throw new Error(
402
435
  "Capture queue exceeds 32 MiB. Drain it before saving more."
403
436
  )
404
- await atomicJson(
405
- join(directory, "queue", `${Date.now()}-${random()}.json`),
406
- payload
437
+ for (const event of events) await atomicJson(
438
+ join(directory, "queue", `${Date.now()}-${random()}.json`), event
407
439
  )
408
440
  return drain(config, directory)
409
441
  }
@@ -427,6 +459,7 @@ export async function main(args = process.argv.slice(2), eventText) {
427
459
  }),
428
460
  })
429
461
  await unlink(file)
462
+ await rm(join(directory, "code-capture"), { recursive: true, force: true })
430
463
  // Queued conversations are local private data. Explicit disconnect removes them.
431
464
  for (const name of await readdir(join(directory, "queue")))
432
465
  await unlink(join(directory, "queue", name))
@@ -33,7 +33,7 @@ export function transcriptMessages(rows, start) {
33
33
  // Called only AFTER the shared adapter has checked conversation:write consent.
34
34
  export async function captureAntigravityEvent(payload, directory, home = homedir()) {
35
35
  if (payload.event === "user" || payload.event === "result") return true
36
- if (!["PreInvocation", "PostInvocation", "Stop"].includes(payload.acent_hook)) return false
36
+ if (!["PreInvocation", "PostInvocation", "Stop", "PreToolUse", "PostToolUse"].includes(payload.acent_hook)) return false
37
37
  const id = payload.conversationId
38
38
  if (typeof id !== "string" || !/^[a-zA-Z0-9_-]{1,128}$/.test(id)) throw new Error("Invalid Antigravity conversation ID.")
39
39
  const supplied = payload.transcriptPath
@@ -64,6 +64,13 @@ export async function captureAntigravityEvent(payload, directory, home = homedir
64
64
  // Only complete JSONL records can be captured while the host is writing.
65
65
  lines.pop()
66
66
  const rows = lines.filter(Boolean).map(line => JSON.parse(line))
67
+ if (["PreToolUse", "PostToolUse"].includes(payload.acent_hook)) {
68
+ const user = rows.findLast(row => row.type === "USER_INPUT" && row.step_index < payload.stepIdx)
69
+ payload.acent_request = user?.source === "USER_EXPLICIT" && user.status === "DONE"
70
+ ? { turnId: `step:${user.step_index}`, content: userText(user.content), linkage: "host_turn", capturedAt: new Date().toISOString() }
71
+ : null
72
+ return true
73
+ }
67
74
  const root = join(directory, "antigravity-sessions")
68
75
  await mkdir(root, { recursive: true, mode: 0o700 })
69
76
  const marker = join(root, createHash("sha256").update(path).digest("hex") + ".json")
@@ -11,7 +11,7 @@ try {
11
11
  const payload = JSON.parse(raw)
12
12
  payload.acent_hook = process.argv[2]
13
13
  console.error("Acent capture timing: " + JSON.stringify({at:new Date().toISOString(),stage:"hook",event:payload.acent_hook,fullyIdle:payload.fullyIdle === true,terminationReason:payload.terminationReason,hasError:!!payload.error}))
14
- if (!["PreInvocation", "PostInvocation", "Stop"].includes(payload.acent_hook)) throw new Error("Unknown Antigravity hook.")
14
+ if (!["PreInvocation", "PostInvocation", "Stop", "PreToolUse", "PostToolUse"].includes(payload.acent_hook)) throw new Error("Unknown Antigravity hook.")
15
15
  await new Promise((resolve, reject) => {
16
16
  const child = spawn(process.execPath, [fileURLToPath(new URL("./hook.mjs", import.meta.url)), "--tool", "Antigravity"],
17
17
  { stdio: ["pipe", "ignore", "inherit"] })