Repository navigation
feat(extras): share Markdown memory across agents - #349
Conversation
Store user-managed notes in extras/memory for global and project scopes. Add CLI operations, a nested dashboard browser, versioned edits, and backup-backed deletion and recovery. Connect selected agents with reviewed, marked reading guidance while preserving existing instruction files and routes. Add explicit INDEX linking, conflict draft comparison, and copy-content previews. Document the workflow in five website locales with English screenshots and translate dashboard copy across all eleven locales. Native automatic memory remains separate from this shared file overlay. Validation: make check; 22 UI tests; TypeScript and ESLint; production UI build; six isolated CLI E2E steps; five-locale website build; explicit Claude-write/fresh-Codex-read smoke test.
Add version-checked rename and folder moves without replacing existing notes. Back up the old path and preserve content and permissions while refreshing selection, search, index warnings, and backup links. Integrate the two-pane Memory browser and compact agent controls. Refresh all English screenshots and document move/link/history behavior in five locales. Validation: make check, scoped UI tests, TypeScript, ESLint, UI production build, five-locale website build, locale parity, and visible Chrome workflow checks.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 81fb2377df
ℹ️ 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".
| if err := tmp.Close(); err != nil { | ||
| return Note{}, err | ||
| } | ||
| if err := os.Rename(tmp.Name(), abs); err != nil { |
There was a problem hiding this comment.
Revalidate before replacing a note
When another editor changes an existing note after the version check in Read but before this rename, the already-prepared draft replaces that newer content without returning ErrConflict; if the edit occurs after the backup, it is not recoverable there either. Concurrent creates have the same problem on Unix-like filesystems because two empty-version writers can both observe a missing file and the later rename silently replaces the first. Re-read and compare the version immediately before committing, and use exclusive creation for new notes.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Addressed in 597998e. Prepared updates re-read and compare the saved version immediately before replacement. New notes use O_CREATE | O_EXCL so a competing create returns a conflict instead of replacing the winner. Regression tests cover changed/deleted files after draft preparation and competing creates.
| if err := syncpkg.BackupFile(abs, syncpkg.BackupReasonDelete); err != nil { | ||
| return err | ||
| } | ||
| return os.Remove(abs) |
There was a problem hiding this comment.
Revalidate before removing a note
If an external editor saves the note after the version comparison and after BackupFile completes, this removal deletes content that was neither authorized by the supplied version nor captured in the backup. The process-local mutex does not protect against editors or another skillshare process, so the file must be re-read and its version checked again immediately before removal.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Addressed in 597998e. Deletion re-reads the note after the backup completes and compares the supplied version immediately before removal. A regression test changes the file after backup and confirms that the newer content is preserved with ErrConflict.
| } | ||
| applied, failures := []string{}, []failure{} | ||
| for _, c := range plan.Changes { | ||
| if err := writeInstructionsFile(c.Path, c.After); err != nil { |
There was a problem hiding this comment.
Recheck each guidance file before applying it
For a plan that changes multiple instruction files, an external editor can modify a later file after planGuidance recomputes the token but while earlier changes are being written or synced. This call then overwrites that edit even though the API promises stale reviews are rejected; s.mu only serializes server handlers. Compare each file with its reviewed Before value immediately before writing it and report a stale conflict if it changed.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Addressed in 597998e. Each guidance file is checked against its reviewed content and existence before backup and again before writing. A conflict preserves that file and reports memory_guidance_stale in the partial result alongside already-applied paths. Regression coverage includes edits, deletions, and creation of a previously missing later file.
| blocking valid notes. Rename/move, automatic learning, native automatic memory, | ||
| and Obsidian integration are not implemented. |
There was a problem hiding this comment.
Remove the obsolete no-move claim
This newly added built-in skill reference says rename/move is not implemented, but the same commit adds the dashboard move endpoint and UI. Agents loading this reference will therefore incorrectly tell users that the feature is unavailable; document the implemented move behavior and leave only genuinely unsupported integrations in this sentence.
AGENTS.md reference: AGENTS.md:L15-L15
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Addressed in 597998e. The built-in reference now documents dashboard move/rename, missing-folder creation, version checks, destination collision rejection, backups, and the unchanged Markdown links/path-keyed history. The unsupported-feature sentence now only lists integrations that remain unimplemented.
Preserve external edits detected after note backup or draft preparation, and create new notes exclusively. Revalidate each guidance file before writing, report stale partial failures, and correct the built-in move/rename documentation.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 597998ea1e
ℹ️ 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".
| <EmptyState icon={BookOpen} title={t('memory.empty')} description={t('memory.emptyHint')} action={!data.initialized && | ||
| <Button variant="primary" disabled={busy} onClick={() => void initialize()}><Plus size={15} />{t('memory.init')}</Button>} /> |
There was a problem hiding this comment.
Allow configured-but-empty memory to be initialized
When a memory extra is already present in configuration but its source directory is empty or was deleted, initialized is true even though INDEX.md and LEARNED.md are absent. This condition hides the only initialization action, and create() also skips initMemory() when data.initialized is true, so notes can be created without the starter index that the generated agent guidance requires. Determine initialization from the starter files as well, or run initialization before creation when the index is missing.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Addressed in 083997a. The dashboard reports initialized only when the extra is configured and both INDEX.md and LEARNED.md are readable. Creation initializes missing starters and fetches the refreshed index version before linking the new note. Regression tests cover empty/deleted sources and either missing starter in global/project mode; the browser check verified Create memory on an already-configured empty source.
| <button type="button" className="ss-ib" aria-label={t('instructions.edit')} title={t('instructions.edit')} disabled={unavailable} onClick={() => file.data && onEdit(file.data)}><Pencil size={15} /></button> | ||
| <button type="button" className="ss-ib" aria-label={t('memory.move')} title={t('memory.move')} disabled={unavailable} onClick={() => file.data && onMove(file.data)}><FolderInput size={15} /></button> | ||
| <CopyButton value={`${root}/${selected}`} title={t('skillEditor.copyPath')} copiedLabel="" errorMessage={t('memory.copyFailed')} unstyled className="ss-ib" size={15} strokeWidth={2} /> | ||
| <Link className="ss-ib" to={`/backup?tab=files&path=${encodeURIComponent(`${root}/${selected}`)}`} aria-label={t('memory.history')} title={t('memory.history')}><History size={15} /></Link> |
There was a problem hiding this comment.
Do not fall back to unrelated backup history
When this note has never been edited, its requested path has no backup record; an external project memory source is also omitted by fileBackupInScope. FileBackups then evaluates files.find(...) ?? files[0], so this History link opens an unrelated file and exposes that file's Restore action instead of showing no history. Honor a missing requested path explicitly and include the configured memory root in project backup scope, especially because sharing-memory.md promises the same recovery workflow for external project overrides.
AGENTS.md reference: AGENTS.md:L15-L15
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Addressed in 083997a. FileBackups honors an explicitly requested path and shows an empty state if that path has no history. Project backup list, preview, and restore also include the configured memory root when sources.extras is external, while unrelated sibling paths remain excluded. API/UI regressions cover this, and a browser check opened a new note’s History while another note had a backup without exposing the other note’s Restore action.
| if err := memory.Init(root); err != nil { | ||
| writeMemoryError(w, err) | ||
| return |
There was a problem hiding this comment.
Log failed partial memory initialization
If memory.Init creates INDEX.md and then fails on LEARNED.md—for example because that path is a directory—or if starter creation succeeds but saveConfig fails, this request has already mutated disk. Every such error returns before the sole success-only writeOpsLog call, leaving the partial mutation absent from operations.log; defer the operation-log write or add error logging to every failure path.
AGENTS.md reference: AGENTS.md:L49-L49
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Addressed in 083997a. Initialization now defers its operation-log write and records error status/message on every failure path as well as success. Regression tests verify logging when INDEX.md was created before LEARNED.md fails and when starter creation succeeds but configuration saving fails.
Detect missing starter files before dashboard note creation and refresh the index after initialization. Honor requested backup paths, include external project memory sources in recovery scope, and log initialization failures after partial mutations.
|
Addressed all seven existing review findings in 597998e and 083997a:
Validation on the fixes: devcontainer The current head is ef2f61a (merge of main); its CI checks are in progress. @codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ef2f61ab80
ℹ️ 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".
| if err := checkGuidanceChange(c); err != nil { | ||
| return err | ||
| } | ||
| return instructions.WriteFile(c.Path, c.After) |
There was a problem hiding this comment.
Create reviewed guidance files exclusively
When a reviewed plan creates a previously missing instruction file, another editor or process can create c.Path after the second checkGuidanceChange and before this call. Fresh evidence in the fixed code is that instructions.WriteFile ultimately uses non-exclusive os.WriteFile, so it truncates that newly created file instead of returning memory_guidance_stale; use exclusive creation for c.Created changes and translate an existing destination into a stale-plan result.
AGENTS.md reference: AGENTS.md:L14-L14
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in b2ddd7f. New reviewed guidance files now use exclusive creation (O_CREATE | O_EXCL). If a competing process creates the file after the final review check, the writer returns errGuidanceStale, which apply reports as memory_guidance_stale without truncating the competing content. A deterministic regression reproduces that exact interval and verifies the external instructions remain intact; successful new-file apply is covered as well. The guidance suite and devcontainer make check passed.
| <button type="button" className="ss-ib" aria-label={t('instructions.edit')} title={t('instructions.edit')} disabled={unavailable} onClick={() => file.data && onEdit(file.data)}><Pencil size={15} /></button> | ||
| <button type="button" className="ss-ib" aria-label={t('memory.move')} title={t('memory.move')} disabled={unavailable} onClick={() => file.data && onMove(file.data)}><FolderInput size={15} /></button> | ||
| <CopyButton value={`${root}/${selected}`} title={t('skillEditor.copyPath')} copiedLabel="" errorMessage={t('memory.copyFailed')} unstyled className="ss-ib" size={15} strokeWidth={2} /> | ||
| <Link className="ss-ib" to={`/backup?tab=files&path=${encodeURIComponent(`${root}/${selected}`)}`} aria-label={t('memory.history')} title={t('memory.history')}><History size={15} /></Link> |
There was a problem hiding this comment.
Normalize Windows paths before opening note history
On Windows, root is returned with native backslashes, while this interpolation appends the note with /. The resulting mixed-separator query is compared literally with the native paths returned by the backup API in FileBackups.tsx, so files.find((f) => f.path === requested) fails and History shows the empty state even when the note has backups. Normalize the path before navigation or compare canonicalized paths.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in b2ddd7f at the shared FileBackups selection boundary, covering Memory History and post-delete/move recovery links. Windows drive and UNC paths are compared with normalized separators, but version/restore API calls retain the selected native path. POSIX literal backslash names remain distinct. Regression tests reproduced both Windows cases before the fix and now pass, along with a POSIX non-match case, all 20 scoped Memory/Backup UI tests, scoped ESLint, TypeScript and the production build. These path tests ran in the Linux devcontainer; no Windows browser run is claimed.
Create new reviewed instruction files exclusively to preserve competing writes. Match Windows history links with native backup paths while keeping POSIX names and backup API paths intact.
|
Addressed both findings from the ef2f61a review in b2ddd7f:
Both bugs were reproduced by failing regression tests before the fixes. Validation passed inside the devcontainer: No visual layout changed, so existing English screenshots remain applicable. Windows matching was covered by UI tests in Linux; this is not a Windows browser verification. CI for the new commit is being monitored. @codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b2ddd7fcb4
ℹ️ 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".
| root, err := s.memoryRoot() | ||
| s.mu.RUnlock() | ||
| return err == nil && syncpkg.PathInside(root, path) |
There was a problem hiding this comment.
Require a configured memory extra before widening backup scope
In project mode with an external sources.extras directory but no configured memory extra, memoryRoot() still returns the default <extras>/memory path because memory.Extra's found result is ignored. Consequently, this check exposes that external directory's backup list, previews, and Restore API to the project, potentially allowing it to overwrite files outside the project even though memory was never enabled. Only widen the scope when the project actually contains the memory extra.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 793392d. The shared project backup scope check now requires memory.Extra to report an existing, valid folder extra before resolving and admitting its external root. An external sources.extras directory by itself no longer grants access to the default memory folder. The regression reproduced the exposed list before the fix, and now verifies the list excludes that directory, both version/preview routes and Restore return file_backup_outside_project, external content remains intact, and in-project backups remain visible. The configured external-source restore test, all FileBackups API tests and devcontainer make check pass.
Keep project backup scope inside the repository unless a valid memory folder extra enables its external source. Cover listing, version preview and restore denial without changing configured-source recovery.
|
Addressed the latest project backup scope finding in 793392d. External memory backup access now requires a configured, valid memory folder extra; an external The regression reproduced the exposed backup list before the fix. It now verifies exclusion from the list, forbidden version/preview/restore requests, preserved external content, and visible in-project backups. Existing configured external-source recovery remains covered and passes. Validation: all FileBackups API tests, devcontainer @codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 793392da9e
ℹ️ 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".
| s.mu.RLock() | ||
| defer s.mu.RUnlock() | ||
| if _, found, err := memory.Extra(s.extrasConfig()); !found || err != nil { | ||
| return false | ||
| } | ||
| root, err := s.memoryRoot() | ||
| return err == nil && syncpkg.PathInside(root, path) |
There was a problem hiding this comment.
Revalidate memory scope under the restore lock
In project mode, this authorization depends on the mutable memory-extra configuration, but handleRestoreFileBackup releases this read lock after fileBackupPath and only then acquires s.mu for the restore. If a concurrent DELETE /api/extras/memory completes in that gap, the restore still writes to the formerly configured external root even though that project no longer has access to it. Hold the lock across scope validation and restore, or revalidate the path after acquiring the restore lock.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in d83c660. Restore now acquires s.mu before fileBackupPath and holds the write lock through scope validation and RestoreFileBackup; deleting or reconfiguring the memory extra cannot interleave between those operations. List and preview handlers similarly hold a read lock through scope validation and reading, and the shared scope helpers explicitly require the caller to hold the lock. A regression fails against the previous unlocked validation and verifies that a preflight-approved external path is rejected under the restore write lock after DELETE /api/extras/memory, preserving its content. All FileBackups API tests pass with the race detector, and devcontainer make check passes.
Validate project memory backup access under the restore write lock so concurrent extra deletion cannot revoke access between validation and writing. Hold read locks across scoped backup reads as well.
|
Addressed the latest restore authorization race in d83c660. Restore now holds the configuration write lock from path/scope validation through the restore. List and preview handlers hold the corresponding read lock through validation and reading; memory-extra deletion or reconfiguration cannot interleave with access. The regression failed against the previous unlocked validation. It verifies a previously permitted external path is rejected under the restore write lock after deleting the memory extra, with its content intact. Validation passed: FileBackups API tests with @codex review |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Summary
Add shared, user-managed Markdown memory under the existing
memoryextra. Claude, Codex, and other configured tools can read the same notes through reviewed instruction-file guidance in global or project mode.INDEX.md/LEARNED.md, list/search, read, write, delete, and print reading guidance.Native automatic memory and automatic learning remain separate. Rename/move does not rewrite Markdown links; the dashboard reports broken index links and exposes the old path's backup history.
Linked Issue
Refs #249.
Screenshots
Validation
make checkin the devcontainer, including domain/API and CLI integration tests.en,ja,ko,zh-Hans,zh-Hant.git diff --check.Type
Checklist
make check)