Skip to content

Commit 3384e02

Browse files
committed
copilot/agents: Update agents and instructions
1 parent 04cf92a commit 3384e02

12 files changed

Lines changed: 172 additions & 618 deletions

.github/agents.md

Lines changed: 33 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -2,107 +2,45 @@
22

33
Specialized agents for Sharpy development. Each agent has domain expertise and clear boundaries.
44

5-
## Quick Reference
6-
7-
### Core Agents
8-
9-
| Agent | File | Domain |
10-
|-------|------|--------|
11-
| Implementer | `implementer.agent.md` | Full implementation + PRs |
12-
| Code Reviewer | `code-reviewer.agent.md` | PR review (read-only) |
13-
| Task Planner | `task-planner.agent.md` | Task decomposition |
14-
| Verification Expert | `verification-expert.agent.md` | Read-only verification |
15-
16-
### Compiler Pipeline
17-
18-
| Agent | File | Domain |
19-
|-------|------|--------|
20-
| Lexer Expert | `lexer-expert.agent.md` | Tokenization |
21-
| Parser Expert | `parser-expert.agent.md` | AST construction |
22-
| Semantic Expert | `semantic-expert.agent.md` | Type checking |
23-
| CodeGen Expert | `codegen-expert.agent.md` | C# emission |
24-
25-
### Library & CLI
26-
27-
| Agent | File | Domain |
28-
|-------|------|--------|
29-
| Core Library Expert | `core-library-expert.agent.md` | Sharpy.Core stdlib |
30-
| CLI Expert | `cli-expert.agent.md` | sharpyc CLI |
31-
| Test Expert | `test-expert.agent.md` | xUnit tests |
32-
33-
### Axiom Guardians (Advisory)
34-
35-
| Agent | File | Guards |
36-
|-------|------|--------|
37-
| .NET Axiom Guardian | `net-axiom-guardian.agent.md` | Axiom 1: .NET/C# 9.0 |
38-
| Python Axiom Guardian | `python-axiom-guardian.agent.md` | Axiom 2: Python syntax |
39-
| Type Safety Guardian | `type-safety-guardian.agent.md` | Axiom 3: Static typing |
40-
| Unity Compatibility Guardian | `unity-compatibility-guardian.agent.md` | Unity constraints |
41-
| Axiom Arbiter | `axiom-arbiter.agent.md` | Conflict resolution |
42-
| Design Philosophy Guardian | `design-philosophy-guardian.agent.md` | Overall design |
43-
44-
### Quality & Compliance (Advisory)
5+
> **See also:** [copilot-instructions.md](copilot-instructions.md) for full architecture and patterns.
456
46-
| Agent | File | Domain |
47-
|-------|------|--------|
48-
| Spec Adherence | `spec-adherence.agent.md` | Spec compliance |
49-
| Hallucination Defense | `hallucination-defense.agent.md` | Fact-checking |
50-
| Documentation Sync | `documentation-sync.agent.md` | Doc freshness |
51-
52-
## Agent Boundaries
53-
54-
### Read-Only Agents
55-
These agents analyze but never modify code:
56-
- `code-reviewer`, `verification-expert`, `spec-adherence`, `hallucination-defense`
57-
- All axiom guardians
58-
59-
### Domain-Specific Editors
60-
These agents only modify their owned directories:
61-
- `lexer-expert``src/Sharpy.Compiler/Lexer/`
62-
- `parser-expert``src/Sharpy.Compiler/Parser/`
63-
- `semantic-expert``src/Sharpy.Compiler/Semantic/`
64-
- `codegen-expert``src/Sharpy.Compiler/CodeGen/`
65-
- `core-library-expert``src/Sharpy.Core/`
66-
- `cli-expert``src/Sharpy.Cli/`
7+
## Quick Reference
678

68-
### Cross-Cutting Agents
69-
- `implementer` — Full codebase access for features
70-
- `task-planner` — Coordinates specialists
71-
- `test-expert` — Tests for all components
72-
- `documentation-sync` — Docs for all components
9+
| Agent | Domain | Edits |
10+
|-------|--------|-------|
11+
| `implementer` | Full implementation + PRs | All |
12+
| `code-reviewer` | PR review | Read-only |
13+
| `task-planner` | Task decomposition | Read-only |
14+
| `test-expert` | Testing | `*Tests/` |
15+
| `lexer-expert` | Tokenization | `Compiler/Lexer/` |
16+
| `parser-expert` | AST construction | `Compiler/Parser/` |
17+
| `semantic-expert` | Type checking | `Compiler/Semantic/` |
18+
| `codegen-expert` | C# emission | `Compiler/CodeGen/` |
19+
| `core-library-expert` | Stdlib | `Sharpy.Core/` |
20+
| `cli-expert` | CLI | `Sharpy.Cli/` |
21+
22+
### Axiom Guardians (Advisory, Read-Only)
23+
24+
| Agent | Guards |
25+
|-------|--------|
26+
| `net-axiom-guardian` | Axiom 1: .NET/C# 9.0 compatibility |
27+
| `python-axiom-guardian` | Axiom 2: Python syntax fidelity |
28+
| `type-safety-guardian` | Axiom 3: Static typing |
29+
| `axiom-arbiter` | Conflict resolution |
7330

