Filename-as-Specification

A methodology for eliminating AI hallucination in code generation. The specification lives where the AI reads first — the filename itself. No ambiguity, no drift, no mass-deleting at 3am.

6Domain Matrices
3AI Agents
6Validation Phases
1MCP Server
Claude API MCP Python TypeScript Bash

The problem

You write a detailed prompt. The AI writes confident code. The code doesn't match what you asked for. You correct it. It introduces new problems. Three hours later, you're mass-deleting and starting over.

The root cause is a tool-use ordering issue. The agent reads the filename first (in a directory listing, or in a tool call response, or in a patch header), then decides what to write into it. If the filename carries no signal, the agent fills the vacuum with a hallucination and commits to it before the file's actual content constrains its behavior.

The insight: put the specification where the AI sees it first — the filename. The AI cannot open the file without absorbing the complete specification. It can't miss it. It can't ignore it. It can't drift.

The anatomy of a FaS filename

user_sv_M0gM0hM0i_D01D04_I+rp0g+E0k+sc0g+E0h_E0m_V010_S2.py

  user       → Entity: User
  sv         → Layer: service
  M0gM0hM0i  → Methods: register, authenticate, get_by_id
  D01D04     → Dependencies: sqlalchemy, jwt
  I+rp0g...  → Internal imports: UserRepository, UserSchema
  E0m        → Export: UserService
  V010       → Version: 0.1.0
  S2         → Status: implemented

One string. Eight orthogonal axes. Parseable both by humans and by a deterministic grammar. The agent reads this filename before writing a single line of the body — and the body it writes is constrained by everything the filename already told it.

The four roles

Domain matrices

A matrix is a lookup table that maps the compact FaS codes into human-readable concepts for a specific domain. Six matrices ship with the system, and there's a template for building your own.

The MCP server

A Model Context Protocol server that gives Claude Desktop native FaS capabilities. Install once and Claude gains permanent access to four tools: parse_fas, generate_architecture, validate_tree, and matrix_lookup. No copy-paste, no context-window pollution, no fragile system prompts.

The server is stateless and reads a local matrices/ directory so you can drop new domain matrices in without restarting it. It streams validation results via MCP's progress protocol so long-running validator phases don't hang the agent.

Why it works

I built this because I was mass-deleting AI-generated code at 3am one too many times. The insight was stupid-simple: put the spec in the filename. Everything else is refinement of that core insight.

Get it

One package on Gumroad — $100. Everything: the methodology document, all six domain matrices, the three agent prompts, the six-phase validator, the MCP server, the orchestrator, and the matrix-builder template for rolling your own.

→ Get Filename-as-Specification on Gumroad