agentleFS
innomoninnomon/classifier-rag/.agents/skills/classifier/SKILL.md

classifier

Skill0 starsChanged 8 months agoMITView on GitHub

A Retrieval-Augmented Classification system implemented in Go using YZMA (llama.cpp) for local embeddings and PostgreSQL with pgvector as a vector database. The classifier binary supports several subcommands: When running in serve mode, the following tools are available to AI assistants: CLASSIFIER can be configured via config.yaml, environment variables, or CLI flags.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. srinidhis05/agentura★ 9same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    When running in serve mode, the following tools are available to AI assistants:

    line 38
  2. Distinctive:

    Build: No CGo required (yzma uses purego, pgx is pure Go).

    line 59
  3. Very specific:

    Use get_topic to determine the intent or category of a user's query for routing to specialized agents.

    line 70
  4. Distinctive:

    When adding entries, use representative phrases for each topic to improve classification accuracy.

    line 71
  5. Very specific:

    Ensure YZMA_LIB is correctly set and the PostgreSQL server has pgvector enabled.

    line 72

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill 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
SKILL.md

classifier Skill

A Retrieval-Augmented Classification system implemented in Go using YZMA (llama.cpp) for local embeddings and PostgreSQL with pgvector as a vector database.

Capabilities

  • Local Embeddings: Generates vector embeddings for text using GGUF models via llama.cpp.
  • Automatic Prefixing: Prepends classification: to text if missing for optimal model accuracy.
  • Topic Classification: Classifies user queries into topic names using vector similarity search in PostgreSQL.
  • Vector Search: Performs similarity search using PostgreSQL's pgvector extension and HNSW indexing.
  • OpenAI-Compatible API: Provides a /v1/chat/completions endpoint for easy integration with existing LLM tools.
  • MCP Server: Exposes classification operations as Model Context Protocol (MCP) tools.
  • Data Portability: Supports JSONL-based export and import of classification mappings.

Core Components

  • rag.go: Core RAG logic including embedding generation and PostgreSQL/pgvector operations.
  • mcp_server.go: MCP server implementation and tool definitions.
  • api.go: OpenAI-compatible HTTP API implementation.
  • main.go: CLI entry point and handcrafted command registry.

Usage Guide

CLI Commands

The classifier binary supports several subcommands:

  • add <topic> <content>: Add a query-to-topic mapping to the classifier.
  • query <text>: Classify the input text and return the best-matching topic.
  • list: List all stored classification entries.
  • delete <hash>: Remove an entry by its unique content hash.
  • export <dir>: Export entries to JSONL files in the specified directory.
  • import <dir>: Import entries from JSONL files in the specified directory.
  • serve: Start both the OpenAI-compatible API and the MCP server.

MCP Tools

When running in serve mode, the following tools are available to AI assistants:

  • add_entry(topic, content): Adds a new classification mapping.
  • get_topic(query_text): Classifies user input into a topic name.
  • list_entries(): Shows all classification mappings in the database.
  • delete_entry(hash): Removes a mapping from the system.

Configuration

CLASSIFIER can be configured via config.yaml, environment variables, or CLI flags.

Key Environment Variables

  • CLASSIFIER_MODEL: Path to the GGUF embedding model.
  • YZMA_LIB: Path to the libllama shared library (required).
  • CLASSIFIER_DATABASE_URL: PostgreSQL connection string (e.g., postgres://user@localhost:5432/db).
  • CLASSIFIER_DEFAULT_TOPIC: Topic returned when no match is found (default: none).

Development and Build

  • Requirements: Go 1.25+.
  • Build: No CGo required (yzma uses purego, pgx is pure Go).
    go build -o classifier .
  • Tests:
    go test ./...

Best Practices for Agents

  • Use get_topic to determine the intent or category of a user's query for routing to specialized agents.
  • When adding entries, use representative phrases for each topic to improve classification accuracy.
  • Ensure YZMA_LIB is correctly set and the PostgreSQL server has pgvector enabled.
  • For high-accuracy classification, consider using higher-dimensional models like T5Gemma 2-270M (640 dims).

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.