TheScheme: a Codex schema-file system built from Markdown, YAML, XML and LLM-attention research, with a routed TypeScript ruleset
▲ 1 r/ChatGPTCoding+2 crossposts

TheScheme: a Codex schema-file system built from Markdown, YAML, XML and LLM-attention research, with a routed TypeScript ruleset

I’ve been working on a project called TheScheme for managing how Codex follows rules inside a codebase.

TheScheme is the template behind everything. It defines how rules are written, how Codex routes between them, and how to stop a large set of instructions from turning into one huge prompt that gets partially ignored.

Instead of putting every instruction into "AGENTS.md", it uses a main router and smaller rule files. Codex starts with the router, works out what the task touches, and only loads the files it needs.

The first full ruleset I built with it is Pragmatic TypeScript. I’ve been using it with Codex on actual projects.

The basic TypeScript approach is:

"Type Strategy → Functional Core → Procedural Shell → Smallest Honest Boundary"

In practice, that means making the domain meaning clear in the types, keeping decisions separate from side effects, and not creating extra services or classes unless they own something real.

One of the main parts is a mirrored-type check that runs before and after changes.

Before editing, Codex checks the boundary it is working with and looks for an existing source of truth. That might be a Zod schema, a runtime object, a function return type, a generated Prisma or Drizzle type, an OpenAPI contract, or a handwritten domain type.

The check is light on purpose. It doesn’t force Codex to add more schemas, brands, helpers, or abstractions. It just makes it check what already owns the shape before creating another version of it.

After the edit, it runs a proper source-of-truth audit. That compares changed types against schemas, generated contracts, runtime values, factory returns, and existing exports.

For example, Codex might write:

type RouteName = "home" | "billing" | "admin";

const routes = {

home: "/",

billing: "/billing",

admin: "/admin",

} as const;

The audit can see that "RouteName" is just a second copy of information already stored in "routes", so the better version is:

const routes = {

home: "/",

billing: "/billing",

admin: "/admin",

} as const;

type RouteName = keyof typeof routes;

It does the same kind of check for interfaces that mirror Zod schemas, copied generated types, duplicated DTOs, and schemas where "z.input" and "z.output" are different because the data gets transformed.

It also understands that similar types can be intentional. A transport DTO and a domain model don’t always represent the same thing. Those cases can be left alone instead of being treated as errors.

The post-change audit separates actual problems, possible drift, acceptable choices, and the smallest useful fix.

The TypeScript pack also has routed rules for errors, Zod boundaries, async workflows, cancellation, workers, HTTP handling, database access, generated clients, functional core/procedural shell architecture, and anti-regression checks.

The other main part of the project is the Pragmatic Codex Schema Factory.

The factory takes the same Scheme template and uses it to build a Codex setup for another project. It isn’t a normal code generator. It generates the instruction and routing environment that Codex will use while working in that repository.

It can create:

AGENTS.md

.ai-rules/

.agents/skills/

.codex/

docs/

prompts/

templates/

The process starts with planner mode. Codex asks about the actual project before generating anything: the framework, database, validation approach, error handling, architecture, directory layout, naming rules, and other conventions.

It then produces a blueprint showing both the application structure and the proposed AI rules structure. Nothing gets written until that blueprint is approved.

Once it is approved, the factory compiles it into Codex-native files.

There are four main factory skills.

"$schema-architect" asks the planning questions and designs the blueprint.

"$schema-to-codex" turns an approved blueprint into "AGENTS.md", routed ".ai-rules", Codex skills, and optional ".codex" configuration.

"$codebase-schema-integrator" is for an existing repository. It inspects the repo first and plans where the rules, skills, and Codex files should go without immediately changing anything.

"$schema-auditor" checks an existing setup for duplicated rules, broken routes, missing triggers, context drift, and instructions that no longer match the project.

The point is to keep the human in the loop. The planner asks, the human approves, and then the factory creates the files.

So TheScheme is the reusable template, Pragmatic TypeScript is a working ruleset built from it, and the Codex Schema Factory is the part that can build the same kind of routed setup for other repositories.

Repo:

https://github.com/mayett515/TheScheme

Pragmatic TypeScript router:

https://github.com/mayett515/TheScheme/blob/main/pragmatic\_typescript\_v3\_ai\_rules\_bundle\_complete/pragmatic\_typescript\_v3\_ai\_rules\_bundle\_flat/.ai-rules/00-system-index.md

Type source-of-truth checker:

https://github.com/mayett515/TheScheme/blob/main/pragmatic\_typescript\_v3\_ai\_rules\_bundle\_complete/pragmatic\_typescript\_v3\_ai\_rules\_bundle\_flat/.ai-rules/02C-type-source-of-truth-checker.md

