explaingit

ahlanlhw/cos

Analysis updated 2026-05-18

0PythonAudience · developerComplexity · 3/5LicenseSetup · easy

TLDR

A local, offline SQLite search tool that lets AI agents quickly find relevant pages in a markdown knowledge base.

Mindmap

mindmap
  root((COS))
    What it does
      Indexes markdown wikis
      Fast agent search
    Tech stack
      Python
      SQLite
      FTS5
    Use cases
      Agent orientation
      Context packs
      Duplicate detection
    Audience
      Developers
      AI agent builders

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Let an AI agent search a large markdown wiki instantly instead of reading every file.

USE CASE 2

Generate a context pack of the most relevant pages to hand to an agent as a prompt attachment.

USE CASE 3

Find near-duplicate pages in a growing knowledge base for cleanup.

USE CASE 4

Get a transparent, explainable ranking that shows why a result scored the way it did.

What is it built with?

PythonSQLiteFTS5

How does it compare?

ahlanlhw/cos0xhassaan/nn-from-scratch3ks/embedoc
Stars00
LanguagePythonPythonPython
Last pushed2023-06-08
MaintenanceDormant
Setup difficultyeasymoderatehard
Complexity3/54/51/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 30min

Local-first, no API keys or cloud dependency needed.

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

In plain English

COS, short for Cognitive Operating System, is a local, offline search tool designed to help AI agents quickly find relevant information inside large markdown knowledge bases such as wikis, documentation sites, and runbooks. The core problem it solves is that when an AI agent needs to orient itself in a large knowledge base, reading every file from scratch is slow and consumes a lot of the agent's limited working memory. COS pre-indexes all the markdown files and makes them instantly searchable. The tool is built on SQLite, a lightweight file based database that runs entirely on your machine with no internet connection, no API keys, and no external services required. It uses FTS5, a built-in SQLite feature for full text search, to scan across titles, page bodies, file paths, and tags. When ranking results, it blends several signals: BM25, a standard keyword relevance algorithm, a wikilink graph score that treats pages with more incoming links as more authoritative, a recency boost for recently updated pages, and a confidence score from frontmatter metadata. Every component of the final score is returned in the output so you can see exactly why a result ranked where it did. A key feature is context packs, a command that assembles the top-N most relevant pages with excerpts into a single file ready to hand to an AI agent as a prompt attachment. There is also a duplicate detection feature that flags near-duplicate pages for review. You would use COS when building or running AI agents that work with a growing markdown knowledge base and need fast, explainable retrieval rather than raw file reads. It is written in Python with a command-line interface.

Copy-paste prompts

Prompt 1
Walk me through initializing the COS database and indexing my markdown wiki with cos init-db and cos ingest.
Prompt 2
Explain how COS combines BM25, graph rank, recency, and confidence into its final search score.
Prompt 3
Show me how to generate a context pack for a specific topic using cos context-pack.
Prompt 4
Help me configure the COS_DB and COS_WIKI environment variables for my own project.

Frequently asked questions

What is cos?

A local, offline SQLite search tool that lets AI agents quickly find relevant pages in a markdown knowledge base.

What language is cos written in?

Mainly Python. The stack also includes Python, SQLite, FTS5.

What license does cos use?

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

How hard is cos to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is cos for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.