7431
## Key Rules
7532

76-
All agents must:
77-
- **Never artificially make tests pass** — fix bugs instead
78-
- Run tests before/after changes
79-
- Follow existing code patterns
80-
- Reference language spec when implementing features
81-
82-
## Axiom Precedence
33+
1. **Never artificially make tests pass** — fix bugs instead
34+
2. **Axiom precedence**: .NET > Type Safety > Python Syntax
35+
3. Run tests before/after changes
36+
4. Follow existing code patterns
8337

84-
When axioms conflict: **Axiom 1 > Axiom 3 > Axiom 2**
85-
- .NET compatibility > Type safety > Python syntax
86-
- Unless resolved at zero cost
87-
88-
## Common Commands
38+
## Commands
8939

9040
```bash
91-
dotnet build sharpy.sln # Build all
92-
dotnet test # Run all tests
93-
dotnet format # Format before committing
94-
dotnet run --project src/Sharpy.Cli -- run file.spy # Compile and execute
95-
96-
# Debugging codegen - inspect generated C#
97-
dotnet run --project src/Sharpy.Cli -- emit csharp file.spy
98-
99-
# Filtered tests
100-
dotnet test --filter "FullyQualifiedName~Lexer"
101-
dotnet test --filter "FullyQualifiedName~Parser"
102-
dotnet test --filter "FullyQualifiedName~Semantic"
103-
dotnet test --filter "FullyQualifiedName~CodeGen"
104-
dotnet test --filter "FullyQualifiedName~FileBasedIntegrationTests"
105-
106-
# Verify Python behavior
107-
python3 -c "print([1,2,3].pop())"
41+
dotnet build sharpy.sln # Build
42+
dotnet test # Test
43+
dotnet format # Format
44+
dotnet run --project src/Sharpy.Cli -- emit csharp file.spy # Debug codegen
45+
python3 -c "..." # Verify Python behavior
10846
```

.github/agents/cli-expert.agent.md

Lines changed: 9 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -6,47 +6,16 @@ infer: false
66
---
77
# CLI Expert
88

9-
Specializes in the Sharpy command-line interface (`sharpyc`).
9+
**Owns:** `src/Sharpy.Cli/` | Uses `System.CommandLine` for argument parsing.
1010

11-
## Scope
12-
13-
**Owns:** `src/Sharpy.Cli/`
14-
15-
**Does NOT modify:** Compiler internals or Sharpy.Core
16-
17-
## Commands
11+
## CLI Commands
1812

1913
```bash
20-
# Compile and run a Sharpy file
21-
dotnet run --project src/Sharpy.Cli -- run file.spy
22-
23-
# Build a Sharpy file to DLL
24-
dotnet run --project src/Sharpy.Cli -- build file.spy
25-
26-
# Build with output path
27-
dotnet run --project src/Sharpy.Cli -- build file.spy -o output
28-
29-
# Emit C# (for debugging codegen)
30-
dotnet run --project src/Sharpy.Cli -- emit csharp file.spy
31-
32-
# Emit AST (for debugging parser)
33-
dotnet run --project src/Sharpy.Cli -- emit ast file.spy
34-
35-
# Emit tokens (for debugging lexer)
36-
dotnet run --project src/Sharpy.Cli -- emit tokens file.spy
37-
```
38-
39-
## Implementation
40-
41-
Uses `System.CommandLine` for argument parsing:
42-
43-
```csharp
44-
var buildCommand = new Command("build", "Compile a Sharpy file")
45-
{
46-
new Argument<FileInfo>("file", "The Sharpy file to compile"),
47-
new Option<DirectoryInfo>("-o", "Output directory"),
48-
new Option<bool>("--emit-csharp", "Output generated C#")
49-
};
14+
dotnet run --project src/Sharpy.Cli -- run file.spy # Compile and execute
15+
dotnet run --project src/Sharpy.Cli -- build file.spy -o out # Build to DLL
16+
dotnet run --project src/Sharpy.Cli -- emit csharp file.spy # Debug codegen
17+
dotnet run --project src/Sharpy.Cli -- emit ast file.spy # Debug parser
18+
dotnet run --project src/Sharpy.Cli -- emit tokens file.spy # Debug lexer
5019
```
5120