Codex Schema Factory:

https://github.com/mayett515/TheScheme/tree/main/pragmatic\_typescript\_v3\_ai\_rules\_bundle\_complete/pragmatic-codex-schema-factory/pragmatic\_codex\_schema\_factory\_v2

u/aford515 — 6 days ago

Whole albums is a vibe and perfect for summer but I swear etouffee was so special when it dropped.

Yeah I love this album but it has no etouffee.

This post sucks but I swear I just hoped for another etouffee moment where I could rinse it the whole time.

Now.its gorilla.

reddit.com
u/aford515 — 2 months ago

im in germany, you guys aswell cant see gemini notebooks? like the folder kind of feature that should be available in europe?

i cant see notebooks and i cant see gemini notebook.

reddit.com
u/aford515 — 3 months ago

why cant i see notebooks in gemini? im in germany?

you guys have the same problems as me? i cant see notebooks i would benefit greatly from them and all.

reddit.com
u/aford515 — 3 months ago
▲ 6 r/kimi

how is the new agentic harness cli?

i know its now nodejs and not python and all but im asking if 0.6.0 which is called the same is actually aswell better in some tasks? do you guys spot the difference?

reddit.com
u/aford515 — 3 months ago

just an anti doomer post "company of a friend doesnt know how to let ai be credited in their services. token limit got maxed a week ago after it being already doubled for 4 times.

so yeah. i asked him aswell if theire making more progress and more stuff actually with ai so regarding if it actually gives them their money back and his answer was : "only on the project and services which will include ai and include ai".

so yeah his company is losing money on claude code. they mainly use claude code. they had a big token limit. it got doubled 4 times and it reached its limit 19th this month.

so from a strict financial perspective theyre not making more money with ai.

reddit.com
u/aford515 — 3 months ago
▲ 12 r/ADHD

vyvanse is so unreliable.

i was productive af for a few days. before that i was 1 month off it because it gave me anxiety. my rhytm changed and it felt amazing being off meds as the slightly worrying about stupid shit and somehow ocd like patterns dissapeared.

ive started taking them again. i was very productive and the almost ocd like symptoms helped me in a "perfectionist" way at my work lol. today though i was so irritated and angry at some small things and i know they wouldve never happened off the meds.

if im off meds though i know that i 100 percently need to do sports every day and all sorts of shit.

also those slightly anxious thoughts on the meds. i hate them. its almost like my perception of some stuff gets hijacked by those ocd like pattern matching aswell. i also dont know if my productivity is actually better on meds or if the "tense feeling" just actually gives it more of an perception of "accomplishment".

reddit.com
u/aford515 — 3 months ago

i like gemini alot but anyone maybe knows how to make it not constantly use outdated information when it has the ability to use new information? should i use a gem for that?

its usally always outdated information then you ask it again and it will correct itself and from that path on it will actually use information that is on par with the latest shit.

the problem is i dont want to always chat a bit to make that work.

should i use a gem for this or has anyone found a workaround?

i think gemini is really flexible and it has the ability to do everything u just have to prompt it right.

what i mean is that it gives me software bugs on opensource or packages that were fixed like 6 months ago. it gives me benchmarks that arent even a thing. the thing is if you prompt it in the right way it doesnt do it. just geminis natural prompt does this. so i have to do a gem, but im not trusting it. gemini feels like a thing that is higely flexible but that actually makes it error prone output wise

reddit.com
u/aford515 — 3 months ago
▲ 0 r/git

Kraken looks so flashy and I dunno. But fork is just so fucking fuego.

I know lazygit is really cool aswell and for a different type of user base but fork is just such a cool piece of software and im thankful for the person who recommended it here.

reddit.com
u/aford515 — 4 months ago
▲ 8 r/fsharp

i just wanted something for my resume. i never used c# or java. i have python knowledge (fastapi, flask).

the only thing that kinda makes me not go fully into it is the thought of it being a (uninteresting thing to show off on my resume whilst simultainiously being very time consuming to learn) is that fear kinda legitimate or should i just say "fuck it" and follow my curiousity? i know this question is not on par with other questions here. are there some strong benefits. i heard f# makes you a better developer if you switch back to your naturally used language? i have some time off atm and im on a job search. i can take more then 5 months off. im adjusting my skills currently. im building a huge thing in typescript atm which is almost done. im leaning very heavily on just going with f#.

i have some friend who has been a .net dev for the past 8 years and i explained him some stuff about what iam planning and he took some time to understand that im not joking. so that is why i posted the question here.

reddit.com
u/aford515 — 4 months ago