docshark AGENTS.md

Project-specific coding rules for DocShark, a local documentation server that collects websites and makes them searchable.

In plain words
What is it for?
Use them when changing DocShark's documentation scraping, SQLite full-text search, library management, or MCP tool integration.
Why use it?
They prevent unwanted commits and unsuitable dependencies while keeping the TypeScript, SQLite, and tool interfaces consistent.

Instructions file for CodexOpenCode

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/michael-obele/docshark/agents-md
Clone the repo
git clone --depth 1 https://github.com/Michael-Obele/docshark

Made for: Codex, OpenCode.

Per session 1,099 This file is loaded in full into every session.
When invoked 1,099 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.01099 $0.01099
Opus 5 $0.00549 $0.00549
Sonnet 5 $0.00220 $0.00220
Haiku 4.5 $0.00110 $0.00110

Measured 2d ago against content hash bf83e47f4479, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

docshark AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 47 lines

How it starts

The opening of the file, as written. The whole thing — 47 lines — stays where its author put it; the contents beside it link to each section on GitHub.

🦈 DocShark: AI Agent Guidelines

You are an expert Senior Typescript/Node.js System Architect contributing to DocShark. DocShark is a fast, local-first Model Context Protocol (MCP) server that scrapes, processes, and serves documentation sites via a customized SQLite and FTS5 backend.

This document serves as your prime directive. You MUST adhere to these rules at all times when generating, analyzing, or refactoring code.

🛑 1. Core Directives (Hard Rules)

  • NO AUTO COMMITS: You must NEVER automatically git add, git commit, or git push against the repository unless explicitly authorized by the user. The user will manually review and commit your code changes.
  • NO ORMs: Do not introduce heavy ORMs like Prisma, Drizzle, or TypeORM. DocShark uses raw bun:sqlite with parameterized string queries to ensure maximum SQLite FTS5 search performance and zero-overhead indexing.
  • NO ANY: Do not use TypeScript's any type unless absolutely necessary (e.g., when dealing with opaque third-party DOM nodes from parsing libraries).
  • MCP PARITY: Any feature added to the library management core (e.g., refreshing, deleting, listing) MUST be exposed as an MCP tool in src/server.ts alongside any complementary CLI commands in src/cli.ts. Do not break the Model Context Protocol spec.

🏗️ 2. Architectural Pillars

DocShark relies on a specific internal pipeline. Understand these pillars before modifying code:

  1. The CLI & MCP Frontends: Entry points are src/cli.ts (cac CLI) and src/server.ts (the JSON-RPC MCP server).
  2. The Worker Pipeline: src/jobs/worker.ts controls the asynchronous flow: Discover (Crawler) -> Fetch -> Extract (HTML to Markdown) -> Chunk -> Index (SQLite)
  3. The Data Layer: src/storage/db.ts handles all SQLite persistence. We utilize WAL mode and strict ON CONFLICT constraints for robust cross-process crawling.

🕸️ 3. Crawling & Extraction Constraints

When modifying the Scraper or Extractor (src/processor/extractor.ts):

  • Renderer Tiers: DocShark cascades from a generic fetch() call to an automated puppeteer-core launch if the payload indicates a JS-rendered SPA.
  • Aggressive Stripping Resilience: Readability.js removes noisy HTML elements, but it will falsely delete deeply-nested code blocks and complex <details> tags.
  • Pre-Process DOM Rescue: Always pre-process the DOM via linkedom inside the extractor to manually rescue complex, text-light tags like <pre> or <table> before passing them to the Readability engine.
  • GFM Markdown Output: We use turndown combined with turndown-plugin-gfm to ensure complex components like tables and strikethroughs render perfectly in the final Markdown payload required for LLM consumption. Configure turndown rules explicitly to .keep() HTML elements like <details> and <summary>.

Read the full file on GitHub · 47 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 47 lines · 1,099 tokens per session scan A bf83e47f4479

Subscribe to this mod's changes

docshark AGENTS.md is an instructions file published in the GitHub repository Michael-Obele/docshark (2 stars, last pushed 3mo ago), licensed MIT. It adds 1,099 tokens to every session, about $0.0055 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.