Skip to content

[upstream PR 892] f<!-- -->ix(cli): anchor engine cwd and rewrite bundled config with absolute paths #401

@wbugitlab1

Description

@wbugitlab1

Source: Source pull request number: 892 in rohitg00/agentmemory (URL omitted to avoid GitHub cross-reference)
Title: fix(cli): anchor engine cwd and rewrite bundled config with absolute paths
Author: rohitg00
State: open
Draft: no
Merged: no
Head: rohitg00/agentmemory:fix/engine-spawn-absolute-paths @ f358f93
Base: main @ 25e7701
Labels: (none)
Changed files: 0
Commits: 0
Created: 2026-06-10T22:48:38Z
Updated: 2026-06-10T22:59:45Z
Closed: (not closed)
Merged at: (not merged)

Original PR body:

Closes #844, closes #700, closes #303.

The bundled iii-config.yaml uses cwd-relative paths and the engine was spawned without a cwd. On global and npx installs, ./data stores landed in whatever directory the user ran the CLI from, and the iii-exec supervision block (src watch, node dist/index.mjs exec) never resolved, so the engine never supervised a worker and nothing respawned it after the in-process worker died. That is the mechanism behind the data-loss-on-restart reports against a live REST port.

startIiiBin now writes ~/.agentmemory/iii-config.runtime.yaml (regenerated each boot) with absolute data paths and an absolute worker exec line whenever the bundled config is in play, copies legacy ./data stores from the invocation directory on first run, and spawns the engine with cwd anchored at ~/.agentmemory. Repo checkouts keep the cwd config and repo-root cwd, so dev behavior is unchanged. User overrides via AGENTMEMORY_III_CONFIG or ~/.agentmemory/iii-config.yaml pass through verbatim. agentmemory remove gains a plan item for the generated file.

Tested by test/engine-launch.test.ts including a drift guard that rewrites the repo's real iii-config.yaml and asserts no relative paths remain.

Summary by CodeRabbit

Release Notes

  • New Features

    • Engine startup now prepares a dedicated runtime directory with automatic configuration setup
    • Added support for legacy data migration during engine launch
    • Improved handling of bundled configurations with proper path resolution
  • Bug Fixes

    • Engine cleanup now properly removes generated runtime configuration files
  • Tests

    • Added comprehensive test coverage for engine launch and configuration utilities

Local branch:
Fork PR:
Fork decision:
Verification:
Notes:

Metadata

Metadata

Assignees

No one assigned

    Labels

    decision-candidateFork decision has not been madeupstream-openUpstream pull request is openupstream-prTracks an upstream pull request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions