Skip to content

Fix TUI sync and receipt-backed activation reporting - #68

Merged
TerminallyLazy merged 1 commit into
mainfrom
codex/fix-tui-sync
Sep 15, 2026
Merged

TerminallyLazy merged 1 commit into
mainfrom
codex/fix-tui-sync

Conversation

@TerminallyLazy

@TerminallyLazy TerminallyLazy commented Sep 15, 2026

Copy link
Copy Markdown
Owner

The TUI accepted /sync and displayed a confirmation, but confirming only changed a status message: no source adapter ran and an empty dashboard stayed empty.

/sync now previews source-linked DOX candidates from the current project and saves exactly that preview after confirmation, using the shared CLI action and existing coordinated-write policy. Source/store paths, candidate review, cancellation, failures, and empty or filtered states are visible, including in compact terminals. Repeated imports retain stable source identities.

Successful activation also checks existing valid recall receipts and gives a concrete session/status next step when proof is missing, instead of asking users to apply an already-applied bridge plan. Failed/review/trust states retain their existing behavior.

Validation: all 570 workspace tests passed, formatting/package validation and shell syntax checks passed, and independent review found no remaining issues. Native terminal checks verified preview, cancel, dashboard refresh after save, and repeat import without duplicates. Compact rendering regressions cover long preview scrolling at 60x18 and actionable errors/command input at 60x14.

The affected project was also checked with a real preview and cancel; its protected files, policy, and empty store remain unchanged. Populating its shared guidance still requires the owner-configured coordinator capability.

High-level PR Summary

This PR fixes the TUI's /sync command to properly preview and save DOX summaries from source files, replacing a broken placeholder implementation. The command now displays source paths, candidate summaries, and project context before confirmation, then saves using the existing CLI action with coordinated-write policy. The PR also improves activation reporting by checking for valid recall receipts and providing concrete next steps (like "open a new session") instead of asking users to reapply already-completed bridge plans. Includes comprehensive test coverage for preview scrolling, compact terminal rendering, coordinated-mode authorization, cancellation, and repeat imports without duplicates.

⏱️ Estimated Review Time: 30-90 minutes

💡 Review Order Suggestion
Order File Path
1 docs/protocol/harness-activation.md
2 crates/tree-ring-memory-cli/src/actions/adapters.rs
3 crates/tree-ring-memory-cli/src/actions/integrations.rs
4 crates/tree-ring-memory-cli/src/tui/actions.rs
5 crates/tree-ring-memory-cli/src/tui/app.rs
6 crates/tree-ring-memory-cli/src/tui/render.rs
7 crates/tree-ring-memory-cli/tests/activation_outcome_acceptance.rs
8 README.md
9 Cargo.toml
10 Cargo.lock

Need help? Join our Discord

Summary by CodeRabbit

  • New Features

    • Added an interactive /sync preview in the TUI, including candidate selection, sensitive-content filtering, scrolling, and confirmation before saving.
    • Repeated syncs are deduplicated, and empty sync results provide clear status information.
    • Sync errors now explain when coordinator authorization is required.
  • Bug Fixes

    • Activation status now verifies existing receipts and provides harness-specific next steps.
    • Improved empty-store, filtered-result, compact-layout, and error messaging.
  • Documentation

    • Updated CLI, TUI, and activation guidance for sync persistence, previews, proof verification, and blocked outcomes.

@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 2d560386-43c5-4785-8482-937a64160a58

📥 Commits

Reviewing files that changed from the base of the PR and between c681ede and eebd2c1.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (9)
  • Cargo.toml
  • README.md
  • crates/tree-ring-memory-cli/src/actions/adapters.rs
  • crates/tree-ring-memory-cli/src/actions/integrations.rs
  • crates/tree-ring-memory-cli/src/tui/actions.rs
  • crates/tree-ring-memory-cli/src/tui/app.rs
  • crates/tree-ring-memory-cli/src/tui/render.rs
  • crates/tree-ring-memory-cli/tests/activation_outcome_acceptance.rs
  • docs/protocol/harness-activation.md

📝 Walkthrough

Walkthrough

Changes

DOX sync and activation reporting

