Feat/issue 1218 agent md context structure#1705
Conversation
Parse AGENT.md frontmatter into a runtime definition and pair it with SOUL.md while keeping a legacy AGENTS.md fallback for transition. Refs sipeed#1218
Use AGENT.md and SOUL.md as the structured bootstrap source, ignore IDENTITY.md for structured agents, remove USER.md from the new context flow, and update pkg/agent tests accordingly. Refs sipeed#1218
Replace the legacy AGENTS.md, IDENTITY.md, and USER.md templates with a structured AGENT.md plus SOUL.md, and update the onboard template test to assert the new generated files. Refs sipeed#1218
Refresh the documented workspace tree across the README translations so onboarding now points to AGENT.md and SOUL.md instead of the retired AGENTS.md, IDENTITY.md, and USER.md files. Refs sipeed#1218
PR #1705 Code ReviewOverall AssessmentThis is a well-designed refactoring that simplifies agent configuration from 3 files to 2. The code quality is good and test coverage is adequate. However, there are a few design issues that need clarification and correction. 🚨 Core Issue: USER.md PositioningUSER.md should be global user information, not agent-level configuration. Issues:
Suggestions:
|
yinwm
left a comment
There was a problem hiding this comment.
PR #1705 Review - Approved ✅
Summary
This PR introduces a structured AGENT.md format with YAML frontmatter, replacing the previous scattered AGENTS.md and IDENTITY.md files. The new format supports machine-readable configuration (name, model, tools, skills, mcpServers, maxTurns) while preserving the body as the LLM prompt.
Key Strengths
- Excellent backward compatibility - Falls back to
AGENTS.mdwhenAGENT.mdis absent - Clean separation of machine-readable config and human-readable prompt
- Comprehensive tests covering frontmatter parsing, fallback logic, and cache invalidation
- Documentation synced across all language READMEs
Minor Suggestions (non-blocking)
-
trackedPaths()logic - When usingAGENTS.mdformat,AGENT.mdis still included in paths even though it doesn't exist. Consider filtering based on actual source type. -
Silent frontmatter failures - Invalid YAML frontmatter returns an empty struct with only a warning log. Users may not realize their config wasn't applied.
-
Test helper duplication -
setupWorkspaceandcleanupWorkspaceare duplicated across test files. Consider extracting to a shared helper. -
README consistency - Some localized READMEs (fr, ja, pt-br, vi) show
...forUSER.mdwhile English version shows full description.
Verdict
Approved - Well-designed change with proper backward compatibility and test coverage. The minor issues above can be addressed in follow-up PRs if needed.
Ready to merge. 🚀
📝 Description
This PR makes the workspace agent bootstrap fully based on the new
AGENT.mdstructure, while keeping backward compatibility with legacyAGENTS.mdworkspaces. #1218What Changed
pkg/agentAGENT.mdinto a runtime-friendly definitionAGENT.mdbody and resolvedSOUL.mdcontent when building the system promptIDENTITY.mdinto the prompt when a structuredAGENT.mdworkspace is presentAGENTS.mdworkspacesAGENTS.md/IDENTITY.md/USER.mdtoAGENT.md+SOUL.mdBehavior Notes
AGENT.mdfrontmatter is parsed for structured metadata, but raw frontmatter is not injected into the promptAGENT.md,SOUL.md, and memory filesAGENTS.mdwithout breaking existing setups🗣️ Type of Change
🤖 AI Code Generation
☑️ Checklist