Habr AI→ original

Как написать игру на 114 тысяч строк с ИИ: практика управления контекстом

Браузерная игра на 114 тысяч строк, полностью написанная с помощью нейросетей за три недели — это реально. Но главная сложность оказалась не в том, умеет ли ИИ писать код, а в том, как удержать большой проект управляемым, когда кодовая база давно не влезает ни в какое контекстное окно. Автор разложил методологию по полочкам.

AI-processed from Habr AI; edited by Hamidun News
Как написать игру на 114 тысяч строк с ИИ: практика управления контекстом
Source: Habr AI. Collage: Hamidun News.
◐ Listen to article

A developer wrote a browser-based game with 114 thousand lines of code entirely with neural networks — and did it in three weeks. This is not a demonstration of AI's power, but a practical analysis of methodology: how to keep a large project manageable when the codebase has long since stopped fitting within the context window.

Three Weeks and 114 Thousand Lines

A browser-based game is not a toy project. 114 thousand lines of code written solo in three weeks — that's a pace impossible without neural networks. The author used AI not as an autocomplete assistant, but as a full-fledged generator: describing tasks in natural language, receiving implementations, iterating on results, moving forward.

But by the middle of the work, it became clear: generation speed is not the main problem with a large AI-assisted project. The main problem is manageability. The larger the codebase, the harder it is to explain to a neural network what has already been implemented, which solutions are established, and what absolutely must not be done. The model doesn't remember pattern choices from two sessions ago. It doesn't know that a function has already been written — in another file.

When Context Runs Out

The context window is a fundamental limitation of a language model when working on a large project. Even the most powerful models have a finite context: thousands of lines of code, multiplied by comments and documentation, quickly exceed the available volume. When a project surpasses tens of thousands of lines, a neural network simply cannot keep the entire repository in memory at once.

The consequences are predictable. AI begins inventing functions that have already been written in another file, conflicts with architectural conventions established in early stages, ignores naming conventions introduced a couple of sessions ago. The code compiles — but the internal logic begins to fall apart. This is not a model bug. This is a structural problem requiring a structural solution from the developer.

How to Keep a Project Under Control

Several principles that worked in practice:

  • Decision documentation outside code — each architectural decision is captured in a separate document. Before each new session, AI receives it as part of the context along with the task.
  • Strict modularity — files are intentionally kept small so each fits in the context window individually. No files with three thousand lines.
  • Session briefings — each new session begins with a brief introduction: what has been done, what conventions are in effect, what we're working on right now.
  • Unified naming conventions — strict style for functions, variables, and modules reduces the risk of collisions that AI misses without explicit reminders.
  • 'Blind' reviews — periodically ask the model to explain code it has already written. A good way to detect hidden contradictions and logical drift between sessions.

None of these principles is new: they are all applied in team development to coordinate people. With AI, they work differently — as a mechanism for managing the model's attention. Not 'who is responsible for what,' but 'what the model knows right now and what matters from that.'

What This Means

114 thousand lines in three weeks — this is a reproducible methodology, not a singular feat. AI is capable of writing code at industrial scale, but the manageability of a large project still depends on the human. Structure, documentation, and conscious context management — this is what distinguishes a project that can be continued and developed from a codebase that no one, including the neural network itself, will understand.

ZK
Hamidun News
AI news without noise. Daily editorial selection from 50+ sources. A product by Zhemal Khamidun, Head of AI at Alpina Digital.

Need AI working inside your business — not just in your newsfeed?

I build production AI for companies — custom CRM, internal tools, autonomous agents, workflow automation. Owned by you, shaped to your process, no per-seat tax. Built by Zhemal Khamidun, CPO of AlpinaGPT (AI platform, 6,000+ users).

What do you think?
Loading comments…