Skip to content

feat: manage global memsearch config via chezmoi - #874

Merged
yxtay merged 1 commit into
mainfrom
feat/memsearch-global-config
Jul 9, 2026
Merged

feat: manage global memsearch config via chezmoi#874
yxtay merged 1 commit into
mainfrom
feat/memsearch-global-config

Conversation

@yxtay

@yxtay yxtay commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add .chezmoitemplates/memsearch_config.toml — global onnx embedding, cross-encoder reranker, and user_profile maintenance (claude-code + opencode) writing to a shared ~/.memsearch/USER.md.
  • Add private_dot_memsearch/modify_config.toml to merge the template into ~/.memsearch/config.toml on chezmoi apply, preserving any existing local overrides.
  • Exclude modify_*.toml from taplo-format (Go template syntax, not valid standalone TOML).

Test plan

  • Verified merge behavior in isolated chezmoi source/destination dirs (fresh install + existing config both produce correct merged TOML)
  • chezmoi execute-template resolves template correctly
  • pre-commit passes with taplo exclusion
  • chezmoi apply on a real machine

Summary by CodeRabbit

  • New Features

    • Added a new memsearch setup with default embedding and reranking settings.
    • Enabled user profile output for supported assistant integrations, saving profiles to a local markdown file.
  • Chores

    • Updated formatting checks to skip certain TOML files used for generated or customized configuration.

Onnx embedding, cross-encoder reranker, and shared user_profile
maintenance (claude-code + opencode) writing to one global USER.md.
Exclude modify_*.toml from taplo-format since it's a Go template, not
valid TOML on its own.
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a6c0bec6-2774-469b-85b3-3416cd7d4646

📥 Commits

Reviewing files that changed from the base of the PR and between 85d9996 and e1dcb11.

📒 Files selected for processing (3)
  • .pre-commit-config.yaml
  • chezmoi/.chezmoitemplates/memsearch_config.toml
  • chezmoi/private_dot_memsearch/modify_config.toml

📝 Walkthrough

Walkthrough

This PR adds a new chezmoi template defining memsearch configuration (embedding provider, reranker model, and user profile plugins), a modify-template that merges this config with existing stdin TOML via mergeOverwrite, and a pre-commit exclusion rule for matching modify_*.toml files.

Changes

Memsearch configuration setup

Layer / File(s) Summary
Memsearch config template
chezmoi/.chezmoitemplates/memsearch_config.toml
New TOML template sets embedding provider to onnx, configures reranker model, and enables claude-code and opencode user profile plugins writing to ~/.memsearch/USER.md.
Modify-template merge and pre-commit exclusion
chezmoi/private_dot_memsearch/modify_config.toml, .pre-commit-config.yaml
Chezmoi modify-template parses optional stdin TOML, merges it with the rendered memsearch config template via mergeOverwrite, and outputs merged TOML; taplo-format hook now excludes files matching `/modify_.*\.toml$`.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

  • yxtay/dotfiles#861: Both PRs introduce chezmoi modify_ templates that parse optional stdin into an object and mergeOverwrite it with a base template, sharing the same modify/merge pattern.

Poem

A rabbit hops with TOML in paw,
Merging configs, no more flaw. 🐰
Onnx whispers, reranker hums,
USER.md waits till the merge comes.
Pre-commit skips what modify makes—
Hop, hop, hooray for tidy stakes!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: managing global memsearch configuration through chezmoi.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/memsearch-global-config

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.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

⚠️MegaLinter analysis: Success with warnings

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ BASH shfmt 3 0 0 0 0.02s
⚠️ JSON prettier 9 0 1 0 0.47s
⚠️ MARKDOWN markdownlint 6 0 2 0 0.56s
✅ MARKDOWN markdown-table-formatter 6 0 0 0 0.17s
✅ YAML prettier 10 0 0 0 0.58s

Detailed Issues

