feat(cli): onboarding wires selected agents inline + memory-share callout#408
Conversation
…lout After the agents multi-select, show a callout explaining that all picked agents share the same memory at :3111 (Claude Code saves visible to Codex + Cursor instantly). After provider selection + .env write, ask whether to run agentmemory connect <agent> for each selected agent right now. On yes, dispatch through the existing connect adapter (same code path as agentmemory connect <agent>) and summarize wired vs manual vs failed. On no/cancel, print the exact commands to run later. Expose runAdapter from src/cli/connect/index.ts so onboarding reuses the same install path the CLI uses today.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThe PR exports the ChangesOnboarding with Agent Wiring
Sequence DiagramsequenceDiagram
participant User
participant Onboarding
participant wireSelectedAgents
participant resolveAdapter
participant runAdapter
User->>Onboarding: Complete agent selection
Onboarding->>User: Show shared memory note (if agents selected)
Onboarding->>wireSelectedAgents: Call wireSelectedAgents(agents)
wireSelectedAgents->>User: Prompt: wire now or later?
alt User declines wiring
wireSelectedAgents->>User: Display "Wire later with:" commands
else User accepts wiring
loop For each selected agent
wireSelectedAgents->>resolveAdapter: Resolve adapter for agent
resolveAdapter-->>wireSelectedAgents: Adapter or undefined
alt Adapter resolved
wireSelectedAgents->>runAdapter: Execute adapter wiring
runAdapter-->>wireSelectedAgents: ConnectResult (success/failure)
wireSelectedAgents->>wireSelectedAgents: Categorize result (wired/manual/failed)
else No adapter
wireSelectedAgents->>wireSelectedAgents: Mark as failed
end
end
wireSelectedAgents->>User: Print wiring summary
end
Onboarding-->>User: Return onboarding result
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/cli/onboarding.ts (1)
163-173: 💤 Low valueOptional: eliminate redundant variable.
pickedAgentsList(line 163) is derived from the same source asagents(line 186) but only used for the length check on line 164. You could move this callout block after line 186 and useagents.length > 0directly.♻️ Suggested refactor
Move the callout block after the
agentsassignment:} - const pickedAgentsList = (agentsPicked as string[]) ?? []; - if (pickedAgentsList.length > 0) { - p.note( - [ - "━ how this works ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━", - "All selected agents share the same memory at :3111.", - "A memory saved by Claude Code is visible to Codex + Cursor instantly.", - "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━", - ].join("\n"), - ); - } - const providerPicked = await p.select<string>({ message: "Which LLM provider should agentmemory use for compress/consolidate?", options: PROVIDERS.map(({ value, label }) => ({ value, label })),Then after line 186:
const provider = providerPicked === "skip" ? null : providerPicked; const agents = (agentsPicked as string[]) ?? []; + + if (agents.length > 0) { + p.note( + [ + "━ how this works ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━", + "All selected agents share the same memory at :3111.", + "A memory saved by Claude Code is visible to Codex + Cursor instantly.", + "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━", + ].join("\n"), + ); + } const envPath = await seedEnvFile(provider);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/cli/onboarding.ts` around lines 163 - 173, The callout uses a redundant variable pickedAgentsList (derived from agentsPicked) only to check length; remove pickedAgentsList, move the callout block to after the agents assignment (variable agents) and replace the length check with agents.length > 0 so the block uses the already-computed agents array instead of agentsPicked/pickedAgentsList.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/cli/onboarding.ts`:
- Line 246: Remove the duplicate "Wiring" step log in onboarding by deleting the
p.log.step(`Wiring ${name}...`) call so that runAdapter (which logs Wiring
${adapter.displayName}… in connect/index.ts:62) remains the single source of
truth; this keeps naming and ellipsis consistent with the runConnect/runAdapter
flow.
---
Nitpick comments:
In `@src/cli/onboarding.ts`:
- Around line 163-173: The callout uses a redundant variable pickedAgentsList
(derived from agentsPicked) only to check length; remove pickedAgentsList, move
the callout block to after the agents assignment (variable agents) and replace
the length check with agents.length > 0 so the block uses the already-computed
agents array instead of agentsPicked/pickedAgentsList.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: f35d090b-dcf2-4424-a771-34463c1f0118
📒 Files selected for processing (2)
src/cli/connect/index.tssrc/cli/onboarding.ts
| p.log.warn(`Wiring ${name}… no adapter available (skipped).`); | ||
| continue; | ||
| } | ||
| p.log.step(`Wiring ${name}...`); |
There was a problem hiding this comment.
Remove duplicate "Wiring" log or use display name for consistency.
Line 246 logs Wiring ${name}... (e.g., "Wiring claude-code..."), but runAdapter (called on line 249) also logs Wiring ${adapter.displayName}… at connect/index.ts:62 (e.g., "Wiring Claude Code…"). This produces two wiring messages per agent with inconsistent naming ("claude-code" vs "Claude Code") and ellipsis styles ("..." vs "…").
The existing runConnect flow (connect/index.ts:104-109) calls runAdapter without a preceding step log, letting runAdapter handle all logging. Consider following the same pattern here.
🎨 Proposed fix
Remove the duplicate log step:
- p.log.step(`Wiring ${name}...`);
let result: ConnectResult;Alternatively, if you want to keep a local log, use the display name and matching ellipsis:
- p.log.step(`Wiring ${name}...`);
+ p.log.step(`Wiring ${adapter.displayName}…`);
let result: ConnectResult;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| p.log.step(`Wiring ${name}...`); | |
| let result: ConnectResult; |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/cli/onboarding.ts` at line 246, Remove the duplicate "Wiring" step log in
onboarding by deleting the p.log.step(`Wiring ${name}...`) call so that
runAdapter (which logs Wiring ${adapter.displayName}… in connect/index.ts:62)
remains the single source of truth; this keeps naming and ellipsis consistent
with the runConnect/runAdapter flow.
Patch bump per the established rule: additive surface only, no breaks to MemoryProvider trait, exported types, or default behaviour. New top-level subcommands (`--reset` already shipped 0.9.15, no new commands here) are opt-in. PRs included since v0.9.15: #408 — onboarding wires selected agents inline + memory-share callout #409 — clarify MCP is opt-in (REST primary) #410 — 5-port ready panel, iii console install, global-install prompt #411 — splash banner rerender + README install hoist + npx caveat #415 — agent-memory.dev refresh (FeaturedIn bar + Agents/Compare/ CommandCenter/Hero updates) Files bumped (9): package.json, packages/mcp/package.json, plugin/.claude-plugin/plugin.json, plugin/.codex-plugin/plugin.json, src/version.ts, src/types.ts, src/functions/export-import.ts, test/export-import.test.ts, CHANGELOG.md
Summary
Today the first-run wizard stores the multi-select in
~/.agentmemory/preferences.jsonand exits. Users then have to re-runagentmemory connect <agent>per agent by hand. This PR closes that loop.Two changes, one PR:
Memory-share callout. After the agents multi-select (only when >=1 agent selected, before provider select), print a callout explaining that all picked agents share the same memory at :3111 — a save by Claude Code is visible to Codex + Cursor instantly.
Wire selected agents inline. After provider selection +
.envwrite, ask "Runagentmemory connect <agent>for each selected agent now? [Y/n]". On yes, dispatch each through the existingrunAdapter(same code path the standaloneagentmemory connect <agent>command uses today), collect per-agent results, and summarizeWired: ... / Skipped/failed: .... On no/cancel, print the exact commands to run later.Edge cases handled:
Scope-limited to
src/cli/onboarding.ts(callout + wire flow) andsrc/cli/connect/index.ts(exportrunAdapter).Sample first-run flow
Test plan
npm run buildpassesnpx vitest run test/cli-connect.test.ts— 13/13 pass (dispatcher + claude-code adapter unchanged)runOnboarding()non-interactively with mocked@clack/prompts+connect/index.js: callout renders, wire prompt fires, per-agent step lines print, summary buckets wired vs manual correctlynpx agentmemory@latest --resetonce publishedDiff stat
Summary by CodeRabbit
New Features