AltimateAI / AltimateAI/altimate-code

Dynamic skill discovery fails silently, hardcoded prompt is only fallback

Aperta
#206 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
bug from-cli user-feedback
Lingua principale
TypeScript
Stelle
811
Fork
134
Merge medio
3g 2h
PR unite (30g)
50

Descrizione

## Problem

Skills defined in `.opencode/skills/` that are **not hardcoded in the agent mode system prompt** (e.g., `builder.txt`) are effectively invisible to the agent — even when the skill file exists on disk and is properly formatted.

## Root Cause

The builder-mode system prompt (`packages/opencode/src/altimate/prompts/builder.txt`) contains a **static, hardcoded list** of available skills under `## Available Skills`. The dynamic skill discovery system (`Skill.fmt()` in `system.ts`) is designed to supplement this by scanning `.opencode/skills/`, `~/.claude/skills/`, `.agents/skills/`, and configured paths at runtime. However, when the dynamic scanner returns 0 results (e.g., working directory mismatch, no project-level `.opencode/` directory), the **only skills the agent knows about are the hardcoded ones**.

This means any newly added skill (like `data-viz`) that exists in `.opencode/skills/data-viz/SKILL.md` but was never added to `builder.txt` will be silently ignored — the agent won't suggest it, won't invoke it, and won't know it exists.

## Observed Behavior

- User asked for a Snowflake credit consumption report with data visualization
- The `data-viz` skill exists at `.opencode/skills/data-viz/SKILL.md` with a proper frontmatter and description that explicitly matches visualization-related requests
- The agent produced a text-only report instead of loading the `data-viz` skill
- The `mcp_skill` tool description confirmed: *"No skills are currently available"* — the dynamic scanner found nothing
- The hardcoded list in `builder.txt` has 14 skills but `data-viz` is not among them

## Expected Behavior

All skills in `.opencode/skills/` should be discoverable by the agent regardless of whether they are manually listed in the agent mode prompt. The dynamic discovery should be the **primary** mechanism, not a supplement to a static list.

## Suggested Fix Options

1. **Remove the hardcoded skill list** from `builder.txt` entirely — rely solely on dynamic discovery via `Skill.fmt()` and `SystemPrompt.skills()`
2. **Auto-generate the skill list** in the prompt from the same scanner that `Skill.available()` uses, so any new `SKILL.md` file is automatically included
3. **As a stopgap**, add `/data-viz` to the hardcoded list in `builder.txt`

## Files Involved

- `packages/opencode/src/altimate/prompts/builder.txt` (lines 72-87) — hardcoded skill list
- `packages/opencode/src/skill/skill.ts` — dynamic skill scanner
- `packages/opencode/src/session/system.ts` — runtime skill injection into system prompt
- `packages/opencode/src/tool/skill.ts` — skill tool definition (shows "No skills available" when scanner returns 0)
- `.opencode/skills/data-viz/SKILL.md` — the missing skill

---

### Metadata

| Field | Value |
|-------|-------|
| CLI Version | v0.4.0 |
| Platform | darwin |
| Architecture | arm64 |
| OS Release | 24.6.0 |
| Category | bug |
| Working Directory | saurabh-altimate-home |
| Session ID | ses_306e28fe3ffem202w6U4qcQawg |

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.