⚠️ MARKDOWN / markdownlint - 2 errors
chezmoi/private_dot_claude/modify_CLAUDE.md:1 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "{{- /*chezmoi:modify-template*..."]
chezmoi/private_dot_config/opencode/modify_AGENTS.md:1 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "{{- /*chezmoi:modify-template*..."]
⚠️ JSON / prettier - 1 error
chezmoi/.chezmoitemplates/claude-settings.json 84ms (unchanged)
chezmoi/.chezmoitemplates/mcp_servers.json 5ms (unchanged)
chezmoi/.chezmoitemplates/opencode-tui.json 3ms (unchanged)
chezmoi/.chezmoitemplates/opencode.json 5ms (unchanged)
[error] chezmoi/private_dot_claude/modify_settings.json: SyntaxError: Unexpected token (1:2)
[error] > 1 | {{- /* chezmoi:modify-template */ -}}
[error]     |  ^
[error]   2 | {{- $current := dict -}}
[error]   3 | {{- if .chezmoi.stdin | trim -}}
[error]   4 | {{-   $current = fromJson .chezmoi.stdin -}}
[error] chezmoi/private_dot_config/mcp/modify_mcp_servers.json: SyntaxError: Unexpected token (1:2)
[error] > 1 | {{- /* chezmoi:modify-template */ -}}
[error]     |  ^
[error]   2 | {{- $current := dict -}}
[error]   3 | {{- if .chezmoi.stdin | trim -}}
[error]   4 | {{-   $current = fromJson .chezmoi.stdin -}}
[error] chezmoi/private_dot_config/opencode/modify_opencode.json: SyntaxError: Unexpected token (1:2)
[error] > 1 | {{- /* chezmoi:modify-template */ -}}
[error]     |  ^
[error]   2 | {{- $current := dict -}}
[error]   3 | {{- if .chezmoi.stdin | trim -}}
[error]   4 | {{-   $current = fromJson .chezmoi.stdin -}}
[error] chezmoi/private_dot_config/opencode/modify_tui.json: SyntaxError: Unexpected token (1:2)
[error] > 1 | {{- /* chezmoi:modify-template */ -}}
[error]     |  ^
[error]   2 | {{- $current := dict -}}
[error]   3 | {{- if .chezmoi.stdin | trim -}}
[error]   4 | {{-   $current = fromJson .chezmoi.stdin -}}
renovate.json 5ms (unchanged)

Notices

📣 MegaLinter 9.5.0 is out! Discover the new features and security recommendations in the release announcement. (Skip this info by defining SECURITY_SUGGESTIONS: false)

See detailed reports in MegaLinter artifacts

Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining FLAVOR_SUGGESTIONS: false)

  • Documentation: Custom Flavors
  • Command: npx mega-linter-runner@9.5.0 --custom-flavor-setup --custom-flavor-linters BASH_SHFMT,JSON_PRETTIER,MARKDOWN_MARKDOWNLINT,MARKDOWN_MARKDOWN_TABLE_FORMATTER,YAML_PRETTIER

MegaLinter is graciously provided by OX Security
Show us your support by starring ⭐ the repository

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new configuration template for memsearch and a chezmoi modify-template script to merge it with local configurations, while also updating pre-commit settings to exclude these files from formatting. Feedback points out a critical bug in the merge logic where mergeOverwrite is used instead of merge, which would incorrectly overwrite local user configurations with the template defaults instead of preserving them.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

{{- $current = fromToml .chezmoi.stdin -}}
{{- end -}}
{{- $template := includeTemplate "memsearch_config.toml" . | fromToml -}}
{{- $merged := mergeOverwrite $current $template -}}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

Using mergeOverwrite $current $template causes the template values ($template) to overwrite the existing local configuration ($current), which is the opposite of the intended behavior of preserving local overrides. In Sprig, mergeOverwrite gives precedence from right to left (the rightmost argument overwrites the leftmost). To preserve local overrides, you should use merge $current $template instead. In Sprig, merge gives precedence to the destination dictionary (the first argument), meaning any existing keys in $current will be preserved, and only missing keys from $template will be added.

{{- $merged := merge $current $template -}}

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

⚠️MegaLinter analysis: Success with warnings

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ BASH bash-exec 3 0 0 0.01s
✅ BASH shellcheck 3 0 0 0.14s
✅ REPOSITORY checkov yes no no 22.5s
✅ REPOSITORY devskim yes no no 1.86s
✅ REPOSITORY dustilock yes no no 0.03s
✅ REPOSITORY gitleaks yes no no 1.6s
✅ REPOSITORY grype yes no no 48.88s
✅ REPOSITORY kingfisher yes no no 9.84s
⚠️ REPOSITORY osv-scanner yes 1 no 0.08s
✅ REPOSITORY secretlint yes no no 1.94s
✅ REPOSITORY syft yes no no 2.35s
✅ REPOSITORY trivy yes no no 10.88s
✅ REPOSITORY trivy-sbom yes no no 0.09s
✅ REPOSITORY trufflehog yes no no 3.45s

