Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
fix(wrapper): drop the host copy of the volume bearer on uninstall and rotation
AkitaOnRails5b316b5089f4
diff --git a/bin/ai-memory b/bin/ai-memoryindex e1c3c198..bbdc39a7 100755--- a/bin/ai-memory+++ b/bin/ai-memory@@ -613,15 +613,23 @@ use_volume_token() {# Refresh the host copy from the volume, then use it. Only `install-hooks`,# the setup step, does this: the managed host commands (`run`, `show`, ...)# and `mcp-bridge`, which starts with every agent session, never enter the-# container engine, so they read the copy it leaves behind.+# container engine, so they read the copy it leaves behind. A volume that+# answers with no token (auth turned off, the token file renamed or gone)+# removes the copy, so a rotated-away bearer does not linger on the host; an+# engine that cannot answer at all leaves the copy as it was.refresh_volume_token() {volume_token_applies || return 0local token- token="$("${DOCKER}" run --rm -v "${DATA_VOLUME}:/data:ro" --entrypoint /bin/sh "${IMAGE}" -c \- 'grep -qs "^[[:space:]]*bearer_token_file[[:space:]]*=[[:space:]]*\"auth-tokens/default\"" /data/config.toml && cat /data/auth-tokens/default' \- 2>/dev/null)" || token=""+ if ! token="$("${DOCKER}" run --rm -v "${DATA_VOLUME}:/data:ro" --entrypoint /bin/sh "${IMAGE}" -c \+ 'if grep -qs "^[[:space:]]*bearer_token_file[[:space:]]*=[[:space:]]*\"auth-tokens/default\"" /data/config.toml; then cat /data/auth-tokens/default 2>/dev/null; fi; exit 0' \+ 2>/dev/null)"; then+ use_volume_token+ return 0+ fitoken="$(printf '%s' "${token}" | tr -d '\r\n')"- if [ -n "${token}" ]; then+ if [ -z "${token}" ]; then+ rm -f "${VOLUME_TOKEN_FILE}"+ else(umask 077mkdir -p "${NATIVE_RUNNER_DIR}" \@@ -822,6 +830,23 @@ case "${WRAPPER_SUBCOMMAND}" inWRITES_HOST_FILES=1;;esac+# A full `uninstall --apply` unwires every hook and MCP entry that reads the+# host copy of the volume's root bearer, so the copy goes too once the+# container reports success. A dry run or an `--only` subset keeps it.+DROPS_VOLUME_TOKEN=0+if [ "${WRAPPER_SUBCOMMAND}" = "uninstall" ]; then+ uninstall_apply=0+ uninstall_only=0+ for arg in ${WRAPPER_ARGS[@]+"${WRAPPER_ARGS[@]:$((idx + 1))}"}; do+ case "${arg}" in+ --apply) uninstall_apply=1 ;;+ --only | --only=*) uninstall_only=1 ;;+ esac+ done+ if [ "${uninstall_apply}" -eq 1 ] && [ "${uninstall_only}" -eq 0 ]; then+ DROPS_VOLUME_TOKEN=1+ fi+fi# bootstrap only *reads* host files — the repo bind-mounted at /work and the# `.ai-memory.toml` markers under $HOME — but an unmapped UID and a confined# SELinux label block reads exactly as hard as writes. The failure is@@ -1048,4 +1073,13 @@ if [ "${WRAPPER_SUBCOMMAND}" = "completions" ]; thenexit "${OUTPUT_STATUS}"fi+if [ "${DROPS_VOLUME_TOKEN}" -eq 1 ]; then+ if "${DOCKER}" "${HELPER_ARGS[@]}"; then+ rm -f "${VOLUME_TOKEN_FILE}"+ exit 0+ else+ exit $?+ fi+fi+exec "${DOCKER}" "${HELPER_ARGS[@]}"diff --git a/docs/install.md b/docs/install.mdindex 9d94b1f2..eeddd82a 100644--- a/docs/install.md+++ b/docs/install.md@@ -3251,7 +3251,11 @@ token into the volume), `docker restart ai-memory`, then re-run`install-hooks` copies the token from the volume to an owner-only file under`~/.local/share/ai-memory/native-runner/`, and the commands the wrapper runsnatively (`install-hooks`, `mcp-bridge`, `run`) read it from there, never from-a command line.+a command line. When `install-hooks` finds no token in the volume any more (auth+turned off, or the token file gone), it deletes that copy; a container engine+that cannot be reached leaves it alone. A full `ai-memory uninstall --apply`+through the wrapper deletes it once the uninstall succeeds; a dry run or an+`--only` subset keeps it.Then wire up the agent CLI. Both commands default to`http://127.0.0.1:49374` - no extra flags needed for the local case:diff --git a/docs/security-boundaries.md b/docs/security-boundaries.mdindex b24f8ca9..2f8d7c25 100644--- a/docs/security-boundaries.md+++ b/docs/security-boundaries.md@@ -78,7 +78,7 @@ means the boundary is not built yet.| 11e | Native self-upgrade archive confinement (#1025) | `ai-memory-cli/src/commands/upgrade.rs` normalizes every tar/zip path, rejects links and special entries, extracts only the binary and `hooks/`, accepts only the exact non-runtime support layout emitted by `release.yml`, and caps both entry count and declared expanded bytes before writing | `upgrade.rs` `release_workflow_support_assets_are_exact_and_ignored` (shipped support paths admitted, near-miss docs/packaging/template paths refused), `extracts_archive_built_like_release_yml` and `extracts_zip_happy_path_with_hooks` (real workflow-shaped archives succeed but support assets are not written), `validate_rejects_path_traversal`, `zip_extract_rejects_path_traversal`, `tar_extract_rejects_declared_expansion_past_limit`, with binary/hooks extraction as the legitimate control | STRONG || 11f | Native hook executable-path integrity after self-replacement (#1027) | `ai-memory-cli/src/commands/render_shared.rs` `hook_embedded_exe_path` is the single executable resolver for every persisted native hook form (POSIX/Windows command, Windows exec, Zero, ZCode, OpenCode 2 assistant capture): it prefers an existing literal path, strips Linux's trailing ` (deleted)` procfs marker only when the stripped installed binary exists, and otherwise falls back to the platform command name. Upgrade keeps the already-loaded config and refreshes in-process | `render_shared.rs` `embedded_exe_strips_the_marker_when_the_stripped_path_exists`, `embedded_exe_preserves_a_real_file_whose_name_has_the_marker_suffix`, `embedded_exe_falls_back_when_the_resolved_path_is_missing`, `hook_embedded_exe_path_names_an_existing_file_without_marker`; `upgrade_e2e.rs` `native_upgrade_refreshes_hooks_without_a_deleted_path_or_losing_cli_data_dir` reproduces the replacement window through the shipped binary, plants the corrupt suffix, and proves refresh removes it while preserving a CLI-only data dir | STRONG on Linux reproduction plus platform-neutral resolver/render coverage; Windows path rendering remains covered by its existing command/exec tests and full Windows CI || 11g | Cross-project tool attribution cannot bypass source or destination capture, or destination server routing (#932, #1199) | `ai-memory-hooks/src/capture_policy.rs` `absolute_tool_location_paths` accepts only bounded, recognized, absolute locations: file-tool targets, a search/list tool's explicit `path`, or a shell command's structured `workdir` (command text is never parsed for a location); `ai-memory-cli/src/commands/hook.rs` `tool_location_routing_cwd` requires every path to prove the same repository/marker boundary, refuses the reroute when the payload cwd's own capture policy would not keep the event (source `ignore_paths` may name paths outside the source checkout, and a command may name source files while its `workdir` points elsewhere), and resolves that destination before capture policy, allowlist marker, server profile, scope hints, or spool credentials. Relative, mixed-project, unsupported, and arbitrary non-project paths keep the payload cwd | `hook.rs` `absolute_file_target_uses_destination_scope_and_capture_policy` (hostile content under the destination exclusion is never spooled; a public control is routed there), `absolute_file_target_cannot_escape_a_destination_server_profile` (unregistered destination profile drops instead of falling back to source/install default), `file_target_routing_refuses_relative_external_and_mixed_project_paths`, `workdir_reroute_applies_the_destination_capture_policy` (a `workdir`-rerouted command reading a destination-excluded path is dropped, public control kept), **`a_reroute_cannot_escape_the_source_capture_exclusions`** (adversarial: a file read under a source pattern that names another project's directory, and a shell command naming an excluded source file with `workdir` in another project, are both refused; public file and shell controls still reroute; fails with the source-policy check removed), `hermes_tool_location_finds_the_marker_the_process_cwd_lacks` (Hermes `terminal` `workdir`, `read_file` `path` and `search_files` `path` reach the repository marker under allowlist; no-workdir, relative-workdir and relative-search controls stay with the unmarked process cwd); `capture_policy.rs` `absolute_tool_location_paths_cover_search_dirs_and_shell_workdirs` (relative workdir, command-text paths, workdir without a command, and Hermes `process` yield no location) | STRONG for native `ai-memory hook`; generated and compatibility hooks retain cwd-only routing |-| 11h | Docker-wrapper capture-policy capability (#1002) | `bin/ai-memory` routes ordinary Linux/macOS `install-hooks`, upgrade refreshes, and every `hook`/`hook-drain` invocation through the stable checksum-verified native host client, so the hook process executes the capture-policy boundary in 11b before spool/network; a hook config that calls the wrapper never runs in the helper container, and an unavailable client drops the event with exit 0 instead of falling back to it. Only an explicit `AI_MEMORY_HOOK_PLATFORM=posix|windows` retains the documented script compatibility path and its warning; `AI_MEMORY_NATIVE_BIN` may not point back to the wrapper. For a server initialized on the named volume, `bin/ai-memory` `refresh_volume_token` (run only by `install-hooks`) copies `/data/auth-tokens/default` (only when `/data/config.toml` names it) to an owner-only `native-runner/server-token` through the helper's stdout, and `use_volume_token` points the native client at that copy (the managed host commands and `mcp-bridge` only read it and never enter the container engine) with `AI_MEMORY_AUTH__BEARER_TOKEN_FILE`, so it is a file-sourced token (never rendered into a harness config) and never an argv; a bind-mounted `AI_MEMORY_DATA_DIR` is read directly and an explicit `AI_MEMORY_AUTH_TOKEN` wins | `scripts/check-native-packaging.sh` `Checking host-launch wrapper routing`: a default allowlist install reaches the fake native client while a Docker executable that always fails proves no container fallback occurred; the explicit `posix` control reaches fake Docker and adds no native invocation; the self-referential native override is refused. `tests/wrapper_upgrade.sh` `lifecycle hook native host routing`: `hook --event session-start` and `hook-drain` reach the fake native client with the stdin payload while `docker`/`podman` stubs on PATH and in `AI_MEMORY_DOCKER` stay unused, and a non-executable `AI_MEMORY_NATIVE_BIN` exits 0 without reaching the engine; `Checking the wrapper hands host commands the volume's root bearer`: for `mcp-bridge`, `install-hooks` and `run` the fake native client receives the token file (mode 600, right content) and the token is absent from its argv; controls: a bind-mounted data dir and an explicit `AI_MEMORY_AUTH_TOKEN` make no copy and ask no container (bite: dropping the export fails the check); `auth_default_e2e.rs` `a_host_client_given_the_token_file_by_env_authenticates` (the native side of the handoff, with a no-variable control) | STRONG on the shipped Linux/macOS wrapper. Windows and remote/manual script installers remain explicitly outside capture-policy v1 |+| 11h | Docker-wrapper capture-policy capability (#1002) | `bin/ai-memory` routes ordinary Linux/macOS `install-hooks`, upgrade refreshes, and every `hook`/`hook-drain` invocation through the stable checksum-verified native host client, so the hook process executes the capture-policy boundary in 11b before spool/network; a hook config that calls the wrapper never runs in the helper container, and an unavailable client drops the event with exit 0 instead of falling back to it. Only an explicit `AI_MEMORY_HOOK_PLATFORM=posix|windows` retains the documented script compatibility path and its warning; `AI_MEMORY_NATIVE_BIN` may not point back to the wrapper. For a server initialized on the named volume, `bin/ai-memory` `refresh_volume_token` (run only by `install-hooks`) copies `/data/auth-tokens/default` (only when `/data/config.toml` names it) to an owner-only `native-runner/server-token` through the helper's stdout, and `use_volume_token` points the native client at that copy (the managed host commands and `mcp-bridge` only read it and never enter the container engine) with `AI_MEMORY_AUTH__BEARER_TOKEN_FILE`, so it is a file-sourced token (never rendered into a harness config) and never an argv; a refresh that reads no token from a reachable volume deletes the copy, and a successful full `uninstall --apply` deletes it after the container returns; a bind-mounted `AI_MEMORY_DATA_DIR` is read directly and an explicit `AI_MEMORY_AUTH_TOKEN` wins | `scripts/check-native-packaging.sh` `Checking host-launch wrapper routing`: a default allowlist install reaches the fake native client while a Docker executable that always fails proves no container fallback occurred; the explicit `posix` control reaches fake Docker and adds no native invocation; the self-referential native override is refused. `tests/wrapper_upgrade.sh` `lifecycle hook native host routing`: `hook --event session-start` and `hook-drain` reach the fake native client with the stdin payload while `docker`/`podman` stubs on PATH and in `AI_MEMORY_DOCKER` stay unused, and a non-executable `AI_MEMORY_NATIVE_BIN` exits 0 without reaching the engine; `Checking the wrapper hands host commands the volume's root bearer`: for `mcp-bridge`, `install-hooks` and `run` the fake native client receives the token file (mode 600, right content) and the token is absent from its argv; controls: a bind-mounted data dir and an explicit `AI_MEMORY_AUTH_TOKEN` make no copy and ask no container (bite: dropping the export fails the check); `Checking the host token copy goes with the volume's token and with uninstall`: a volume answering with no token removes the copy and hands none over, while an unreachable engine keeps it; a dry-run, `--only hooks` or failing `uninstall` keeps it and a successful `uninstall --apply` removes it (bite: without either removal the check fails); `auth_default_e2e.rs` `a_host_client_given_the_token_file_by_env_authenticates` (the native side of the handoff, with a no-variable control) | STRONG on the shipped Linux/macOS wrapper. Windows and remote/manual script installers remain explicitly outside capture-policy v1 || 11j | Offline recovery journal and transcript replay | `ai-memory-cli/src/commands/recovery.rs` keeps bounded locators, ordered semantic transcript digests, pre-launch cursors and persistent correlated-delivery/loss evidence in an atomic journal, refuses a symlinked data dir and any symlinked component inside it (ancestors above the data dir are trusted, so macOS `/var` → `/private/var` works), sanitizes/caps failure reasons, and bounds each replay plus the whole pass; `hook_spool` coordinates enqueue and quarantine with short filesystem locks, canonically resolves partial scope from the recorded cwd, bounds per-file reads and current global occupancy across the main spool and recovery directories, sweeps completed tombstones, and holds correlated events outside drain until replay succeeds or restores them on failure; degraded resumes use `ai-memory-workstream`'s adapter-validated delta export, whose blocking parse and baseline scans are capped by record, event-count, source-byte and serialized-byte totals; `backfill::import_exact_session` chunks by item and byte limits and requires per-item durable acknowledgements; `run.rs` journals every session launch, including explicit spool-only evidence for unsupported exporters, and journals a resumed export only after capturing its exact pre-launch cursor; `workstream.rs` `/recover/finish` retains owner/project authorization, rejects superseded runs, and validates a finished retry by durable transcript/native/cursor/exit identity without regenerating its checkpoint; validated recovery ingest keys bind session, agent, event kind and sanitized event identity until session purge | `transcript.rs` `persisted_baseline_exports_only_offline_append_and_rejects_rewrite`, parser/baseline cap and ordered-semantic digest tests; CLI `run_offline.rs` real degraded spool-only and overlap/idempotency tests; `recovery.rs` `spool_only_without_correlated_evidence_never_auto_clears`, `a_dropped_spool_event_stays_lost_on_the_next_empty_pass`, loss/time-budget tests, `symlinked_journal_and_ancestor_are_refused`, `a_symlinked_ancestor_of_the_data_dir_is_trusted`, `a_symlink_inside_a_data_dir_under_a_symlinked_ancestor_is_refused`; `hook_spool.rs` partial-scope late enqueue, completion-race, occupancy churn/active-cap, bounded-read and tombstone-sweep tests, plus interval isolation (`completed_tombstone_keeps_a_later_resume_of_the_same_session` proves a post-interval resume hook is delivered, `completing_one_recovery_interval_leaves_the_other_intervals_entries_intact` proves one interval's completion never consumes another's evidence and ambiguous entries fail closed into the main spool); `backfill.rs` `two_sequential_recovery_intervals_on_one_resumed_session_replay_exactly_once` proves the second interval's content and session-end are stored with end-of-session effects while reruns stay pure replays; `transcript.rs` `an_oversized_first_record_is_skipped_by_session_listing_caps` proves the first-record byte caps bite before allocation; store `insert_observation_ingest_dedups_on_key` rejects cross-session and changed-event preclaims; hooks `expired_run_recovery_is_owner_only_and_refuses_superseded_runs` proves changed transcript refusal and changed-checkpoint no-op | STRONG on Unix integration coverage; Unix lock opens use no-follow and atomic replacement rechecks the destination. Windows owner-only ACL/reparse and lock semantics require the PR `windows` lane || 11i | OpenCode executable probing and generated-config cleanup (#1097) | `ai-memory-cli/src/config.rs` captures the full process environment once in typed `RuntimeEnv`; `run.rs` overlays explicit `run --env` values with platform key semantics and uses that same effective environment for executable resolution, probing, and launch without rereading process environment; `opencode_dialect.rs` invokes only direct argv `--version`, caps output and time, and rejects malformed/future majors. Automatic launch skips only OpenCode on probe failure; explicit OpenCode fails. `install_hooks.rs` quarantines the incompatible sibling before reading its exact ownership markers, restores unowned content with an atomic no-replace link, and never deletes or overwrites a concurrent replacement; `install_mcp.rs` owns the shared dual-schema endpoint/token inference used by both installers, rejects conflicting generated V1/V2 entries before mutation, and migrates an alternate-major entry only when endpoint, generated shape, and absent-or-Authorization-only headers match, preserving custom headers and ambiguous entries; auto-wire migrates MCP before hooks infer from that exact config path and skips hook mutation when transition preflight fails | `run.rs` `automatic_opencode_probe_failure_keeps_another_harness_available`, `opencode_executable_probe_selects_v2_for_launch_and_autowire`, effective-child-environment PATH casing controls, fake V1/V2/env-derived-major/malformed/future/timeout executable tests, `setup-agent` V1/V2 no-probe integration controls; `install_hooks.rs` `opencode_plugin_cleanup_removes_only_exact_owned_incompatible_sibling`, `opencode_plugin_cleanup_preserves_a_concurrent_user_replacement`, `opencode_plugin_restore_moves_quarantine_when_destination_is_free`, `opencode_plugin_restore_preserves_an_existing_replacement`, `opencode_plugin_restore_does_not_replace_a_file_created_at_restore_window`, `opencode_plugin_cleanup_does_not_escape_custom_target_directory`; `install_mcp.rs` `opencode_install_reuses_owned_endpoint_and_token_across_major_transitions`, `opencode_install_refuses_conflicting_owned_transition_entries`, `opencode_install_does_not_infer_from_a_user_owned_transition_entry`, `opencode_mcp_migration_moves_only_owned_alternate_shape`, `opencode_mcp_migration_preserves_ambiguous_user_entry`, `opencode_mcp_migration_preserves_custom_headers`, `opencode_mcp_migration_accepts_only_historical_generated_headers` | STRONG for Unix process probes and platform-neutral ownership gates; exact Windows executable resolution remains covered by `run.rs` resolver tests and requires the PR `windows` label || 11k | Server-side tool drop list (#1241) | `ai-memory-hooks/src/drop_list.rs` `IngestDropList::matches`, checked in `router.rs` `admit_hook` and the `handle_hook_batch` loop right after the client capture protocol and before the rate limiter, the ingest semaphore, the sanitizer and storage; lists from `[ingest] drop_tool_use_id_prefixes` / `drop_tool_names`, validated once in `Config::load` (at most 64 entries of 128 printable characters each). Only tool events match: a tool-call id by prefix, a tool name exactly, both read through the per-agent mapping `capture_policy::tool_payload_fields` that tool metadata uses (generic Claude-style fields for an agent without one; Factory Droid sends no tool-call id, so only its tool name can match). A drop answers 202 and counts as `dropped_by_policy`; the matched value is never logged | `router.rs` `the_ingest_drop_list_drops_before_any_capacity_is_spent` (with the semaphore exhausted a listed event still answers 202; control: an unlisted one gets 429) and `the_ingest_drop_list_applies_to_hook_batches` (listed items acknowledged as policy drops, the unlisted item ingested); `drop_list.rs` unit tests (prefix only at the start, names only exact, non-tool events never match, bounds refused; `each_agent_is_matched_on_its_own_tool_fields` matches OpenCode `callID`, Hermes `extra.tool_call_id` and Antigravity `toolCall.name`, with same-agent controls kept, and fails when only the generic fields are read). Both router tests fail with `matches` forced to `false` | STRONG. The list applies to every project on the server; it narrows what is stored and never widens access |diff --git a/scripts/check-native-packaging.sh b/scripts/check-native-packaging.shindex fa0419c4..7fcb29b3 100755--- a/scripts/check-native-packaging.sh+++ b/scripts/check-native-packaging.sh@@ -201,7 +201,13 @@ main() {#!/usr/bin/env bashprintf '%s\n' "$*" >>"${AI_MEMORY_DOCKER_TEST_LOG}"case "$*" in- *"--entrypoint /bin/sh"*) printf 'VOLUME-ROOT-TOKEN\n' ;;+ *"--entrypoint /bin/sh"*)+ [ -z "${AI_MEMORY_TEST_ENGINE_DOWN:-}" ] || exit 125+ printf '%s\n' "${AI_MEMORY_TEST_VOLUME_TOKEN-VOLUME-ROOT-TOKEN}"+ ;;+ *" uninstall "* | *" uninstall")+ [ -z "${AI_MEMORY_TEST_UNINSTALL_FAIL:-}" ] || exit 3+ ;;esacFAKEcat >"${token_native}" <<'FAKE'@@ -273,6 +279,43 @@ FAKEfail "an explicit AI_MEMORY_AUTH_TOKEN must win over the volume token copy"fi+ log "Checking the host token copy goes with the volume's token and with uninstall"+ local token_copy="${token_home}/.local/share/ai-memory/native-runner/server-token"+ token_wrapper() {+ HOME="${token_home}" XDG_DATA_HOME="${token_home}/.local/share" \+ AI_MEMORY_NO_VERSION_CHECK=1 AI_MEMORY_NO_TTY=1 \+ AI_MEMORY_DOCKER="${token_docker}" AI_MEMORY_NATIVE_BIN="${token_native}" \+ AI_MEMORY_DOCKER_TEST_LOG="${token_docker_log}" AI_MEMORY_WRAPPER_TEST_LOG="${token_log}" \+ bin/ai-memory "$@" </dev/null >/dev/null+ }+ token_wrapper install-hooks --agent claude-code --apply+ test -s "${token_copy}" || fail "install-hooks must leave the host token copy"+ # An engine that cannot answer keeps the copy and still hands it over.+ : >"${token_log}"+ AI_MEMORY_TEST_ENGINE_DOWN=1 token_wrapper install-hooks --agent claude-code --apply+ test -s "${token_copy}" || fail "an unreachable engine must not remove the host token copy"+ assert_contains "${token_log}" "file=${token_copy}"+ # A volume with no token any more (auth off or rotated away) removes it.+ : >"${token_log}"+ AI_MEMORY_TEST_VOLUME_TOKEN="" token_wrapper install-hooks --agent claude-code --apply+ test ! -e "${token_copy}" || fail "a volume without a token must remove the host token copy"+ if grep -Fq 'file=/' "${token_log}"; then+ fail "a removed host token copy must not be handed to the native client"+ fi+ # uninstall: a dry run, an --only subset and a failed run keep the copy; a+ # successful full --apply removes it.+ token_wrapper install-hooks --agent claude-code --apply+ token_wrapper uninstall+ test -s "${token_copy}" || fail "an uninstall dry run must keep the host token copy"+ token_wrapper uninstall --apply --only hooks+ test -s "${token_copy}" || fail "uninstall --only must keep the host token copy"+ if AI_MEMORY_TEST_UNINSTALL_FAIL=1 token_wrapper uninstall --apply; then+ fail "a failing uninstall must keep its exit status"+ fi+ test -s "${token_copy}" || fail "a failed uninstall must keep the host token copy"+ token_wrapper uninstall --apply --yes+ test ! -e "${token_copy}" || fail "uninstall --apply must remove the host token copy"+log "Creating temporary alternate root"mkdir -p \"${TMP_ROOT}/etc" \