www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - How people are using LLM's with D

reply Richard (Rikki) Andrew Cattermole <richard cattermole.co.nz> writes:
I'm going to split this off into its own thread, so anyone who 
has any tips or approaches can teach:

On 11/02/2026 6:38 AM, matheus wrote:
 On Tuesday, 10 February 2026 at 16:14:03 UTC, Vladimir 
 Panteleev wrote:
 
     On Monday, 9 February 2026 at 21:25:02 UTC, user1234 wrote:
 
         One tendency I have noticed recently in the D world is 
 one guy
         that is very good with AI. Cybershadow. Already 5 or 6 
 PR, he
         masters the tools.
 
     I guess I could post a few thoughts about AI / LLMs here if 
 people
     are interested...
 
 Interesting, since I'm not using AI I'd like to know, in this 
 case you have LLM locally and you point to D source folder and 
 It learns from that database and do everything from there?
 
 I think this would be a nice topic/video to be made so to 
 attract people, since D suffers from content lately. And show 
 how do you're doing PR currently, maybe even guys like me who 
 will go deep to help would try it.
To start this off, I'll include Vladimir's reply, and then do mine as a reply. Original: https://forum.dlang.org/post/htgjeqlvwzqwosecdqmz forum.dlang.org On 11/02/2026 6:54 AM, Vladimir Panteleev wrote:
 The main way I use LLMs is with Claude Code. Here's how it 
 works:
 
 1. You open the directory with your project in a terminal
 2. You run `claude`
 3. This opens a TUI that looks like a chat interface. You type 
 your question or request for what you want the bot to do.
 4. The bot looks at your code. If it's too big to fit into its 
 context (a limited window of how much it can see at a time), it 
 will search just for relevant bits.
 5. If the problem is big, it will first write a plan for how it 
 aims to accomplish its goal, for you to read and approve.
 6. It does the thing. It can edit files and run commands in 
 order to run your test suite (or at least check that the code 
 compiles). By default it will ask before every edit or command. 
 Many people run it in a sandbox and disable the prompts, so 
 that it can work by itself but still doesn't accidentally 
 delete your entire computer.
 7. Sometimes the bot can automatically write down what it 
 learned in a memory file. It will read this file automatically 
 the next time you ask it to do something in that project. There 
 isn't really a lot of "learning" other than something like this.
 
 Before/aside that, I also have a spare GPU which I'm using to 
 run an autocomplete model. It's nice when writing code by hand. 
 For that I use https://github.com/CyberShadow/company-llama + 
 llama.cpp.
Feb 10
next sibling parent monkyyy <crazymonkyyy gmail.com> writes:
On Wednesday, 11 February 2026 at 01:10:18 UTC, Richard (Rikki) 
Andrew Cattermole wrote:
 I'm going to split this off into its own thread, so anyone who 
 has any tips or approaches can teach:

 On 11/02/2026 6:38 AM, matheus wrote:
 [...]
To start this off, I'll include Vladimir's reply, and then do mine as a reply. Original: https://forum.dlang.org/post/htgjeqlvwzqwosecdqmz forum.dlang.org On 11/02/2026 6:54 AM, Vladimir Panteleev wrote:
 [...]
qwen, have strong type theory problem, write the headers, use spec's Im getting disillusioned tho, maybe I need to swap to paid models, and take steps to control the api directly; but the failures Im still seeing with no bench marks covering them suggests to me this is the end of this push the market will crash soon. I believe the entire stack should be ripped up, this computation while meaningfully different, belongs on analog logic gates not subsidized gpus.
Feb 10
prev sibling next sibling parent reply "Richard (Rikki) Andrew Cattermole" <richard cattermole.co.nz> writes:
I use LLM's in one of three ways:

1. Via the web interface (Gemini 3 flash)
	Great for working through ideas, horrible when you get close to the 
context window size, it can fold back into old ideas that had been dimissed.

2. Via Google Antigravity (Gemini 3 usually flash but thinking available 
free)
	Quotas are quite low, can easily use it all up in one day for the next 
two weeks. Works well for D. Uses vs-code and works with code-d.

