feat: surface template README to agent template tools (#26334)

Fixes CODAGT-447.

Alternative implementation of https://github.com/coder/coder/pull/26212
and https://github.com/coder/coder/pull/25978

- Adds up to the first 1000 characters of `README.md` (with leading
frontmatter stripped) to `chattool.list_templates` output
- Adds up to 800 characters of `README.md` to `chattool.read_template`.

**Note:** skipping `toolsdk` versions to keep scope small.

> 🤖 Generated by Coder Agents
This commit is contained in:
Cian Johnston
2026-06-24 12:32:46 +01:00
committed by GitHub
parent 85652554f9
commit 2d28c1b396
11 changed files with 712 additions and 8 deletions
+12 -3
View File
@@ -124,9 +124,9 @@ immediately with no provisioning delay.
## Optimize your templates
The agent selects templates based on their **name and description** — it does
not read Terraform. Clear, specific descriptions are the most important factor
in whether the agent picks the right template.
The agent selects templates based on their **name, description, and README**.
It does not read Terraform. Clear, specific descriptions are the most important
factor in whether the agent picks the right template.
Update your template descriptions to include:
@@ -134,6 +134,15 @@ Update your template descriptions to include:
- Which repository or service it is for, if applicable.
- What type of work it supports (backend, frontend, data pipeline, etc.).
When 128 characters is not enough, put the most important routing context near
the top of the template's
[`README.md`](./platform-controls/template-optimization.md#put-routing-context-near-the-top-of-the-readme).
The chat agent's template listing includes a bounded README excerpt (roughly the
first 1,000 characters), and template detail includes the README (up to roughly
8,000 characters). Both are reduced to plain text: frontmatter is stripped,
link text is kept while link URLs are dropped, images and badges are dropped
entirely, and code blocks and tables are preserved as text.
**Good examples:**
| Description | Why it works |