{
"meta": {
"agent": "planner",
"task_id": "533",
"title": "Compound skill: write AGENTS.md learnings via PR instead of direct commit",
"created_at": "2026-04-16T12:00:00Z"
},
"inputs": [
{
"name": "issue-533",
"type": "context",
"ref": "https://github.com/AgentSDE/agent-core/issues/533",
"notes": "AGENTS.md direct-commit fails with 409 on protected repos after GitHub App migration"
},
{
"name": "compound.service.ts",
"type": "file",
"ref": "src/hooks/compound.service.ts",
"notes": "writeLearnings() uses createOrUpdateFile() — the root cause"
},
{
"name": "github.service.ts",
"type": "file",
"ref": "src/github/github.service.ts",
"notes": "Missing createBranch/enableAutoMerge methods"
},
{
"name": "SKILL.md",
"type": "file",
"ref": ".claude/skills/compound-learnings/SKILL.md",
"notes": "Already uses PR path — server-side hook should match"
}
],
"outputs": [
{
"name": "plan",
"type": "plan",
"format": "md",
"content": "plan.md"
}
],
"files": [
{
"path": "src/github/github.service.ts",
"action": "modify",
"reason": "Add createBranch, getDefaultBranchSha, enableAutoMerge methods"
},
{
"path": "src/github/github.service.spec.ts",
"action": "modify",
"reason": "Unit tests for new GitHubService methods"
},
{
"path": "src/hooks/compound.service.ts",
"action": "modify",
"reason": "Replace direct commit with branch+PR+auto-merge flow"
},
{
"path": "src/hooks/compound.service.spec.ts",
"action": "modify",
"reason": "Update tests for PR-based flow"
},
{
"path": ".claude/skills/compound-learnings/SKILL.md",
"action": "inspect",
"reason": "Verify no conditional branching on repo type"
}
],
"steps": [
{
"id": "S1",
"summary": "Add createBranch, getDefaultBranchSha, and enableAutoMerge methods to GitHubService with unit tests",
"acceptance": [
"createBranch calls POST /repos/{owner}/{repo}/git/refs with correct ref and SHA",
"createBranch handles 422 (branch exists) by deleting and recreating",
"getDefaultBranchSha resolves default branch name and HEAD SHA",
"enableAutoMerge calls GraphQL enablePullRequestAutoMerge with SQUASH method",
"enableAutoMerge catches errors gracefully when auto-merge is not enabled on the repo",
"All three methods have unit tests in github.service.spec.ts"
],
"depends_on": []
},
{
"id": "S2",
"summary": "Refactor CompoundService.writeLearnings to use branch+PR+auto-merge flow instead of direct commit",
"acceptance": [
"writeLearnings creates a branch (agents-md/issue-{N}), commits AGENTS.md to it, opens a PR, and enables auto-merge",
"Direct createOrUpdateFile to default branch is removed",
"Existing AGENTS.md content is fetched from default branch and appended correctly",
"New AGENTS.md (file doesn't exist) is handled correctly",
"compound.service.spec.ts tests updated to verify PR flow",
"npm run test passes",
"npm run lint passes",
"npm run build succeeds"
],
"depends_on": [
"S1"
]
}
],
"risks": [
{
"risk": "enableAutoMerge fails if repo doesn't have auto-merge enabled in settings",
"mitigation": "Catch error and log warning — PR stays open for manual merge"
},
{
"risk": "Stale branch from prior failed run blocks creation",
"mitigation": "Delete existing branch before creating (same pattern as compound-learnings skill)"
}
],
"assumptions": [
"GitHubService.graphql() is available for the enableAutoMerge mutation",
"All target repos have 'Allow auto-merge' enabled (but code handles the case where it's not)"
],
"open_questions": []
}