https://raw.githubusercontent.com/aliasunder/vault-cortex/HEAD/AGENTS.md
− obsidian-markdown/ # Pure parsers and transforms with no I/O (pdf-engine excepted): lines, frontmatter, callouts, headings, links, tags, body-tags + obsidian-remark-parser + remark-ports/, tasks, recurrence, memory-entries, canvas, plaintext, pdf + pdf-engine, moment-format− vault-operations/ # Vault read, write, and patch: vault-filesystem (base I/O), vault-patcher, note-mover, memory-store, daily-notes, vault-folder-config, task-mutations, task-format-config, trash-config, trash-sweeper, asset-operations− oauth/ # OAuth 2.1: oauth-provider, oauth-routes, consent-page− exports a single `links` namespace, _not_ for the service-grouping reason above− but to wall off its `/g` grammar regexes (shared `lastIndex` footgun) behind− position-safe methods.− destructured `import { env } from "node:process"`, which `logger.ts` uses.− failure modes or a no-match / empty-result contract worth clarifying− ("returns an empty array, not an error"); omit it only for tools that− cannot meaningfully fail. Include `Obsidian syntax:` on write tools.− `PromptRegistrationContext`.+ http-error-middleware.ts # Express error handler shared by the full server and setup mode: short 4xx for bad request bodies, 500 with a stack otherwise+ obsidian-markdown/ # Pure parsers and transforms with no I/O (pdf-engine excepted): lines, frontmatter, callouts, headings, links, tags, body-tags + obsidian-remark-parser + remark-ports/, tasks, recurrence, memory-entries, canvas, file-kinds, html, plaintext, pdf + pdf-engine, moment-format+ vault-operations/ # Vault read, write, and patch: vault-filesystem (base I/O), vault-patcher, note-mover, memory-store, daily-notes, vault-folder-config, task-mutations, task-format-config, trash-config, trash-sweeper, asset-operations, asset-text+ pdf-extractor.ts, pdf-extraction-child.ts, pdf-extraction-protocol.ts # One shared child owns PDF text reads and deferred indexing; raw page rendering stays in the server+ oauth/ # OAuth 2.1: oauth-provider, oauth-routes, authorize-guard, consent-page, unknown-client-page+ exports a single `links` namespace to keep link recognition private behind+ position-safe methods. Its scanners own their cursors per call; the remaining+ `/g` inline-code regex is used through `matchAll` and `replace`.+ - Pass field values as they are: the logger caps every string it logs.+ destructured `import { env } from "node:process"`, which `logger.ts` uses+ and `pdf-extractor.ts` uses for the environment allowlist handed to the+ PDF child.+ failure modes; omit it only for tools that cannot meaningfully fail.+ An empty-result contract ("returns an empty array, not an error")+ goes under `Behavior:`, not `Errors:`. Include `Obsidian syntax:` on+ write tools.+ - **State a fact, never its absence, its implication or its mechanism.**+ The reader is an agent picking tools from text it pays for by the+ token. A definition never says that a limit, cap or restriction does+ not exist ("no upper cap"): a limit is named only where one applies,+ and an unnamed one is not assumed. It never spells out what a stated+ fact already implies ("in the server's timezone" already says the day+ may not be the caller's), and never explains a mechanism the agent+ cannot change ("until the index catches up"). The test for any clause:+ delete it, and if the agent would send the same call and read the+ result the same way, it stays deleted.+ `PromptRegistrationContext`. Wrap the handler in `trackedPromptHandler`+ (`prompt-helpers.ts`) so background embedding waits while the prompt+ runs. `tool-definitions.ts` wraps every tool handler centrally, but+ nothing wraps prompts for you.+ Add a foreground tracking test, like the existing prompts' ones, that+ spies on `trackForegroundWork` and fails when the handler skips the+ wrapper.+ - Vitest prints a test's console output, `src/logger.ts`'s lines included,+ only when that test fails (`silent: "passed-only"`, with the log lines+ routed to the console by `src/__tests__/helpers/route-log-lines-to-console.ts`).+ To see a passing test's output, run `npm test -- <file> --silent=false`.+ - New test support files go in subfolders of their `__tests__/` folder:+ a module that a test imports or runs (a harness, an input generator,+ an oracle, a script the test spawns) in `helpers/`, and data that the