feat(cli): splash banner, agent grid, provider picker, smart defaults#403
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThe PR adds a first-run onboarding flow, a JSON-backed CLI preferences store, a terminal-aware splash, a buffered/verbose boot logger, readiness polling and plain-stdout readiness hints in the CLI, and routes core startup logs through the boot logger. ChangesFirst-run onboarding and startup improvements
Sequence Diagram(s)sequenceDiagram
participant CLI as CLI main
participant Prefs as Preferences
participant Board as Onboarding
participant Env as .env seeding
participant Engine as Engine / agentmemory
participant REST as /agentmemory/livez
CLI->>Prefs: readPrefs()
Prefs-->>CLI: current or defaults
alt First run
CLI->>Board: runOnboarding()
Board->>Board: prompt agents & provider
Board->>Env: seedEnvFile(provider)
Env->>Env: copy .env.example or write skeleton
Board->>Prefs: writePrefs(agents, provider, firstRunAt)
Board-->>CLI: OnboardingResult
end
CLI->>REST: waitForAgentmemoryReady() or startEngine()
REST-->>CLI: ready
CLI->>CLI: printReadyHint() to stdout
CLI->>Prefs: writePrefs(skipSplash: true)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 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 There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add 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 (2)
src/logger.ts (1)
63-72: ⚡ Quick winTrim the new boot-log WHAT-comment block.
Please replace this behavior narration with clearer symbol naming (or a short WHY note only) to align with repo standards.
As per coding guidelines, "Avoid code comments explaining WHAT — use clear naming instead".
🤖 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/logger.ts` around lines 63 - 72, The comment block describing the "boot log" behavior is overly verbose and explains WHAT the code does; instead, replace it with a concise WHY note or clearer symbol naming: shorten the block above the bootLog variable to a one-line summary like "bootLog: capture one-time startup status lines (quiet vs verbose modes)" and/or add a brief WHY sentence explaining why buffering is needed, then remove the long narration referencing register-* functions; update references to bootLog and any register-* usages if needed to ensure names are self-explanatory (e.g., keep symbol bootLog and mention verbose flag behavior only briefly).src/index.ts (1)
456-459: ⚡ Quick winRemove the new WHAT-oriented inline comment block.
This block explains behavior already expressed by
bootLogusage and can be reduced to naming/structure instead.As per coding guidelines, "Avoid code comments explaining WHAT — use clear naming instead".
🤖 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/index.ts` around lines 456 - 459, Remove the WHAT-oriented inline comment block that explains behavior already conveyed by bootLog and the surrounding code; delete the multi-line comment about "Ready / Endpoints lines..." and, if needed for clarity, replace it with a short, structural note or better-named symbol (e.g., rename variables/functions or add a compact comment referencing bootLog) so the code communicates intent through naming rather than an explanatory block; ensure references to bootLog and the worker ready state remain clear without the verbose comment.
🤖 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/index.ts`:
- Around line 233-251: The startup warnings currently call bootLog which can be
muted; update the two warning branches so that when isAutoCompressEnabled() is
true you call bootWarn instead of bootLog, and similarly when
isContextInjectionEnabled() is true call bootWarn instead of bootLog; keep the
same warning message text and leave the else branches using bootLog
unchanged—locate these calls around the isAutoCompressEnabled and
isContextInjectionEnabled checks and swap bootLog -> bootWarn for the
true/warning cases.
---
Nitpick comments:
In `@src/index.ts`:
- Around line 456-459: Remove the WHAT-oriented inline comment block that
explains behavior already conveyed by bootLog and the surrounding code; delete
the multi-line comment about "Ready / Endpoints lines..." and, if needed for
clarity, replace it with a short, structural note or better-named symbol (e.g.,
rename variables/functions or add a compact comment referencing bootLog) so the
code communicates intent through naming rather than an explanatory block; ensure
references to bootLog and the worker ready state remain clear without the
verbose comment.
In `@src/logger.ts`:
- Around line 63-72: The comment block describing the "boot log" behavior is
overly verbose and explains WHAT the code does; instead, replace it with a
concise WHY note or clearer symbol naming: shorten the block above the bootLog
variable to a one-line summary like "bootLog: capture one-time startup status
lines (quiet vs verbose modes)" and/or add a brief WHY sentence explaining why
buffering is needed, then remove the long narration referencing register-*
functions; update references to bootLog and any register-* usages if needed to
ensure names are self-explanatory (e.g., keep symbol bootLog and mention verbose
flag behavior only briefly).
🪄 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: 4c517d9d-cd85-4cb1-ad5d-0cf6b31dcfe3
📒 Files selected for processing (7)
src/cli.tssrc/cli/onboarding.tssrc/cli/preferences.tssrc/cli/splash.tssrc/index.tssrc/logger.tstest/preferences.test.ts
| if (isAutoCompressEnabled()) { | ||
| console.log( | ||
| `[agentmemory] WARNING: AGENTMEMORY_AUTO_COMPRESS=true — every PostToolUse observation will be sent to your LLM provider for compression. This spends API tokens proportional to your session tool-use frequency (see #138). Set AGENTMEMORY_AUTO_COMPRESS=false to disable.`, | ||
| bootLog( | ||
| `WARNING: AGENTMEMORY_AUTO_COMPRESS=true — every PostToolUse observation will be sent to your LLM provider for compression. This spends API tokens proportional to your session tool-use frequency (see #138). Set AGENTMEMORY_AUTO_COMPRESS=false to disable.`, | ||
| ); | ||
| } else { | ||
| console.log( | ||
| `[agentmemory] Auto-compress: OFF (default, #138) — observations indexed via zero-LLM synthetic compression. Set AGENTMEMORY_AUTO_COMPRESS=true to opt-in to LLM-powered summaries (uses your API key).`, | ||
| bootLog( | ||
| `Auto-compress: OFF (default, #138) — observations indexed via zero-LLM synthetic compression. Set AGENTMEMORY_AUTO_COMPRESS=true to opt-in to LLM-powered summaries (uses your API key).`, | ||
| ); | ||
| } | ||
|
|
||
| if (isContextInjectionEnabled()) { | ||
| console.log( | ||
| `[agentmemory] WARNING: AGENTMEMORY_INJECT_CONTEXT=true — the PreToolUse and SessionStart hooks will inject up to ~4000 chars of memory context into every tool turn. On Claude Pro this burns session tokens proportional to your tool-call frequency (see #143). Set AGENTMEMORY_INJECT_CONTEXT=false to disable.`, | ||
| bootLog( | ||
| `WARNING: AGENTMEMORY_INJECT_CONTEXT=true — the PreToolUse and SessionStart hooks will inject up to ~4000 chars of memory context into every tool turn. On Claude Pro this burns session tokens proportional to your tool-call frequency (see #143). Set AGENTMEMORY_INJECT_CONTEXT=false to disable.`, | ||
| ); | ||
| } else { | ||
| console.log( | ||
| `[agentmemory] Context injection: OFF (default, #143) — hooks capture observations but do not inject context into Claude Code's conversation. Set AGENTMEMORY_INJECT_CONTEXT=true to opt-in (warning: expect your Claude Pro allocation to drain faster).`, | ||
| bootLog( | ||
| `Context injection: OFF (default, #143) — hooks capture observations but do not inject context into Claude Code's conversation. Set AGENTMEMORY_INJECT_CONTEXT=true to opt-in (warning: expect your Claude Pro allocation to drain faster).`, | ||
| ); | ||
| } |
There was a problem hiding this comment.
Route startup warnings through bootWarn, not bootLog.
bootLog is quiet-buffered by default, so these warning paths can be suppressed. Use bootWarn for always-visible warnings.
Suggested diff
-import { bootLog } from "./logger.js";
+import { bootLog, bootWarn } from "./logger.js";
@@
- bootLog(
+ bootWarn(
`WARNING: AGENTMEMORY_AUTO_COMPRESS=true — every PostToolUse observation will be sent to your LLM provider for compression. This spends API tokens proportional to your session tool-use frequency (see `#138`). Set AGENTMEMORY_AUTO_COMPRESS=false to disable.`,
);
@@
- bootLog(
+ bootWarn(
`WARNING: AGENTMEMORY_INJECT_CONTEXT=true — the PreToolUse and SessionStart hooks will inject up to ~4000 chars of memory context into every tool turn. On Claude Pro this burns session tokens proportional to your tool-call frequency (see `#143`). Set AGENTMEMORY_INJECT_CONTEXT=false to disable.`,
);🤖 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/index.ts` around lines 233 - 251, The startup warnings currently call
bootLog which can be muted; update the two warning branches so that when
isAutoCompressEnabled() is true you call bootWarn instead of bootLog, and
similarly when isContextInjectionEnabled() is true call bootWarn instead of
bootLog; keep the same warning message text and leave the else branches using
bootLog unchanged—locate these calls around the isAutoCompressEnabled and
isContextInjectionEnabled checks and swap bootLog -> bootWarn for the
true/warning cases.
Replaces the 25-line `[agentmemory] X` log spam on first invocation
with a SkillKit-grade onboarding flow:
* `src/cli/splash.ts` — terminal-width-aware ASCII banner with three
tiers (>=120 / 80-119 / <80 cols), brand-accent orange via ANSI
256-colour, NO_COLOR-aware, no new deps.
* `src/cli/preferences.ts` — JSON-backed prefs at
`~/.agentmemory/preferences.json`, atomic write via tmp+fsync+rename,
graceful defaults on corrupt/missing file, `isFirstRun()` /
`resetPrefs()` helpers. 7 unit tests added.
* `src/cli/onboarding.ts` — first-run multi-select for agents (native
plugin + MCP-server rows from the README), single-select for
provider (anthropic / openai / gemini / openrouter / minimax / skip
-> BM25-only), seeds `~/.agentmemory/.env`, prints the next-step
hint.
* `src/logger.ts` — adds `bootLog` / `setBootVerbose`. The 18 startup
`console.log` calls in `src/index.ts` route through this shim;
default is muted, `--verbose` (or AGENTMEMORY_VERBOSE=1) restores
the old chatty output. Warnings, errors, and shutdown logs stay
loud.
* `src/cli.ts` — splash before clack intro, run onboarding when
`isFirstRun()` or `--reset`, propagate verbosity to the worker
logger, wait for `/agentmemory/livez` after `import("./index.js")`
and print a single-line ready hint. Adds `--reset` flag.
First-run output drops from 30+ lines to ~10. Subsequent runs are a
single ready line. `--verbose` restores the old verbose surface for
debugging. Build passes; the 10 pre-existing failures in
`test/mcp-standalone.test.ts` are unchanged (903 -> 910, all 7 new
passes are `test/preferences.test.ts`).
e14e73c to
d03c088
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/logger.ts (1)
74-76: ⚡ Quick winRead environment variable once.
The environment variable
process.env["AGENTMEMORY_VERBOSE"]is accessed twice in the same expression.♻️ Refactor to read once
-let bootVerbose = - process.env["AGENTMEMORY_VERBOSE"] === "1" || - process.env["AGENTMEMORY_VERBOSE"] === "true"; +const verboseEnv = process.env["AGENTMEMORY_VERBOSE"]; +let bootVerbose = verboseEnv === "1" || verboseEnv === "true";🤖 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/logger.ts` around lines 74 - 76, The bootVerbose assignment reads process.env["AGENTMEMORY_VERBOSE"] twice; instead read the env var once into a local const (e.g., const envVerbose = process.env["AGENTMEMORY_VERBOSE"]) and then set bootVerbose = envVerbose === "1" || envVerbose === "true"; update the variable declaration where bootVerbose is defined to use this single-read pattern (refer to the bootVerbose variable in logger.ts).
🤖 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.
Nitpick comments:
In `@src/logger.ts`:
- Around line 74-76: The bootVerbose assignment reads
process.env["AGENTMEMORY_VERBOSE"] twice; instead read the env var once into a
local const (e.g., const envVerbose = process.env["AGENTMEMORY_VERBOSE"]) and
then set bootVerbose = envVerbose === "1" || envVerbose === "true"; update the
variable declaration where bootVerbose is defined to use this single-read
pattern (refer to the bootVerbose variable in logger.ts).
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: ab91ddcd-d62c-4e65-b066-b21aa9ad9c17
📒 Files selected for processing (7)
src/cli.tssrc/cli/onboarding.tssrc/cli/preferences.tssrc/cli/splash.tssrc/index.tssrc/logger.tstest/preferences.test.ts
🚧 Files skipped from review as they are similar to previous changes (6)
- test/preferences.test.ts
- src/cli/preferences.ts
- src/cli/splash.ts
- src/cli.ts
- src/index.ts
- src/cli/onboarding.ts
… remove, silent killers) (#407) Patch bump per the established rule: all changes additive, no breaks to MemoryProvider trait or exported types or default behaviour. New top-level subcommands (connect, remove, --reset, --force) are opt-in. PRs included since v0.9.14: #405 — silent killers: viewer port auto-bump, engine version-match warning, stop --force, adopt-on-attach, npx PATH hint #402 — agentmemory connect — automate native-plugin install for 8 agents (claude-code, codex, cursor, gemini-cli, openclaw end-to-end; hermes/pi/openhuman stubbed) #406 — interactive doctor v2 + agentmemory remove (destruction plan + two-confirmation flow) #403 — splash banner + agent grid + provider picker + smart-defaults preferences + bootLog shim (30+ lines of log spam → 10) 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
What
Replaces the 25-line
[agentmemory] Xlog spam on first invocation with a SkillKit-grade onboarding. The user goes from a wall of unstructured startup chatter to a three-step interactive flow plus a single-line ready hint.New modules
src/cli/splash.tsTerminal-width-aware ASCII banner, three render tiers:
>= 120 cols— full block-art logo + tagline80–119 cols— compact monospace title + tagline< 80 cols— single-lineagentmemory v0.9.14Brand accent is
#FF6B35rendered through ANSI 256-colour (38;5;208), honoursNO_COLOR, no new deps.src/cli/preferences.tsJSON-backed prefs at
~/.agentmemory/preferences.json:tmp+fsync+renameso a Ctrl+C never corrupts the filereadPrefs()returns defaults on missing / corrupt / wrong-schema filesisFirstRun()returns true whenfirstRunAt === nullresetPrefs()for the new--resetflag--resetsrc/cli/onboarding.tsFirst-run interactive flow using
@clack/prompts:multiselectover native-plugin agents (claude-code · codex · openhuman · openclaw · hermes · pi · cursor · gemini-cli) + MCP-only agents (opencode · cline · goose · kilo · aider · claude-desktop · windsurf · roo), with glyphs (⟁ ◫ ◎ ✦ ⬡) and◇fallbackselectover providers (anthropic · openai · gemini · openrouter · minimax · skip — BM25-only mode)~/.agentmemory/.envfrom the bundled template (idempotent viaCOPYFILE_EXCL)Re-runs only on
--reset.Log demotion
src/logger.tsgetsbootLog()andsetBootVerbose(). The 18 startupconsole.logcalls insrc/index.tsare rewritten to route through this shim. Default behaviour: buffered + dropped. With--verbose(orAGENTMEMORY_VERBOSE=1): printed verbatim. Warnings, errors, and shutdown logs stay loud.CLI surgery
src/cli.ts:runOnboarding()whenisFirstRun()or--resetsetBootVerbose(IS_VERBOSE)propagates verbosity to the workerwaitForAgentmemoryReady()polls/agentmemory/livezafter the worker imports; prints a single-line ready hint:--resetflag wipes prefs and re-runs onboardingFirst-run output (target ~10 lines)
Subsequent runs:
Acceptance check
npm run buildpassesnpm test— 900/910 passing; the 10 failures are pre-existing intest/mcp-standalone.test.ts(parity withmain). 7 new passes fromtest/preferences.test.ts.@clack/promptswas already in.--verboserestores full boot log--resetwipes prefs and re-runs onboardingSummary by CodeRabbit
New Features
Tests