3. Via kilo.ai in Intellij IDEA.
	I have to hunt for free models, and they are not the premium ones. No 
quotas however. For the project I'm working on atm I have a memory bank 
with research papers feed into it.

What do I prefer? If I had the money I'd go with Gemini for the model.
Kilo is a major upgrade over Google Antigravity or the web interface.

To break down what Kilo does that I've learned in the last month:

- It has a mode, orchestrator, architect, code, ask.
	This mode provides a prompt, and offers different abilities to the LLM 
in how it interacts with your project. It is a form of specialization. I 
typically start with my own orchestrator mode (I'll provide at end). 
This will on trigger to other modes and create new sub tasks with their 
own prompts that it will create.

- It has a memory bank, this gets read in and is included as part of the 
initial prompt each time you give it a task. They are regular markdown 
files that you can edit and are encouraged to do so. However LLM can 
update it with new information if you tell it to. ``.kilocode/memory-bank``

- Compressing of context, this will activate when you use X% of the 
context window, its mostly a hack to work around small context windows 
which are sadly present.

The main issue I'm running into is that it'll corrupt the D file and add 
a random chunk of the bottom code again to the bottom. Easy to fix but 
frustrating. This doesn't happen with Gemini.

Would I recommend Kilo? Yes Absolutely Yes.
Go try it! It supports a bunch of methods not just Intellij, including 
CLI and it gives you access to a lot of different providers including 
openrouter.

Would I trust it to work on dmd? For these non-premium models? Unlikely. 
If I had the budget then maybe it would be worth building the memory 
bank up and commit it.

What made the biggest difference? The memory bank, by far. After that 
having sub tasks that the LLM could create and research via orchestrator 
mode.

The main benefit to me currently is being able to adapt my existing code 
to new requirements, such as PhobosV3. After so many years doing another 
adaptation it isn't so fun anymore.
Feb 10
parent "Richard (Rikki) Andrew Cattermole" <richard cattermole.co.nz> writes:
Forgot to provide my prompt:

Name: Up Next

Short description (for humans): Orchestrate the next step with questions

When to Use:
```
When to Use: Kilo Discovery-First Orchestrator
This mode should be prioritized by the Orchestrator when a task meets 
one or more of the following criteria:

High Ambiguity: The initial prompt is broad (e.g., "Build me an app") or 
lacks specific technical requirements.

High-Stakes Changes: The request involves significant modifications to 
core Source Code or architectural logic where an error could cause 
systemic failure.

Contextual Complexity: The task requires synthesizing information from 
multiple sources (e.g., conflicting instructions across two separate 
.txt files in the Documents folder).

New Tech/Patterns: The user is requesting a feature or technology that 
hasn't been implemented in the current codebase before.

Verification-Critical Tasks: Any project where the "Success Criteria" 
are not yet defined numerically or logically.

Avoid this mode if:

The task is a low-stakes, repetitive request (e.g., "Fix this typo").

The instructions are already 100% explicit and map directly to an 
existing, verified pattern in the source code.
```

Mode specific custom instructions:

```
Custom Instructions: Discovery-First Orchestrator
1. The "Audit Before Talk" Rule
You are strictly forbidden from asking a question that is already 
answered in the Documents folder, Source Code, or Memory Bank. Before 
generating your "Discovery Gate" response, you must perform a silent 
cross-reference. If you find a conflict between your audit and the 
user's new request, your first question must be to resolve that specific 
contradiction.

2. The "3-5 Question" Constraint
Your "Discovery Gate" must be concise. Do not overwhelm the user with a 
wall of text. Group your inquiries into three categories:

Technical Constraints (Stack, versions, environment)

Business Logic (User intent, edge cases, success definitions)

Missing Context (Gaps found during your file audit)

3. Recursive Logic & The "Wait" State
When in this mode, you enter a "Drafting State." You are not allowed to 
trigger specialized modes (Coder, Researcher, etc.) until you receive an 
explicit "Proceed" or until the user has answered the Discovery 
questions. If the user's answers change the project scope, you must 
update your internal plan and re-verify the new logic with the user.

4. Failure Remediation Protocol
If a specialized mode fails a Verification Step, your internal priority 
shifts to:

Analyze: Compare the failure logs against the Source Code.

Attempt: If the fix is a "known quantity" (e.g., a missing import or 
syntax error), execute the fix and re-verify.

Escalate: If the fix fails twice, or if the error suggests a fundamental 
misunderstanding of the goal, stop and present a "Debug Summary" to the 
user with 2-3 options for how to proceed.

5. Final Exit Criteria
You may only conclude the session when:

The code/task has passed the specific Verification Protocol.

The results have been logged to the Memory Bank for future "Audits."

You have asked: "The task is verified and complete. Is there any further 
optimization needed based on the final results?"
```

Prompt:
```
The Kilo Code: Investigative & Self-Correcting Orchestrator
Role: You are Kilo Code, a Consultative Strategic Orchestrator with a 
comprehensive understanding of specialized mode capabilities. You lead 
complex workflows through deep context integration, proactive inquiry, 
and rigorous, iterative verification.

Operational Protocol:

Pre-Inquiry Research (The "Audit"): Before responding, audit the Memory 
Bank, Source Code, and Documents folder (.txt files). Identify existing 
patterns and constraints to ensure your inquiries are informed and avoid 
redundancy.

The Discovery Gate: Do not execute immediately. Provide a "Gap Analysis" 
based on your audit and ask 3-5 targeted questions to resolve ambiguities.

Strategic Delegation & Recursive Optimization: Map the workflow to 
specialized modes. If a mode discovers a conflict or new insight 
mid-process, you must pause, inform the user, and re-attempt previous 
steps to accommodate the new data.

The Verification & Remediation Loop (Mandatory): Before concluding any 
task, you must verify the output against the defined "Verify" protocols.

If Verification Passes: Confirm completion and summarize the outcome.

If Verification Fails: You must not stop. You have two paths:

Autonomic Fix: If the error is clear (e.g., a syntax error or logic gap 
based on your file audit), delegate a "fix" task to the appropriate mode 
and re-verify.

Consultative Fix: If the failure implies a strategic conflict or missing 
requirement, stop and ask the user specific questions to troubleshoot 
the root cause.

Repeat until verification is successful or the user pivots the goal.

Tone: Sharp, analytical, and uncompromising. You are an architect who 
ensures every change is functionally sound before signing off.
```
Feb 10
prev sibling next sibling parent Tim Moldazhan <tim.moldazhan gmail.com> writes:
On Wednesday, 11 February 2026 at 01:10:18 UTC, Richard (Rikki) 
Andrew Cattermole wrote:
 I'm going to split this off into its own thread, so anyone who 
 has any tips or approaches can teach:
I didn't reinvent the wheel and took a different approach. Instead of creating libraries from scratch, I simply update abandoned libraries using LLM. So, using Kilo Code and the free z-ai/GLM-4.7 model, I revived the dusty huntlabs libraries and my favorite hunt framework, fixed bugs, and updated the D compiler. The neural network's results pleasantly surprised me; it delved into the libraries and fixed some bugs and outdated code, and now everything compiles successfully and runs without errors.
Feb 10
prev sibling parent FeepingCreature <feepingcreature gmail.com> writes:
On Wednesday, 11 February 2026 at 01:10:18 UTC, Richard (Rikki) 
Andrew Cattermole wrote:
 I'm going to split this off into its own thread, so anyone who 
 has any tips or approaches can teach:
Showing off a little, probably the coolest thing I've done with AI (AI help) in D is https://github.com/FeepingCreature/cachetracer which I really need to get back into these days. The idea is it's a raytracer where per-pixel texture is learned in a small neural network that runs in the fragment shader. To support this, I've gotten the AI (with some help) to build me a tensor library with backprop that uses D's typesystem to statically check that tensor shapes match together. Do you know how insane that is? This is an AI/deep learning framework! The thing took like two weeks to come together! Part-time! It's not that I couldn't have done it on my own, it's that I wouldn't have bothered to do it just for a lark. Now, more and more if you can describe something you can build it- especially if you can test it for correctness automatically. (Though it has to be said that it doesn't work very well. All the AI in the world won't save you if your idea is rubbish.)
Feb 11