Layer / File(s) Summary
DOX sync preview and persistence
crates/tree-ring-memory-cli/src/actions/adapters.rs, crates/tree-ring-memory-cli/src/tui/actions.rs, crates/tree-ring-memory-cli/src/tui/app.rs
The TUI now previews DOX syncs, supports candidate controls, and applies reviewed reports through apply_dox_preview.
Structured sync confirmation rendering
crates/tree-ring-memory-cli/src/tui/render.rs
Confirmation views now show candidates, sources, sensitivity masking, scrolling, controls, and empty-store states.
Activation receipt verification
crates/tree-ring-memory-cli/src/actions/integrations.rs, crates/tree-ring-memory-cli/tests/activation_outcome_acceptance.rs, docs/protocol/harness-activation.md
Activation results re-verify matching receipts and report harness-specific next steps. Acceptance tests cover proof, mismatch, review, and trust outcomes.
Documentation and package release updates
Cargo.toml, README.md
The package version changes to 0.15.10. Documentation describes sync persistence, TUI controls, and activation reporting.

Estimated code review effort: 4 (Complex) | ~60 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant TUI
  participant sync_dox
  participant SQLiteMemoryStore
  TUI->>sync_dox: request dry-run preview
  sync_dox-->>TUI: return DoxSyncReport
  TUI->>SQLiteMemoryStore: apply reviewed report events
  SQLiteMemoryStore-->>TUI: return persistence result
Loading
sequenceDiagram
  participant integrations_activate
  participant verify_activation_receipts
  participant IntegrationLifecycleActionReport
  integrations_activate->>verify_activation_receipts: verify matching receipt
  verify_activation_receipts-->>integrations_activate: return receipt state or no proof
  integrations_activate->>IntegrationLifecycleActionReport: set state and next step
Loading
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-tui-sync

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Fix TUI sync and receipt-backed activation reporting

🐞 Bug fix ✨ Enhancement 🧪 Tests 📝 Documentation ⚙️ Configuration changes 🕐 40+ Minutes

Grey Divider

AI Description

• Makes TUI /sync preview and atomically persist reviewed DOX candidates.
• Exposes empty, filtered, sensitive, compact-terminal, and authorization states.
• Reports successful activation from valid receipts with actionable proof guidance.
Diagram

