What the agent does
The agent reads the plugin before it writes a suggester, because where the trigger fires and what it inserts both depend on how the plugin is laid out. In a plugin built from obsidianmd/obsidian-sample-plugin, package.json builds with tsc -noEmit -skipLibCheck && node esbuild.config.mjs production, so a type error fails the build, and esbuild.config.mjs bundles src/main.ts into a CommonJS main.js with obsidian and the CodeMirror packages external. src/main.ts registers a ribbon icon, a status bar item, three commands and a settings tab, and src/settings.ts holds MyPluginSettings with one mySetting string and DEFAULT_SETTINGS. manifest.json pins minAppVersion to 1.0.0 and isDesktopOnly to false, and the repository's AGENTS.md asks for code split into src/commands/, src/ui/ and src/utils/ rather than one growing main.ts.
Then it reads the API it will use. The installed obsidian typings, 1.12.3 in the sample's lockfile, declare EditorSuggest<T> as an abstract class over PopoverSuggest<T> with two methods to implement, onTrigger(cursor, editor, file) returning an EditorSuggestTriggerInfo or null, and getSuggestions(context) returning T[] or a promise of one, plus renderSuggestion and selectSuggestion inherited from the popover, a limit field, setInstructions and a context that holds the trigger's start, end and query. The typings warn that onTrigger runs on every keypress, so the agent keeps it to one editor.getLine(cursor.line) and a regular expression on the text before the cursor, returning null as early as it can. The plugin registers the class once with this.registerEditorSuggest(...) in onload.
The agent writes src/ui/suggest.ts with a class that triggers on a short prefix the settings tab lets the user change, say ::, and offers two kinds of item: note names from this.app.vault.getMarkdownFiles() and tags from each file's CachedMetadata through this.app.metadataCache.getFileCache(file) and the exported getAllTags. getSuggestions filters by context.query, case-insensitively, and respects limit. renderSuggestion writes the name into the element with createDiv and a smaller line for the kind; selectSuggestion replaces the range from context.start to context.end with [[Note]] for a note or #tag for a tag using editor.replaceRange, then moves the cursor past it. The trigger prefix becomes a second field in MyPluginSettings, with a text setting in SampleSettingTab.display, and the wiring goes in onload beside the existing commands.
Before it opens the pull request it runs npm ci, npm run build and npm run lint. The lint step matters here: eslint.config.mts enables eslint-plugin-obsidianmd's recommended rules through typescript-eslint with the project service, so a stray innerHTML, a console.log left in or a any in the suggester fails it the way the repository's lint.yml workflow would on push. Nothing in the sample is desktop-only and EditorSuggest exists since API 0.12.17, so manifest.json keeps its minAppVersion; the agent says so in the pull request rather than bumping it.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Add an autocomplete suggester to this Obsidian plugin. Read src/main.ts, src/settings.ts, manifest.json, esbuild.config.mjs, eslint.config.mts and AGENTS.md first, then read EditorSuggest, EditorSuggestTriggerInfo and getAllTags in node_modules/obsidian/obsidian.d.ts. Create src/ui/suggest.ts with an EditorSuggest subclass: onTrigger fires when the text before the cursor on the current line ends with the trigger prefix from settings (default `::`) followed by the query, and must return null as early as possible; getSuggestions lists markdown file names from the vault and tags from the metadata cache that match the query; selectSuggestion replaces the trigger range with a [[wikilink]] or a #tag. Add the prefix as a setting with a text field in the settings tab. Register the suggester in onload. Keep minAppVersion unless the API you use needs a newer one, and say which. Run `npm ci`, `npm run build` and `npm run lint`, fix what they report, and open a pull request that describes the trigger, the two sources and how to try it in a vault. Change nothing unrelated.",
"resources": [
{
"url": "https://github.com/your-org/your-app"
}
]
}- Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
- Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
- Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.
What comes back
What comes back is a pull request on its own branch with a new src/ui/suggest.ts, a new field and setting in src/settings.ts, one registerEditorSuggest call in src/main.ts, and no change to manifest.json or versions.json unless the description explains why. The description names the trigger prefix, the two sources of items, the key and mouse paths through selectSuggestion, and quotes the npm run build and npm run lint output. The repository's own lint.yml workflow runs on the branch as it does on any push.
The session keeps the record: every file the agent read in obsidian.d.ts, each build and lint command with its full output, and any lint failure it fixed on the way. GET /o/{org}/sessions/{id}/messages returns that transcript, and GET /o/{org}/p/{project}/sessions/{id}/changes returns the diff per file.
Before merging, a reviewer loads main.js, manifest.json and styles.css into a test vault under .obsidian/plugins/<id>/, as the repository's AGENTS.md describes, and types the prefix in a note: the popover should open, narrow as they type, and insert on Enter or click. They check three things the build cannot: that onTrigger returns null on an ordinary line, that a vault with thousands of notes stays responsive, and that the inserted text lands where the trigger was and nowhere else. A follow-up message to the same session, such as asking for headings as a third source, continues on the same branch.
Run it on every Obsidian plugin built from the sample
Start it from your terminal with one POST /o/{org}/sessions, this prompt as input and the plugin repository in resources, then close the laptop. The run keeps going in its sandbox, and the key's webhook_url receives one run.completed with the pull request in result when the turn ends. A request_id that is a UUID v5 of the repository's full name makes a retried request return the run already started instead of a second pull request.
A developer who maintains several plugins sends the same body once per repository. GET /o/{org}/github lists every repository the Rush GitHub App installation reaches, so a script can keep the ones with a manifest.json at the root. Each run reads its own main.ts, so a plugin that already has a src/ui/ directory gets the suggester beside its other views, and one that already registers an EditorSuggest gets a second trigger rather than a duplicate.
The use case this job follows, with its automation and trigger: Hand off a long task.
Why run it on Rush?
An editor suggester is small but fiddly: onTrigger runs on every keypress, the popover's range arithmetic is off by one until it is not, and the Obsidian lint rules reject habits that work elsewhere. In a Rush sandbox the agent reads the installed typings instead of remembering them, builds with the same esbuild config the plugin ships with, and runs the same ESLint rules the repository's workflow runs, so the pull request arrives already green.
The pull request carries its proof: the build and lint output and the transcript of every file the agent read. Several plugins can get the same feature at the same time in separate sandboxes, each against its own main.ts, and the only thing left for a person is to type the prefix in a vault and watch the popover open.
Frequently asked questions
Does it work on mobile?
EditorSuggest is part of the shared API and the sample's manifest.json sets isDesktopOnly to false, so the suggester loads on mobile too. The agent avoids activeDocument and Node APIs in the new file. Trying it on a phone is still a manual step the reviewer does.
Will it bump minAppVersion?
Only if it uses an API newer than the manifest allows. EditorSuggest and registerEditorSuggest date from API 0.12.17 and getAllTags is older, so a plugin on the sample's 1.0.0 keeps its value. If the agent reaches for something marked with a later @since in the typings it raises the version, adds the entry to versions.json and says so in the pull request.
Can the suggestions come from somewhere other than the vault?
Yes. getSuggestions may return a promise, and the typings say to pass the context along when it does, so a source that reads a file or calls a service fits. Say in the prompt what the source is; the agent keeps onTrigger synchronous either way, because that is the function that runs on every keypress.
How does it avoid slowing the editor down?
By doing almost nothing in onTrigger: one getLine, one regular expression anchored at the cursor, and an early null. The vault and tag scans happen in getSuggestions, which only runs once a trigger matched, and the result is cut to limit entries before rendering. The reviewer confirms this in a large vault, since no automated check measures it.
More Obsidian plugin jobs
More jobs like this: Hand off a long task
- Add Retries to Resend Email Sending (Resend)
- Add Email Verification to an AdonisJS App (AdonisJS)
- Add Email Verification to a Django REST Framework Project (Django REST Framework)