Detailed Issues

⚠️ REPOSITORY / osv-scanner - 1 error
Scanning dir .
Starting filesystem walk for root: /
End status: 41 dirs visited, 144 inodes visited, 0 Extract calls, 2.935336ms elapsed, 2.935566ms wall time
No package sources found, --help for usage information.

Notices

📣 MegaLinter 9.5.0 is out! Discover the new features and security recommendations in the release announcement. (Skip this info by defining SECURITY_SUGGESTIONS: false)

See detailed reports in MegaLinter artifacts

Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining FLAVOR_SUGGESTIONS: false)

  • Documentation: Custom Flavors
  • Command: npx mega-linter-runner@9.5.0 --custom-flavor-setup --custom-flavor-linters BASH_EXEC,BASH_SHELLCHECK,REPOSITORY_CHECKOV,REPOSITORY_DEVSKIM,REPOSITORY_DUSTILOCK,REPOSITORY_GITLEAKS,REPOSITORY_GRYPE,REPOSITORY_OSV_SCANNER,REPOSITORY_SECRETLINT,REPOSITORY_SYFT,REPOSITORY_TRIVY,REPOSITORY_TRIVY_SBOM,REPOSITORY_TRUFFLEHOG,REPOSITORY_KINGFISHER

MegaLinter is graciously provided by OX Security
Show us your support by starring ⭐ the repository

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

⚠️MegaLinter analysis: Success with warnings

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ ACTION actionlint 5 0 0 0.33s
✅ ACTION zizmor 5 0 0 0 0.52s
✅ BASH bash-exec 3 0 0 0.01s
✅ BASH shellcheck 3 0 0 0.08s
✅ BASH shfmt 3 0 0 0 0.02s
✅ COPYPASTE jscpd yes no no 0.8s
✅ EDITORCONFIG editorconfig-checker 72 0 0 0.09s
⚠️ JSON prettier 9 0 1 0 0.95s
✅ JSON v8r 9 0 0 5.88s
⚠️ MARKDOWN markdownlint 6 0 2 0 0.68s
✅ MARKDOWN markdown-table-formatter 6 0 0 0 0.2s
✅ REPOSITORY checkov yes no no 24.2s
✅ REPOSITORY gitleaks yes no no 1.2s
✅ REPOSITORY git_diff yes no no 0.01s
✅ REPOSITORY grype yes no no 49.2s
⚠️ REPOSITORY osv-scanner yes 1 no 0.17s
✅ REPOSITORY secretlint yes no no 1.45s
✅ REPOSITORY syft yes no no 3.2s
✅ REPOSITORY trivy yes no no 9.76s
✅ REPOSITORY trivy-sbom yes no no 0.16s
✅ REPOSITORY trufflehog yes no no 3.56s
⚠️ SPELL lychee 25 2 0 1.07s
✅ YAML prettier 10 0 0 0 0.65s
✅ YAML v8r 10 0 0 8.69s
✅ YAML yamllint 10 0 0 0.42s

Detailed Issues

⚠️ SPELL / lychee - 2 errors
📝 Summary
---------------------
🔍 Total...........21
🔗 Unique..........16
✅ Successful......19
⏳ Timeouts.........0
🔀 Redirected.......4
👻 Excluded.........0
❓ Unknown..........0
🚫 Errors...........2
⛔ Unsupported......2

Errors in chezmoi/.chezmoitemplates/mcp_servers.json
[406] https://mcp.deepwiki.com/mcp (at 11:15) | Rejected status code: 406 Not Acceptable

Errors in chezmoi/.chezmoitemplates/opencode.json
[406] https://mcp.deepwiki.com/mcp (at 24:15) | Rejected status code: 406 Not Acceptable

