Skip to content

Commit 12c2e53

Browse files
committed
refactor: use SeedReferences return value and consolidate reference prompt section
1 parent 064616c commit 12c2e53

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

internal/agent/system_prompt.txt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,9 @@ Rules:
276276
</memory_management>
277277
{{end}}
278278

279+
<reference>
279280
{{if .ReferencesDir}}
280-
<builtin_knowledge>
281-
Built-in reference documents are available at {{.ReferencesDir}}/. Use `read` to load them when you need detailed information beyond what `dagu schema` provides.
281+
Reference documents are available at {{.ReferencesDir}}/. Use `read` to load them when you need details beyond what `dagu schema` provides.
282282

283283
Available references:
284284
- `schema.md` — Complete DAG YAML schema (top-level and step-level fields)
@@ -292,10 +292,7 @@ Load a reference when:
292292
- A user asks about a specific executor, CLI command, or env var and `dagu schema` doesn't cover the detail
293293
- You need to write a DAG that uses coding agents (claude -p, codex exec, gemini -p, etc.)
294294
- You want to double-check a pitfall before authoring a DAG
295-
</builtin_knowledge>
296295
{{end}}
297-
298-
<reference>
299296
Use `dagu schema` and `dagu example` via bash to look up DAG YAML structure and see examples:
300297
- `dagu schema dag` — root-level DAG fields
301298
- `dagu schema dag steps` — step properties

internal/service/frontend/server.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ func NewServer(ctx context.Context, cfg *config.Config, dr exec.DAGStore, drs ex
180180
}
181181

182182
// Seed built-in knowledge references to data dir (not git-synced).
183-
fileagentskill.SeedReferences(
183+
referencesDir := fileagentskill.SeedReferences(
184184
filepath.Join(cfg.Paths.DataDir, "agent", "references"),
185185
)
186186

@@ -318,7 +318,7 @@ func NewServer(ctx context.Context, cfg *config.Config, dr exec.DAGStore, drs ex
318318

319319
var agentAPI *agent.API
320320
if agentConfigStore != nil {
321-
agentAPI, err = initAgentAPI(ctx, agentConfigStore, agentModelStore, agentSkillStore, agentSoulStore, &cfg.Paths, cfg.Server.Session.MaxPerUser, dr, auditSvc, memoryStore, newRemoteNodeAdapter(remoteNodeResolver))
321+
agentAPI, err = initAgentAPI(ctx, agentConfigStore, agentModelStore, agentSkillStore, agentSoulStore, &cfg.Paths, referencesDir, cfg.Server.Session.MaxPerUser, dr, auditSvc, memoryStore, newRemoteNodeAdapter(remoteNodeResolver))
322322
if err != nil {
323323
logger.Warn(ctx, "Failed to initialize agent API", tag.Error(err))
324324
}
@@ -649,7 +649,7 @@ func autoEnableExampleSkills(ctx context.Context, configStore agent.ConfigStore)
649649

650650
// initAgentAPI creates and returns an agent API.
651651
// The API uses the config store to check enabled status and resolve providers via the model store.
652-
func initAgentAPI(ctx context.Context, store *fileagentconfig.Store, modelStore agent.ModelStore, skillStore agent.SkillStore, soulStore agent.SoulStore, paths *config.PathsConfig, sessionMaxPerUser int, dagStore exec.DAGStore, auditSvc *audit.Service, memoryStore agent.MemoryStore, remoteResolver agent.RemoteNodeResolver) (*agent.API, error) {
652+
func initAgentAPI(ctx context.Context, store *fileagentconfig.Store, modelStore agent.ModelStore, skillStore agent.SkillStore, soulStore agent.SoulStore, paths *config.PathsConfig, referencesDir string, sessionMaxPerUser int, dagStore exec.DAGStore, auditSvc *audit.Service, memoryStore agent.MemoryStore, remoteResolver agent.RemoteNodeResolver) (*agent.API, error) {
653653
sessStore, err := filesession.New(paths.SessionsDir, filesession.WithMaxPerUser(sessionMaxPerUser))
654654
if err != nil {
655655
logger.Warn(ctx, "Failed to create session store, persistence disabled", tag.Error(err))
@@ -681,7 +681,7 @@ func initAgentAPI(ctx context.Context, store *fileagentconfig.Store, modelStore
681681
ConfigFile: paths.ConfigFileUsed,
682682
WorkingDir: paths.DAGsDir,
683683
BaseConfigFile: paths.BaseConfig,
684-
ReferencesDir: filepath.Join(paths.DataDir, "agent", "references"),
684+
ReferencesDir: referencesDir,
685685
},
686686
})
687687

0 commit comments

Comments
 (0)