graph TD
  Sync["TUI /sync"] --> Preview["DOX preview"] --> Confirm{"User confirms?"}
  Confirm -->|yes| Store["Atomic store write"] --> Dashboard["Dashboard refresh"]
  Confirm -->|no| Preview
  Activation["Activation success"] --> Receipt{"Valid receipt?"} --> Report["State and next step"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Re-run DOX collection on confirmation
  • ➕ Uses the newest source contents at confirmation time
  • ➕ Requires less preview state in the pending action
  • ➖ May persist candidates different from those the user reviewed
  • ➖ Introduces a time-of-check/time-of-use race
  • ➖ Makes cancellation and deterministic testing less explicit
2. Create an activation receipt automatically
  • ➕ Could report activation as active immediately
  • ➕ Reduces the apparent post-activation workflow
  • ➖ Would claim lifecycle recall occurred when only bridge publication completed
  • ➖ Weakens receipt-backed proof semantics
  • ➖ Could conceal trust, review, or session-scoping requirements

Recommendation: Keep the PR's reviewed-snapshot persistence and receipt-verification approach. Saving exactly the preview preserves user consent and atomic policy enforcement, while reusing real receipts maintains the distinction between bridge publication and proven lifecycle recall.

Files changed (10) +916 / -64

Enhancement (2) +395 / -47
actions.rsRepresent DOX previews as pending TUI actions +34/-9

Represent DOX previews as pending TUI actions

• Replaces the sync placeholder with a pending action containing the reviewed report, selected candidate, and scroll position. Confirmation summaries now expose source, store, project, sensitivity, skipped sections, warnings, and stable identity behavior.

crates/tree-ring-memory-cli/src/tui/actions.rs

render.rsRender scrollable sync previews and actionable compact states +361/-38

Render scrollable sync previews and actionable compact states

• Adds responsive confirmation panels with candidate details, privacy filtering, explicit wrapping, and bounded scrolling. Improves empty and filtered dashboard guidance, prioritizes commands and errors in compact terminals, and adds rendering regressions across terminal sizes.

crates/tree-ring-memory-cli/src/tui/render.rs

Bug fix (3) +322 / -12
adapters.rsExpose reviewed DOX preview persistence +12/-3

Expose reviewed DOX preview persistence

• Adds 'apply_dox_preview' to atomically persist the exact events returned by a dry run. The regular DOX sync action now reuses this shared write path and retains store validation and coordinated policy enforcement.

crates/tree-ring-memory-cli/src/actions/adapters.rs

integrations.rsReport activation outcomes from valid receipts +36/-5

Report activation outcomes from valid receipts

• After successful bridge publication, verifies existing activation receipts and reports their proven state without writing new proof. Missing proof now directs users to open a new harness session and run verbose status, while blocked review and trust outcomes remain authoritative.

crates/tree-ring-memory-cli/src/actions/integrations.rs

app.rsExecute the full TUI DOX synchronization workflow +274/-4

Execute the full TUI DOX synchronization workflow

• Runs a dry-run source adapter for '/sync', supports candidate navigation and scrolling, and persists exactly the reviewed snapshot on confirmation. Refreshes dashboard state after success, preserves cancellation and atomic failures, resolves relative project roots, and adds behavioral tests for repeat imports and coordinated denial.

crates/tree-ring-memory-cli/src/tui/app.rs

Tests (1) +172 / -0
activation_outcome_acceptance.rsCover receipt-backed activation outcomes end to end +172/-0

Cover receipt-backed activation outcomes end to end

• Adds Unix acceptance tests for missing, valid, and mismatched activation receipts across activate and link commands. Verifies dry runs remain plans and that prior proof cannot override review, trust, or deactivation outcomes.

crates/tree-ring-memory-cli/tests/activation_outcome_acceptance.rs

Documentation (2) +23 / -1
README.mdDocument persisted DOX sync and TUI review behavior +16/-1

Document persisted DOX sync and TUI review behavior

• Clarifies that source adapters save source-linked summaries unless run with '--dry-run'. Documents empty-store semantics, '/sync' review and cancellation, stable identities, coordinated authorization, and preview navigation.

README.md

harness-activation.mdDefine post-activation receipt reporting semantics +7/-0

Define post-activation receipt reporting semantics

• Documents that successful activation reuses matching receipt verification, does not create proof, and directs unproven users to a new session. Clarifies that historical receipts cannot override blocked publication or trust states.

docs/protocol/harness-activation.md

Other (2) +4 / -4
Cargo.lockLock workspace crates at version 0.15.10 +3/-3

Lock workspace crates at version 0.15.10

• Updates the resolved versions of the CLI, core, and SQLite workspace packages from 0.15.9 to 0.15.10.

Cargo.lock

Cargo.tomlBump the workspace release to 0.15.10 +1/-1

Bump the workspace release to 0.15.10

• Advances the shared workspace package version for the bug-fix release.

Cargo.toml

@TerminallyLazy
TerminallyLazy merged commit fe7b6f0 into main Sep 15, 2026
1 of 3 checks passed
@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (4) 📘 Rule violations (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Custom store sync misses project rules 🐞 Bug ≡ Correctness
Description
preview_dox_sync derives source_root from project_root_for_memory_root(&self.root), whose
non-.tree-ring branch returns the memory-store root rather than the project from which the TUI was
launched. Thus a project using a custom --root scans that store for AGENTS.md—including the
store's initialization guidance when present—instead of the project's instructions, yielding an
empty preview or importing unrelated rules.
Code

crates/tree-ring-memory-cli/src/tui/app.rs[R557-558]

+        let source_root = std::path::absolute(project_root_for_memory_root(&self.root))
+            .map_err(|error| error.to_string())?;
Relevance

●●● Strong

Custom-root path resolution can scan the store instead of the project; path-context bugs have been
accepted.

PR-#16
PR-#17

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changed sync method passes the project-root helper's result directly to the DOX adapter. The
helper returns an arbitrary root unchanged unless its final path component is .tree-ring, while
the CLI defines that root as the memory-store root and initialization writes an AGENTS.md in it.

crates/tree-ring-memory-cli/src/tui/app.rs[555-575]
crates/tree-ring-memory-cli/src/tui/app.rs[717-725]
crates/tree-ring-memory-cli/src/main.rs[60-67]
README.md[246-253]
crates/tree-ring-memory-core/src/dox.rs[41-63]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`/sync` treats every custom memory-store root as the project source root. The global `--root` option is documented as a memory-store location, so a TUI launched from a project with `--root /some/store` must discover that project's `AGENTS.md`, not `/some/store/AGENTS.md`.

### Fix Focus Areas
- crates/tree-ring-memory-cli/src/tui/app.rs[555-572]
- crates/tree-ring-memory-cli/src/tui/app.rs[717-725]

### Recommended Fix
Carry or derive the TUI launch project directory independently from the memory-store root, and use that directory as the DOX source root. Retain the existing `.tree-ring` compatibility behavior, but do not infer that arbitrary custom store paths are project directories; add coverage for launching from a project with a custom `--root`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. A crafted guide controls the terminal 🐞 Bug ⛨ Security
Description
wrap_preview_text copies control characters from pending.summary and the selected DOX event into
raw terminal lines without sanitization. When an AGENTS.md summary or source path contains escape,
bell, or similar control characters, opening /sync emits them during confirmation rendering and
can alter the display or trigger terminal control behavior.
Code

crates/tree-ring-memory-cli/src/tui/render.rs[R801-803]

+            let lines = wrap_preview_text(
+                &format!("{}\n\n{detail}", pending.summary),
+                regions[0].width,
Relevance

●● Moderate

Terminal-control sanitization is a credible security issue, but history lacks a close matching
precedent.

PR-#36

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
DOX summaries and source references originate in project-controlled AGENTS.md content and paths,
and the new preview passes them through a character-by-character wrapper that retains every
character. The existing live-event display explicitly removes control characters, demonstrating that
terminal-facing source data is expected to be sanitized.

crates/tree-ring-memory-cli/src/tui/render.rs[788-813]
crates/tree-ring-memory-cli/src/tui/render.rs[864-880]
crates/tree-ring-memory-core/src/dox.rs[158-189]
crates/tree-ring-memory-core/src/dox.rs[272-286]
crates/tree-ring-memory-cli/src/tui/stream.rs[32-40]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The DOX confirmation preview renders source-derived text without stripping terminal control characters, allowing crafted guidance or paths to affect the user's terminal.

## Fix Focus Areas
- crates/tree-ring-memory-cli/src/tui/render.rs[801-813]
- crates/tree-ring-memory-cli/src/tui/render.rs[864-880]

## Recommended Fix
Sanitize every explicit preview row before constructing its `Line`, removing or visibly replacing control characters while preserving the intended line boundaries. Add a rendering regression test containing escape and bell characters in both a candidate summary and source reference, and verify those bytes never reach the rendered buffer.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

3. Sync understates discarded guidance 🐞 Bug ≡ Correctness
Description
PendingAction::sync_dox labels skipped_secret_count as a number of secret sections even though
the collector increments it once for an entirely discarded file. When any section trips the secret
guard, events_from_agents_file abandons every otherwise eligible candidate from that AGENTS.md,
so the preview and empty-state status describe a narrower omission than occurred.
Code

crates/tree-ring-memory-cli/src/tui/actions.rs[R131-133]

+            sensitive_count,
+            preview.skipped_secret_count,
+            preview.warnings.len(),
Relevance

●●● Strong

Displayed count contradicts file-level secret skipping; reviewers accept precise source-adapter
reporting fixes.

PR-#17

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The collector processes each file as one result and increments skipped_secret_count when that
whole operation returns AdapterSkip::Secret. Secret detection returns immediately from the
file-processing function, discarding events accumulated from earlier sections, while the newly added
TUI text calls the resulting count “secret sections.”

crates/tree-ring-memory-core/src/dox.rs[41-63]
crates/tree-ring-memory-core/src/dox.rs[158-217]
crates/tree-ring-memory-cli/src/tui/actions.rs[124-133]
crates/tree-ring-memory-cli/src/tui/app.rs[576-583]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The TUI describes the file-level `skipped_secret_count` as skipped sections, concealing that all guidance from each affected `AGENTS.md` was omitted.

## Fix Focus Areas
- crates/tree-ring-memory-cli/src/tui/actions.rs[124-133]
- crates/tree-ring-memory-cli/src/tui/app.rs[576-583]
- README.md[677-683]

## Recommended Fix
Change the confirmation, empty-state, and documentation wording to identify affected `AGENTS.md` files rather than sections, preferably stating that files containing detected secret content are skipped entirely. Add a test with one ordinary and one secret section in the same file to lock the displayed semantics to the collector's behavior.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


4. Shared stores overwrite project rules 🐞 Bug ≡ Correctness
Description
The new TUI flow persists DOX events whose IDs are derived solely from a relative source reference,
while the supplied project value is only the source root's basename and is not part of that ID. When
two projects with the same relative AGENTS.md section sync into one configured store, the batch
upsert replaces the first project's summary, source, and project fields with the second project's
record.
Code

crates/tree-ring-memory-cli/src/tui/app.rs[R567-572]

+        let preview = sync_dox(
+            None,
+            DoxSyncActionRequest {
+                source_root,
+                project: Some(project.clone()),
+                dry_run: true,
Relevance

●●● Strong

Project identity omission causes real upsert collisions, conflicting with the PR’s shared-store and
stable-identity intent.

PR-#29
PR-#32

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The added TUI path provides a project label and persists the generated preview, but generated IDs
disregard that label. SQLite's batch write uses an upsert on the ID, so equal relative source
references collide rather than coexist in a shared configured store.

crates/tree-ring-memory-cli/src/tui/app.rs[559-575]
crates/tree-ring-memory-cli/src/tui/app.rs[498-509]
crates/tree-ring-memory-core/src/dox.rs[171-189]
crates/tree-ring-memory-core/src/dox.rs[321-347]
crates/tree-ring-memory-sqlite/src/lib.rs[448-488]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The TUI creates source-linked DOX candidates for a configured store, but core DOX IDs hash only the source path relative to the scanned project. Distinct projects with the same relative `AGENTS.md` paths and headings therefore produce identical primary keys when they share a custom memory store, causing one project's sync to overwrite the other's records.

### Fix Focus Areas
- crates/tree-ring-memory-cli/src/tui/app.rs[559-575]
- crates/tree-ring-memory-core/src/dox.rs[171-189]
- crates/tree-ring-memory-core/src/dox.rs[321-347]

### Recommended Fix
Include a stable, unambiguous project identity in the DOX stable-ID input, such as a canonical-root fingerprint plus the relative source reference. Preserve stable IDs for repeated syncs of the same project, and add a shared-store test proving identical relative source paths from two projects remain separate records.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
✅ Cross-repo context — repo relationships
  Explored: repo: TerminallyLazy/tree-ring-memory-agent-zero (sha: e8712174)
  Explored: repo: TerminallyLazy/tree-ring-memory-codex-plugin (sha: 2f0adc25)
  Explored: repo: TerminallyLazy/tree-ring-memory-claude-plugin (sha: 0e55ec03)
  Explored: repo: TerminallyLazy/tree-ring-memory-media-kit (sha: 0ac914d8)
  Explored: repo: TerminallyLazy/tree-ring-memory-cookbook (sha: e7807f3b)
  Explored: repo: TerminallyLazy/tree-ring-memory-skill (sha: 93044651)
  Explored: repo: TerminallyLazy/homebrew-tree-ring (sha: 48f35d42)
Review mode: 🧠 Deep: This is a high-density behavioral change spanning TUI state/input/rendering, sync persistence and identity, coordinated writes, activation receipt logic, and new integration paths, creating multiple independent opportunities for subtle defects.

Grey Divider

Tip of the day
💡 Did you know, you can reply 'qodo' on any finding to push back, ask questions, or dig deeper

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment on lines +801 to +803
let lines = wrap_preview_text(
&format!("{}\n\n{detail}", pending.summary),
regions[0].width,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

2. A crafted guide controls the terminal 🐞 Bug ⛨ Security

wrap_preview_text copies control characters from pending.summary and the selected DOX event into
raw terminal lines without sanitization. When an AGENTS.md summary or source path contains escape,
bell, or similar control characters, opening /sync emits them during confirmation rendering and
can alter the display or trigger terminal control behavior.
Agent Prompt
## Issue description
The DOX confirmation preview renders source-derived text without stripping terminal control characters, allowing crafted guidance or paths to affect the user's terminal.

## Fix Focus Areas
- crates/tree-ring-memory-cli/src/tui/render.rs[801-813]
- crates/tree-ring-memory-cli/src/tui/render.rs[864-880]

## Recommended Fix
Sanitize every explicit preview row before constructing its `Line`, removing or visibly replacing control characters while preserving the intended line boundaries. Add a rendering regression test containing escape and bell characters in both a candidate summary and source reference, and verify those bytes never reach the rendered buffer.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +131 to +133
sensitive_count,
preview.skipped_secret_count,
preview.warnings.len(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

3. Sync understates discarded guidance 🐞 Bug ≡ Correctness

PendingAction::sync_dox labels skipped_secret_count as a number of secret sections even though
the collector increments it once for an entirely discarded file. When any section trips the secret
guard, events_from_agents_file abandons every otherwise eligible candidate from that AGENTS.md,
so the preview and empty-state status describe a narrower omission than occurred.
Agent Prompt
## Issue description
The TUI describes the file-level `skipped_secret_count` as skipped sections, concealing that all guidance from each affected `AGENTS.md` was omitted.

## Fix Focus Areas
- crates/tree-ring-memory-cli/src/tui/actions.rs[124-133]
- crates/tree-ring-memory-cli/src/tui/app.rs[576-583]
- README.md[677-683]

## Recommended Fix
Change the confirmation, empty-state, and documentation wording to identify affected `AGENTS.md` files rather than sections, preferably stating that files containing detected secret content are skipped entirely. Add a test with one ordinary and one secret section in the same file to lock the displayed semantics to the collector's behavior.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +557 to +558
let source_root = std::path::absolute(project_root_for_memory_root(&self.root))
.map_err(|error| error.to_string())?;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. Custom store sync misses project rules 🐞 Bug ≡ Correctness

preview_dox_sync derives source_root from project_root_for_memory_root(&self.root), whose
non-.tree-ring branch returns the memory-store root rather than the project from which the TUI was
launched. Thus a project using a custom --root scans that store for AGENTS.md—including the
store's initialization guidance when present—instead of the project's instructions, yielding an
empty preview or importing unrelated rules.
Agent Prompt
### Issue description
`/sync` treats every custom memory-store root as the project source root. The global `--root` option is documented as a memory-store location, so a TUI launched from a project with `--root /some/store` must discover that project's `AGENTS.md`, not `/some/store/AGENTS.md`.

### Fix Focus Areas
- crates/tree-ring-memory-cli/src/tui/app.rs[555-572]
- crates/tree-ring-memory-cli/src/tui/app.rs[717-725]

### Recommended Fix
Carry or derive the TUI launch project directory independently from the memory-store root, and use that directory as the DOX source root. Retain the existing `.tree-ring` compatibility behavior, but do not infer that arbitrary custom store paths are project directories; add coverage for launching from a project with a custom `--root`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +567 to +572
let preview = sync_dox(
None,
DoxSyncActionRequest {
source_root,
project: Some(project.clone()),
dry_run: true,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

4. Shared stores overwrite project rules 🐞 Bug ≡ Correctness

The new TUI flow persists DOX events whose IDs are derived solely from a relative source reference,
while the supplied project value is only the source root's basename and is not part of that ID. When
two projects with the same relative AGENTS.md section sync into one configured store, the batch
upsert replaces the first project's summary, source, and project fields with the second project's
record.
Agent Prompt
### Issue description
The TUI creates source-linked DOX candidates for a configured store, but core DOX IDs hash only the source path relative to the scanned project. Distinct projects with the same relative `AGENTS.md` paths and headings therefore produce identical primary keys when they share a custom memory store, causing one project's sync to overwrite the other's records.

### Fix Focus Areas
- crates/tree-ring-memory-cli/src/tui/app.rs[559-575]
- crates/tree-ring-memory-core/src/dox.rs[171-189]
- crates/tree-ring-memory-core/src/dox.rs[321-347]

### Recommended Fix
Include a stable, unambiguous project identity in the DOX stable-ID input, such as a canonical-root fingerprint plus the relative source reference. Preserve stable IDs for repeated syncs of the same project, and add a shared-store test proving identical relative source paths from two projects remain separate records.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

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