Doc Sync logo

Doc Sync

Organization
aspenkit
doc-sync

Incremental skill updater that maps git diffs to affected skills and optionally auto-syncs via a post-commit hook

Overview

Publisheraspenkit
Repositoryaspens
Skill namedoc-sync
Stars
102
Forks
7
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by aspenkit on GitHub. Read the source before you install it.

Installation

Install the Doc Sync AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/aspenkit/aspens/tree/main/.agents/skills/doc-sync
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/aspenkit/aspens.git /tmp/aspens
mkdir -p .claude/skills
cp -r /tmp/aspens/.agents/skills/doc-sync .claude/skills/doc-sync
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Doc Sync in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Doc Sync on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Doc Sync is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

You are working on doc-sync, the incremental skill update command (aspens doc sync).

Key Concepts

  • Monorepo-aware: getGitRoot(repoPath) resolves the actual git root. projectPrefix (toGitRelative) computes the subdirectory offset. scopeProjectFiles() filters changed files to the project subdirectory. Diffs are fetched from gitRoot but file paths are project-relative.
  • Multi-target publish: configuredTargets() reads .aspens.json for all configured targets. chooseSyncSourceTarget() picks the best source (prefers Claude if both exist). LLM generates for the source target; publishFilesForTargets() transforms output for all other configured targets. graphSerialized and repoPath are passed through to the transform context for conditional architecture references and disk-based instructions file loading.
  • Backend routing: runLLM() from runner.js dispatches to runClaude() or runCodex() based on config.backend (defaults to source target's id).
  • Diff-based flow: Gets git diff HEAD~N..HEAD from git root, scopes changed files to project prefix, then feeds diff plus existing skill contents and graph context to the selected backend.
  • Changetype filter (Phase 1): isNoOpDiff() from diff-classifier.js skips the LLM call entirely on lockfile-only diffs and diffs touching zero code-bearing files. LOCK_FILES and CODE_BEARING_EXTS are the source of truth — extend them here, not at call sites.
  • Prompt path variables: Passes { skillsDir, skillFilename, instructionsFile, configDir } from source target to loadPrompt() for path substitution in prompts.
  • Refresh mode (--refresh): Skips diff entirely. Reviews every skill against the current codebase. Base skill refreshed first, then domain skills in parallel batches of PARALLEL_LIMIT (3). Also refreshes instructions file and reports uncovered domains. Refresh mode runs ensureRootKeyFilesSection before syncSkillsSection so the root file always carries a current Key Files block.
  • Deterministic section repair: repairDeterministicSections() runs a no-LLM pass that re-injects ## Skills, ## Behavior, and ## Key Files into the root instructions file from on-disk state. Called from the no-op / "up to date" sync paths so missing-section drift is fixed every invocation. The normal sync flow also runs the same Skills + Behavior + Key Files injection block on the canonical instructions file after the LLM step, so drift gets repaired whether or not the LLM produced an update.
  • Graph rebuild on every sync: Calls buildRepoGraph + persistGraphArtifacts (with source target) to keep graph fresh. graphSerialized return value is captured and forwarded to publishFilesForTargets for conditional Codex architecture refs. Graph failure is non-fatal.
  • Legacy v0.7 hub-block cleanup: notifyLegacyHubBlockIfPresent() surfaces a one-line notice on the first sync after upgrade when AGENTS.md/AGENTS.md still carries the legacy ## Key Files hub-counts block, so the diff that strips it isn't alarming. regenerateStaleCodeMap() force-rebuilds .claude/code-map.md on no-op syncs when it still carries the legacy **Hub files** block.
  • Graceful response handling: After LLM returns, if output has content but no <file> tags, treats it as "no updates needed" with a verbose-only warning. The prompt explicitly requests an empty response when nothing needs updating.
  • Graph-aware skill mapping: mapChangesToSkills() checks direct file matches via fileMatchesActivation() (from skill-reader.js) and also whether changed files are imported by files matching a skill's activation block.
  • Interactive file picker: When diff exceeds 80k chars and TTY is available, offers multiselect with skill-relevant files pre-selected.
  • Prioritized diff: buildPrioritizedDiff() gives skill-relevant files 60k char budget, everything else 20k (80k total). Cuts at diff --git boundaries.
  • Token optimization: Affected skills sent in full; non-affected skills send only path + description line.
  • Split writes: Direct-write files (.claude/, AGENTS.md, root AGENTS.md) use writeSkillFiles(). Directory-scoped AGENTS.md files (e.g. src/AGENTS.md) use writeTransformedFiles().
  • Skill-rules regeneration: After writing, regenerates skill-rules.json via extractRulesFromSkills() — only for targets with supportsHooks: true (Claude). Uses hookTarget from publish targets list.
  • findExistingSkills is target-aware: Uses target.skillsDir and target.skillFilename to locate skills for any target.
  • Git hook (monorepo-aware): installGitHook() installs at the git root with per-project scoping. Hook uses PROJECT_PATH derived from project-relative offset. Each subproject gets its own labeled hook block (# >>> aspens doc-sync hook (label) >>>) with a unique function name (__aspens_doc_sync_<slug>). Multiple subprojects can coexist in one post-commit hook. Hook skips aspens-only commits scoped to the project prefix. 5-minute per-project cooldown via /tmp/aspens-sync-<hash>.lock; logs to /tmp/aspens-sync-<hash>.log (truncated to last 100 lines past 200). Unlabeled v0.6-era blocks are auto-upgraded on re-install.
  • Force writes: doc-sync always calls writeSkillFiles with force: true.

Critical Rules

  • runLLM is called with allowedTools: ['Read', 'Glob', 'Grep'] — doc-sync must never grant write tools.
  • parseOutput restricts paths based on getAllowedPaths([sourceTarget]) — paths outside the allowed set are silently dropped.
  • Unparseable output is a soft warning — if LLM returns text without any <file> tags, doc-sync logs a verbose warning and treats it as "no updates needed" instead of throwing.
  • getGitDiff gracefully falls back from N commits to 1 if fewer available. actualCommits tracks what was used.
  • The command exits early with CliError if the source target's skills directory doesn't exist.
  • checkMissingHooks() in bin/cli.js only checks for Claude skills (not Codex — Codex doesn't use hooks).
  • dedupeFiles() ensures no duplicate paths when publishing across multiple targets.
  • Git operations use gitRoot — diffs, logs, and changed files are fetched from git root, not repoPath. File paths are then scoped via projectPrefix.
  • diff-classifier.js is a leaf module — graph-builder.js imports LOCK_FILES from it; never import from graph-builder back into the classifier.

References

  • Patterns: src/lib/skill-reader.js — GENERIC_PATH_SEGMENTS, fileMatchesActivation(), getActivationBlock()

Last Updated: 2026-05-11

Frequently asked questions

What does the Doc Sync AI skill do?

Incremental skill updater that maps git diffs to affected skills and optionally auto-syncs via a post-commit hook

Why use Doc Sync on TypingMind?

Because you install it once and use it with any model. Doc Sync is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Doc Sync in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/aspenkit/aspens/tree/main/.agents/skills/doc-sync. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Doc Sync?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Doc Sync?

As many as you like. As long as a model supports skills, you can use Doc Sync with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Doc Sync AI skill free?

Yes. It is published on GitHub by aspenkit under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