This CLI contains instructions on how to write code comments in its AGENTS.md. Can you see what of it translates to ~/dev/intropy/tooling/intropy-topology even though the cli is in go and the topology library is in C#
Assistant
User
Can you update the code comments according to your recommendation and update AGENTS.md?
Assistant
Updated.
intropy-topology
Added root AGENTS.md with C# comment and XML documentation rules.
Removed speculative and historical comments.
Shortened architecture-heavy API summaries.
Added missing public record parameter docs and <inheritdoc />.
The topology example files remain byte-identical to CLI goldens.
Validation
dotnet build Intropy.Topology.slnx — passed
dotnet test Intropy.Topology.slnx --no-build — 184 passed, 1 environment-dependent test skipped
go test ./internal/system — passed
Independent standards review — no findings
Pre-existing untracked docs/brainstorms/, docs/plans/, and catalog/ were untouched. No commit or PR was created.
Yes. Most of the comment guidance is language-independent and translates cleanly to C#.
Directly applicable
Explain why, not what the code does.
Never narrate history—avoid references to PRs, fixes, previous implementations, or refactors.
Document every exported/public symbol.
In C#, this means XML documentation on public types and members using <summary>, <param>, <returns>, and <exception>.
Keep documentation blocks short. Move architectural explanations into docs/.
Document deliberate exclusions and invariants when they prevent an attractive but incorrect change.
Do not commit TODO, FIXME, HACK, or XXX comments.
The repository already supports this well through:
GenerateDocumentationFile
TreatWarningsAsErrors
nullable reference types
full analyzer mode
C# adaptations
The Go rule “doc comment on every exported symbol” becomes:
Add XML documentation to every public or protected API shipped by the package. Describe its observable contract rather than restating its signature.
For C#, documentation should emphasize:
mutation and thread-safety
validation timing
replacement/idempotency semantics
returned collection ordering and immutability
exceptions callers can prevent
serialization or compatibility guarantees
Use <inheritdoc /> where an implementation genuinely inherits the same contract.
The ten-line guideline should primarily apply to <summary>. Parameter and exception tags may take additional lines. Longer conceptual material belongs under docs/concepts/ or docs/decisions/.
Existing good examples
IntropyAspire.cs has a strong explanatory comment:
Subscribers start first, so a publisher's first message finds a registered subscription…
That captures the invariant, derivation, and cycle trade-off rather than narrating the code.
TopologyValidationException.cs explains why the exception carries all diagnostics:
…so a SystemHost run reports the whole picture at once.
Several test comments are also useful:
csharp
// Assert — 6380, not the Redis default: `dapr init` owns 6379 on the host.
The required // Arrange / // Act / // Assert markers are a reasonable explicit exception to “do not narrate the code.” Additional text after the marker should still explain the scenario or invariant.
Current comments worth tightening
There are three forward-looking comments which conflict with the CLI guidance:
Refs.cs: “lets future generation/codegen reflect on it”
Model/Resources.cs: “feed the future Dapr pubsub component”
examples/order-loader/Program.cs: “the (future) Intropy Hosting framework”
These should describe the current contract or move planned behavior into an issue/design document. The Resources.cs wording also appears stale because generation already exists.
Some public summaries—particularly Component, TopicRef, and ConnectorRef—mix API contract with substantial architecture explanation. They are useful, but parts could move into <remarks> or existing concept documentation.
Suggested topology-specific block
markdown
## Code comments and XML documentation
Comments explain invariants, trade-offs, and non-obvious constraints. They do
not narrate the implementation or its history.
- Never reference a PR, issue, fix, previous implementation, or refactor.
- Do not commit TODO, FIXME, HACK, or XXX comments. Track planned work outside
the source.
- Add XML documentation to every public or protected API shipped by a package.
- Describe the observable contract: validation timing, mutation, thread-safety,
ordering, replacement semantics, and preventable exceptions.
- Do not merely restate the symbol name or C# signature.
- Keep `<summary>` concise, normally no more than ten lines. Put extended
concepts in `<remarks>` or `docs/`.
- Use `<param>`, `<returns>`, `<exception>`, `<see>`, and `<c>` where they improve
IntelliSense.
- Use `<inheritdoc />` when the inherited contract is unchanged.
- “Deliberately not X” comments are encouraged when they prevent a plausible
but invalid design change.
- Test phase markers (`// Arrange`, `// Act`, `// Assert`) are allowed. Added
commentary should explain the scenario or invariant.
Because Intropy.Topology.Generation exposes check, graph, and generate, the CLI’s stdout/stderr and error-writing rules also translate to that package, independently of Go versus C#.