Skip to content

Project: add Windows USB portable kit for in-tree deployment#1088

Open
FaberVi wants to merge 1 commit into
rohitg00:mainfrom
FaberVi:main
Open

Project: add Windows USB portable kit for in-tree deployment#1088
FaberVi wants to merge 1 commit into
rohitg00:mainfrom
FaberVi:main

Conversation

@FaberVi

@FaberVi FaberVi commented Jul 20, 2026

Copy link
Copy Markdown
  • Add agentmemory-portable kit with setup, start, stop, status, and update entry points
  • Add PowerShell scripts for portable Node, iii-engine, home remapping, and Docker conflict handling
  • Add kit-owned iii-config.yaml with SQLite state stored under ./data
  • Add MCP launcher and Cursor MCP example configuration
  • Document kit layout, ports, and Docker conflict options in README
  • Ignore portable runtime artifacts in root and kit .gitignore
  • Update plugin hook region paths for portable in-tree source layout

Summary by CodeRabbit

  • New Features

    • Added a portable Windows kit that can be installed, started, stopped, updated, and monitored from a local folder or USB drive.
    • Added setup guidance, configurable runtime settings, MCP integration, health checks, and status/diagnostic commands.
    • Added safeguards for conflicting running services and optional automatic cleanup.
  • Chores

    • Updated generated source annotations and excluded portable runtime artifacts from version control.

- Add agentmemory-portable kit with setup, start, stop, status, and update entry points
- Add PowerShell scripts for portable Node, iii-engine, home remapping, and Docker conflict handling
- Add kit-owned iii-config.yaml with SQLite state stored under ./data
- Add MCP launcher and Cursor MCP example configuration
- Document kit layout, ports, and Docker conflict options in README
- Ignore portable runtime artifacts in root and kit .gitignore
- Update plugin hook region paths for portable in-tree source layout
@vercel

vercel Bot commented Jul 20, 2026

Copy link
Copy Markdown

@FaberVi is attempting to deploy a commit to the rohitg00's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

Portable Agentmemory kit

Layer / File(s) Summary
Kit layout and runtime configuration
.gitignore, agentmemory-portable/.gitignore, agentmemory-portable/README.md, agentmemory-portable/iii-config.yaml, agentmemory-portable/kit.config.ps1, agentmemory-portable/mcp-cursor.example.json
Defines the portable directory layout, runtime persistence configuration, optional overrides, usage instructions, and MCP server settings.
Portable setup and build orchestration
agentmemory-portable/scripts/_env.ps1, agentmemory-portable/scripts/setup.ps1, agentmemory-portable/setup.cmd
Adds environment detection, prerequisite checks, tool installation, repository wiring, runtime file initialization, configuration synchronization, and Windows build orchestration.
Runtime safety and daemon control
agentmemory-portable/scripts/start.ps1, status.ps1, stop.ps1, ready-banner.ps1, agentmemory-portable/start*.cmd, status.cmd, stop.cmd
Adds Docker conflict handling, portable environment setup, daemon start/status/stop commands, readiness polling, and Windows wrappers.
Update and MCP entrypoints
agentmemory-portable/scripts/update.ps1, agentmemory-portable/update.cmd, agentmemory-portable/mcp-launch.cmd
Adds portable repository update/build behavior and MCP launching through bundled Node entrypoints.

Plugin source-region paths

