@cirtium/acent-connect 1.2.1 → 1.2.3

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "acent",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
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"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "acent",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
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",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "acent",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "Recall past work, trace code changes, revisit decisions, and resume tasks with Acent.",
5
5
  "author": {
6
6
  "name": "Cirtium"
@@ -1,7 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import { spawn } from "node:child_process"
3
3
  import { fileURLToPath } from "node:url"
4
+ import { recordWorkspaceCall, workspaceInstructions } from "./antigravity-workspace.mjs"
4
5
  const started = Date.now()
6
+ const event = process.argv[2]
7
+ let output = event === "PreToolUse" ? { decision: "allow" } : {}
5
8
  try {
6
9
  let raw = ""
7
10
  for await (const chunk of process.stdin) {
@@ -9,8 +12,12 @@ try {
9
12
  if (Buffer.byteLength(raw) > 2 * 1024 * 1024) throw new Error("Hook event exceeds 2 MiB.")
10
13
  }
11
14
  const payload = JSON.parse(raw)
12
- payload.acent_hook = process.argv[2]
15
+ payload.acent_hook = event
13
16
  if (!["PreInvocation", "PostInvocation", "Stop", "PreToolUse", "PostToolUse"].includes(payload.acent_hook)) throw new Error("Unknown Antigravity hook.")
17
+ if (event === "PreInvocation") output = workspaceInstructions(payload)
18
+ if (event === "PreToolUse") {
19
+ await recordWorkspaceCall(payload).catch(() => console.error("Acent could not verify this workspace call."))
20
+ }
14
21
  await new Promise((resolve, reject) => {
15
22
  const child = spawn(process.execPath, [fileURLToPath(new URL("./hook.mjs", import.meta.url)), "--tool", "Antigravity"],
16
23
  { stdio: ["pipe", "ignore", "inherit"] })
@@ -21,5 +28,5 @@ try {
21
28
  })
22
29
  console.error("Acent capture timing: " + JSON.stringify({at:new Date().toISOString(),stage:"finished",durationMs:Date.now()-started}))
23
30
  } catch (error) { console.error("Acent could not save this event.") }
24
- // Hooks must emit a JSON object and must never force the agent to continue.
25
- process.stdout.write("{}\n")
31
+ // PreToolUse delegates the decision to Antigravity's normal permission policy.
32
+ process.stdout.write(JSON.stringify(output) + "\n")
@@ -0,0 +1,92 @@
1
+ import { createHash, randomUUID } from "node:crypto"
2
+ import { mkdir, readFile, readdir, realpath, rename, stat, unlink, writeFile } from "node:fs/promises"
3
+ import { homedir } from "node:os"
4
+ import { join } from "node:path"
5
+ import { projectFolder } from "./connection-context.mjs"
6
+
7
+ const lifetimeMs = 60_000
8
+ const toolName = "acent_workspace"
9
+ const serverName = "acent_acent"
10
+ const isConversationId = value => typeof value === "string" && /^[a-zA-Z0-9_-]{1,128}$/.test(value)
11
+
12
+ export const antigravityWorkspaceTool = {
13
+ name: toolName,
14
+ description: "Use Acent in the current Antigravity chat when the regular Acent tools cannot identify its workspace. Use the conversation ID supplied by the Acent hook. Omit tool to list the available tools, or set tool to acent_connect or an Acent tool from the returned list.",
15
+ inputSchema: {
16
+ type: "object",
17
+ properties: {
18
+ conversationId: { type: "string", description: "Conversation ID supplied by the Acent hook in this chat." },
19
+ tool: { type: "string", description: "Acent tool to call. Omit to list tools." },
20
+ arguments: { type: "object", description: "Arguments for the selected Acent tool." },
21
+ },
22
+ required: ["conversationId"],
23
+ additionalProperties: false,
24
+ },
25
+ }
26
+
27
+ function ordered(value) {
28
+ if (Array.isArray(value)) return value.map(ordered)
29
+ if (!value || typeof value !== "object") return value
30
+ return Object.fromEntries(Object.keys(value).sort().map(key => [key, ordered(value[key])]))
31
+ }
32
+
33
+ function evidenceFile(args) {
34
+ const dir = join(process.env.ACENT_CONFIG_HOME || join(homedir(), ".config", "acent"), "antigravity-workspaces")
35
+ const key = createHash("sha256").update(JSON.stringify(ordered(args))).digest("hex")
36
+ return { dir, file: join(dir, `${key}.json`) }
37
+ }
38
+
39
+ export function workspaceInstructions(payload) {
40
+ if (payload.invocationNum !== 0 || !isConversationId(payload.conversationId)) return {}
41
+ return { injectSteps: [{ systemMessage: { systemMessage:
42
+ `When Acent tools are needed and the regular Acent server cannot identify this workspace, use ${toolName} on ${serverName} with conversationId ${payload.conversationId}. To connect, set tool to acent_connect. To use connected tools, omit tool to list them, then pass the chosen tool and its arguments to ${toolName}. Use only the conversation ID supplied by this hook.`
43
+ } }] }
44
+ }
45
+
46
+ export async function recordWorkspaceCall(payload) {
47
+ const call = payload.toolCall
48
+ const lazy = call?.name === "call_mcp_tool" && call.args?.ServerName === serverName && call.args?.ToolName === toolName
49
+ const eager = call?.name === `mcp_${serverName}_${toolName}`
50
+ if (!lazy && !eager) return
51
+ const args = lazy ? call.args.Arguments : call.args
52
+ if (!isConversationId(payload.conversationId) || args?.conversationId !== payload.conversationId) return
53
+
54
+ const roots = payload.workspacePaths
55
+ if (!Array.isArray(roots) || roots.length > 1) return
56
+ const folder = roots.length === 1 ? projectFolder(roots[0]) : undefined
57
+ if (roots.length === 1 && !folder) return
58
+ const context = folder ? { scope: "folder", folder: await realpath(folder) } : { scope: "general" }
59
+ const { dir, file } = evidenceFile(args)
60
+ await mkdir(dir, { recursive: true, mode: 0o700 })
61
+ const now = Date.now()
62
+ await Promise.all((await readdir(dir)).map(async entry => {
63
+ const path = join(dir, entry)
64
+ const info = await stat(path).catch(() => undefined)
65
+ if (info?.isFile() && now - info.mtimeMs > lifetimeMs) await unlink(path).catch(() => {})
66
+ }))
67
+ const temporary = `${file}.${randomUUID()}`
68
+ try {
69
+ await writeFile(temporary, JSON.stringify({ context, expires: now + lifetimeMs }), { mode: 0o600, flag: "wx" })
70
+ await rename(temporary, file)
71
+ } finally {
72
+ await unlink(temporary).catch(() => {})
73
+ }
74
+ }
75
+
76
+ export async function consumeWorkspaceCall(args) {
77
+ if (!isConversationId(args?.conversationId)) return undefined
78
+ const { file } = evidenceFile(args)
79
+ const claimed = `${file}.${randomUUID()}`
80
+ try {
81
+ await rename(file, claimed)
82
+ } catch (error) {
83
+ if (error.code === "ENOENT") return undefined
84
+ throw error
85
+ }
86
+ try {
87
+ const { context, expires } = JSON.parse(await readFile(claimed, "utf8"))
88
+ return expires >= Date.now() ? context : undefined
89
+ } finally {
90
+ await unlink(claimed).catch(() => {})
91
+ }
92
+ }
@@ -295,9 +295,9 @@ export const bridgeTools = [
295
295
  ]
296
296
 
297
297
  export const bridgeInstructions = [
298
- "Use Acent Bridge when the user explicitly asks to delegate. For agent-initiated delegation, call acent_bridge_settings when planning a task that matches an automatic delegation trigger, or as soon as the trigger becomes clear. If the project reports automatic=true and a suitable candidate is available, start the matching Bridge workflow. Pass automatic=true when listing candidates, starting a task, or starting refinement. Honor any user instruction to keep the work in the current agent.",
299
- "When planning a substantial change, look for focused read-only investigation of callers, existing behavior, edge cases, or regression coverage. Delegate it early if you can continue useful work in parallel and know how you will use the findings. Reassess when edit scopes or a reviewable patch become clear. Other automatic triggers are independent implementation with verifiable outcomes and disjoint write scopes, substantive changes to payments, authorization, privacy, or durable data, and difficult failures where the cause remains unclear or a fix repeatedly fails.",
300
- "Keep one writer responsible for each shared contract, state machine, or business rule, even if the files are disjoint. Resolve shared design decisions before starting parallel implementation. If one task needs an earlier result, pass dependsOn or finish the prerequisite first. Handle small, straightforward edits and dependent steps directly. Use read-only review or diagnosis for independent work when writes need one owner.",
298
+ "Use Acent Bridge when the user explicitly asks to delegate. For feature work or a bug fix that needs investigation or behavioral verification, identify one focused task that could run alongside your work as soon as the goal and likely scope are clear. Check acent_bridge_settings at that point, even for a single-file change. If the project reports automatic=true and a suitable candidate is available, start the independent task before detailed investigation or implementation, and continue the main work in parallel. Pass automatic=true when listing candidates, starting a task, or starting refinement. Honor any user instruction to keep the work in the current agent.",
299
+ "Prefer one concrete read-only task when the implementation scope is still forming, such as tracing a caller, identifying a specific regression case, or checking test coverage. Give the delegate a distinct question with a verifiable result. Check settings if a trigger first becomes clear later and reassess when a reviewable patch is ready. Other automatic triggers are independent implementation with verifiable outcomes and disjoint write scopes, substantive changes to payments, authorization, privacy, or durable data, and difficult failures where the cause remains unclear or a fix repeatedly fails.",
300
+ "Handle straightforward copy or styling edits and dependent steps directly. Start additional automatic tasks only when each has a distinct, useful result. Keep one writer responsible for each shared contract, state machine, or business rule, even if the files are disjoint. Resolve shared design decisions before starting parallel implementation. If one task needs an earlier result, pass dependsOn or finish the prerequisite first. Use read-only review or diagnosis for independent work when writes need one owner.",
301
301
  "Keep authorized production actions such as deploys, database migrations, and live payments or refunds with the coordinating agent. Use Bridge for independent review of the plan and verification of the result.",
302
302
  "If automatic delegation is disabled, continue the task directly. If automatic delegation is enabled but no suitable candidate is available, continue work you can verify and state the specific reason the independent work did not run. Report only the reviews and checks that actually completed.",
303
303
  "Get candidates for each new task and choose a tool and model that fit the work and the user's preference. Favor lower-usage options for routine work when verified quota is low and the user has not pinned a model. Start tasks with concrete acceptance criteria.",
@@ -308,9 +308,9 @@ export const bridgeInstructions = [
308
308
  "Use acent_bridge_integrate to check and apply completed diffs. For substantive changes implemented in parallel, review the integrated result and run end-to-end checks while eligible independent reviewers look at the same integrated candidate. Give multiple reviewers complementary priorities, such as concurrency, interface behavior, or regressions. Keep the reviewed files stable while reviews and checks run. Apply findings and re-review and rerun affected checks if the candidate changes.",
309
309
  "For substantive authorized edits with a defined write scope, use acent_bridge_refine to run independent review, repair and re-review. Pass applied task IDs in dependsOn. Choose eligible model families and optionally set each reviewer's focus to a distinct priority. Set apply=true only within the user's authorized editing scope.",
310
310
  "At needs_checks, call verify with the current checkRevision and authorized test commands to run in the private staging workspace. For a pending verified patch, inspect and approve it with apply and checkRevision. Replace a failed reviewer with replace_reviewer and an eligible reviewer. Resolve context requests using acent_bridge_continue and then resume refinement status. For standalone review of integrated work, submit commands to acent_bridge_finalize and poll without commands until verification finishes. Use setupCommands if the private check copy needs project-specific preparation. Remain responsible for the final result.",
311
- "Include an Acent Bridge section in the first final answer after any Bridge run or requested independent review, including when a requested review could not run. Start with a bold Acent Bridge label and the observed status in the user's language. Follow it immediately with a Markdown table with columns for agent or check, scope, outcome, and findings or evidence. Include the table even when only one delegate participated or its execution model is unknown. Name the coordinator and delegate separately for the checks each performed. For delegates, use actualModel as the host-reported model. For the coordinator, use the host's model metadata for that turn when available. When the execution model is unavailable, label any requested model as requested and mark the execution model unconfirmed. Keep model families separate from model names.",
311
+ "Include an Acent Bridge section in the first final answer after any Bridge run or requested independent review, including when a requested review could not run. Start with a bold Acent Bridge label and the observed status in the user's language. Follow it immediately with a Markdown table showing the agent or check and its execution model, the work it performed and its scope, the outcome, and the findings or evidence. Include the table even when only one delegate participated or its execution model is unknown. Name the coordinator and delegate separately for the checks each performed. For delegates, use actualModel as the host-reported model. For the coordinator, use the host's model metadata for that turn when available. When the execution model is unavailable, label any requested model as requested and mark the execution model unconfirmed. Keep model families separate from model names.",
312
312
  "Use one row per task, reviewer, or check. Use reviewResult and reviewResults to distinguish findings, no findings in the reviewed scope, unclassified results, failed or blocked reviews, and reviews that did not run. Include relevant earlier and replacement rows with their round, and list checksNotRun as not run. Keep findings reported by a single reviewer visible. Report whether each material finding was reproduced, remains unverified, or was fixed and rechecked. Cite file lines and short observed evidence in the table or in an Evidence section above the conclusion. Keep raw logs and credentials out of the answer.",
313
- "End the Bridge report with a final conclusion stating whether the patch was applied or is awaiting application, which material findings or checks remain, and the recommended next action when needed. For read-only work, conclude with the result and any remaining uncertainty.",
313
+ "Put application status, pending checks, and blockers in the table or the evidence above the conclusion. End the entire final answer, after the table and any evidence, with exactly one standalone sentence summarizing the overall outcome and the delegate's most useful observed contribution. If delegation could not run, state the blocker in that sentence. Place nothing after it.",
314
314
  ].join(" ")
315
315
 
316
316
  const cacheDuration = 120_000
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { encryptedReadTool, readEncryptedRecords, privateGrant } from "./encrypted-capture.mjs"
3
- import { readFile } from "node:fs/promises"
3
+ import { readFile, realpath } from "node:fs/promises"
4
4
  import { connectionGuidance } from "./host-guidance.mjs"
5
5
  // Folder-scoped MCP with setup available even before the first authorization.
6
6
  import { clarificationInstructions, clarificationTool, clarify, createQuestionChannel } from "./clarification.mjs"
@@ -11,7 +11,9 @@ import { bridgeInstructions, bridgeTools, createBridge } from "./bridge.mjs"
11
11
  import { bridgeCaptureEvents } from "./bridge-capture.mjs"
12
12
  import { createInterface } from "node:readline"
13
13
  import { mkdir } from "node:fs/promises"
14
- import { dirname } from "node:path"
14
+ import { dirname, resolve } from "node:path"
15
+ import { fileURLToPath } from "node:url"
16
+ import { antigravityWorkspaceTool, consumeWorkspaceCall } from "./antigravity-workspace.mjs"
15
17
  import { createPluginUpdateNotice, pluginUpdateInstructions, readPluginInstallation } from "./plugin-updates.mjs"
16
18
  import {
17
19
  options,
@@ -30,6 +32,8 @@ const launchFolder = folderIndex < 0 ? undefined : launchArgs[folderIndex + 1]
30
32
  if (folderIndex >= 0 && !projectFolder(launchFolder)) launchArgs.splice(folderIndex, 2)
31
33
  const startupConfig = await boundConfig(["flush", ...launchArgs])
32
34
  let activeConfig = startupConfig
35
+ const isAntigravity = startupConfig.tool === "Antigravity"
36
+ const pluginFolder = resolve(fileURLToPath(new URL("..", import.meta.url)))
33
37
  const recoverCursorFolder = startupConfig.tool === "Cursor" &&
34
38
  launchFolder === "${workspaceFolder}" && !launchArgs.includes("--general")
35
39
  const installation = await readPluginInstallation(activeConfig.tool).catch(() => null)
@@ -38,6 +42,7 @@ let clientCapabilities = {}
38
42
  let protocol
39
43
  let pendingConnection
40
44
  let connectionUrl
45
+ let connectionDirectory
41
46
  const setupTool = {
42
47
  name: "acent_connect",
43
48
  title: "Acent Connect",
@@ -67,14 +72,26 @@ function recoverCursorConfig() {
67
72
  return cursorFolderRecovery
68
73
  }
69
74
 
70
- async function detectConnectionContext(config) {
75
+ async function detectConnectionContext(config, verifiedWorkspace) {
76
+ if (verifiedWorkspace) {
77
+ return { context: verifiedWorkspace, roots: verifiedWorkspace.folder ? undefined : [] }
78
+ }
71
79
  const roots = clientCapabilities.roots ? await rootRequests.request() : undefined
80
+ const explicitGeneral = config.general &&
81
+ (config !== startupConfig || launchArgs.includes("--general"))
82
+ const bound = isAntigravity && !projectFolder(launchFolder)
83
+ ? explicitGeneral ? { ...config, bindingKnown: true } : undefined
84
+ : config
72
85
  const context = connectionContext({
73
86
  roots,
74
87
  explicitFolder: projectFolder(launchFolder) ||
75
88
  (config.tool === "Cursor" ? process.env.CURSOR_PROJECT_DIR : undefined),
76
- bound: recoverCursorFolder && config === startupConfig ? undefined : config,
89
+ bound: recoverCursorFolder && config === startupConfig ? undefined : bound,
77
90
  })
91
+ if (isAntigravity && context.scope === "folder" &&
92
+ await realpath(context.folder).catch(() => resolve(context.folder)) === pluginFolder) {
93
+ return { context: { scope: "unknown" }, roots }
94
+ }
78
95
  return { context, roots }
79
96
  }
80
97
 
@@ -101,7 +118,8 @@ const needsConnection = (error) =>
101
118
  error.code === "invalid_grant" ||
102
119
  error.code === "project_unavailable" ||
103
120
  error.status === 401
104
- const setupTools = () => ({ tools: [setupTool, ...localBridgeTools] })
121
+ const workspaceTools = isAntigravity ? [antigravityWorkspaceTool] : []
122
+ const setupTools = () => ({ tools: [setupTool, ...localBridgeTools, ...workspaceTools] })
105
123
 
106
124
  function toolErrorMessage(error) {
107
125
  if (needsConnection(error))
@@ -137,13 +155,16 @@ async function postMcp(config, access, message) {
137
155
  }
138
156
  async function startConnection(config) {
139
157
  const directory = configDirectory(config)
140
- if (pendingConnection) return connectionUrl
141
- await mkdir(directory, { recursive: true, mode: 0o700 })
158
+ if (pendingConnection) {
159
+ if (directory !== connectionDirectory)
160
+ throw new Error("Finish the pending connection before changing its workspace")
161
+ return connectionUrl
162
+ }
163
+ connectionDirectory = directory
142
164
  const ready = Promise.withResolvers()
143
- pendingConnection = connect(config, directory, (url) => {
144
- connectionUrl = url.toString()
145
- ready.resolve(connectionUrl)
146
- })
165
+ pendingConnection = mkdir(directory, { recursive: true, mode: 0o700 }).then(() => connect(config, directory, (url) => {
166
+ ready.resolve(url.toString())
167
+ }))
147
168
  .then(() => {
148
169
  config.bindingKnown = true
149
170
  write({ jsonrpc: "2.0", method: "notifications/tools/list_changed" })
@@ -155,13 +176,16 @@ async function startConnection(config) {
155
176
  .finally(() => {
156
177
  pendingConnection = undefined
157
178
  connectionUrl = undefined
179
+ connectionDirectory = undefined
158
180
  })
159
- return ready.promise
181
+ connectionUrl = ready.promise
182
+ return connectionUrl
160
183
  }
161
184
  const lines = createInterface({ input: process.stdin, crlfDelay: Infinity })
162
185
  async function handleLine(line) {
163
186
  if (!line.trim()) return
164
187
  let message
188
+ let workspaceCatalog = false
165
189
  try {
166
190
  let config = activeConfig
167
191
  if (Buffer.byteLength(line) > 64 * 1024)
@@ -174,7 +198,8 @@ async function handleLine(line) {
174
198
  }
175
199
  // Responses are never forwarded to the HTTP tool endpoint.
176
200
  if (!message.method) return
177
- const reply = (result) => write({ jsonrpc: "2.0", id: message.id, result })
201
+ const reply = (result) => write({ jsonrpc: "2.0", id: message.id, result: workspaceCatalog
202
+ ? { ...content(JSON.stringify(result)), structuredContent: result } : result })
178
203
  const replyTool = async (result) => reply(await withPluginUpdate(result))
179
204
  if (message.method === "initialize") {
180
205
  if (!pluginUpdates && installation && process.env.ACENT_BRIDGE_WORKER !== "1" &&
@@ -209,11 +234,27 @@ async function handleLine(line) {
209
234
  reply({})
210
235
  return
211
236
  }
237
+ let verifiedWorkspace
238
+ if (isAntigravity && message.method === "tools/call" && message.params?.name === antigravityWorkspaceTool.name) {
239
+ const args = message.params.arguments ?? {}
240
+ verifiedWorkspace = await consumeWorkspaceCall(args)
241
+ if (!verifiedWorkspace || verifiedWorkspace.folder === pluginFolder) {
242
+ reply(content("Acent could not verify this Antigravity chat's workspace. Use the conversation ID supplied by the Acent hook with a single workspace folder open.", true))
243
+ return
244
+ }
245
+ if (args.tool === antigravityWorkspaceTool.name) {
246
+ reply(content("Choose an Acent tool from the workspace tool list.", true))
247
+ return
248
+ }
249
+ workspaceCatalog = args.tool === undefined
250
+ message.method = workspaceCatalog ? "tools/list" : "tools/call"
251
+ message.params = workspaceCatalog ? undefined : { name: args.tool, arguments: args.arguments }
252
+ }
212
253
  if (message.method === "tools/call" &&
213
254
  localBridgeTools.some(tool => tool.name === message.params?.name)) {
214
255
  try {
215
256
  const args = message.params.arguments ?? {}
216
- const { context } = await detectConnectionContext(config)
257
+ const { context } = await detectConnectionContext(config, verifiedWorkspace)
217
258
  const value = await bridge(message.params.name, args,
218
259
  context.scope === "folder" ? context.folder : undefined, async (folder) => {
219
260
  const projectConfig = options([
@@ -256,13 +297,17 @@ async function handleLine(line) {
256
297
  let scope = message.params.arguments?.scope ?? "auto"
257
298
  let detectedFolder
258
299
  let projectlessRoots = false
259
- const resumePending = scope === "auto" && !!pendingConnection
300
+ const resumePending = !isAntigravity && scope === "auto" && !!pendingConnection
260
301
  if (scope !== "auto" && scope !== "folder" && scope !== "general")
261
302
  throw new Error("Choose folder or general scope")
262
303
  if (resumePending) scope = config.general ? "general" : "folder"
263
- if (scope === "auto") {
264
- const { context: detected, roots } = await detectConnectionContext(config)
265
- if (detected.scope === "unknown") {
304
+ if (scope === "auto" || isAntigravity) {
305
+ const { context: detected, roots } = await detectConnectionContext(config, verifiedWorkspace)
306
+ if (isAntigravity && scope === "folder" && detected.scope !== "folder") {
307
+ reply(content("Acent could not identify the Antigravity project folder. Open a single workspace folder in Antigravity and try again.", true))
308
+ return
309
+ }
310
+ if (scope === "auto" && detected.scope === "unknown") {
266
311
  const value = {
267
312
  status: "needs_user_input",
268
313
  question: "Connect Acent to this project's conversations or to general conversations outside projects?",
@@ -273,18 +318,20 @@ async function handleLine(line) {
273
318
  return
274
319
  }
275
320
  projectlessRoots = Array.isArray(roots) && roots.length === 0
276
- scope = detected.scope
321
+ if (scope === "auto") scope = detected.scope
277
322
  detectedFolder = detected.folder
278
323
  }
279
324
  if (!resumePending) {
280
- const folder = detectedFolder || config.contextFolder || config.folder || process.cwd()
325
+ const folder = isAntigravity
326
+ ? detectedFolder || config.contextFolder
327
+ : detectedFolder || config.contextFolder || config.folder || process.cwd()
281
328
  config = options(["flush", "--tool", config.tool, "--server", config.server,
282
329
  ...(scope === "general" ? ["--general"] : []),
283
- ...(projectlessRoots ? [] : ["--folder", folder]),
330
+ ...(!projectlessRoots && folder ? ["--folder", folder] : []),
284
331
  ])
285
- if (pendingConnection && configDirectory(config) !== configDirectory(activeConfig))
332
+ if (pendingConnection && configDirectory(config) !== connectionDirectory)
286
333
  throw new Error("Finish the pending connection before changing its scope")
287
- activeConfig = config
334
+ if (!verifiedWorkspace) activeConfig = config
288
335
  }
289
336
  if (message.params.arguments?.reconnect !== true) {
290
337
  try {
@@ -309,7 +356,18 @@ async function handleLine(line) {
309
356
  )
310
357
  return
311
358
  }
312
- if (recoverCursorFolder && config === startupConfig) {
359
+ if (isAntigravity) {
360
+ const { context, roots } = await detectConnectionContext(config, verifiedWorkspace)
361
+ if (context.scope === "unknown") {
362
+ if (message.method === "tools/list") return reply(setupTools())
363
+ throw Object.assign(new Error("No workspace connection"), { code: "ENOENT" })
364
+ }
365
+ const folder = context.folder || (roots === undefined ? config.contextFolder : undefined)
366
+ config = await boundConfig(["flush", "--tool", config.tool, "--server", config.server,
367
+ ...(context.scope === "general" ? ["--general"] : []),
368
+ ...(folder ? ["--folder", folder] : []),
369
+ ])
370
+ } else if (recoverCursorFolder && config === startupConfig) {
313
371
  await recoverCursorConfig()
314
372
  config = activeConfig
315
373
  if (config === startupConfig) {
@@ -367,18 +425,19 @@ async function handleLine(line) {
367
425
  const localTools = privateGrant(grant.client_id)
368
426
  ? (grant.captureKey && grant.scope?.split(" ").includes("original:read") ? [encryptedReadTool] : [])
369
427
  : grant.scope?.split(" ").includes("conversation:write") ? [attachmentTool] : []
370
- result.result.tools = [...result.result.tools.filter((tool) => tool.name !== clarificationTool.name), setupTool, clarificationTool, ...localTools, ...localBridgeTools]
428
+ result.result.tools = [...result.result.tools.filter((tool) => tool.name !== clarificationTool.name), setupTool, clarificationTool, ...localTools, ...localBridgeTools, ...workspaceTools]
371
429
  }
372
430
  if (message.method === "tools/call" && result.result)
373
431
  result.result = await withPluginUpdate(result.result)
374
- write(result)
432
+ if (workspaceCatalog && result.result) reply(result.result)
433
+ else write(result)
375
434
  } catch (error) {
376
435
  console.error("Acent request failed.")
377
436
  if (message?.id !== undefined)
378
437
  write({
379
438
  jsonrpc: "2.0",
380
439
  id: message.id,
381
- ...(message.method === "tools/call"
440
+ ...(message.method === "tools/call" || workspaceCatalog
382
441
  ? {
383
442
  result: content(toolErrorMessage(error), true),
384
443
  }
@@ -1,18 +1,18 @@
1
1
  ---
2
2
  name: acent-bridge
3
- description: Acent Bridge delegates work to another coding agent in the current project. Use for explicit delegation requests and when evaluating automatic delegation for independent implementation tasks, high-impact reviews, or difficult diagnoses.
3
+ description: Acent Bridge delegates work to another coding agent in the current project. Use for explicit delegation and consider it early for feature work, bug fixes, and reviews with an independent check.
4
4
  ---
5
5
 
6
6
  # Acent Bridge
7
7
 
8
8
  Use the Acent Bridge MCP tools in a session with one local project folder open. If the tools are unavailable, tell the user that Bridge is unavailable in the current session.
9
9
 
10
- - Look for useful independent work while planning a substantial change and again when scopes or reviewable changes become clear. Check `acent_bridge_settings` when a trigger below applies. If the project reports `automatic: true` and a suitable candidate is available, start the matching workflow. Pass `automatic: true` when listing candidates, starting a task, or starting refinement. Honor the user's instructions about delegation. Users can change the setting in the project's Bridge dialog.
11
- - **Early investigation.** Delegate a focused read-only investigation of callers, existing behavior, edge cases, or regression coverage when the coordinator can continue useful work in parallel and knows how it will use the findings.
10
+ - For feature work or a bug fix that needs investigation or behavioral verification, identify one focused task that could run alongside your work as soon as the goal and likely scope are clear. Check `acent_bridge_settings` at that point, even for a single-file change. If the project reports `automatic: true` and a suitable candidate is available, start the independent task before detailed investigation or implementation, and continue the main work in parallel. Check settings when a trigger first becomes clear later and reassess when a reviewable patch is ready. Pass `automatic: true` when listing candidates, starting a task, or starting refinement. Honor the user's instructions about delegation. Users can change the setting in the project's Bridge dialog.
11
+ - **Early investigation.** Prefer one concrete read-only task when the implementation scope is still forming. Ask the delegate to trace a caller, identify a specific regression case, or check existing test coverage that can inform the fix. Give it a distinct question with a verifiable result, while the coordinator advances other work.
12
12
  - **Parallel implementation.** Delegate independently verifiable tasks with disjoint write scopes once shared design decisions are settled.
13
13
  - **Independent review.** Have a different model family review substantive changes to payments, authorization, privacy, or durable data before reporting completion. For substantive changes implemented in parallel, review the integrated result with the coordinator and eligible independent reviewers while the coordinator runs end-to-end checks.
14
14
  - **Independent diagnosis.** Delegate a read-only investigation if the cause remains unclear or a fix repeatedly fails.
15
- - Keep small, straightforward edits and dependent steps with the coordinating agent. Give each shared contract, state machine, or business rule one writer, even when it spans separate files. Finish a prerequisite first or use `dependsOn` when later work needs its result. Use read-only review or diagnosis for independent work when writes need one owner.
15
+ - Keep straightforward copy or styling edits and dependent steps with the coordinating agent. Start additional automatic tasks only when each has a distinct, useful result. Give each shared contract, state machine, or business rule one writer, even when it spans separate files. Finish a prerequisite first or use `dependsOn` when later work needs its result. Use read-only review or diagnosis for independent work when writes need one owner.
16
16
  - Keep authorized production actions with the coordinating agent, including deployments, database migrations, and live payments or refunds. Bridge can review the plan or verify the outcome independently.
17
17
  - If automatic delegation is disabled, continue directly. If it is enabled and no suitable candidate is available, continue the work you can verify and report why independent work did not run.
18
18
  - Classify the work as `implement`, `review`, or `diagnose`. Call `acent_bridge_candidates` and select a returned tool and model that fit the task and the user's preference. For review, diagnosis, and refinement, pass the host-reported model for this turn as `currentModel`. Supply `originModel` when reviewing earlier work whose originating model is known. Bridge uses the earlier model when supplied and recognized, otherwise it checks independence against the current model. In Codex, if candidate selection returns `origin_model_unverified` and the Bridge hook reports the current model, retry with that ID. Pass the same model inputs to start the selected work. Report when no eligible candidate is available.
@@ -36,8 +36,8 @@ For a payment review, the coordinator can report that a sandbox purchase produce
36
36
 
37
37
  ## Report Bridge results
38
38
 
39
- 1. Include an Acent Bridge section in the first final answer after any Bridge run or requested independent review, including when a requested review could not run. Start with `**Acent Bridge** · <status>` in the user's language. Follow it immediately with a Markdown table with columns for agent or check, scope, outcome, and findings or evidence. Include the table even when only one delegate participated or its execution model is unknown. Name the coordinator and delegate separately for the checks each performed. For delegates, use `actualModel` as the host-reported model. For the coordinator, use the host's model metadata for that turn when available. When the execution model is unavailable, label any requested model as requested and mark the execution model unconfirmed. Keep model families separate from model names.
39
+ 1. Include an Acent Bridge section in the first final answer after any Bridge run or requested independent review, including when a requested review could not run. Start with `**Acent Bridge** · <status>` in the user's language. Follow it immediately with a Markdown table showing the agent or check and its execution model, the work it performed and its scope, the outcome, and the findings or evidence. Include the table even when only one delegate participated or its execution model is unknown. Name the coordinator and delegate separately for the checks each performed. For delegates, use `actualModel` as the host-reported model. For the coordinator, use the host's model metadata for that turn when available. When the execution model is unavailable, label any requested model as requested and mark the execution model unconfirmed. Keep model families separate from model names.
40
40
  2. Use one row per distinct task, review, or check. Keep relevant earlier rounds and replacement reviewers visible. Use `reviewResult` and `reviewResults` to distinguish findings, no findings in the reviewed scope, unclassified output, failed or blocked reviews, and reviews that did not run. Mark `checksNotRun` as not run and report other unavailable tools with their observed reasons. Preserve findings reported by a single reviewer. Say whether each material finding was reproduced, fixed and rechecked, or still needs verification. Cite file lines and short observed evidence in the table or in an Evidence section above the conclusion. Keep raw logs and credentials out of the answer.
41
- 3. End with a final conclusion stating whether the patch was applied or is awaiting application, which material findings or checks remain, and the recommended next action when one is needed. For read-only work, conclude with the result and any remaining uncertainty.
41
+ 3. Put application status, pending checks, and blockers in the table or the evidence above the conclusion. End the entire final answer, after the table and any evidence, with exactly one standalone sentence summarizing the overall outcome and the delegate's most useful observed contribution. If delegation could not run, state the blocker in that sentence. Place nothing after it.
42
42
 
43
43
  When the coordinator and delegate verify different parts of a result, name the observer for each material piece of evidence and identify any check that remains unverified.
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://antigravity.google/schemas/v1/plugin.json",
3
3
  "name": "acent",
4
4
  "displayName": "Acent",
5
- "version": "1.2.1",
5
+ "version": "1.2.3",
6
6
  "description": "Recall past work, trace code changes, revisit decisions, and resume tasks with Acent.",
7
7
  "author": {
8
8
  "name": "Cirtium"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cirtium/acent-connect",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "type": "module",
5
5
  "description": "Install and connect the shared Acent coding-tool plugin",
6
6
  "repository": {