Files
DeepSeek-Reasonix/internal/skill/embedded_reference.go
T
SivanCola 7249169c9b refactor(skill): streamline prompts and load references on demand (#10189)
Problem: verbose standing instructions and truncated skill catalogs obscure relevant guidance.

Root cause: task-specific procedures entered shared context, catalogs clipped entries, and the built-in guide exposed all diagnostics together.

Fix: keep concise task routing, preserve whole catalog entries with discovery hints, and load embedded references through read_skill. Refresh outdated development guidance and intentional prompt goldens.

Verification: go test ./...; make lint; Markdown link checks; discovery, reference isolation, and stable provider-prefix regression tests. No live-model A/B was performed.
2026-09-12 19:32:19 +08:00

22 lines
717 B
Go

package skill
import (
"fmt"
"strings"
"reasonix/internal/skill/builtincontent"
)
func renderEmbeddedReference(sk Skill, reference string) (string, error) {
if sk.Scope != ScopeBuiltin || !strings.HasPrefix(sk.Path, "(builtin:") ||
!strings.HasSuffix(sk.Path, ")") {
return "", fmt.Errorf("skill %q has no embedded references; use its source files for file-backed references", sk.Name)
}
source := strings.TrimSuffix(strings.TrimPrefix(sk.Path, "(builtin:"), ")")
body, err := builtincontent.ReadReference(source, reference)
if err != nil {
return "", fmt.Errorf("read_skill reference %q: %w", reference, err)
}
return fmt.Sprintf("# Skill reference: %s/%s\n\n%s", sk.Name, reference, body), nil
}