Skip to content

Commit c047a05

Browse files
Pujitha PaladuguPujitha Paladugubrady gasterCopilot
authored
fix(sdk): read legacy Role/Owns charter sections for capability advertisement (#2381)
* fix(sdk): read legacy Role/Owns charter sections for capability advertisement Motivation: charterEvidence() only consulted the description, expertise, capabilities, the "What I Own" section and the "I handle" boundary. Charters written with legacy "## Role" / "## Owns" sections (which parseAgentDoc retains in extraSections) contributed no evidence, so declared implementers and reviewers were advertised as advisory-only with "write and modify code" / "review code" listed as absent. Approach: include the retained "Owns" and "Role" extra sections in the charter evidence alongside "What I Own". Existing edit-negation handling (positiveEditEvidence) applies unchanged, so negated edit claims do not grant edit authority; negated review claims are not handled (a pre-existing limitation that also applies to "What I Own"). Only the charter half of the report is addressed; the "## Domain -> Agent" routing-table form in the Ralph triage parser is left alone, as accepting it changes shared triage behaviour and merits a separate decision. Validation: added two tests in test/team-capabilities.test.ts (legacy sections yield edit/review authority; negated legacy Role stays advisory). Ran `npx vitest run test/team-capabilities.test.ts`: the legacy-section test fails without the source change and all 47 pass with it. `npx tsc --noEmit -p packages/squad-sdk` is clean. The repo-wide `npm run lint` shows unresolved squad-sdk imports in squad-cli because the SDK is not built here; I did not build the full tree or run the whole test suite. Partially addresses the report: https://github.com/bradygaster/squad/issues/2366 Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com> Assisted-by: claude-sonnet-5-5 (via Claude Code) * test(sdk): isolate legacy charter section coverage Part of #2366 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --------- Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com> Co-authored-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com> Co-authored-by: brady gaster <bradygaster@github.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent cb7be10 commit c047a05

3 files changed

Lines changed: 50 additions & 1 deletion

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@bradygaster/squad-sdk": patch
3+
---
4+
5+
Team capability advertisement now reads legacy `## Role` and `## Owns` charter sections, so declared implementers and reviewers are no longer reported as advisory-only.

‎packages/squad-sdk/src/config/team-capabilities.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,15 @@ function charterEvidence(charterMarkdown: string | undefined): {
301301
return { focus: '', evidence: '' };
302302
}
303303

304-
const owns = doc.extraSections['What I Own'] ?? '';
304+
// Legacy charters use `## Role` / `## Owns` instead of `## Identity` /
305+
// `## What I Own`; parseAgentDoc retains them verbatim in extraSections.
306+
const owns = [
307+
doc.extraSections['What I Own'],
308+
doc.extraSections['Owns'],
309+
doc.extraSections['Role'],
310+
]
311+
.filter(Boolean)
312+
.join('\n');
305313
const boundaries = doc.extraSections['Boundaries'] ?? '';
306314
const handles = boundaries.match(/\*\*I handle:?\*\*\s*(.+)/i)?.[1] ?? '';
307315

‎test/team-capabilities.test.ts‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,3 +612,39 @@ describe('#1608 — prompt budget impact', () => {
612612
expect(Buffer.byteLength(block, 'utf8')).toBeLessThan(8192);
613613
});
614614
});
615+
616+
describe('legacy charter sections (## Role / ## Owns)', () => {
617+
const teamMarkdown = `# Team\n\n## Members\n\n| Name | Role |\n| --- | --- |\n| Builder | Specialist |\n| Reviewer | Specialist |\n`;
618+
619+
it('derives edit authority from a legacy Role section alone', () => {
620+
const profile = buildTeamCapabilityProfile({
621+
teamMarkdown,
622+
charters: {
623+
Builder: '# Builder\n\n## Role\n\nImplement and refactor frontend code.\n',
624+
},
625+
});
626+
const builder = profile.specialists.find((s) => s.name === 'Builder');
627+
expect(builder?.authority).toContain('edit');
628+
expect(profile.absentCapabilities.join('\n')).not.toMatch(/write and modify code/);
629+
});
630+
631+
it('derives review authority from a legacy Owns section alone', () => {
632+
const profile = buildTeamCapabilityProfile({
633+
teamMarkdown,
634+
charters: {
635+
Reviewer: '# Reviewer\n\n## Owns\n\n- Review code and approve changes.\n',
636+
},
637+
});
638+
const reviewer = profile.specialists.find((s) => s.name === 'Reviewer');
639+
expect(reviewer?.authority).toContain('review');
640+
expect(profile.absentCapabilities.join('\n')).not.toMatch(/review code and pull requests/);
641+
});
642+
643+
it('still honours negation in legacy sections', () => {
644+
const profile = buildTeamCapabilityProfile({
645+
teamMarkdown,
646+
charters: { Builder: '# Builder\n\n## Role\n\nDoes not implement code.\n' },
647+
});
648+
expect(profile.specialists.find((s) => s.name === 'Builder')?.authority).toEqual(['advisory']);
649+
});
650+
});

0 commit comments

Comments
 (0)