Skip to content

Add per-project scope option and fix interactive sudo prompt#10

Open
peter-wagstaff wants to merge 2 commits intofjktkm:mainfrom
peter-wagstaff:main
Open

Add per-project scope option and fix interactive sudo prompt#10
peter-wagstaff wants to merge 2 commits intofjktkm:mainfrom
peter-wagstaff:main

Conversation

@peter-wagstaff
Copy link

Summary

  • feat: Add scope option (shared | per-project) to isolate persistence data per dev container
  • fix: Use sudo -n (non-interactive) to prevent password prompts that block container startup in environments without passwordless sudo

Motivation

When using agent-persistence across multiple projects, all containers share the same volume, which means conversation history, plugin configs, and cached setup state bleed between projects. The new per-project scope creates isolated subdirectories within the volume keyed by DEVCONTAINER_ID, so each workspace gets its own data while still sharing a single Docker volume.

Changes

  • oncreate.sh / poststart.sh: Use sudo -n to fail silently instead of blocking on a password prompt; support DEVCONTAINER_ID-based subdirectory when scope is per-project
  • install.sh: Pass SCOPE option through to the env file
  • devcontainer-feature.json: Add scope option (default: shared for backwards compatibility), bump version to 1.4.0

Usage

  "features": {
      "ghcr.io/fjktkm/devcontainer-features/agent-persistence:1": {
          "scope": "per-project"
      }
  }

Note: per-project scope requires DEVCONTAINER_ID in the project's containerEnv because ${devcontainerId} substitution is not supported in feature

containerEnv metadata:

  "containerEnv": {
      "DEVCONTAINER_ID": "${devcontainerId}"
  }

Without this, the feature falls back to shared scope.

Backwards Compatibility

Default behavior is unchanged, scope defaults to shared, which uses the volume root exactly as before.

peter-wagstaff and others added 2 commits February 23, 2026 19:06
Use sudo -n so the scripts fail silently instead of blocking
on a password prompt in containers without passwordless sudo.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add a "scope" option (default: "shared") that controls whether all
containers share the same persistence data or each gets an isolated
subdirectory within the volume keyed by DEVCONTAINER_ID.

When scope is "per-project", the scripts use
/mnt/agent-persistence/$DEVCONTAINER_ID/ instead of the volume root.
This requires DEVCONTAINER_ID to be set in the project's containerEnv
since ${devcontainerId} substitution is not supported in feature
containerEnv metadata.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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