k-dense-byok: Instructions file for Codex

AGENTS.md

k-dense-byok AGENTS.md is an instructions file for Codex, OpenCode from K-Dense-AI/k-dense-byok. It costs 19,736 tokens per session, scanned D, original, MIT.

A project guide for K-Dense BYOK, a local research assistant that lets users connect their own AI model accounts. It runs a web interface and a backend service together in one repository.

In plain words
What is it for?
Use it when starting the app, tracing a request through the web interface and backend, or changing the agent’s tools and delegation behaviour.
Why use it?
It explains the project’s services, agent tools, and request flow so developers know where frontend, backend, and agent changes belong.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md. Also seen: mentions CLAUDE.md; mentions subagents; positional $N argument.

This is K-Dense-AI/k-dense-byok's own configuration. It tells Codex and OpenCode how to work on k-dense-byok itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything k-dense-byok configures →

About the project

K-Dense BYOK is a desktop AI research assistant that lets scientists describe research tasks in plain language and have an agent inspect data, run analysis code, search sources, and produce figures or reports. It is intended for scientific work across fields, using the user’s selected hosted or local AI models. The catalogue add-ons support its research workflow.

K-Dense-AI/k-dense-byok · 1,427 stars · on GitHub · arxiv.org

Reuse

Borrowing it

Nothing to install: this file belongs to K-Dense-AI/k-dense-byok. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/K-Dense-AI/k-dense-byok/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/K-Dense-AI/k-dense-byok

Made for: Codex, OpenCode.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for k-dense-byok AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/k-dense-ai/k-dense-byok/agents-md/github.svg)](https://agentmods.dev/instructions/k-dense-ai/k-dense-byok/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/k-dense-ai/k-dense-byok/agents-md"><img src="https://agentmods.dev/badge/instructions/k-dense-ai/k-dense-byok/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for k-dense-byok AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/k-dense-ai/k-dense-byok/agents-md"><img src="https://agentmods.dev/badge/instructions/k-dense-ai/k-dense-byok/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 19,736 This file is loaded in full into every session.
When invoked 19,736 The same file — it is already loaded in full.
Security scan D 2 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.19736 $0.19736
Opus 5.5 $0.07894 $0.07894
Sonnet 5.5 $0.03947 $0.03947
Haiku 4.5 $0.01974 $0.01974

Measured 21d ago against content hash de71aeb31ec7, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade D, and why

k-dense-byok AGENTS.md scanned grade D with 2 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 21d 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.

Reads MCP configurationmediumAgent snooping

mcp.json carries server URLs and auth tokens; reading it lets a mod discover and abuse other integrations.

- **MCP is Pi's built-in support, and it forces a tool denylist.** `session-registry.ts` adds Pi's exported `createCodemodeExtension()`, `createToolSearchExtension()` and `createMcpExtension()` to the lead's extension fa

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

- **Raw-data guard.** `server/src/agent/data-guard.ts` is a `tool_call` hook (registered after the subagent bridge so budget gates run first) that blocks `write`/`edit`/`bash` mutations of the project's protected globs (
AGENTS.md · 142 lines

How it starts

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

AGENTS.md

Guidance for coding agents (Claude Code loads it via CLAUDE.md) working in this repository.

Project overview

K-Dense BYOK is a local AI research-assistant app ("Kady") that brings the user's own model credentials (API keys or supported subscriptions). It runs natively on macOS, Linux, and Windows. It is one repo with two runtime services started together by the cross-platform launcher start.mjs (wrapped by ./start.sh on macOS/Linux and start.cmd on Windows):

Service Port Code
Frontend (Next.js 16 / React 19) 3000 web/
Backend (TypeScript + Pi coding-agent SDK) 8000 server/

The backend embeds the Pi SDK (@earendil-works/pi-coding-agent) and runs a single flat agent with built-in tools (read/bash/edit/write/grep/find/ls), a subagent/bg_wait delegation pair (the pi-subagents extension package), an interview clarifying-questions tool (a native re-implementation of pi-interview — see server/src/agent/interview.ts; the form renders inline in the chat UI instead of the package's own browser window), the pi-web-access web tools (web_search/fetch_content/get_search_content/source_check), live PDF annotation tools (add_pdf_annotation/list_pdf_annotations/remove_pdf_annotation), a hybrid durable Modal tool family (modal_run/modal_submit/modal_status/modal_wait/modal_cancel/modal_results/modal_submit_batch; server/src/agent/modal-tool.ts), a generate_image tool (Pi 1.0 image models, saved into the sandbox; server/src/agent/image-tool.ts), and MCP tools through Pi's built-in MCP support (project .pi/mcp.json + global <agentDir>/mcp.json; see the MCP caveat below). PDF annotations and Modal jobs are also available to child agents through the vendored kady-pdf-annotations and kady-modal Pi packages; annotation sidecars use a shared cross-process lock and atomic replacement. Modal jobs are server-owned and restart-recoverable. There is no orchestrator/expert split and no model proxy: models go directly to OpenRouter, connected Pi OAuth providers (openai, openai-codex, anthropic, github-copilot, xai, kimi-coding, meta), NVIDIA NIM (API key), or a local Ollama / OpenAI-compatible server. Everything runs locally; user data lives in projects/.

Read the full file on GitHub · 142 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. 21d ago Changed · +675 tokens per session de71aeb31ec7
  2. 1mo ago Changed · +1 lines · +563 tokens per session 20aea46f9b30
  3. 1mo ago Changed · +205 tokens per session 5a03e8e481e5
  4. 1mo ago Changed · +1,867 tokens per session a957af4d03b5
  5. 1mo ago Changed · +10 lines · +952 tokens per session 5e9e18858c8b
  6. 1mo ago Changed · +5 lines · +2,402 tokens per session scan C → D 1bdf7d5e027c
  7. 1mo ago Changed · +13 lines · +3,660 tokens per session scan A → C 35384bec7300
  8. 1mo ago Changed · +2 lines · +1,598 tokens per session 3a7c5b98a656
  9. 2mo ago Changed · +347 tokens per session f1f42a65581c
  10. 2mo ago First seen · 111 lines · 7,467 tokens per session scan A e92e58bf1be2

Subscribe to this mod's changes

k-dense-byok AGENTS.md is an instructions file published in the GitHub repository K-Dense-AI/k-dense-byok (1,427 stars, last pushed 21d ago), licensed MIT. It adds 19,736 tokens to every session, about $0.0789 per session on Opus 5.5. A static security scan graded it D with 2 findings (reads mcp configuration, recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

k-dense-byok AGENTS.md compared with instructions from other repositories

k-dense-byok AGENTS.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
k-dense-byok AGENTS.mdK-Dense-AI/k-dense-byokInstructions file1.4k21d agoMITD19,736Codex, OpenCode
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143ktodayMITA7,461Codex, OpenCode
langchain AGENTS.mdlangchain-ai/langchainInstructions file149kyesterdayMITA4,680Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA5,516GitHub Copilot
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA3,093GitHub Copilot
deepseek-harness AGENTS.mddeepseek-ai/deepseek-harnessInstructions file274k2d agoMITA4,313Codex, OpenCode