Markdown in /src
Posted by perrygeo 1 day ago
Comments
Comment by aDyslecticCrow 6 hours ago
Cluttering the repo with out-dated, very wordy and quickly aging prompts will just confuse any agent tasked with looking at the repo in the future. Keeping context windows down is a real limitation to good LLM output, and this workflow may work completely against it.
- A plan.md describing the project, main abstraction idea, end costumer, and so on is great; but it should be kept minimal and up-to-date with the repo.
- Block comments on top of source-files and functions are great, and already very useful to coding agents. I don't see a value to anything more than what is already typical best practice.
Comment by xg15 5 hours ago
If prompts are specifications for a change of the system's behavior, then it seems natural to manage them as changes and not as resources.
This would also keep them in the right "historical context" of the repo and avoid the "prompt rot" you were talking about.
Comment by aDyslecticCrow 5 hours ago
Functional safety development processes often demand code-review, technical design decisions, changes of plans, or intentional compromises; to be linked together with reference IDs in the code they effect. But the workflow for this is usually extremely manual and absolute misery. But a codebase made like this is like magic to read later.
Comment by ffsm8 5 hours ago
You'd consequently only need to implement your custom git gui and extension to visualize this information.
Maybe a good project for the next weekend? Just eg make a prototype tui in golang and see where you end up
Comment by matchagaucho 4 hours ago
Comment by viccis 4 hours ago
Comment by aDyslecticCrow 3 hours ago
"yes claude i prefered the blue graph two months ago, how does thar help us with this json parsing bug?"
Comment by sajithdilshan 4 hours ago
Comment by cobychapple 14 minutes ago
Comment by ktpsns 21 hours ago
We did put non-code into /src for a very long time: It was heredocs, multiline docs, etc. Actually my preference is to put texts close to code and only fallback to /docs/something.md at a conceptual level. Which is probably what the author proposes, given that he sees markdown as primary interface to code.
Comment by Rendello 6 hours ago
I actually miss what I had when I was playing around in TempleOS. All text in the OS is rich (you can toggle between the markup and the standard WYSIWYG view), so comments could have formatting, colours, images (bitmap or vector, great for diagrams), hell, even (aggressively spinning) 3D models.
The thing I used most was the collapsible sections, think <details> and <summary> in HTML. Although I appreciate plain text and would hate WYSIWYG rich text in my serious source code (not to mention binary data appended to the end of the source file for images and models), I can't help but pine for those features. Being able to just draw a real diagram and being able to edit it later in seconds as opposed to making some horrid ASCII art was awesome.
Comment by fifferfaffer 6 hours ago
One example is SpiderMonkey, which uses these beautiful, long expository comments explaining not only what, but why design choices have been made. https://searchfox.org/firefox-main/source/js/public/RootingA...
If the goal is "locality", you can't get much closer than as a comment.
As far as markdown becoming "source code for agents" under the agentic paradigm, per-directory `AGENTS.md` seems more consistent, at least visually. If agent managed markdown is going to be high-churn, I'd rather it be confined to a single file. Constraints, especially for agents, are good.
Comment by lucicditee 5 hours ago
Comment by baldvinmar 3 hours ago
I would much rather have significantly more detailed comments inline with code to describe the intention at any given step than just a high level markdown file. We already have PDRs and markdown seems like it would just be an extension of that.
Comment by MiroslavPokorny 1 hour ago
Source code main attribute should be reproducable builds...
Same source gives the same output.
Comment by maarut 1 hour ago
I assume src/ is treated as the source of truth. If we start placing Markdown documentation inside src/, outdated documentation can live alongside the actual source of truth, blurring the boundary between what the system actually does and what the documentation says it does.
Comment by esalman 1 hour ago
This is being done with an agent-first approach in mind. Agents cost a lot to run. Moving markdown to /src will only help AI subscription sellers.
If you are a fan of local LLM, then you also know code is not cheap. It requires substantial amount of investment in infra acquisition and maintenance.
Markdown should be where they always were, in /docs. It does not make a difference for an agent. But it allows to keep /src clean and adhere to zero-token architecture.
Comment by aslakhellesoy 4 hours ago
In-between all those ephemeral agent sessions, spec, plan and design files, there is something that survives. The src/*.md files.
With Varar you can link small parts (cells) of those Markdown files to your code, so they stay in sync. So you (and agents) can find out what your system does without reading 300 million lines of code.
Full disclaimer: I am the guy who wrote Cucumber - that most people here hate. I eventually lost my love for that tool myself, but I did miss the ability to keep docs and code in sync. Hence Varar - a tool like that with fewer (different?) warts, for the agentic area.
Comment by xg15 6 hours ago
But I don't really like the "LLMs as compiler" metaphor. If you followed that logic to the end, you'd have to "rebuild" your entire project from the spec every time the spec changes. Not just would the token cost be insane, but you'd also get a completely different implementation each time, maybe with different UI and design decisions where the spec left things open.
The alternative is to see the code as the source of truth and LLMs as (extremely sophisticated) editing or refactoring tools. Then by all means, still check in your prompts, but now they are documentation on how a feature was implemented, not the source of truth themselves.
Comment by divbzero 4 hours ago
src/
md/
README.md # index of all md, entry point for agents
TODO.md # a list of general TODOs open for this module
OVERVIEW.md # a technical overview of this module
features/FEATURE_1.md # a set of feature-specific documents
data/DATAMODEL_1.md # descriptions of data models in the module
api/API_1.md # descriptions of APIs the module provides
infrastructure/INFRASTRUCTURE_1.md # descriptions of infrastructure used by the module
What if we standardized on README.md in each subdirectory alongside the code? src/
README.md # entry point for humans and agents
TODO.md # list of general TODOs open for this module
INFRA.md # descriptions of infrastructure used by the module
api/
README.md # descriptions of APIs the module provides
models/
README.md # descriptions of data models in this module
README.md in each subdirectory seems to align better with OP’s objective “that Markdown should be checked in to /src, next to the code it produces”. It is also a convention already in use in many code repositories.Comment by c0rruptbytes 2 hours ago
Comment by diegolas 4 hours ago
Comment by gianlucabertell 3 hours ago
Comment by sroerick 5 hours ago
It's a SEXP language but could just as easily be markdown. It'd probably be better if it was - I spend a lot of tokens matching parentheses.
Compared to markdown - I lose some human readability but gain a lot in workflow.
For me - it turns the sort of "free form jazz code odyssey" into something with structure. It changes the question to "does the spec match my idea? And does the code match my spec?"
Every so often, I do a "code astrology reset" and try to purge all the tricks I use to keep things functional. I absolutely notice an efficiency hit when I don't have a spec language. Even with the new models - I find this essential to keep things on track.
I think most people on large projects hit a scaling ceiling with markdown specs. They get massive and contradictory very quickly. I think a src/md folder is a good strategy. I try to organize with a "one spec per module" rule. It doesn't always happen that way but I find that helpful.
I think Literate Programming is a good inspiration here. I also think Yegge's beads and Gastown have some really smart things to say in this regard - even if he's a bit tokenmaxxy for my taste.
Comment by tombert 6 hours ago
The interesting part of any program source is what it took to make that program. I view AI-generated code in the same category that I see a binary.
[1] https://blog.tombert.com/Posts/Technical/2026/04-April/Stop-...
Comment by allknowingfrog 5 hours ago
Essays of this nature should generally be prefixed with "if you happen to work in exactly the same way that I do..."
Comment by jmathai 15 hours ago
Before implementation, context is always cleared to ensure that the model is working only from known context (skills, AGENT.md, etc).
A major benefit of this is that agents can look up prior prompt instructions as needed or when mentioned in the current prompt it's working on.
I recently described my workflow here https://jaisenmathai.com/articles/sojourn-for-ios-was-45-one...
Comment by jdzikowski 6 hours ago
Comment by aDyslecticCrow 6 hours ago
Nested markdown or restructured-text or asciidoc is pretty good workflow already to re-use blocks, link to different pages, or do some rich formatting like collapsible sections.
Comment by euroderf 17 hours ago
IME developers have low tolerance for interrupting flow to track down the docu that is aimed at them, so keep it near and obvious.
Comment by gianlucabertell 3 hours ago
Comment by recursivedoubts 3 hours ago
One thing to say given some of the comments here: in this approach the stuff in /src/md would be treated as well as stuff in /src/java or whatever: it would need to be maintained as precisely as possible, not just be a stream of development record of what has happened.
I'm also happy to consider that Markdown might not be the right format for this, or that the whole thing is a terrible idea. But I see people saving content in other places (linear, etc.) that drive agents and it just seems like maybe we should keep that stuff close to the generated source.
Comment by lowbloodsugar 1 hour ago
Comment by arthurjj 6 hours ago
Comment by maxk42 19 hours ago
Comment by aogaili 6 hours ago
Comment by tom_ 5 hours ago
Comment by aogaili 4 hours ago
This is not doc, this is an .md file as a src to be used by LLMs to generate code. Therefore they are src files but in english.
Comment by maxk42 13 minutes ago
Comment by aogaili 1 minute ago
We don't look at binaries, we don't look at assembly, we work with high level languages. The specs were for developers to translate to programming primitives, but if the translation is largely automated, then the specs will become the code and we will need better ways to manage those, and I think the IDEs are gradually trending that way.
Regarding that it should not be on HN, if the author is seeing many organizations doing this practice, then why we he not share that empirical observation? is it only because it is against your pure world and abstractions? Just the recent leak for the Muse agent shows that most of the system behaviour is written in markdown.
Whether you like it or not, technology never care about purest and idealist, it evolve under pressure of deliveries and pragmatic choices, and if there is such a pressure, which the author claims to be, then HN is the medium to share it.
Comment by thatguy89 12 hours ago
1. he's describing a manual version of Spec-Kit / OpenSpec / BMAD?
2. Thinks Markdown is... somehow different from normal text or other markup languages?
3. Doesn't seem to understand that LLMs are not deterministic?
Comment by aogaili 6 hours ago
this not perfect but he is describing a real trend, so listen with open mind.
Comment by kderbyma 5 hours ago
Comment by throwuxiytayq 20 hours ago
Comment by Naru41 17 hours ago
Comment by undershirt 5 hours ago
i'd be enthused to work this way if changes to `src/*.md` files could be "hot-reloaded" on save, like an iterative LLM watch compiler, and skipping the chat prompts altogether.
Comment by 2001zhaozhao 5 hours ago
Comment by tancop 20 hours ago
Comment by skybrian 16 hours ago
If you split code up into multiple packages, moving the docs closer to the code might make sense. The docs for package foo could be in packages/foo/docs.
Comment by bbor 1 hour ago
First, none of this changes the need for a separate `/docs` dir, also checked into git. Wikis are fun, but docs are essential!
Second, I personally think the new paradigm will be putting all of this into tons of new README.md files, which I'm kinda baffled aren't more common deep into dir hierarchies already. That intuitively tells the human authors and the artificial readers that;
A) it toes a similar "for technical people but not necessarily just our dedicated engineering team" line as the root README --more formal than an ephemeral "prompt" and less formal than a user-facing doc,
B) this isn't the AGENT.md file so should remain human-authored only,
C) this is only an overview with a strong preference for brevity & clarity, and
D) this is focused on this specific directory (along w/ the other benefits of locality, as the author extolls already).
Have I cracked the code? Is there a Turing award for inventing the concept of using a tool we already use but just a bit more extensively -- or at least a YC slot?
*P.S.* OP you dropped this: )
Comment by jocelyner 1 hour ago
Comment by TZubiri 5 hours ago
> That Markdown should be checked in to /src
I've made a similar argument last June, although I made the point with a sample project rather than manifesto style
https://github.com/TZubiri/keyboard-transpositions-checker
> A Proof of Concept for LLM as source code. I am of the position that the "code" is now target code and not source code. My strongest source for this claim is Stallman's classical definition of Source Code which is the "preferred way to modify the program".
> Upload the conversation with ChatGPT as source code
Although this was pre-agents/markdown, the main way to generate code was just with user-interface conversations with the LLM.
And my position differs in which I argue against uploading the target code, just the source code. Which is an issue if the LLM is not deterministic, but it's workable.
That said I apparently did foreshadow solutions to these issues
> Since we are using a consumer interface, and not an api, (first we have no guarantees that the code will not be used for training, so there's no IP protection, but also), we don't have much reproducibility, robust publishing should use API access and publish exact model with revision as well as seed (and even then we are not guaranteed reproducibility.
I think in general we'll end up rewinding so much, the sloppers are recursing and building a ton of harnessing tools that will need to be trashed because they made a fundamental mistake at the very first steps. Those of us who are a bit more careful will probably only get back to agentic engineering once the slopper activity dies down, it's pretty much career suicide at this point to get into it. Anyone who is barely careful is just waiting it out.