Layer / File(s) Summary
Plugin source-region directive updates
plugin/scripts/*.mjs
Updates embedded //#region source paths to reference ../../agentmemory/src/hooks/...; executable logic remains unchanged.

Estimated code review effort: 4 (Complex) | ~45 minutes

Suggested reviewers: rohitg00

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding a Windows USB portable kit for in-tree deployment.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (5)
agentmemory-portable/README.md (1)

8-13: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Specify a language identifier for fenced code blocks.

Providing a language identifier (e.g., text or bash) enables syntax highlighting and resolves markdown lint warnings.

  • agentmemory-portable/README.md#L8-L13: Change ``` to ```text
  • agentmemory-portable/README.md#L20-L34: Change ``` to ```text
🤖 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 `@agentmemory-portable/README.md` around lines 8 - 13, Specify the text
language identifier on both fenced code blocks in
agentmemory-portable/README.md: lines 8-13 and 20-34. Change each opening fence
from an unlabeled fence to a text-labeled fence, leaving the block contents
unchanged.
agentmemory-portable/scripts/_env.ps1 (1)

213-216: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider using the dynamic kit path to find leftover processes.

The process cleanup checks for *\agentmemory-portable\*, which will miss leftover processes if the user renames the kit folder (e.g., my-usb-kit). Consider using the actual $KitRoot dynamically to improve reliability.

📝 Proposed fix
       $_.Path -and (
-        $_.Path -like "*\agentmemory-portable\*" -or
+        $_.Path -like "$KitRoot\*" -or
         $_.Path -like "*\home\.agentmemory\bin\iii.exe"
       )
🤖 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 `@agentmemory-portable/scripts/_env.ps1` around lines 213 - 216, Update the
process cleanup path filter in the PowerShell script to derive the portable-kit
match from the existing $KitRoot value instead of the hardcoded
`*\agentmemory-portable\*` pattern, while preserving the separate iii.exe path
check.
agentmemory-portable/setup.cmd (1)

1-6: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Convert batch files to use Windows (CRLF) line endings.

These .cmd files are currently saved with Unix (LF-only) line endings. In Windows cmd.exe, processing files with LF line endings can occasionally cause script malfunction or label parsing errors due to boundary bugs. It is highly recommended to convert all .cmd and .bat files to use CRLF line endings.

  • agentmemory-portable/setup.cmd#L1-L6: convert line endings to CRLF.
  • agentmemory-portable/start-clean.cmd#L1-L7: convert line endings to CRLF.
  • agentmemory-portable/start.cmd#L1-L7: convert line endings to CRLF.
  • agentmemory-portable/status.cmd#L1-L6: convert line endings to CRLF.
  • agentmemory-portable/stop.cmd#L1-L6: convert line endings to CRLF.
🤖 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 `@agentmemory-portable/setup.cmd` around lines 1 - 6, Convert the line endings
to CRLF for all affected batch files: agentmemory-portable/setup.cmd lines 1-6,
agentmemory-portable/start-clean.cmd lines 1-7, agentmemory-portable/start.cmd
lines 1-7, agentmemory-portable/status.cmd lines 1-6, and
agentmemory-portable/stop.cmd lines 1-6. Preserve the existing script contents
and behavior.

Source: Linters/SAST tools

agentmemory-portable/scripts/setup.ps1 (2)

58-61: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Ensure TLS 1.2 is enabled for web requests.

In Windows PowerShell 5.1 (the default on Windows 10), Invoke-WebRequest may fail to download from modern HTTPS endpoints (like nodejs.org or GitHub) if TLS 1.2 is not explicitly enabled.

Unless this is already handled upstream in _env.ps1, consider enforcing TLS 1.2 before attempting the downloads.

🛠️ Proposed workaround

You can enforce TLS 1.2 by adding the following line before the Invoke-WebRequest calls:

[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
🤖 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 `@agentmemory-portable/scripts/setup.ps1` around lines 58 - 61, Ensure TLS 1.2
is enabled before the download request in the setup script. Add the
ServicePointManager security-protocol configuration immediately before the
Invoke-WebRequest call, preserving any already-enabled protocols while including
Tls12.

140-152: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Avoid duplicate variables in the .env minimal seed.

If the .env.example file is missing, the script writes a minimal seed containing EMBEDDING_PROVIDER and AGENTMEMORY_URL, and then immediately appends the exact same variables right after in the "overrides" section. This results in duplicated keys in the generated .env file.

♻️ Proposed fix
   else {
     @(
-      "# agentmemory portable kit - minimal seed",
-      "EMBEDDING_PROVIDER=local",
-      "AGENTMEMORY_URL=http://127.0.0.1:3111"
+      "# agentmemory portable kit - minimal seed"
     ) | Set-Content -Path $envTarget -Encoding UTF8
   }
🤖 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 `@agentmemory-portable/scripts/setup.ps1` around lines 140 - 152, Update the
fallback `.env` seed flow in the setup script so `EMBEDDING_PROVIDER` and
`AGENTMEMORY_URL` are written only once; retain them in either the minimal seed
or the portable kit overrides, while preserving the `AGENTMEMORY_USE_DOCKER`
override.
🤖 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 `@agentmemory-portable/mcp-cursor.example.json`:
- Around line 3-8: Update the agentmemory MCP configuration to invoke the
bundled mcp-launch.cmd through the command/args fields instead of npx and the
npm package, preserving the existing AGENTMEMORY_URL environment setting. Also
update the related README usage example to show the same portable launcher.

In `@agentmemory-portable/mcp-launch.cmd`:
- Around line 13-26: Update the source-root resolution in mcp-launch.cmd to
support both layouts: use "%KIT%\repo" when that directory exists, otherwise
default to "%KIT%\..". Apply the resolved root consistently when checking and
launching standalone.mjs, cli.mjs, and packages\mcp\bin.mjs.

---

Nitpick comments:
In `@agentmemory-portable/README.md`:
- Around line 8-13: Specify the text language identifier on both fenced code
blocks in agentmemory-portable/README.md: lines 8-13 and 20-34. Change each
opening fence from an unlabeled fence to a text-labeled fence, leaving the block
contents unchanged.

In `@agentmemory-portable/scripts/_env.ps1`:
- Around line 213-216: Update the process cleanup path filter in the PowerShell
script to derive the portable-kit match from the existing $KitRoot value instead
of the hardcoded `*\agentmemory-portable\*` pattern, while preserving the
separate iii.exe path check.

In `@agentmemory-portable/scripts/setup.ps1`:
- Around line 58-61: Ensure TLS 1.2 is enabled before the download request in
the setup script. Add the ServicePointManager security-protocol configuration
immediately before the Invoke-WebRequest call, preserving any already-enabled
protocols while including Tls12.
- Around line 140-152: Update the fallback `.env` seed flow in the setup script
so `EMBEDDING_PROVIDER` and `AGENTMEMORY_URL` are written only once; retain them
in either the minimal seed or the portable kit overrides, while preserving the
`AGENTMEMORY_USE_DOCKER` override.

In `@agentmemory-portable/setup.cmd`:
- Around line 1-6: Convert the line endings to CRLF for all affected batch
files: agentmemory-portable/setup.cmd lines 1-6,
agentmemory-portable/start-clean.cmd lines 1-7, agentmemory-portable/start.cmd
lines 1-7, agentmemory-portable/status.cmd lines 1-6, and
agentmemory-portable/stop.cmd lines 1-6. Preserve the existing script contents
and behavior.
🪄 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: f9b1e2de-b213-4ad9-87cb-8962e50effc7

📥 Commits

Reviewing files that changed from the base of the PR and between a8e7d19 and 22cdb95.

📒 Files selected for processing (33)
  • .gitignore
  • agentmemory-portable/.gitignore
  • agentmemory-portable/README.md
  • agentmemory-portable/iii-config.yaml
  • agentmemory-portable/kit.config.ps1
  • agentmemory-portable/mcp-cursor.example.json
  • agentmemory-portable/mcp-launch.cmd
  • agentmemory-portable/scripts/_env.ps1
  • agentmemory-portable/scripts/ready-banner.ps1
  • agentmemory-portable/scripts/setup.ps1
  • agentmemory-portable/scripts/start.ps1
  • agentmemory-portable/scripts/status.ps1
  • agentmemory-portable/scripts/stop.ps1
  • agentmemory-portable/scripts/update.ps1
  • agentmemory-portable/setup.cmd
  • agentmemory-portable/start-clean.cmd
  • agentmemory-portable/start.cmd
  • agentmemory-portable/status.cmd
  • agentmemory-portable/stop.cmd
  • agentmemory-portable/update.cmd
  • plugin/scripts/notification.mjs
  • plugin/scripts/post-commit.mjs
  • plugin/scripts/post-tool-failure.mjs
  • plugin/scripts/post-tool-use.mjs
  • plugin/scripts/pre-compact.mjs
  • plugin/scripts/pre-tool-use.mjs
  • plugin/scripts/prompt-submit.mjs
  • plugin/scripts/session-end.mjs
  • plugin/scripts/session-start.mjs
  • plugin/scripts/stop.mjs
  • plugin/scripts/subagent-start.mjs
  • plugin/scripts/subagent-stop.mjs
  • plugin/scripts/task-completed.mjs

Comment on lines +3 to +8
"agentmemory": {
"command": "npx",
"args": ["-y", "@agentmemory/mcp"],
"env": {
"AGENTMEMORY_URL": "http://127.0.0.1:3111"
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Use mcp-launch.cmd instead of npx for the portable MCP server.

The current example uses npx, which relies on the host having Node.js installed globally and downloads the package from npm. This defeats the purpose of a portable kit. Since mcp-launch.cmd is provided to run the MCP server using the bundled portable Node and local repository, the example should instruct users to invoke it instead.

💡 Proposed fix
     "agentmemory": {
-      "command": "npx",
-      "args": ["-y", "`@agentmemory/mcp`"],
+      "command": "<DRIVE>:\\path\\to\\agentmemory-portable\\mcp-launch.cmd",
+      "args": [],
       "env": {

(You may also want to update the README.md line 84 to reflect this change).

📝 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.

Suggested change
"agentmemory": {
"command": "npx",
"args": ["-y", "@agentmemory/mcp"],
"env": {
"AGENTMEMORY_URL": "http://127.0.0.1:3111"
}
"agentmemory": {
"command": "<DRIVE>:\\path\\to\\agentmemory-portable\\mcp-launch.cmd",
"args": [],
"env": {
"AGENTMEMORY_URL": "http://127.0.0.1:3111"
}
🤖 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 `@agentmemory-portable/mcp-cursor.example.json` around lines 3 - 8, Update the
agentmemory MCP configuration to invoke the bundled mcp-launch.cmd through the
command/args fields instead of npx and the npm package, preserving the existing
AGENTMEMORY_URL environment setting. Also update the related README usage
example to show the same portable launcher.

Comment on lines +13 to +26
if exist "%KIT%\repo\dist\standalone.mjs" (
"%KIT%\portable\node\node.exe" "%KIT%\repo\dist\standalone.mjs"
exit /b %ERRORLEVEL%
)

if exist "%KIT%\repo\dist\cli.mjs" (
"%KIT%\portable\node\node.exe" "%KIT%\repo\dist\cli.mjs" mcp
exit /b %ERRORLEVEL%
)

if exist "%KIT%\repo\packages\mcp\bin.mjs" (
"%KIT%\portable\node\node.exe" "%KIT%\repo\packages\mcp\bin.mjs"
exit /b %ERRORLEVEL%
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

Fix missing support for the default "in-tree" layout.

The script hardcodes "%KIT%\repo\..." for locating the source. According to the README.md and _env.ps1, the kit supports an "in-tree" layout where the code is located at the parent directory ("%KIT%\.."), not in a nested repo folder. This hardcoded path will cause mcp-launch.cmd to fail in the default in-tree setup because it will not find any of the target files.

Detect the repo directory or default to the parent directory to ensure compatibility with both layouts.

🐛 Proposed fix
-if exist "%KIT%\repo\dist\standalone.mjs" (
-  "%KIT%\portable\node\node.exe" "%KIT%\repo\dist\standalone.mjs"
+set "REPO=%KIT%\repo"
+if not exist "%REPO%" (
+  set "REPO=%KIT%\.."
+)
+
+if exist "%REPO%\dist\standalone.mjs" (
+  "%KIT%\portable\node\node.exe" "%REPO%\dist\standalone.mjs"
   exit /b %ERRORLEVEL%
 )
 
-if exist "%KIT%\repo\dist\cli.mjs" (
-  "%KIT%\portable\node\node.exe" "%KIT%\repo\dist\cli.mjs" mcp
+if exist "%REPO%\dist\cli.mjs" (
+  "%KIT%\portable\node\node.exe" "%REPO%\dist\cli.mjs" mcp
   exit /b %ERRORLEVEL%
 )
 
-if exist "%KIT%\repo\packages\mcp\bin.mjs" (
-  "%KIT%\portable\node\node.exe" "%KIT%\repo\packages\mcp\bin.mjs"
+if exist "%REPO%\packages\mcp\bin.mjs" (
+  "%KIT%\portable\node\node.exe" "%REPO%\packages\mcp\bin.mjs"
   exit /b %ERRORLEVEL%
 )
📝 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.

Suggested change
if exist "%KIT%\repo\dist\standalone.mjs" (
"%KIT%\portable\node\node.exe" "%KIT%\repo\dist\standalone.mjs"
exit /b %ERRORLEVEL%
)
if exist "%KIT%\repo\dist\cli.mjs" (
"%KIT%\portable\node\node.exe" "%KIT%\repo\dist\cli.mjs" mcp
exit /b %ERRORLEVEL%
)
if exist "%KIT%\repo\packages\mcp\bin.mjs" (
"%KIT%\portable\node\node.exe" "%KIT%\repo\packages\mcp\bin.mjs"
exit /b %ERRORLEVEL%
)
set "REPO=%KIT%\repo"
if not exist "%REPO%" (
set "REPO=%KIT%\.."
)
if exist "%REPO%\dist\standalone.mjs" (
"%KIT%\portable\node\node.exe" "%REPO%\dist\standalone.mjs"
exit /b %ERRORLEVEL%
)
if exist "%REPO%\dist\cli.mjs" (
"%KIT%\portable\node\node.exe" "%REPO%\dist\cli.mjs" mcp
exit /b %ERRORLEVEL%
)
if exist "%REPO%\packages\mcp\bin.mjs" (
"%KIT%\portable\node\node.exe" "%REPO%\packages\mcp\bin.mjs"
exit /b %ERRORLEVEL%
)
🤖 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 `@agentmemory-portable/mcp-launch.cmd` around lines 13 - 26, Update the
source-root resolution in mcp-launch.cmd to support both layouts: use
"%KIT%\repo" when that directory exists, otherwise default to "%KIT%\..". Apply
the resolved root consistently when checking and launching standalone.mjs,
cli.mjs, and packages\mcp\bin.mjs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant