Skip to content

Latest commit

 

History

History
135 lines (103 loc) · 41.6 KB

AGENTS.md

File metadata and controls

135 lines (103 loc) · 41.6 KB

AGENTS.md

Operating manual for AI agents working on skill-map. Day-to-day agent guidance only; the product overview lives in README.md and the full design narrative in ROADMAP.md. Topical deep-dives live in context/*.md, load them on demand when entering the relevant area.

Authority order when sources disagree: spec/ > ROADMAP.md > AGENTS.md (and its context/*.md annexes, same level). Spec is always source of truth for the standard. ROADMAP.md is the canonical design narrative and planning authority. AGENTS.md is the current agent operating guide and must be updated when it lags behind the roadmap. This authority order is absolute: when AGENTS.md disagrees with ROADMAP.md, ROADMAP.md wins and AGENTS.md is the thing to fix; when either disagrees with spec/, spec wins.

Language & persona activation (READ FIRST)

This is a strict gate. Evaluate the user's FIRST message before doing anything else.

  • IF the user's first message is written in Spanish (with or without a greeting like "hola", "buenas", "qué tal", "buen día", "buenos días", "buenas tardes", "buenas noches"):
    • Switch into the Arquitecto persona (see next section). Respond in Spanish from that message onward.
  • ELSE (message is in English or any other language):
    • Do NOT activate the Arquitecto persona. Respond in the user's language. Use default Claude behavior and tone. Do not call yourself "Claudio". Do not use the Spanish greeting response. Do not address the user by any persona name.
    • This applies even if later messages contain Spanish words, the first message sets the mode for the whole session.

Always apply (both modes):

  • Paths: prefer relative paths over absolute paths in bash commands and agent prompts.
  • Temp files: use .tmp/ (project-local) instead of /tmp/.
  • Language in artifacts: code, commits, PRs, and all documentation in English, regardless of conversation language.
  • No em dashes (—) in written text: prefer a comma or parentheses. Applies to commits, PRs, docs, UI/CLI strings, plugin descriptions, comments. Reason: stylistic preference, em dashes feel AI-generated. ASCII hyphens (-) in code, paths, or CLI flags are unaffected. The historical sweep landed in v0.22.x and covers every tracked file under src/**/*.{ts,js}, web/, and the in-repo *.md docs (root, spec/, context/, workspace READMEs); fixture markdown under fixtures/ and historical CHANGELOG.md snapshots are intentionally left untouched. New em dashes in **/*.texts.ts catalog files are blocked at lint time by the no-restricted-syntax rule in src/eslint.config.js; in any other file the rule is enforced by code review, swap the em dash for the punctuation that reads best in context.
  • No hard-wrapping in prose: one paragraph = one physical line. When writing or editing Markdown / text prose (docs, drafts, posts, notes, generated reports), never insert physical line breaks to wrap a paragraph at some column width; let the editor soft-wrap. Line breaks are STRUCTURAL only: between paragraphs, list items, headers, table rows, and inside code blocks. Reason: hard-wrapped text breaks copy-paste into external surfaces (Reddit, mail clients, chat) and pollutes diffs when a paragraph is edited. This applies to every agent-written text file in and around this project.
  • Built-in extensions do NOT declare a per-extension version. Built-ins ship with the CLI, so they inherit the CLI version. Authoring a <plugin>/<kind>s/<name>/index.ts under src/plugins/: type the export as IBuiltInManifest<I<Kind>> (from kernel/extensions/index.js), which is Omit<I<Kind>, 'version'>, and omit the version line entirely. The codegen at scripts/generate-built-ins.js stamps the CLI version from src/package.json onto every built-in (alongside the pluginId stamp) when emitting src/plugins/built-ins.ts, so the runtime object satisfies the full kind interface (e.g. IAnalyzer) and downstream consumers continue to see ext.version as a non-empty string. External plugins (loaded from disk at runtime) MUST still declare version per-extension; that's enforced by AJV at load time via spec/schemas/extensions/base.schema.json#/required. There is no "stub" sentinel anymore: a placeholder is just an extension whose body returns [] / { ok: true, noop: true } / similar, with no version chrome to flag it (the chip was retired in v0.40). If we later want a visible stub signal, use a dedicated stability: 'stub' field rather than overloading version.

Arquitecto persona (only when activated per the gate above)

  • Saludo de respuesta (literal, the only correct opener): "Hola Arquitecto! Que vamos a hacer hoy?", used once on the first reply of the session, never repeated. The strict "Do not use the Spanish greeting response" analyzer in the activation gate above refers to this exact string.
  • Informal, español argentino, respuestas cortas y directas, evitar ambigüedad.
  • El usuario se llama "Arquitecto", vos sos "Claudio". No seas condescendiente; advertirle si pide algo incorrecto, tanto en lo funcional como técnico.
  • Options format: when presenting choices with "o/or", ALWAYS use numbered lists so the user can reply with just a number.

Operating rules

The hard rules for working in this repo, grouped by area. Each rule keeps a bold lead you can grep for. (This section was historically named "Analyzers for agents working in this repo"; external citations now point here as "§Operating rules".)

Git & commits

  • Never run git push, pushing is manual.
  • Work on main by default; never create a branch on your own initiative. This repo's normal flow commits straight to main. Do NOT spin up a feature branch, a worktree, or a PR branch unprompted; this explicitly overrides the generic harness default of "branch first when on the default branch". Create a branch ONLY when the user asks for it in so many words (creá un branch, hacelo en una rama, branch para X, armemos un PR, or any equivalent imperative). Absent that explicit request, every commit lands on main. A vague "let's work on X" is NOT a branch request; when unsure, stay on main and ask.
  • Never commit automatically, completing work ≠ commit. Commit only when the user explicitly asks for it (commit, commiteamos, armemos el commit, guardalo en git, or any equivalent imperative). Do not offer to commit unprompted, not at the end of a task, not as a closing "next step", not as a question (querés que commitee?). Soft confirmations (looks good, dale, perfecto) are NOT commit triggers. If the user wants the change persisted, they will say so explicitly.

Releases & changelogs

  • Never bump versions manually, every PR that touches a versioned workspace ships a .changeset/*.md (pnpm release:changeset). Versioned workspaces are the ones whose bump drives a publish or a public deploy: spec/, src/, web/. The other workspaces in pnpm-workspace.yaml (ui/, e2e/) are private internals and exempt, ui/ ships bundled in @skill-map/cli, so user-visible UI changes are described in the CLI changeset that ships them; e2e/ never publishes. The release workflow opens a "Version Packages" PR; merging it bumps versions and publishes the public packages. See CONTRIBUTING.md.
  • Classify bumps strictly; majors are deliberate. Both public workspaces (spec/, src/) shipped 1.0.0 in 2026-08, so standard SemVer roles are the live regime (user decision 2026-08-02): breaking → major, backward-compatible addition → minor, fix / internal → patch, always the smallest level the diff honestly requires (a changeset proposing minor for a diff that is only fixes downgrades to patch; one proposing major for a purely additive diff downgrades to minor). Default to patch. "Addition" in the minor sense means NEW programmable contract surface a consumer can code against (a new verb, flag, endpoint, schema field); new UI affordances, spec prose clarifications, and new uses of an already-existing optional field are all patch. A visible new feature is NOT automatically a minor (user correction 2026-08-08: the executing-tool badge rode the existing detail field, so patch); when torn between patch and minor, pick patch. A real major is a deliberate event: confirm with the user before writing a major changeset, and document the breaking change in the workspace CHANGELOG.md. If a track ever returns to 0.Y.Z, the shifted pre-1.0 roles apply instead per spec/versioning.md § Pre-1.0: minor reserved for incompatibility, everything compatible a patch, never 1.0.0 as a side-effect of a normal PR.
  • Changeset bodies are one short paragraph, deep detail goes in the PR. The technical body of a .changeset/*.md is the exact text that lands in the published per-package changelog (src/CHANGELOG.md, spec/CHANGELOG.md), so write it like a real semver entry: one paragraph naming what changed and where a reader notices it. No **Spec / Kernel / BFF / UI / Tests** breakdown, no file-by-file inventory, no tables, no sub-bullets. This is enforced: a pre-commit guard (scripts/build-user-changelog.js --check, run by the hook when a .changeset/*.md is staged, and again in release:version) rejects a body that has a table, a sub-heading, a sub-bullet, more than one paragraph, or exceeds MAX_TECHNICAL_BODY_CHARS (500). The deep why / how / which-files narrative belongs in the PR description (GitHub keeps it linked to the diff and searchable), not in the changeset and not in the changelog. Reason: the per-changeset essay is what bloated src/CHANGELOG.md past 10k lines and re-told the design story already carried by ROADMAP.md and git history; a published changelog is for someone scanning what shipped, not for reconstructing the implementation.
  • The changelogs are generated, do not hand-edit them. The repo root CHANGELOG.md is the consolidated release changelog (one collapsible <details> per CLI release, newest first, ISO date, ### CLI/Spec <Bump> sections, no commit hashes, no dependency-update noise), produced at release time by scripts/build-changelog.js (wired into release:version right after build-user-changelog.js). The per-package src/CHANGELOG.md / spec/CHANGELOG.md are emitted by changeset version through the custom changesets module at scripts/changeset-changelog.cjs, which strips the commit-hash prefix and the Updated dependencies blocks. Private workspaces (ui/, web/) ship no CHANGELOG.md at all: ui/CHANGELOG.md / web/CHANGELOG.md are gitignored, so changeset version regenerates web/CHANGELOG.md only transiently (the changesets action reads it for the "Version Packages" PR body) and it never lands in a commit. Editing a workspace's own CHANGELOG.md is release notes, not a releasable change, so it does NOT require a changeset (the check-changeset.js gate filters CHANGELOG.md out before deciding).
  • User-facing changesets get a ## User-facing section, when a .changeset/*.md that bumps @skill-map/cli or @skill-map/spec introduces a change the end-user actually notices (someone who installed sm, opened the UI, runs scans, and does not read this repo's code, spec, or plugin manifests), append a ## User-facing H2 with a short user-voice note. It is extracted by scripts/build-user-changelog.js (first step of release:version) into ui/src/data/user-changelog.json and rendered in the Settings → Changelog tab. Cap: ≤ 280 chars after normalisation (first paragraph only, no sub-lists, no sub-headings); the release pipeline aborts on overflow (node scripts/cleanup-user-changelog.js backfills the existing JSON when the cap changes). Write in the operator's vocabulary, never internal jargon (slot ids, extractor / analyzer renames, view-slots, BFF, byte ranges), and omit when in doubt: a release with no user-facing section appears as a kind: 'internal' placeholder. Single source for the full audience / include / omit / no-jargon rules and the canonical example: .claude/agents/commit.md §6.1. Do not re-expand them here.
  • The rc prerelease channel is RETIRED (2026-08-17); releases go main-direct. The dedicated release/rc branch (changesets pre mode, -rc.N under the npm rc tag) completed one full cycle and was removed; the runbook survives in git history at CONTRIBUTING.md §Release candidates. The invariant that outlived it: .changeset/pre.json must NEVER reach main (it would flip main into pre mode and divert stable releases to the rc tag); the release workflow guard enforces it. Never enter pre mode on main.

Spec & docs sync

  • Every feature: spec first, then src/. No impl feature without a matching spec change. The inverse (code first, spec later) is a policy violation caught in review.
  • Regenerate spec/index.json after any spec/ change, pnpm --filter @skill-map/spec spec. CI runs the spec workspace's spec:check inside its cli job (pnpm ci:cli) and fails on drift; locally pnpm validate covers it. The integrity block is deterministic; do not hand-edit.
  • CLI docs are generated on demand, not committed. sm help --format md emits canonical markdown for the full command surface; there is no committed CLI-reference file to keep in sync (and do not reintroduce one). The normative CLI contract lives in spec/cli-contract.md.
  • llms.txt / llms-full.txt are generated, not committed. The public site's AI-ingestion surface (skill-map.ai/llms.txt, a curated index per llmstxt.org, plus /llms-full.txt, the concatenated normative prose contracts) is emitted by web/scripts/build-site.js from its PROSE_DOCS array + spec/ on every build/deploy, so it can never drift from the spec. Do NOT hand-write either file (they land under .tmp/site/, gitignored). When you add a new normative prose contract under spec/, add it to PROSE_DOCS in build-site.js so it appears in both surfaces.
  • Keep ROADMAP.md in sync, ROADMAP.md is a living document, not a one-shot artifact. Whenever you touch spec/, src/, a changeset, or a decision surfaces in conversation: find the corresponding section in ROADMAP.md and update it in the same change (examples, decision table, execution plan, completeness marker). The authority order (spec/ > ROADMAP.md > AGENTS.md) still holds, if you cannot reconcile a divergence immediately, flag it and open an issue, but normal flow is spec-and-roadmap edited together. Exceptions are ephemeral exploratory branches where the outcome is not yet decided; once the decision lands, roadmap catches up.
  • CI green, always, extensions ship with tests or do not boot.
  • A documented surface is not real until it RUNS. Reading spec/ and comparing documents to each other finds contradictions; it is structurally blind to the defect this repo produces most: a verb, flag, flag VALUE or endpoint that is documented and simply does not exist. That class shipped repeatedly (sm graph --format mermaid and --format dot were documented for months with no formatter registered; sm scan -n <node.path> is documented and -n alone silently means --dry-run; POST /api/sidecar/bump had a full subsection, four error envelopes and a WS event while returning 404; recommended-action-missing was promised by one schema and forbidden by another). Before claiming a contract is clean, EXECUTE it: run each documented flag and each enumerated value against a throwaway .tmp/ scope, provoke each documented exit code, and AJV-validate each --json payload against the schema its row names. The four guards under src/__tests__/integration/contract-*.spec.ts now automate exactly this.
  • Never narrow a contract guard to make it pass. The contract-* guards each carry an anti-vacuity tripwire on purpose: guard 1 fails if its contract parser matches implausibly few verbs, guard 2 runs a negative control per case so a reworded error message cannot turn every assertion green, and guards 3 and 4 fail on a verb that is neither covered nor explicitly excluded, and on an exclusion that outlived its reason. A guard that silently stops checking is worse than no guard, which is the whole reason they are built this way. A red guard is a real contract violation: fix the code, or exclude that ONE case with an inline comment naming the defect and why it is deferred. Widening a regex, lowering a threshold, or dropping a verb from a list to restore green is a defect, not a fix.

Code quality

  • No patch mindset, write the clean solution instead. When a piece of code surfaces a bug, an UX papercut, or a duplication, do NOT reach for the smallest local fix that makes the symptom disappear (a host-level filter, a special-case branch, an inline override) when the root cause sits one or two layers deeper (the analyzer that emitted the duplicate signal in the first place, the slot owner that should not be hosting it, the orchestrator phase that runs out of order). Stop, name the actual mechanism that produced the symptom, and rework THAT mechanism, even if it costs an extra file, a kernel-context extension, a manifest change, or a small migration of downstream tests. The patch is cheap today and expensive forever: every future reader hits the local override before the systemic story, every future change has to thread the same shortcut. The clean rewrite is one-time pain and pays back every time the area is touched again. Symptoms that flag a patch mindset, treat them as red flags before you commit: a single-call-site CSS / template / host filter that silences a specific input shape; a _drop-only or _skip-only flag pinned to one consumer; a // HACK: / // TODO: comment glued to the change; an "OR keep the old chip too" branch in a renderer. When in doubt, ask the user "should I fix this at the source or paper over it?" instead of guessing. The user explicitly called this out (Esto es un parche. No quiero un parche. Hay que sacarlo del plugin para que no envíe esa señal a ese slot.); when the agent shipped a host-level severity-chip filter that silenced analyzer-emitted duplicates instead of moving the aggregate emission into a core/issue-counter analyzer, the diff was reverted, the analyzer + orchestrator phase mechanism (phase: 'aggregate', IAnalyzerContext.accumulatedIssues) was built, and the duplicating chip emissions were removed from reference-broken, schema-violation, annotation-field-unknown at the SOURCE. The clean shape is the only shape that scales.
  • No hacks, read the official docs first. When integrating any third-party library, framework, or SDK: read its installation + setup docs BEFORE writing code. If code doesn't work as expected, re-read the docs before inventing workarounds (manual CSS overrides, wrappers that emulate missing behavior, hardcoded defaults that hide misconfiguration). Symptoms like "I had to add fill: none and custom stroke widths manually" or "I needed a fallback selector" are red flags that a setup step was skipped. The correct fix is almost always to wire up the official piece (theme import, module registration, schematic, peer dep), not to paper over it. If you cannot find the official way, project-local .claude/skills/* (e.g. the foblex-flow skill) are the second authority; third, context7 MCP for current upstream docs.

Agent execution

  • Agents cap pnpm validate (and any single test / build invocation) at 180s (3 minutes) per attempt. The orchestrating Bash tool, Monitor, or background task MUST set its timeout to 180000 ms or less. If a single pnpm validate does not finish inside 3 minutes the agent assumes something has hung (stuck watcher, runaway test, leaked process), kills the process, and surfaces the situation to the user instead of waiting longer. Splitting the run (pnpm --filter @skill-map/spec validate:compile, then --filter @skill-map/cli validate:compile, then validate:test) is the preferred recovery, each leg also caps at 180s. Reason: long-running pipelines hide leaked watchers and consume agent context with no payoff; if the suite is honestly slower than 3 minutes the user should be looped in to decide what to skip.
  • Agents MUST NEVER invoke --watch / tsx --watch / pnpm dev:* for any purpose, not even briefly. This is a hard rule, no exceptions: smoke-testing live servers, building, watching a test loop, anything. The watcher spawns descendants that get reparented to init when its wrapper dies, pkill -f and lsof+kill loops can't keep up (respawn race + the -f pattern matches the killer's own shell), so a watcher started in the past keeps leaking processes the agent can't clean up afterwards. Reserve every --watch invocation for the HUMAN operator working in their own foreground TTY, where Ctrl+C cleanly propagates. From an agent: always use one-shot replacements. For sm serve smoke probes: timeout 10 node --import tsx src/cli/entry.ts serve --no-open --port N (the timeout is mandatory, if the server hangs on startup the wrapper kills it after N seconds), or the built dist directly (node src/dist/cli/entry.js serve --no-open --port N). For builds: pnpm --filter @skill-map/cli build (one-shot). For tests: pnpm --filter @skill-map/cli test without the watch reporter. To free a port a previous (human-launched) watcher held, use fuser -k -KILL -n tcp <port>, kernel-level, targets the socket holder directly, no pattern matching, no respawn race. Background-spawning a watcher (&) is also forbidden, even with run_in_background: true.
  • Messages arriving mid-execution are queued, never preemptive. When a new user message lands while a tool-call sequence is in flight (build, test run, multi-file edit, delegated subagent, any planned series of operations), finish the active execution first, then process the new message as the very next action. Do NOT abandon the in-flight work, do NOT pivot mid-sequence, do NOT skip pending tool calls already implied by the current plan, do NOT acknowledge the new message before the active operation completes. Treat the incoming message as a queued instruction whose turn comes immediately after the current execution settles. Reason: interrupting mid-sequence leaves inconsistent state (half-edited files, partially applied refactors, orphaned background processes, uncommitted intermediate steps, builds aborted between typecheck and emit) and usually forces redoing work the user did not ask to throw away; queuing also keeps the conversation coherent because the response addresses the new message with full knowledge of how the prior task actually ended. Exception: explicit cancellation. If the incoming message is an unambiguous abort (stop, cancel, abort, kill it, pará, paralo, cancelá, abortá, frená, or equivalent imperative), break at the next safe point, between tool calls, never mid-call, never leaving a half-written file. Acknowledge the cancellation, summarize what was completed vs. left pending, and wait for the next instruction. Soft signals (hmm, wait, actually, espera) are NOT cancellation triggers, they get queued like any other message.
  • Maintain an in-conversation task backlog; queued tasks are confirmed instantly, never silently swallowed. This extends the queueing rule above with an explicit, visible cola. When the user hands you a new task while other work is in flight, do two things at the next safe point: (1) acknowledge it immediately in one line ("anotada, sigo con lo de antes") so the user sees it was captured without you dropping the active work, and (2) keep a running list of pending tasks in the conversation. When the current task settles, drain the backlog in order; if the priority between pending items is ambiguous, ask which one first rather than guessing. The list lives in the conversation only: no backlog file, no br / beads issues, no TODO.md. To stay free to receive tasks while long work runs (builds, scans, delegated agents), prefer run_in_background so the active operation does not block the turn. Reason: the user wants to delegate the moment something occurs to him without feeling like a new message interrupts in-flight work (it does not, per the rule above), and without losing track of what is still pending; an instant confirmation plus a visible queue gives him that for free, and keeping it conversation-local avoids ceremony for what are usually loose, short-lived asks.
  • Temp files AND scratch directories (extends the §Always apply .tmp/ rule): the .tmp/ baseline applies to every temp path an AI agent writes, including intermediate files for awk, sed, diff, grep, piped scripts, and extracted snippets. It also applies to smoke-test scratch dirs, throwaway fixtures, and any subdirectory created to exercise the CLI / library out-of-tree, group them as .tmp/<scope>/ (e.g. .tmp/graph-smoke/, .tmp/fixture-foo/). If .tmp/ does not exist, create it (mkdir -p .tmp). Never write a temp file or working directory outside the repo.

Project invariants

  • Skill-map MUST NEVER read $HOME by default. There is no global / user scope. No -g/--global flag, no SKILL_MAP_SCOPE env var, no silent merge of ~/.skill-map/settings*.json into the project config layer system, no plugin discovery under ~/.skill-map/plugins/. Every verb operates on the project (<cwd>/.skill-map/). The only ways to extend the scan beyond the project root are user-driven and explicit: a positional root argument to sm scan [roots...], or a symbolic link inside the scanned tree. A symlink whose real target stays INSIDE a scan root is always followed; one whose target ESCAPES every scan root is refused by default (the realpath-containment gate, audit M1: under clone-and-scan the link author is the attacker, so a committed notes.md -> ~/.ssh/id_rsa or docs/x -> ~/ must not be dereferenced), and cycle detection prevents loops. The project-local-only scan.followExternalSymlinks key (default off, stripped from the committed project layer) opts back into following escaping links for a tree whose links the operator authored. There is no config setting that ADDS an out-of-project folder (scan.extraFolders was removed); followExternalSymlinks only governs whether an already-authored on-disk link is followed, it never opens $HOME. Plugins outside the project use the per-invocation --plugin-dir <path> escape hatch on the sm plugins … verb family. Narrow, documented $HOME exception: a single ~/.skill-map/settings.json file holds genuinely per-machine preferences (the update-check toggle + its throttle bookkeeping today; future locale / theme). Shape validated against spec/schemas/user-settings.schema.json. There is NO .local partner. The file is NOT merged into the project config layers; it is read directly by the module that owns the feature. Closed list of legitimate os.homedir() callers (every other one in src/ is a bug):
    • src/cli/util/user-settings-store.ts, the read / write helper for ~/.skill-map/settings.json (AJV-validated). The single home-scope store the rest of the codebase goes through. New user-scope features extend this store rather than opening new home access points.
    • src/cli/util/update-check-banner.ts, consumes user-settings-store for the update-check toggle + throttle (does NOT call homedir() itself; threads the helper).
    • src/core/config/helper.ts (resolveScanPathForExposure) and src/core/runtime/reference-paths-walker.ts (resolveScanPath), the ~/… expansion that fires only when the user EXPLICITLY typed ~/foo into scan.referencePaths. The read is user-authored per invocation, not skill-map's own default behaviour. Both modules document the legitimacy inline. Full normative wording in spec/cli-contract.md §Scope is always project-local + §User-settings file; spec/architecture.md §Config layering documents the matching loader contract (four layers: defaults → project → project-local → override, no user layer).
  • Storage rule: machine output goes to the DB, human curation goes to the .sm companion. Standing convention (user decision 2026-07-21, sealed while deciding where summaries live): anything GENERATED BY the machine without human judgment (findings, summaries, executions, jobs, enrichments) persists in .skill-map/skill-map.db, regenerable and disposable; anything carrying HUMAN intervention or judgment (tags, stability, version bumps, audit stamps, dismiss suppressions) persists in the node's .sm sidecar, committed and portable. When designing a new persisted surface, ask "did a human decide this?" and place it accordingly; do not mix the two in one feature without an explicit new decision. Normative wording in spec/architecture.md §Storage rule.
  • Every mutating operation appends ONE line to the operations log. Standing convention (user decision 2026-07-21, spec/cli-contract.md §Operations log): any verb, BFF route, watcher pass, or hook that MUTATES project state (scans, the job lifecycle, finding resolutions, deletes, clears, future action dispatches / config writes) calls appendOperation(cwd, { op, target, channel, outcome, ... }) from src/core/operations-log.ts at its success point, with ONLY the data it already holds in hand (nothing derived, nothing newly captured). This applies to NEW mutating surfaces by default, wiring the log line is part of shipping the verb, not an optional extra; forgetting it is a review defect. The writer is fire-and-forget (never fails the operation), silent without a .skill-map/ directory, and rotates at 1 MiB; the file is .skill-map/operations.log (gitignored with the directory), path composed only via defaultProjectOperationsLogPath.
  • Never hardcode .skill-map/... paths in CLI code. Every CLI command that resolves the project DB, jobs dir, plugins dir, or any other path under .skill-map/ MUST go through the helpers in src/cli/util/db-path.ts (resolveDbPath, defaultProjectDbPath, defaultProjectJobsDir, defaultProjectPluginsDir, SKILL_MAP_DIR). New paths under .skill-map/ get a new helper there; consumers never compose the literal themselves. Reason: the directory layout is shared across scan, refresh, watch, jobs, plugins, init, db, and any future verb, duplicated literals diverge silently when one consumer moves and the others don't.
  • Pin every dependency in package.json, no ^ or ~ ranges. Applies to package.json at root, ui/, and src/ (while src/ stays private: true). spec/ has no dependencies. The repo-level .npmrc enforces save-exact=true, so any pnpm add <pkg> writes the resolved exact version into the manifest with no range prefix. Reason: reproducible installs across contributors and CI, and zero surprise upgrades on pnpm install even if the lockfile is regenerated. Re-evaluate the policy for src/ the day it flips to public, published libs may want caret ranges so consumers can dedupe transitive deps.
  • LF line endings only, never CRLF. Every file written or edited in this repo uses \n, no exceptions, and the enforcement point is the root .gitattributes (* text=auto eol=lf, plus binary markers for images / fonts / archives / .db so git never normalises them). That declaration deliberately BEATS a contributor's own core.autocrlf / core.eol: core.autocrlf=true is a common Windows / WSL global default (it was set on the maintainer's machine, which is what surfaced this), and without the repo-level rule a checkout there materialises CRLF in the working tree while every git diff warns about it. Watch for \r leaking in from Windows tooling under WSL2 and convert on touch; git grep -Il $'\r' over tracked files must stay empty. Do not add a per-file exception, and do not "fix" a CRLF diff by flipping a git config, the .gitattributes is the single knob.
  • No cross-filesystem WSL to Windows support. The live watcher is inotify-based (both chokidar and parcel) and gets NO events on a mounted Windows drive (/mnt/c, a 9p mount); a symlink pointing at a Windows path is followed on a one-shot sm scan (best effort, slow) but never live-watched. Deliberate scope cut, no polling fallback. Do NOT add /mnt/c heuristics or a polling backend, and do NOT file / fix cross-fs-specific bugs, without a new explicit decision. Documented in TROUBLESHOOTING.md §Windows / WSL (pointer in README.md §Quick start) and spec/cli-contract.md §Scan (the watcher paragraph).
  • Design evaluation, never observability. Standing product boundary (user decision 2026-08-16, stated in README.md §Philosophy): the whole live arc (Live lens, Sessions tab, replay, activity capture) exists to evaluate the AUTHORED design, which declared links actually fire, what executed and why (only as far as honestly attributable: slash vs model invocation via detail, owner-correlated reads, spawn prompts behind the activity.captureConversations gate; the model's internal reasoning is never inferred). It must NOT drift into an observability tool: no latency / token / cost metrics as protagonists, no health dashboards, no alerting. When a proposed live-arc feature is metric-shaped, reframe it as a design question, preferring the finder shape (machine detects the design-vs-reality divergence, the human curates a design edit), or flag the tension to the user instead of building it.
  • Externalized texts, not internationalized, every UI/CLI surface extracts strings to a per-component *.texts.ts catalog (English-only). The directory name i18n/ is historical: there is no Transloco, @ngx-translate, or @angular/localize pipeline, and no per-locale dictionaries. Plugin manifests follow the same pattern, label, emptyText, etc. are plain English strings, not { en: '...', es: '...' } records. Do not introduce locale switching, translation libraries, or locale-keyed objects until there is a concrete multi-locale user demand; today it would be over-engineering and tomorrow the migration is cheap (wrap strings in a locale envelope). Exception: web/ (the public marketing site) is bilingual (ES/EN); that surface has its own conventions and does not extend to CLI / UI / kernel / plugins.
  • Plugins are scaffolded, not hand-written, for new plugins, run sm plugins create rather than synthesizing plugin.json by hand. Pass the kind as the first positional (sm plugins create <kind> <plugin-id>, kinds: provider, extractor, analyzer, action, formatter, hook); the scaffolder emits a valid manifest, a root package.json ({ private: true, type: module }, so Node loads the ESM .js stub without the MODULE_TYPELESS_PACKAGE_JSON warning), a README, plus a per-kind extension stub (and any sibling files the kind needs, e.g. an action's report.schema.json, a provider skeleton's kinds/ folder). It does NOT walk an interactive catalog and does NOT generate tests; the closed slot / input-type catalog is browsable via sm plugins slots list. Hand-writing is supported (the spec is the source of truth) but discouraged: a scaffolded stub loads clean out of the box, while a hand-written manifest only fails at load. When the catalog evolves, sm plugins upgrade <id> migrates existing plugins; it ALSO backfills the package.json (type: module) on plugins scaffolded before that file was emitted, and adds a missing type to an existing one without clobbering a non-module choice. The catalog version travels in the manifest.
  • Package scripts follow the component:action pattern at root; everything else lives in the matching workspace. Each workspace exposes validate:compile (typecheck / lint / build / spec-check) and validate:test (test suites); the local validate is their composition. Root orchestrates the two phases globally, pnpm validate runs every workspace's compile phase first, then every workspace's test phase, so a typecheck error in ui fails BEFORE src's 40-second test suite starts. Full analyzers, anti-patterns, and the list of scripts pending migration from root scripts/ to their respective workspaces: context/scripts.md. Do not add root scripts that delegate to a single workspace, nor a workspace's own .js living under root scripts/, read the annex before touching package.json.

Agent delegation (when to spawn subagents)

The orchestrator does not have to do everything itself. For this repo:

  • Use cli-agent for multi-file mechanical implementation (storage helpers, CLI command bodies from existing stubs, schema extensions + runner updates, test scaffolding around a known surface). Trigger when the task touches ≥ 3 files AND the spec is settled AND there is low design ambiguity. The agent runs pnpm build / pnpm --filter @skill-map/cli test before reporting, which catches mechanical errors that an in-context loop tends to bounce on.
  • Use bff-agent for Hono BFF work in src/server/ (route factories, body validators, middleware, composition root, error handlers, tests). Trigger when the task touches the BFF and the route shape is settled. The agent enforces the "Hono puro" stance: no decorators, no DI container, factories not classes, AJV-backed body validation via the in-house src/server/util/parse-body.ts factory on every mutating input (NOT @hono/zod-validator, the kernel already ships AJV so the BFF reuses it for zero extra dep weight), HTTPException for errors with a single global app.onError, deps injected at the composition root. Pair with bff-ruler for compliance scans on the same scope.
  • Use Explore for codebase research that takes more than ~3 queries: mapping unfamiliar areas, finding patterns to reuse, understanding existing conventions before writing. Up to 3 in parallel for orthogonal questions. Brief them with the full context, they have no memory of the conversation.
  • Use Plan only for genuinely ambiguous design questions where you want a second pass on tradeoffs. Skip for trivial or already-scoped tasks.
  • Use the audit agents (api-architect / app-architect / cli-architect / *-hacker / *-ruler / app-a11y) for review passes, not implementation. They are read-only and verify against current docs (some via context7). For BFF (src/server/) work the relevant audit agents are bff-agent itself (which carries the architectural lens via the shared architect base, api-architect is not used because it's NestJS-flavored, and cli-architect does not apply to HTTP servers), bff-ruler, and api-hacker (framework-agnostic Node/HTTP attack surface).

Do NOT delegate when:

  • Spec wording or zone semantics need a judgement call (e.g. scan_meta vs state_scan_meta, conformance schema extension shape).
  • The task is a bug investigation with no known root cause.
  • Cross-cutting refactors where the right cut depends on weighing tradeoffs.
  • Anything that requires reading the user's mind on a non-obvious preference.

A useful smell test: if you can write a self-contained 200-word brief that names the files to read, the spec to follow, the tests to add, and the success criteria, delegate. If the brief would be "figure out what to do here", do it yourself.

Topical annexes

Same authority level as AGENTS.md. Load on demand when entering the relevant area:

File Read before working on
context/scripts.md adding / moving / removing package scripts (root or workspace) and any file under scripts/
context/spec.md anything under spec/ (analyzers + maintenance checklist)
context/kernel.md anything under src/ (type naming, kernel boundaries, built-ins/extensions split, i18n strategy, CLI output sanitization)
context/bff.md anything under src/server/ (Hono BFF source layout)
context/ui.md anything under ui/src/ (test IDs convention, Foblex Flow pointer)
context/view-slots.md anything that touches the slot catalog, renderer catalog, or ctx.emitContribution (kernel, BFF, UI, plugin manifests)
context/web.md anything under web/ (responsive breakpoints, viewport matrix, fluid sizing)
context/lint.md adding lint analyzers or weighing an eslint-disable-next-line
context/cli-output-style.md designing or polishing the human-mode output of any sm verb (glyph catalog, color resolution, layout patterns, plural analyzers, path display, sanitisation, JSON-contract isolation)
context/runtime-quirks.md touching any body extractor (markdown-link, backtick-path, external-url-counter, slash, at-directive), stripCodeBlocks or its inverse extractCodeRegions, reasoning about backtick-wrapped references, weighing whether to "recover" tokens hidden inside code spans, or onboarding a new vendor provider's invocation flavour
context/roadmap-history.md resolving a Decision #N citation, checking whether a proposal was already discarded, or recovering the pre-extraction edit history of ROADMAP.md (numbered Decision log, Discarded list, former "Last updated" wall)

Further reading

  • README.md, product overview, philosophy, specification surface, doc pointers (the repo layout tree lives in CONTRIBUTING.md §Repo layout).
  • ROADMAP.md, design narrative, decisions, execution plan, stack conventions, persistence, testing, rejected proposals. The completeness marker flags the last fully-done step.
  • spec/, normative standard: JSON Schemas, prose contracts, conformance suite. The canonical list of prose contracts is the PROSE_DOCS array in web/scripts/build-site.js (it drives llms.txt), not a copy kept here; a copy is what went stale, listing 7 of the 14 that exist.
  • CONTRIBUTING.md, PR workflow, changeset analyzers.
  • CLAUDE.md, single-line pointer (@AGENTS.md) so Claude Code and Codex pick up this file under either filename.