feat(agentic): auto-copy AX spec + Core source into agent workspaces
prepWorkspace now copies RFC-025-AGENT-EXPERIENCE.md and all Core .go files into .core/reference/ in every dispatched workspace. Agents can read the AX conventions and Core API without network access. Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
4329bd7f27
commit
2bbc8063cf
1 changed files with 33 additions and 2 deletions
|
|
@ -227,12 +227,15 @@ func (s *PrepSubsystem) prepWorkspace(ctx context.Context, _ *mcp.CallToolReques
|
|||
// 8. Copy spec files into specs/
|
||||
out.SpecFiles = s.copySpecs(wsDir)
|
||||
|
||||
// 9. Write PLAN.md from template (if specified)
|
||||
// 9. Copy AX reference files into .core/reference/
|
||||
s.copyReference(wsDir)
|
||||
|
||||
// 11. Write PLAN.md from template (if specified)
|
||||
if input.PlanTemplate != "" {
|
||||
s.writePlanFromTemplate(input.PlanTemplate, input.Variables, input.Task, wsDir)
|
||||
}
|
||||
|
||||
// 10. Write prompt template
|
||||
// 11. Write prompt template
|
||||
s.writePromptTemplate(input.Template, wsDir)
|
||||
|
||||
out.Success = true
|
||||
|
|
@ -473,6 +476,34 @@ func (s *PrepSubsystem) copySpecs(wsDir string) int {
|
|||
return count
|
||||
}
|
||||
|
||||
// copyReference copies the AX spec and Core source files into .core/reference/
|
||||
// so dispatched agents can read the conventions and API without network access.
|
||||
func (s *PrepSubsystem) copyReference(wsDir string) {
|
||||
refDir := filepath.Join(wsDir, "src", ".core", "reference")
|
||||
coreio.Local.EnsureDir(refDir)
|
||||
|
||||
// Copy AX spec from docs repo
|
||||
axSpec := filepath.Join(s.codePath, "core", "docs", "docs", "specs", "RFC-025-AGENT-EXPERIENCE.md")
|
||||
if data, err := coreio.Local.Read(axSpec); err == nil {
|
||||
coreio.Local.Write(filepath.Join(refDir, "RFC-025-AGENT-EXPERIENCE.md"), data)
|
||||
}
|
||||
|
||||
// Copy Core Go source files for API reference
|
||||
coreGoDir := filepath.Join(s.codePath, "core", "go")
|
||||
entries, err := coreio.Local.List(coreGoDir)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
for _, entry := range entries {
|
||||
if entry.IsDir() || filepath.Ext(entry.Name()) != ".go" {
|
||||
continue
|
||||
}
|
||||
if data, err := coreio.Local.Read(filepath.Join(coreGoDir, entry.Name())); err == nil {
|
||||
coreio.Local.Write(filepath.Join(refDir, entry.Name()), data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (s *PrepSubsystem) generateContext(ctx context.Context, repo, wsDir string) int {
|
||||
if s.brainKey == "" {
|
||||
return 0
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue