Refactor project config and refresh UI tooling#24
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7eeaad649b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -5207,7 +5329,6 @@ fn initialize_repo( | |||
| .context("write .mem/.gitignore")?; | |||
There was a problem hiding this comment.
Rewrite legacy .mem/.gitignore during migration
This only updates .mem/.gitignore when the file is missing, so existing repos initialized with the old runtime/ rule keep that legacy content. In the same commit, doctor now recommends removing /.mem from the root .gitignore; after users do that, legacy .mem/config.toml and .mem/memory-layer.env become visible to Git and can be accidentally committed. Please migrate existing .mem/.gitignore content (or patch it in doctor/init fix mode) instead of skipping when the file already exists.
Useful? React with 👍 / 👎.
| let remaining = max_total_chars.saturating_sub(total_chars); | ||
| let limit = max_message_chars.min(remaining).max(1); | ||
| let (limited, truncated) = truncate_chars(&content, limit); |
There was a problem hiding this comment.
Enforce llm_audit max_total_chars as a hard limit
When total_chars already reaches max_total_chars, remaining becomes 0 but limit is forced to at least 1, so the loop still records additional prompt content. Because truncate_chars also appends a "[truncated]" suffix, persisted audit text can exceed the configured global cap by more than one character, which defeats the expected privacy/size bound for audit logging.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
This PR refreshes the web UI/TUI feature parity while refactoring “project-local” runtime/config/cache defaults to user-local storage (keeping .mem/project.toml as the repo marker). It also introduces LLM audit/debug logging and expands query/graph diagnostics surfaced across the UI and activity stream.
Changes:
- Add new memory types (
documentation,task) and propagate them through API parsing, ingestion heuristics, UI filters, and docs. - Move per-project config/state/cache paths to user-local directories via new path helpers; update CLI (
init,doctor,scan, dev overlay) + docs accordingly. - Refresh web UI: add runtime status polling, an Errors tab, Activity “Get Up To Speed” briefing, contextual Help panel, and richer query/graph diagnostics + LLM audit controls.
Reviewed changes
Copilot reviewed 50 out of 50 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| web/src/types.ts | Extend web API types for graph diagnostics, runtime status, LLM audit, briefing, and new memory types. |
| web/src/styles.css | Layout tweaks plus new styles for help/briefing/restart indicators. |
| web/src/App.tsx | New tabs (Activity/Errors), help panel + shortcuts, runtime status polling, query history enrichment, graph connection rendering. |
| web/src/api.ts | Add endpoints for runtime status, up-to-speed briefings, and LLM audit status/toggle. |
| README.md | Update setup/dev stack docs to reflect user-local project layout and legacy fallbacks. |
| docs/user/web-ui.md | New browser UI guide describing tabs, runtime status, evidence, audit, and help. |
| docs/user/tui/watchers.md | Document h help toggle. |
| docs/user/tui/review.md | Update navigation keys + help toggle documentation. |
| docs/user/tui/resume.md | Document h help toggle. |
| docs/user/tui/README.md | Update global navigation/help key bindings. |
| docs/user/tui/query.md | Document h help toggle. |
| docs/user/tui/project.md | Document h help toggle. |
| docs/user/tui/memories.md | Document h help toggle. |
| docs/user/tui/errors.md | Document h help toggle. |
| docs/user/tui/embeddings.md | Update navigation keys + help toggle documentation. |
| docs/user/tui/agents.md | Update navigation keys + help toggle documentation. |
| docs/user/tui/activity.md | Document LLM audit mode and help toggle. |
| docs/user/README.md | Add Browser UI to user-facing navigation. |
| docs/user/getting-started.md | Document user-local project paths, legacy fallbacks, and LLM audit mode. |
| docs/user/cli/wizard.md | Update wizard behavior and legacy migration guidance. |
| docs/user/cli/upgrade.md | Update skill-backup path to user-local runtime directory. |
| docs/user/cli/service.md | Update dev-stack path references for user-local runtime/config. |
| docs/user/cli/scan.md | Update index/report/env locations to user-local project paths + legacy env fallback. |
| docs/user/cli/remember.md | Add documentation memory examples. |
| docs/user/cli/query.md | Add documentation memory type example. |
| docs/user/cli/init.md | Update init behavior to user-local + .mem/project.toml marker. |
| docs/user/cli/graph.md | Update index path references. |
| docs/user/cli/doctor.md | Update diagnostics language for new layout + legacy migration. |
| docs/user/cli/dev.md | Update dev overlay creation description. |
| docs/user/cli/activities.md | Document llm_audit events and audit mode config/toggle. |
| docs/index.md | Add Browser UI link to docs front page. |
| docs/developer/skills/how-skills-work.md | Update upgrade backup path references. |
| docs/developer/README.md | Update dev stack config path references. |
| docs/developer/examples/agent-example/skills/memory-layer/references/curation-rules.md | Extend memory type guidance with documentation/task etc. |
| docs/developer/dev-stack.md | Update dev stack docs for user-local paths and pitfalls. |
| docs/developer/architecture/overview.md | Update architecture overview for new project layout. |
| docs/developer/architecture/memory-types.md | Add documentation memory type semantics and inference rules. |
| docs/developer/architecture/how-it-works.md | Update config resolution order and runtime/index path references. |
| crates/mem-watch/src/lib.rs | Move default runtime dir to user-local project runtime when resolvable. |
| crates/mem-service/src/main.rs | Add /v1/runtime/status, LLM audit config endpoints, LLM audit activity emission, include Documentation in resume context, graph detail plumbing. |
| crates/mem-search/src/lib.rs | Add documentation parsing + graph-term filtering to reduce noisy graph candidate queries. |
| crates/mem-platform/src/lib.rs | Introduce user-local project path computation (config/state/cache) and repo root discovery helpers. |
| crates/mem-ingest/src/lib.rs | Heuristics + canonical text normalization for documentation candidates; tests. |
| crates/mem-cli/src/wizard.rs | Add global [llm_audit] defaults to wizard-rendered global config. |
| crates/mem-cli/src/tui.rs | Add help overlay, LLM audit status/toggle in Activity, documentation type filter, and llm-audit activity rendering. |
| crates/mem-cli/src/scan.rs | Move repo index + scan report locations to user-local paths; allow documentation type in scan prompt; tests. |
| crates/mem-cli/src/main.rs | Refactor init/doctor/dev overlay paths to user-local layout; add LLM audit API client methods; update skill backup paths. |
| crates/mem-api/src/lib.rs | Add Documentation memory type, LLM audit config + activity structs, and user-local project config discovery helpers. |
| .agents/skills/memory-layer/references/curation-rules.md | Update skill reference docs with new memory types and documentation guidance. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return items.sort((left, right) => { | ||
| const leftTime = left.when ? Date.parse(left.when) : Date.now(); | ||
| const rightTime = right.when ? Date.parse(right.when) : Date.now(); | ||
| return rightTime - leftTime; |
| fn render_global_config(draft: &WizardDraft) -> String { | ||
| format!( | ||
| "# Shared Memory Layer defaults and secrets.\n# Repo-local overrides should live in .mem/config.toml inside each project.\n\n[service]\nbind_addr = \"127.0.0.1:4040\"\ncapnp_unix_socket = \"{}\"\ncapnp_tcp_addr = \"127.0.0.1:4041\"\n# service API token is provisioned automatically into memory-layer.env\nrequest_timeout = \"30s\"\n\n[database]\nurl = \"{}\"\n\n[cluster]\nenabled = {}\n# advertise_addr = \"192.168.1.50:4040\"\n# discovery_multicast_addr = \"239.255.42.99:4042\"\n# announce_interval = \"5s\"\n# peer_ttl = \"15s\"\n# priority = 100\n\n# Optional shared writer label. If omitted, Memory Layer derives a writer id automatically.\n# [writer]\n# id = \"codex-cli-main\"\n# name = \"Codex CLI\"\n\n[features]\nllm_curation = false\n\n[llm]\nprovider = \"{}\"\nbase_url = \"{}\"\napi_key_env = \"{}\"\nmodel = \"{}\"\ntemperature = 0.0\nmax_input_bytes = 120000\nmax_output_tokens = 3000\n\n[embeddings]\nprovider = \"openai\"\nbase_url = \"https://api.openai.com/v1\"\napi_key_env = \"{}\"\nmodel = \"\"\nbatch_size = 16\n\n[automation]\nenabled = false\nmode = \"suggest\"\nfile_events = true\npoll_interval = \"60s\"\ncapture_idle_threshold = \"10m\"\nmin_changed_files = 2\nrequire_passing_test = false\ncurate_after_captures = 3\ncurate_on_explicit_flush = true\nignored_paths = [\".git/\", \"target/\", \".memory-layer/\"]\n# repo_root = \"/path/to/repo\"\n# audit_log_path = \"/path/to/repo/.memory-layer/automation.log\"\n# state_file_path = \"/path/to/repo/.memory-layer/automation-state.json\"\n", | ||
| "# Shared Memory Layer defaults and secrets.\n# Repo-local overrides should live in .mem/config.toml inside each project.\n\n[service]\nbind_addr = \"127.0.0.1:4040\"\ncapnp_unix_socket = \"{}\"\ncapnp_tcp_addr = \"127.0.0.1:4041\"\n# service API token is provisioned automatically into memory-layer.env\nrequest_timeout = \"30s\"\n\n[database]\nurl = \"{}\"\n\n[cluster]\nenabled = {}\n# advertise_addr = \"192.168.1.50:4040\"\n# discovery_multicast_addr = \"239.255.42.99:4042\"\n# announce_interval = \"5s\"\n# peer_ttl = \"15s\"\n# priority = 100\n\n# Optional shared writer label. If omitted, Memory Layer derives a writer id automatically.\n# [writer]\n# id = \"codex-cli-main\"\n# name = \"Codex CLI\"\n\n[features]\nllm_curation = false\n\n[llm]\nprovider = \"{}\"\nbase_url = \"{}\"\napi_key_env = \"{}\"\nmodel = \"{}\"\ntemperature = 0.0\nmax_input_bytes = 120000\nmax_output_tokens = 3000\n\n# Opt-in debug trail for service-side LLM calls. Prompt messages are redacted before persistence.\n[llm_audit]\nenabled = false\nredact = true\nmax_message_chars = 8000\nmax_total_chars = 32000\n\n[embeddings]\nprovider = \"openai\"\nbase_url = \"https://api.openai.com/v1\"\napi_key_env = \"{}\"\nmodel = \"\"\nbatch_size = 16\n\n[automation]\nenabled = false\nmode = \"suggest\"\nfile_events = true\npoll_interval = \"60s\"\ncapture_idle_threshold = \"10m\"\nmin_changed_files = 2\nrequire_passing_test = false\ncurate_after_captures = 3\ncurate_on_explicit_flush = true\nignored_paths = [\".git/\", \"target/\", \".memory-layer/\"]\n# repo_root = \"/path/to/repo\"\n# audit_log_path = \"/path/to/repo/.memory-layer/automation.log\"\n# state_file_path = \"/path/to/repo/.memory-layer/automation-state.json\"\n", |
| pub fn preferred_project_config_base_dir() -> Option<PathBuf> { | ||
| #[cfg(target_os = "macos")] | ||
| { | ||
| return Some(macos_app_support_dir()?.join("projects")); | ||
| } | ||
|
|
||
| #[cfg(not(target_os = "macos"))] | ||
| { | ||
| if let Ok(config_home) = env::var("XDG_CONFIG_HOME") { | ||
| return Some( | ||
| PathBuf::from(config_home) | ||
| .join("memory-layer") | ||
| .join("projects"), | ||
| ); | ||
| } | ||
| let home = env::var("HOME").ok()?; | ||
| Some( | ||
| PathBuf::from(home) | ||
| .join(".config") | ||
| .join("memory-layer") | ||
| .join("projects"), | ||
| ) | ||
| } |
| let manager = runtime_manager_status(&state.config.profile, &version); | ||
| let skills = runtime_skill_status(query.repo_root.as_deref(), &version); | ||
| let restart_notice = runtime_restart_notice(state.startup_at, &version); |
|
I could not inspect the diff in this environment because every shell invocation failed with a sandbox/bwrap loopback error, so I did not identify any actionable regressions from the provided change set. |
|
No discrete regressions were identified from the available change context. |
|
Codex resolver found no safe code changes to apply. |
|
I was not able to inspect the diff in this environment because the shell runner was blocked by container sandboxing, so I could not identify any concrete regressions to flag. |
|
Codex resolver found no safe code changes to apply. |
|
I couldn’t obtain a usable diff from the sandboxed environment, so I could not identify any discrete, actionable regressions introduced by the patch. Based on the available information, there are no findings to report. |
|
Codex resolver found no safe code changes to apply. |
Summary
Validation