A community-driven registry for Claude, Cursor, Windsurf, Cline & more. Not affiliated with Anthropic.
Are you the author? Sign in to claim
Synchronize AI coding–agent knowledge files (rules, templates, guidelines) across your project.
Synchronize AI coding–agent knowledge files (rules, templates, guidelines) across your project.
knowhub is a lightweight CLI tool that synchronizes “resources” (local files, directories, or remote URLs) into one or more output locations within your project. It was designed with AI coding agents in mind—Cursor, Copilot, Windsurf, and more—so you can centrally manage coding guidelines, AI prompts, rule files, or shared snippets and distribute them across different directories without manual copying.
Running npx knowhub will:
This ensures that any AI-agent rules, templates, or shared knowledge files stay in sync project-wide, with minimal overhead.
npx knowhub to fetch and place resources—no subcommands needed (aside from init).overwrite: true | false. If false, existing outputs remain untouched; if true, outputs are overwritten.symlink property can be true (create symbolic links; auto-fallback to copy on Windows if symlinks aren't permitted) or false/omitted (duplicate files or directory trees).url are fetched via HTTP(S) and written as text files.path points to a directory, knowhub can recursively copy or symlink that entire directory tree into each output folder.--dry-run to see which files would be written or skipped, without modifying disk.Install knowhub as a development dependency:
npm install --save-dev knowhub
# or
yarn add --dev knowhub
# or
bun add --dev knowhub
knowhub searches for your configuration in these locations (in this order):
.knowhubrc (JSON or YAML).knowhubrc.json.knowhubrc.yaml or .knowhubrc.yml.knowhubrc.js.knowhubrc.tspackage.json, under a top-level "knowhub" fieldIf multiple files exist, the one with highest precedence is loaded. If no configuration is found, knowhub exits with an error.
Important: Environment variable expansion (e.g., ${API_TOKEN}) is not supported in JSON or YAML configuration files.
.knowhubrc.json and .knowhubrc.yaml: Use literal values or placeholders like "YOUR_API_TOKEN_HERE".knowhubrc.ts and .knowhubrc.js: Use process.env.API_TOKEN to access environment variablesExample comparison:
# ❌ This does NOT work in YAML/JSON files
headers:
Authorization: "Bearer ${API_TOKEN}"
# ✅ Use literal values in YAML/JSON files
headers:
Authorization: "Bearer YOUR_API_TOKEN_HERE"
// ✅ This works in TypeScript/JavaScript files
headers: {
Authorization: `Bearer ${process.env.API_TOKEN}`,
}
Resource SchemaEach entry in the resources array must conform to this schema:
/**
* One resource to be synchronized using the plugin architecture.
*
* - `plugin`: string (required) - Name of the plugin to use (e.g., "local", "http")
* - `pluginConfig`: object (required) - Plugin-specific configuration
* - `overwrite`: boolean (default: true) - Whether to overwrite existing files
* - `outputs`: string or string[] (required) - Output destination paths
*/
export type Resource = {
plugin: string; // e.g. "local", "http", "github"
pluginConfig: unknown; // Plugin-specific configuration object
overwrite?: boolean; // Default: true
outputs: string | string[];
};
knowhub comes with several built-in plugins:
"local")Handles local filesystem resources (files and directories).
// Plugin configuration
interface LocalPluginConfig {
path: string; // Local filesystem path
symlink?: boolean; // Create symlinks instead of copying (default: false)
}
Example:
- plugin: "local"
pluginConfig:
path: "./shared-rules/common-style.md"
symlink: true
overwrite: true
outputs: [".cursor/rules/common-style.md"]
"http")Fetches resources from HTTP(S) URLs with advanced features.
// Plugin configuration
interface HttpPluginConfig {
url: string; // HTTP(S) URL to fetch
headers?: Record<string, string>; // Custom headers
timeout?: number; // Timeout in milliseconds (default: 30000)
method?: string; // HTTP method (default: "GET")
body?: string; // Request body for POST/PUT
}
Example:
- plugin: "http"
pluginConfig:
url: "https://example.com/api-spec.json"
headers:
Authorization: "Bearer YOUR_API_TOKEN_HERE"
Accept: "application/json"
timeout: 10000
overwrite: true
outputs: ["src/assets/api-spec.json"]
Below is a minimal .knowhubrc.yaml that demonstrates common use cases:
# .knowhubrc.yaml
resources:
# 1) Local Markdown file, symlink to two outputs, overwrite if exists
- plugin: "local"
pluginConfig:
path: './shared-rules/common-style.md'
symlink: true
overwrite: true
outputs:
- '.cursor/rules/common-style.md'
- '.github/copilot-instructions.md'
# 2) Remote YAML (URL), copy to two outputs, skip overwriting existing files
- plugin: "http"
pluginConfig:
url: 'https://raw.githubusercontent.com/YourOrg/ai-rules/main/security-guidelines.yaml'
overwrite: false
outputs:
- '.windsurfrules'
- 'docs/ai/security-guidelines.yaml'
# 3) Local UI widgets directory, recursively copy into output, overwrite existing
- plugin: "local"
pluginConfig:
path: './shared-rules/ui-widgets'
overwrite: true
outputs:
- 'components/ui-widgets'
# 4) Local PDF, copy and overwrite
- plugin: "local"
pluginConfig:
path: './shared-rules/compliance.pdf'
overwrite: true
outputs:
- 'docs/ai/compliance.pdf'
# 5) Remote JSON with custom headers
- plugin: "http"
pluginConfig:
url: 'https://example.com/api-spec.json'
headers:
Authorization: "Bearer YOUR_API_TOKEN_HERE"
Accept: "application/json"
timeout: 10000
overwrite: true
outputs:
- 'src/assets/api-spec.json'
You can also place this in a TypeScript file (.knowhubrc.ts) or JSON (.knowhubrc.json) with the same structure:
// .knowhubrc.ts
import type { Config } from 'knowhub';
const config: Config = {
resources: [
{
plugin: "local",
pluginConfig: {
path: './shared-rules/common-style.md',
symlink: true,
},
overwrite: true,
outputs: ['.cursor/rules/common-style.md', '.github/copilot-instructions.md'],
},
{
plugin: "http",
pluginConfig: {
url: 'https://raw.githubusercontent.com/YourOrg/ai-rules/main/security-guidelines.yaml',
},
overwrite: false,
outputs: ['.windsurfrules', 'docs/ai/security-guidelines.yaml'],
},
{
plugin: "local",
pluginConfig: {
path: './shared-rules/ui-widgets',
},
overwrite: true,
outputs: ['components/ui-widgets'],
},
{
plugin: "local",
pluginConfig: {
path: './shared-rules/compliance.pdf',
},
overwrite: true,
outputs: ['docs/ai/compliance.pdf'],
},
{
plugin: "http",
pluginConfig: {
url: 'https://example.com/api-spec.json',
headers: {
Authorization: "Bearer ${API_TOKEN}",
Accept: "application/json",
},
timeout: 10000,
},
overwrite: true,
outputs: ['src/assets/api-spec.json'],
},
],
};
export default config;
npx knowhubSimply run this in your project root:
npx knowhub
The tool will:
Find and load your configuration.
Validate that each resource has a valid plugin name, proper pluginConfig, a boolean overwrite (defaults to true), and one or more outputs.
Fetch each resource using the specified plugin:
Copy, Symlink, or Write each resource into every output path:
overwrite.overwrite.overwrite.Print Summary:
overwrite: false or content is identical.Dry-run preview: To see what would happen without modifying anything, run:
hljs language-bashnpx knowhub --dry-runThis prints, for each resource and output, whether it would copy, symlink, or skip.
Quiet mode: To suppress all output (useful for CI/CD), run:
hljs language-bashnpx knowhub --quiet
Custom config path: If your config file is not in the default location, specify:
hljs language-bashnpx knowhub --config ./config/my-knowhub.yaml
Suppose you maintain a centralized set of Cursor Rules in a shared folder (./ai-rules/cursor). To distribute them to each project’s .cursor/rules folder:
# .knowhubrc.yaml
resources:
- plugin: "local"
pluginConfig:
path: './ai-rules/cursor'
overwrite: true
outputs:
- '.cursor/rules'
Running npx knowhub will recursively copy everything under ./ai-rules/cursor/* into .cursor/rules/*.
If you keep your Copilot instruction file in a single location (./ai-rules/copilot/instructions.md), and you want to place it in .github/copilot-instructions.md:
resources:
- plugin: "local"
pluginConfig:
path: './ai-rules/copilot/instructions.md'
symlink: true
overwrite: true
outputs:
- '.github/copilot-instructions.md'
On POSIX systems, this will create a symlink:
.github/copilot-instructions.md → ../ai-rules/copilot/instructions.md
On Windows, if symlinks aren't allowed, it will copy the file instead.
If your Windsurf configuration is hosted remotely:
resources:
- plugin: "http"
pluginConfig:
url: 'https://raw.githubusercontent.com/YourOrg/ai-rules/main/windsurf-config.yaml'
overwrite: false
outputs:
- '.windsurfrules'
- 'docs/ai/windsurf-config.yaml'
Running npx knowhub will fetch the YAML text and write it to .windsurfrules and docs/ai/windsurf-config.yaml, unless those files already exist.
To copy a folder of AI prompt templates (./ai-templates) into two places:
resources:
- plugin: "local"
pluginConfig:
path: './ai-templates'
overwrite: true
outputs:
- 'src/ai/prompt-templates'
- 'docs/ai/prompt-templates'
This recursively copies all files and subdirectories from ./ai-templates/* into src/ai/prompt-templates/* and docs/ai/prompt-templates/*.
For APIs requiring authentication or custom headers:
resources:
- plugin: "http"
pluginConfig:
url: 'https://api.internal.com/config.json'
headers:
Authorization: "Bearer YOUR_API_TOKEN_HERE"
X-Team: "frontend"
Accept: "application/json"
timeout: 15000
overwrite: true
outputs:
- 'config/api-settings.json'
This fetches from an authenticated API with custom headers and a 15-second timeout.
Integrate knowhub into your continuous-integration pipeline to ensure that generated outputs remain in sync with your configuration. For example, in GitHub Actions:
name: Sync AI Agent Knowledge
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
sync-ai-agent-knowledge:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
- name: Install dependencies
run: npm ci
- name: Run knowhub
run: npx knowhub
- name: Commit updated outputs
run: |
git config user.name "github-actions"
git config user.email "actions@github.com"
git add .
git diff --quiet || git commit -m "chore: update AI agent knowledge files"
git push
npx knowhub to update all outputs.knowhub supports a powerful plugin system that allows you to extend its functionality with custom resource fetchers. You can create plugins to fetch from APIs, databases, cloud services, or any other data source.
knowhub automatically loads plugins specified in your configuration, eliminating the need for manual registration:
# .knowhubrc.yaml
plugins:
- "./plugins/github-plugin.ts"
- "./plugins/my-custom-plugin.js"
- "./node_modules/knowhub-slack-plugin"
resources:
- plugin: "github"
pluginConfig:
owner: "company"
repo: "standards"
path: "rules.md"
token: "${GITHUB_TOKEN}"
outputs: [".cursor/rules.md"]
Add custom plugins to your knowhub configuration using the plugins field:
.ts, .js)Example with multiple plugin types:
// .knowhubrc.ts
import type { Config } from 'knowhub';
const config: Config = {
plugins: [
"./plugins/github-plugin.ts", // Local TypeScript plugin
"./plugins/slack-plugin.js", // Local JavaScript plugin
"knowhub-jira-plugin", // NPM package plugin
],
resources: [
{
plugin: "github",
pluginConfig: {
owner: "company",
repo: "coding-standards",
path: "cursor-rules.md",
token: process.env.GITHUB_TOKEN,
},
outputs: [".cursor/rules.md"],
},
{
plugin: "slack",
pluginConfig: {
channel: "engineering",
messageId: "12345",
token: process.env.SLACK_TOKEN,
},
outputs: ["docs/announcements.md"],
},
],
};
export default config;
local (filesystem), http (HTTP/HTTPS requests)examples/ directory for plugin development guides and sample implementationsFor detailed instructions on creating your own plugins, including a complete GitHub plugin example, see the Plugin Development Guide in the examples/ directory.
The guide covers:
This project is licensed under the MIT License. See the LICENSE file for details.
Template para nuevos proyectos con Claude Code: CLAUDE.md, slash commands y documentación automática
Visual, example-driven guide with copy-paste CLAUDE.md templates for quick setup
Portable skills, agents, and templates that add Spec-Driven Development and TDD workflows to any Claude Code project. De
ATLAS: a senior-engineer layer for Claude Code. Explore with wireframes & prototypes, clarify the essentials, capture it