Hint: Followed 4 redirects. You might want to consider replacing redirecting URLs with the resolved URLs. Use verbose mode (`-v`/`-vv`) to see redirection details.
Hint: You can configure accepted/rejected response codes with `-a` or `--accept`
⚠️ MARKDOWN / markdownlint - 2 errors
chezmoi/private_dot_claude/modify_CLAUDE.md:1 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "{{- /*chezmoi:modify-template*..."]
chezmoi/private_dot_config/opencode/modify_AGENTS.md:1 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "{{- /*chezmoi:modify-template*..."]
⚠️ REPOSITORY / osv-scanner - 1 error
Scanning dir .
Starting filesystem walk for root: /
End status: 41 dirs visited, 144 inodes visited, 0 Extract calls, 2.740184ms elapsed, 2.740535ms wall time
No package sources found, --help for usage information.
⚠️ JSON / prettier - 1 error
chezmoi/.chezmoitemplates/claude-settings.json 147ms (unchanged)
chezmoi/.chezmoitemplates/mcp_servers.json 9ms (unchanged)
chezmoi/.chezmoitemplates/opencode-tui.json 5ms (unchanged)
chezmoi/.chezmoitemplates/opencode.json 12ms (unchanged)
[error] chezmoi/private_dot_claude/modify_settings.json: SyntaxError: Unexpected token (1:2)
[error] > 1 | {{- /* chezmoi:modify-template */ -}}
[error]     |  ^
[error]   2 | {{- $current := dict -}}
[error]   3 | {{- if .chezmoi.stdin | trim -}}
[error]   4 | {{-   $current = fromJson .chezmoi.stdin -}}
[error] chezmoi/private_dot_config/mcp/modify_mcp_servers.json: SyntaxError: Unexpected token (1:2)
[error] > 1 | {{- /* chezmoi:modify-template */ -}}
[error]     |  ^
[error]   2 | {{- $current := dict -}}
[error]   3 | {{- if .chezmoi.stdin | trim -}}
[error]   4 | {{-   $current = fromJson .chezmoi.stdin -}}
[error] chezmoi/private_dot_config/opencode/modify_opencode.json: SyntaxError: Unexpected token (1:2)
[error] > 1 | {{- /* chezmoi:modify-template */ -}}
[error]     |  ^
[error]   2 | {{- $current := dict -}}
[error]   3 | {{- if .chezmoi.stdin | trim -}}
[error]   4 | {{-   $current = fromJson .chezmoi.stdin -}}
[error] chezmoi/private_dot_config/opencode/modify_tui.json: SyntaxError: Unexpected token (1:2)
[error] > 1 | {{- /* chezmoi:modify-template */ -}}
[error]     |  ^
[error]   2 | {{- $current := dict -}}
[error]   3 | {{- if .chezmoi.stdin | trim -}}
[error]   4 | {{-   $current = fromJson .chezmoi.stdin -}}
renovate.json 8ms (unchanged)

Notices

📣 MegaLinter 9.5.0 is out! Discover the new features and security recommendations in the release announcement. (Skip this info by defining SECURITY_SUGGESTIONS: false)

See detailed reports in MegaLinter artifacts

Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining FLAVOR_SUGGESTIONS: false)

  • Documentation: Custom Flavors
  • Command: npx mega-linter-runner@9.5.0 --custom-flavor-setup --custom-flavor-linters ACTION_ACTIONLINT,ACTION_ZIZMOR,BASH_EXEC,BASH_SHELLCHECK,BASH_SHFMT,COPYPASTE_JSCPD,EDITORCONFIG_EDITORCONFIG_CHECKER,JSON_V8R,JSON_PRETTIER,MARKDOWN_MARKDOWNLINT,MARKDOWN_MARKDOWN_TABLE_FORMATTER,REPOSITORY_CHECKOV,REPOSITORY_GIT_DIFF,REPOSITORY_GITLEAKS,REPOSITORY_GRYPE,REPOSITORY_OSV_SCANNER,REPOSITORY_SECRETLINT,REPOSITORY_SYFT,REPOSITORY_TRIVY,REPOSITORY_TRIVY_SBOM,REPOSITORY_TRUFFLEHOG,SPELL_LYCHEE,YAML_PRETTIER,YAML_YAMLLINT,YAML_V8R

MegaLinter is graciously provided by OX Security
Show us your support by starring ⭐ the repository

@yxtay
yxtay merged commit a0f90db into main Jul 9, 2026
34 checks passed
@yxtay
yxtay deleted the feat/memsearch-global-config branch July 9, 2026 04:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant