Lock finished passages with a highlight so AI assistants editing your notes leave them unchanged.
When you revise a draft back and forth with an AI assistant, passages you've already polished keep getting "improved" again. This plugin lets you select those passages in the editor and lock them. Locked text gets a soft green highlight and a 🔒 icon, and the lock is written into the Markdown source so any AI that edits the file can see it.
Intro sentence that still needs work. %%LOCK%%This line is final, don't touch it.%%/LOCK%% More draft text.
%% … %% is Obsidian's comment syntax, so the markers are hidden in reading view and exported output, and they don't show up in your published text.
{==text==}{>>comment<<}), the lock expands to cover the whole comment so it isn't broken.The markers only help if the AI respects them. There are two ways to set that up:
CLAUDE.md, AGENTS.md, a system prompt, and so on).extras/claude-code contains a PreToolUse hook. Before Claude edits a .md file, it rejects any Edit, Write, or MultiEdit that would change or remove a locked passage, and it tells Claude why. To install it, copy protect-locks.py to <vault>/.claude/hooks/ and merge settings.json into <vault>/.claude/settings.json. It requires python3.The hook only covers Claude's file-editing tools. Edits made through shell commands, or by other assistants, rely on the instructions alone.
Search for Lock Text for AI in Settings → Community plugins. To install manually, copy main.js, manifest.json, and styles.css from the latest release into <vault>/.obsidian/plugins/lock-text-for-ai/.
和 AI 反复改稿时,已经改好的段落常常被 AI 又改一遍。这个插件让你在编辑界面里选中这些段落,把它们锁定:锁定的文字有浅绿底色和 🔒 图标,锁定标记直接写在 Markdown 源码里,AI 读文件就能看到。
这句还要改。%%LOCK%%这句定稿了,别动。%%/LOCK%%后面继续改。
%% … %% 是 Obsidian 的注释写法,阅读视图和导出结果里都看不到,不影响成稿。
{==原文==}{>>批注<<}),锁定范围会自动扩大到整条批注。CLAUDE.md、AGENTS.md、系统提示词等)。extras/claude-code 里有一个 PreToolUse 钩子。Claude 改 .md 文件前,如果这次修改会改动或删掉锁定内容,会被直接驳回,并告诉它原因。安装方法:把 protect-locks.py 复制到 <库>/.claude/hooks/,把 settings.json 的内容合并进 <库>/.claude/settings.json。需要系统里有 python3。钩子只管 Claude 自带的改文件工具。如果 AI 用命令行脚本改文件,或者用的是其他 AI,就只能靠规则约束。