cd /news/developer-tools/stop-wasting-tokens-i-built-a-file-m… Β· home β€Ί topics β€Ί developer-tools β€Ί article
[ARTICLE Β· art-34406] src=dev.to β†— pub= topic=developer-tools verified=true sentiment=↑ positive

Stop Wasting Tokens: I Built a File-Mapping Standard for AI-Assisted Development

A 16-year-old developer built FolioDux, an open-source file-mapping standard that reduces token usage in AI-assisted development by providing a compact index of a project's structure. Instead of feeding the entire codebase to an AI on every query, FolioDux lets the AI read a single index file first, then load only the relevant files, cutting token consumption from thousands to hundreds. The tool works with any AI that accepts a system prompt, including Claude, ChatGPT, Gemini, Cursor, and Copilot.

read4 min views1 publishedJun 19, 2026

Every time I started a new AI chat session, it read my entire codebase.

50 files. Thousands of tokens. On every single message. Whether I was asking about authentication, database schema, or a single UI component β€” the AI read everything.

I'm 16 and building AI-powered products. Token costs add up fast. Context windows fill up. The AI loses track of older files. Responses slow down.

So I built something to fix it.

When you work with AI on large projects, you face a choice:

There's no middle ground β€” or at least there wasn't.

FolioDux is a lightweight, open-source file-mapping standard for AI-assisted development.

The idea is simple: instead of giving your AI every file, you give it a compact index that tells it where everything is and what it does. The AI reads the index first, identifies the relevant files, and reads only those.

One file. Two rules. Any AI.

It works with Claude, ChatGPT, Gemini, Cursor, Copilot β€” any tool that accepts a system prompt.

You add one file β€” FOLIODUX.md

β€” to your project root.


STACK: React19+TypeScript+Vite Β· Express+SQLite Β· JWT

---

## TASKS
auth/login/register   β†’ AuthView.tsx, authService.ts, server.ts
create/edit task      β†’ TaskForm.tsx, taskService.ts, server.ts, types.ts
list/filter tasks     β†’ TaskList.tsx, taskService.ts
database              β†’ db.ts, server.ts

---

## INDEX
App.tsx           | fe  | root: routing, auth state, layout wrapper
AuthView.tsx      | fe  | login + register forms, error display
taskService.ts    | svc | CRUD tasks, local cache, optimistic updates
server.ts         | be  | Express: all routes β€” auth, tasks, projects, user
db.ts             | be  | SQLite setup, schema creation, migrations on boot
types.ts          | typ | Task, Project, User, Status(todo|in-progress|done)

---

## GROUPS
Frontend:  App.tsx Β· AuthView.tsx Β· TaskList.tsx Β· TaskForm.tsx
Services:  authService.ts Β· taskService.ts
Backend:   server.ts Β· db.ts

---

## NOTES
- All routes except /api/auth/* require Authorization: Bearer {JWT}
- Task status values: todo | in-progress | done only

Then you add two rules to your AI system prompt:

RULE 1 β€” NAVIGATE BEFORE RESPONDING
At the start of every response, before reading any other file:
1. Read FOLIODUX.md in full.
2. Check TASKS β€” if the request matches a keyword, read ONLY those files.
3. If no match in TASKS, scan INDEX keywords to identify relevant files.
4. Read ONLY the identified files. Never read the full codebase unless asked.

RULE 2 β€” UPDATE AFTER CREATING
After creating any new file, add one line to FOLIODUX.md INDEX:
{filename} | {type} | {keywords β€” no articles, no filler verbs, max 8 words}
Update TASKS and GROUPS if needed.

That's it. Your AI now navigates the project like a developer who already knows the codebase.

Without FolioDux:

You ask "fix the login bug". Your AI reads all 50 files. Uses 4,000 tokens before even starting to think about your question. Maybe hits the context limit halfway through.

With FolioDux:

Your AI reads FOLIODUX.md

, finds auth/login β†’ AuthView.tsx, authService.ts, server.ts

, reads 3 files. Uses ~300 tokens. Answers faster and more accurately.

curl -O https://raw.githubusercontent.com/matteo-turri/foliodux/main/foliodux-init.mjs
node foliodux-init.mjs

The CLI script scans your project, detects the tech stack from package.json

, classifies every file by type, extracts descriptions from comments and exports, and generates FOLIODUX.md

in seconds.

Zero external dependencies. Node.js 18+ only.

The only part the script can't fill automatically. Open FOLIODUX.md

and map your most common requests to the files they need:

## TASKS
auth/login/register   β†’ AuthView.tsx, authService.ts, server.ts
create/edit product   β†’ ProductForm.tsx, productService.ts, server.ts, types.ts
payment/checkout      β†’ CheckoutView.tsx, paymentService.ts, server.ts

Copy the two rules above into your AI tool's system prompt. Templates for Claude Projects, ChatGPT, Cursor, and generic tools are available in the repo.

FolioDux uses a compressed keyword syntax designed to be readable by both humans and AI while using as few tokens as possible.

Description rules:

+

for "and", |

for "or", β†’

for "calls"| ❌ Verbose | βœ… FolioDux | |---|---| | This is the main server file that handles all the API routes | Express: all routes β€” auth, tasks, projects, user | | A service that manages authentication and user sessions | login, register, logout, JWT session storage |

Type codes:

Code Meaning
fe
Frontend component
be
Backend / API
svc
Service / logic
cfg
Config / build
typ
Types / interfaces
doc
Documentation
tst
Test
dpl
Deploy / infra

One file. No config, no database, no server. Just a Markdown file in your project root.

Tool-agnostic. Works with any AI that accepts a system prompt.

Token-first. Every design decision optimizes for token efficiency.

Self-updating. Rule 2 makes the AI maintain the index automatically as the project grows.

Human-readable. Valid Markdown. Open, edit, and version-control it like any other file.

The full project β€” including the CLI script, prompt templates for Claude/ChatGPT/Cursor, and a complete example β€” is on GitHub:

β†’ github.com/matteo-turri/foliodux

Open source. MIT license. Stars and feedback welcome.

Built this to solve my own problem while working on my projects. I'm 16 and based in Milan β€” if you try FolioDux, let me know what you think in the comments.

── more in #developer-tools 4 stories Β· sorted by recency
── more on @foliodux 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain β€” perfect for shipping the agent you just read about.

$git push zahid main
β†’ Live at https://your-agent.zahid.host βœ“
Get free account β†’ Pricing
from €0/mo Β· no card required
LIVE [news/stop-wasting-tokens-…] indexed:0 read:4min 2026-06-19 Β· β€”