Project: add Windows USB portable kit for in-tree deployment#1088
Project: add Windows USB portable kit for in-tree deployment#1088FaberVi wants to merge 1 commit into
Conversation
- 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
|
@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. |
📝 WalkthroughWalkthroughChangesPortable Agentmemory kit
Plugin source-region paths
Estimated code review effort: 4 (Complex) | ~45 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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: 2
🧹 Nitpick comments (5)
agentmemory-portable/README.md (1)
8-13: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueSpecify a language identifier for fenced code blocks.
Providing a language identifier (e.g.,
textorbash) enables syntax highlighting and resolves markdown lint warnings.
agentmemory-portable/README.md#L8-L13: Change```to```textagentmemory-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 valueConsider 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$KitRootdynamically 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 winConvert batch files to use Windows (CRLF) line endings.
These
.cmdfiles are currently saved with Unix (LF-only) line endings. In Windowscmd.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.cmdand.batfiles 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 winEnsure TLS 1.2 is enabled for web requests.
In Windows PowerShell 5.1 (the default on Windows 10),
Invoke-WebRequestmay 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-WebRequestcalls:[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 winAvoid duplicate variables in the
.envminimal seed.If the
.env.examplefile is missing, the script writes a minimal seed containingEMBEDDING_PROVIDERandAGENTMEMORY_URL, and then immediately appends the exact same variables right after in the "overrides" section. This results in duplicated keys in the generated.envfile.♻️ 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
📒 Files selected for processing (33)
.gitignoreagentmemory-portable/.gitignoreagentmemory-portable/README.mdagentmemory-portable/iii-config.yamlagentmemory-portable/kit.config.ps1agentmemory-portable/mcp-cursor.example.jsonagentmemory-portable/mcp-launch.cmdagentmemory-portable/scripts/_env.ps1agentmemory-portable/scripts/ready-banner.ps1agentmemory-portable/scripts/setup.ps1agentmemory-portable/scripts/start.ps1agentmemory-portable/scripts/status.ps1agentmemory-portable/scripts/stop.ps1agentmemory-portable/scripts/update.ps1agentmemory-portable/setup.cmdagentmemory-portable/start-clean.cmdagentmemory-portable/start.cmdagentmemory-portable/status.cmdagentmemory-portable/stop.cmdagentmemory-portable/update.cmdplugin/scripts/notification.mjsplugin/scripts/post-commit.mjsplugin/scripts/post-tool-failure.mjsplugin/scripts/post-tool-use.mjsplugin/scripts/pre-compact.mjsplugin/scripts/pre-tool-use.mjsplugin/scripts/prompt-submit.mjsplugin/scripts/session-end.mjsplugin/scripts/session-start.mjsplugin/scripts/stop.mjsplugin/scripts/subagent-start.mjsplugin/scripts/subagent-stop.mjsplugin/scripts/task-completed.mjs
| "agentmemory": { | ||
| "command": "npx", | ||
| "args": ["-y", "@agentmemory/mcp"], | ||
| "env": { | ||
| "AGENTMEMORY_URL": "http://127.0.0.1:3111" | ||
| } |
There was a problem hiding this comment.
🎯 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.
| "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.
| 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% | ||
| ) |
There was a problem hiding this comment.
🎯 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.
| 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.
Summary by CodeRabbit
New Features
Chores