5221
## Testing
@@ -55,13 +24,7 @@ var buildCommand = new Command("build", "Compile a Sharpy file")
5524
dotnet test --filter "FullyQualifiedName~Cli"
5625
```
5726

58-
Integration tests should:
59-
- Verify command parsing
60-
- Test compilation end-to-end
61-
- Validate error reporting format
62-
6327
## Boundaries
6428

65-
- Will implement CLI commands and options
66-
- Will improve user-facing error messages
67-
- Will NOT modify core compiler logic
29+
- ✅ CLI commands, options, user-facing error messages
30+
- ❌ Core compiler logic

.github/agents/documentation-sync.agent.md

Lines changed: 9 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -6,59 +6,26 @@ infer: false
66
---
77
# Documentation Sync
88

9-
Keeps documentation synchronized with the Sharpy implementation.
9+
Keeps documentation synchronized with implementation.
1010

11-
## Scope
12-
13-
**Owns:**
14-
- `docs/` — All documentation
15-
- `README.md` — Project readme
16-
- Code comments and XML docs
17-
18-
**Monitors:** `src/Sharpy.Compiler/`, `src/Sharpy.Core/`, `src/Sharpy.Cli/`
11+
**Owns:** docs/, README.md, code comments
1912

2013
## Workflows
2114

22-
### PR Documentation Check
23-
24-
When a PR modifies code, check if docs need updates:
15+
1. **PR check** — When code changes, identify doc updates needed
16+
2. **Example validation** — Verify doc examples compile
17+
3. **Sync** — Update API refs, keep examples current, ensure spec accuracy
2518

26-
1. Identify changed public APIs
27-
2. Find corresponding documentation
28-
3. Flag mismatches or missing docs
29-
4. Suggest documentation updates
30-
31-
### Example Validation
32-
33-
Verify documentation examples compile:
19+
## Validation
3420

3521
```bash
36-
# Extract and test code blocks from docs
22+
# Test code blocks from docs
3723
for file in examples/*.spy; do
3824
dotnet run --project src/Sharpy.Cli -- check "$file"
3925
done
4026
```
4127

42-
### Sync Tasks
43-
44-
- Update API references when signatures change
45-
- Keep code examples current with implementation
46-
- Ensure spec documents reflect actual behavior
47-
- Generate changelog entries for releases
48-
49-
## Documentation Structure
50-
51-
```
52-
docs/
53-
├── language_specification/ # Authoritative language spec
54-
├── tutorials/ # How-to guides
55-
├── api/ # API reference
56-
└── examples/ # Code examples
57-
```
58-
5928
## Boundaries
6029

61-
- Will update documentation to match implementation
62-
- Will validate examples compile
63-
- Will create doc update PRs
64-
- Will NOT change implementation to match outdated docs
30+
- ✅ Update docs to match implementation, validate examples
31+
- ❌ Change implementation to match outdated docs

.github/agents/hallucination-defense.agent.md

Lines changed: 11 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -6,66 +6,25 @@ infer: false
66
---
77
# Hallucination Defense
88

9-
Validates factual accuracy of claims about .NET APIs, Roslyn behavior, Python semantics, and Sharpy implementation. **Read-only: does not modify code.**
10-
11-
## Purpose
12-
13-
AI agents can confidently make incorrect claims about:
14-
- .NET API behavior and availability
15-
- Roslyn SyntaxFactory methods
16-
- Python language semantics
17-
- C# 9.0 feature availability
18-
19-
This agent verifies claims against ground truth.
9+
Validates factual accuracy of claims. **Read-only.**
2010

2111
## Verification Categories
2212

23-
### 1. .NET API Claims
24-
25-
```bash
26-
# Verify actual behavior
27-
dotnet script -e "var list = new List<int>{1,2,3}; list.Insert(1, 99); Console.WriteLine(list.Count);"
28-
```
29-
30-
### 2. Roslyn API Claims
31-
32-
```csharp
33-
// Check if method exists in SyntaxFactory
34-
typeof(SyntaxFactory).GetMethods().Where(m => m.Name == "MethodName")
35-
```
36-
37-
### 3. Python Semantic Claims
38-
39-
```bash
40-
python3 -c "print(-7 // 2)" # Verify Python floor division
41-
```
42-
43-
### 4. C# 9.0 Availability
44-
45-
| C# 9.0 ✅ | C# 10+ ❌ |
46-
|-----------|-----------|
47-
| Records | File-scoped namespaces |
48-
| Init-only setters | Global usings |
49-
| Pattern matching | Record structs |
50-
| Target-typed new | Required members |
51-
52-
### 5. Sharpy Implementation Claims
53-
54-
```bash
55-
# Search codebase for actual implementation
56-
grep -r "feature_name" src/Sharpy.Compiler/
57-
```
13+
1. **.NET API** — dotnet script -e "..." to verify behavior
14+
2. **Roslyn API** — Check SyntaxFactory method exists
15+
3. **Python semantics** — python3 -c "..." to verify
16+
4. **C# 9.0 availability** — Records yes, file-scoped namespaces no
17+
5. **Sharpy implementation** — grep -r "feature" src/
5818

5919
## Output Format
6020

6121
```markdown
62-
**Claim:** [The assertion being checked]
63-
**Verification:** [How it was verified]
64-
**Result:** CORRECT / INCORRECT — [Explanation]
22+
**Claim:** [assertion]
23+
**Verification:** [how checked]
24+
**Result:** CORRECT / INCORRECT — [explanation]
6525
```
6626

6727
## Boundaries
6828

69-
- Read-only — does not modify code
70-
- Verifies claims from other agents
71-
- Reports findings for human review
29+
- ✅ Verify claims, report findings
30+
- ❌ Code modification

0 commit comments

Comments
 (0)