agentleFS
SireJeffSireJeff/k0ntext/.github/copilot-instructions.md

k0ntext

Copilot instructions8 starsChanged 9 months agoMITView on GitHub

This is the k0ntext package (v3.8.0) - a unified AI context engineering tool that provides intelligent context for Claude Code, GitHub Copilot, Cline, Cursor, Windsurf, Aider, Continue, Antigravity, and Gemini. When users install k0ntext, they can run: The MCP server provides these tools: - search_context - Semantic search - get_item - Retrieve context item

The file

Show its rules and text

We split this copilot-instructions.md into the rules it gives an agent

13 rules. About 0 are common, 9 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈9

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Database Snapshots: - Create, restore, diff, and manage database snapshots

    line 60
  2. Very specific:

    When users install k0ntext, they can run:

    line 66
  3. Very specific:

    When contributing to k0ntext:

    line 110
  4. Distinctive:

    TypeScript: - All source is in TypeScript

    line 112
  5. Distinctive:

    Async/Await: - Use async/await for database operations

    line 113
  6. Distinctive:

    Testing: - Write tests for new features (Vitest)

    line 115
  7. Distinctive:

    Documentation: - Update README and docs/

    line 116
  8. Distinctive:

    When generating code for this project:

    line 143
  9. Distinctive:

    Follow TypeScript best practices

    line 144
  10. Distinctive:

    Use JSDoc for function documentation

    line 145
  11. Very specific:

    Consider cross-platform compatibility (Windows/macOS/Linux)

    line 147
  12. Distinctive:

    Use Vitest for new test files

    line 148
  13. Very specific:

    Follow existing patterns in src/ directory

    line 149

≈ “Common” is an estimate: at least 1 in 5 of the 3,779 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

K0ntext - Copilot Instructions

Project Overview

This is the k0ntext package (v3.8.0) - a unified AI context engineering tool that provides intelligent context for Claude Code, GitHub Copilot, Cline, Cursor, Windsurf, Aider, Continue, Antigravity, and Gemini.

Tech Stack

  • Language: TypeScript
  • Runtime: Node.js 18+
  • Database: SQLite + sqlite-vec (vector embeddings)
  • MCP: Model Context Protocol server
  • AI: OpenRouter API for intelligent analysis and embeddings
  • Testing: Vitest
  • CLI: Commander.js

Project Structure

k0ntext/
├── src/                    # TypeScript source code
│   ├── agent-system/       # TodoListManager, TimestampTracker
│   ├── agents/             # Smart agents (Cleanup, Performance, Drift, FactCheck)
│   ├── analyzer/           # Intelligent codebase analysis
│   ├── cli/                # CLI commands and REPL shell
│   ├── config/             # Centralized model configuration
│   ├── db/                 # SQLite database client and migrations
│   ├── embeddings/         # OpenRouter integration
│   ├── services/           # SnapshotManager and services
│   ├── template-engine/    # Handlebars template system
│   ├── template-sync/      # Template synchronization
│   ├── utils/              # Utilities (chunking, encoding)
│   └── mcp.ts              # MCP server
├── bin/                    # CLI entry point
├── agents/                 # AI agent definitions
├── skills/                 # RPI workflow skills
├── templates/              # Context templates
├── tests/                  # Vitest tests
└── docs/                   # Documentation

Key Commands

CommandDescription
npm installInstall dependencies
npm run buildBuild TypeScript to dist/
npm testRun test suite (watch mode)
npm run test:runRun tests once
npm run lintRun ESLint

Core Features

  1. Intelligent Analysis - OpenRouter-powered codebase understanding
  2. Semantic Search - Vector database with embeddings
  3. MCP Server - 10 tools + 6 prompts for AI assistants
  4. Cross-Tool Sync - Synchronize context across 9 AI tools
  5. Interactive REPL Shell - Auto-starts when running k0ntext with no arguments
  6. Template Sync - Keeps .claude/ directory up-to-date with package templates
  7. Database Snapshots - Create, restore, diff, and manage database snapshots
  8. Drift Detection - AI-powered documentation drift detection
  9. Git Hooks - Automatic context maintenance on commits

CLI Commands

When users install k0ntext, they can run:

CommandDescription
k0ntext initInitialize with intelligent analysis
k0ntext generateGenerate context files for all tools
k0ntext mcpStart MCP server
k0ntext syncSync across AI tools
k0ntext indexIndex codebase into database
k0ntext searchSemantic search across content
k0ntext statsDatabase statistics
k0ntext checkCheck if context files are outdated
k0ntext restoreRestore AI tool configs from backups
k0ntext cleanupClean up other AI tool folders
k0ntext validateValidate context files
k0ntext drift-detectAI-powered drift detection
k0ntext cross-syncSync across all AI tools
k0ntext hooksGit hooks management
k0ntext fact-checkValidate documentation accuracy
k0ntext sync-templatesSync .claude/ templates
k0ntext template-statusShow template sync status
k0ntext snapshotCreate/restore database snapshots
k0ntext migrateManage database migrations
k0ntext watchAuto-index file changes
k0ntext exportExport database
k0ntext importImport from exports
k0ntext performanceShow performance metrics

MCP Server Tools

The MCP server provides these tools:

  • search_context - Semantic search
  • get_item - Retrieve context items
  • add_knowledge - Store insights
  • analyze - Run intelligent analysis
  • get_tool_configs - View AI tool configs
  • query_graph - Traverse knowledge graph
  • get_stats - Database statistics
  • add_relation - Add relationships
  • find_path - Find paths
  • run_drift_check - Check documentation sync

Development Guidelines

When contributing to k0ntext:

  1. TypeScript - All source is in TypeScript
  2. Async/Await - Use async/await for database operations
  3. Error Handling - Provide clear error messages
  4. Testing - Write tests for new features (Vitest)
  5. Documentation - Update README and docs/

Key Dependencies

  • @modelcontextprotocol/sdk - MCP protocol
  • better-sqlite3 - SQLite database
  • sqlite-vec - Vector embeddings
  • commander - CLI framework
  • zod - Schema validation
  • handlebars - Template engine
  • ora - Spinner/progress indicators

Entry Points

  • CLI: bin/k0ntext.js -> dist/cli/index.js
  • MCP: dist/mcp.js
  • Main: dist/index.js

Database

  • File: .k0ntext.db (SQLite)
  • Schema: src/db/schema.ts
  • Client: src/db/client.ts
  • Migrations: src/db/migrations/

Copilot Behavior

When generating code for this project:

  • Follow TypeScript best practices
  • Use JSDoc for function documentation
  • Handle errors gracefully
  • Consider cross-platform compatibility (Windows/macOS/Linux)
  • Use Vitest for new test files
  • Follow existing patterns in src/ directory

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.