π Documentation Write Agent Specification¶
π Purpose¶
The Documentation Write Agent is responsible for transforming structured knowledge outputs into high-quality, traceable, edition-aware technical documentation β written in the ConnectSoft tone, format, and style.
It ensures that every artifact produced by the factory β whether from a Developer Agent, Test Generator, Architect Agent, or Bug Resolver β is:
π§Ύ Documented, explained, visualized, and ready for consumption by developers, stakeholders, AI agents, and external tools.
π― Primary Goals¶
| Goal | Description |
|---|---|
| π Generate human-readable documentation | Converts agent outputs into well-formatted .md, .yaml, or .json files |
| π§ Enrich context from memory | Retrieves related knowledge to cross-link documentation |
| πͺ Maintain tone & structure | Follows ConnectSoft writing style: clear, modular, edition-aware |
| π§Ύ Enable traceability | Each doc includes traceId, agentId, sourceArtifactId, and editionId |
| π Serve as input for other agents | Provides documentation for Studio Agent, Generator Agent, and QA workflows |
π§© Key Use Cases¶
| Case | Outcome |
|---|---|
| β After MicroserviceGeneratorAgent emits a new service | Creates /docs/modules/<service>/README.md |
π After TestGeneratorAgent emits .feature files |
Creates test overview, scenario descriptions, and QA metadata pages |
| π§ After Bug Resolver Agent proposes a fix | Converts fix-summary.md into structured changelogs |
| π After Vision Architect defines features | Writes /docs/features/<feature>/blueprint.md from trace plan |
| βοΈ After Architecture Agents update diagrams | Updates /docs/architecture/ with rendered diagrams and explanations |
π Typical Output Types¶
| Output | Description |
|---|---|
README.md |
Main module documentation page |
fix-summary.md |
Summary of bug fix, linked to fingerprintId |
feature-blueprint.md |
Vision/feature spec from planning phase |
test-plan.md |
QA test overview generated from .feature files |
architecture-overview.md |
High-level platform or cluster docs |
studio.preview.json |
Structured metadata for Studio dashboard tiles |
π§ Agent Class & Personality¶
| Trait | Description |
|---|---|
| π§Ύ Narrative-first | Turns structured agent outputs into fluent, informative narratives |
| π Structurally aware | Understands headers, lists, tables, code blocks, diagrams |
| π Knowledge-linked | Cross-links trace paths, modules, and memory-embedded knowledge |
| π§ Edition-aware | Scopes output to specific editions (vetclinic, multitenant-lite, etc.) |
| π€ Collaboration-friendly | Invoked by agents or users via trace or MCP prompt contexts |
π§ System Role¶
flowchart TD
GEN[π§ Generator Agents]
TEST[π§ͺ Test Generator Agent]
BUG[π οΈ Bug Resolver Agent]
DOC[π Documentation Write Agent]
KM[π§ Knowledge Management Agent]
STUDIO[π Studio Agent]
GEN --> DOC
TEST --> DOC
BUG --> DOC
DOC --> KM
DOC --> STUDIO
β Summary¶
The Documentation Write Agent:
- π Converts internal AI outputs into developer-facing, test-ready documentation
- π Ensures each document is trace-linked, memory-aware, and reusable
- π§ Supports other agents with readable artifacts, changelogs, diagrams, and storyboards
- βοΈ Scales across editions, modules, and services, generating docs dynamically
- π Powers Studio and external dashboards with renderable previews and metadata
It is the voice of the AI Factory β ensuring that autonomous outputs are visible, verifiable, and valuable to humans and agents alike.
π Responsibilities¶
This section outlines the explicit responsibilities of the Documentation Write Agent. These define how it contributes to the ConnectSoft AI Software Factory by turning structured agent output into narrative, visual, and modular documentation.
β Core Responsibilities¶
| Responsibility | Description |
|---|---|
| π§Ύ Generate Markdown Documentation | Converts agent outputs (traces, blueprints, test plans, fix summaries) into well-structured .md documents |
| π§ Retrieve Context from Memory | Enriches documentation with knowledge entries, trace metadata, and relevant artifact links |
| π Embed Traceability | Automatically includes traceId, artifactId, agentId, and editionId in generated docs |
| π§° Apply Doc Templates | Uses semantic Markdown templates for features, services, modules, bug summaries, architecture overviews, etc. |
| π§© Modularize Output | Splits docs by module, feature, or agent cluster into reusable sub-sections or linked index files |
| π Attach Diagrams | Includes inline Mermaid diagrams or references to .svg and .png architecture visuals |
| π§Ύ Emit Studio Preview Artifacts | Outputs studio.preview.json for dashboard tiles, code previews, or status badges |
| π§ Summarize Structured YAML or JSON | Converts raw inputs like test-results.json, bug-resolution.yaml, feature-plan.yaml into readable narratives |
| π Conform to Style Guide | Applies tone, structure, and branding rules consistent with ConnectSoft documentation style |
| π οΈ Auto-link Artifacts | Cross-links related docs, GitHub paths, tests, microservices, and trace cluster summaries |
π§Ύ Supported Artifact Types¶
| Input Source | Output Target |
|---|---|
trace.plan.yaml |
blueprint.md (feature or capability doc) |
bug-resolution.yaml + fix-summary.md |
fix-report.md (changelog with reasoning) |
README.template.md + service info |
README.md per microservice |
.feature + test metadata |
test-plan.md, qa-index.md, scenario-details.md |
Architecture diagrams (.mmd, .svg) |
architecture-overview.md, mermaid-preview.md |
Prompt blueprints (*.prompt, *.template.yaml) |
prompt-library.md, agent-instruction.md |
π οΈ Post-Processing Duties¶
| Task | Purpose |
|---|---|
| β Linting | Validate Markdown headings, table consistency, and format correctness |
| π Link rewriting | Ensure relative links between modules, editions, or sections resolve properly |
| π§ Anchor tagging | Automatically add anchor IDs for Studio scroll targeting and TOC generation |
| π Folder layout enforcement | Output organized by edition β domain β cluster β artifact type |
| π§βπ» Markdown component injection | Add tabs, toggles, notes, tips via ConnectSoft-styled extensions |
| π Studio status generation | Output studio.bug.status.json, studio.module.preview.json for visual integration |
π§© Role in Documentation Lifecycle¶
flowchart TD
PLAN[π Planning Agent]
GEN[π§ Generator Agent]
TEST[π§ͺ Test Generator Agent]
BUG[π οΈ Bug Resolver Agent]
DOC[π Documentation Write Agent]
KM[π§ Knowledge Management Agent]
STUDIO[π Studio Agent]
PLAN --> DOC
GEN --> DOC
TEST --> DOC
BUG --> DOC
DOC --> KM
DOC --> STUDIO
β Summary¶
The Documentation Write Agent is responsible for:
- π§Ύ Writing traceable, readable, and edition-scoped documentation
- π Automating the full transformation from structured input β human-facing docs
- π Linking memory, trace, module, and fix metadata across all agents
- π§© Powering Studio previews, changelogs, module READMEs, test plans, and visual diagrams
- π‘ Ensuring that ConnectSoftβs autonomous outputs are comprehensible, navigable, and production-grade
π₯ Inputs Consumed¶
This section outlines the structured and semi-structured inputs the Documentation Write Agent consumes from other agents and source artifacts to produce comprehensive, traceable documentation.
π Primary Input Artifacts¶
| File | Source Agent | Description |
|---|---|---|
trace.plan.yaml |
Vision Architect Agent | Feature or capability blueprint β foundation for feature docs |
feature.spec.json |
Product Owner Agent | Structured user stories and scenarios to convert into narrative specs |
bug-resolution.yaml + fix-summary.md |
Bug Resolver Agent | Input for fix changelogs and explanation documentation |
test-results.json |
QA Agent | Test results, pass/fail matrix, and scenario grouping |
.feature files |
Test Generator Agent | BDD-style specs, mapped into test plan documents |
README.template.md |
Microservice Generator Agent | Base template for service documentation |
prompt.plan.yaml |
Prompt Architect Agent | Used for documenting AI instruction flows and prompt inheritance |
architecture-overview.mmd or .svg |
Architecture Agents | Visual representation of components, clusters, and flows |
π Example: trace.plan.yaml¶
featureId: notify-clients-after-booking
agentsInvolved:
- ProductManagerAgent
- MicroserviceGeneratorAgent
- NotificationPlannerAgent
modulesAffected:
- NotificationService
- EmailService
capabilities:
- trigger confirmation email
- fallback to SMS
documentation:
overview: true
generateFeatureDoc: true
edition: vetclinic
β Triggers feature-blueprint.md in /docs/features/notify-clients-after-booking/
π Example: bug-resolution.yaml¶
fingerprintId: bug-5521b
fixType: addNullCheck
module: Appointments
edition: vetclinic-premium
confidenceScore: 0.91
resolutionStatus: proposed
patchFile: proposed-fix.diff
β Used to write fix-report.md with summary and linked patch.
π Dynamic Inputs (via Skill Context or Vector Search)¶
| Input | Description |
|---|---|
memory-entry.json |
Embedded documents used for references, summary, and cross-linking |
knowledge-index.yaml |
Helps group documents by agent, capability, or module |
traceId + artifactId |
Passed via SKContext, used to embed traceability headers |
editionId |
Ensures doc output respects edition scoping (e.g., lite vs. enterprise) |
π§ Semantic Kernel Input Context¶
| Variable | Purpose |
|---|---|
SKContext["documentType"] |
Controls which template is selected |
SKContext["artifactTraceId"] |
Ensures document is trace-linked |
SKContext["agentCluster"] |
Helps classify the doc into architecture, engineering, QA, planning, etc. |
SKContext["rawInput"] |
Structured artifact body used for summarization, formatting, or rewriting |
SKContext["injectMemoryReferences"] |
Flag to append related docs and knowledge entries at the bottom |
π Inputs from Studio Agent¶
| File | Use |
|---|---|
studio.style.config.json |
Branding and layout rules (e.g., callouts, heading structure, links) |
studio.annotation.yaml |
Human-injected descriptions or overrides for ambiguous sections |
studio.preview.config.yaml |
Triggers for preview rendering, coverage dashboards, and module highlights |
β Summary¶
The Documentation Write Agent consumes inputs from:
- π Planning artifacts (
trace.plan.yaml,feature.spec.json) - π§ͺ QA and Bug reports (
fix-summary.md,test-results.json) - π§ Memory entries, edition overlays, and trace metadata
- π§Ύ Generator Agent outputs (
README.template.md,.feature) - π§© Architecture diagrams and prompt plans for visual and prompt docs
This input mesh allows the agent to generate rich, accurate, and trace-linked documentation for every ConnectSoft artifact and edition.
π€ Outputs Produced¶
This section defines the structured documentation artifacts generated by the Documentation Write Agent. These outputs are written in Markdown, YAML, and JSON, optimized for both human readers and downstream agent/tool consumption.
π Markdown Documentation Outputs¶
| File | Purpose |
|---|---|
README.md |
Main documentation for a microservice, module, or agent output |
feature-blueprint.md |
Description of a feature or capability from trace planning |
fix-report.md |
Narrative explanation of a bug fix (sourced from fix-summary.md) |
test-plan.md |
Summary of generated tests and associated .feature specs |
architecture-overview.md |
Documented diagrams and architecture flows with embedded Mermaid or SVG |
prompt-library.md |
Library of prompts and templates used by agents (e.g., ProductManagerAgent) |
studio-guides.md |
Descriptions of how to use Studio dashboard views, metrics, or annotations |
module-index.md |
Index of documentation pages for a module or cluster (e.g., QA, Engineering) |
π§Ύ YAML / JSON Metadata Outputs¶
| File | Purpose |
|---|---|
documentation.index.yaml |
Structured index of generated documents (by traceId, moduleId, edition) |
studio.preview.json |
Supplies Studio with preview title, summary, badges, agent IDs, and status flags |
trace-doc-map.yaml |
Maps trace paths to documentation files (traceId β doc output) |
doc-coverage.metrics.json |
Captures documentation coverage across agents, editions, and clusters |
π Example: README.md (Microservice)¶
# Notification Service
This service handles client communication via email, SMS, and push.
## Capabilities
- Send confirmation messages after appointments
- Fallback to SMS if email fails
- Localized per edition: `vetclinic`, `multitenant-lite`
## Trace Info
- `traceId`: proj-901-notify
- Generated by: MicroserviceGeneratorAgent
- Maintained by: NotificationPlannerAgent
π Example: fix-report.md¶
# π οΈ Fix Report: Cancel Appointment Modal
- **Fingerprint**: bug-a1c02d34
- **Classification**: Flaky UI Test
- **Fix Strategy**: `waitForVisible("confirmation-modal", 1000ms)`
- **Edition**: `vetclinic-premium`
- **Confidence**: 94%
- **Patch Size**: 2 lines
## Resolution Summary
The modal was rendered with a race condition. The fix delays assertion using a visible-wait strategy to stabilize test execution.
π Studio Preview Output Example (studio.preview.json)¶
{
"traceId": "proj-811-v1",
"document": "feature-blueprint.md",
"previewTitle": "Notify Clients After Booking",
"tags": ["feature", "planning", "notification"],
"status": "documented",
"agentId": "VisionArchitectAgent"
}
π§ Cross-Linked Output¶
Each generated file:
- π Contains
traceId,agentId,moduleId,editionIdheaders - π Links to related
.diff,.feature,.yaml,.mdfiles via local relative references - π§ May embed retrieved
memory-entry.jsonsummaries or architecture annotations - π Supports Studio dashboard rendering, CI inclusion, and multi-edition overlays
β Summary¶
The Documentation Write Agent emits a complete set of:
- π Markdown documentation pages for features, modules, tests, and fixes
- π§Ύ YAML/JSON indexes and metadata for trace, preview, and coverage reporting
- π Trace-linked artifacts for downstream agents, Studio dashboards, and developer teams
These outputs ensure that every ConnectSoft-generated capability, plan, test, and fix is documented, linked, and ready for delivery or review.
π§ Knowledge Base¶
This section outlines the embedded knowledge that powers the Documentation Write Agentβs ability to generate accurate, structured, and style-consistent documentation across all ConnectSoft artifacts, modules, and editions.
π Pretrained & Embedded Knowledge¶
| Domain | Description |
|---|---|
| π§Ύ ConnectSoft Documentation Style Guide | Markdown formatting, headings, tables, language tone, callouts, etc. |
| π§© Doc Template Library | Predefined templates for README.md, feature-blueprint.md, test-plan.md, fix-report.md, etc. |
| π Agent Responsibilities and Output Contracts | Understands the roles and output structures of every system agent (e.g., Bug Resolver Agent β fix-summary.md) |
| π§ Modular Doc Layout Patterns | Best practices for organizing docs per module, edition, agent cluster |
| π Studio Tile Rendering Rules | Generates studio.preview.json with correct format, status, and tags |
| ποΈ Project Folder Conventions | Knows where to place docs: /docs/modules/, /docs/features/, /docs/fixes/, etc. |
| π§ Traceability Grammar | Automatically includes trace metadata and links to traceId, agentId, editionId, etc. |
π Examples of Internal Templates¶
β
feature-blueprint.md Template¶
# {{FeatureTitle}}
> This document was generated by the Documentation Write Agent using trace `{{traceId}}`.
## Overview
{{FeatureSummary}}
## Capabilities
- {{capability1}}
- {{capability2}}
## Modules Affected
- {{moduleA}}
- {{moduleB}}
## Agent Collaboration
{{AgentDiagram}}
β
fix-report.md Template¶
# π οΈ Fix Report: {{BugTitle}}
- **Fingerprint**: {{fingerprintId}}
- **Fix Type**: {{fixType}}
- **Edition**: {{editionId}}
- **Confidence**: {{confidenceScore}}%
- **Patch Summary**: {{summary}}
## Root Cause
{{RootCauseExplanation}}
## Fix Details
{{PatchExplanation}}
π§ Pattern-Matching Capabilities¶
| Trigger | Response |
|---|---|
.feature file with Scenario: |
Converts to a Markdown test plan with a list of scenarios |
bug-resolution.yaml + fix-summary.md |
Triggers fix changelog generation with strategy and root cause explanation |
trace.plan.yaml with generateFeatureDoc: true |
Auto-generates blueprint with capabilities and agent involvement |
π Memory-Aware Composition¶
The agent retrieves:
memory-entry.jsonto embed summaries or historical referencesknowledge-index.yamlto build cross-links between features/modulestrace-link-map.jsonto construct breadcrumb paths and related artifact links
π Example:¶
Given traceId: proj-821-ai-prompting β auto-links:
prompt-library.mdprompt-plan.yamlagent-instruction.mdstudio.preview.json
π§Ύ Prebuilt Markdown Components¶
| Component | Purpose |
|---|---|
:::tip blocks |
Inserted for notes and best practices |
| Mermaid diagrams | Rendered automatically if .mmd provided |
| Edition badges | Auto-generated at top of document (vetclinic-premium) |
| Feature dependency lists | Rendered as collapsible trees if dependsOn detected |
β Summary¶
The Documentation Write Agent already knows:
- π How to structure docs by artifact type, trace, and edition
- π What templates, layouts, and components to use for each scenario
- π How to enrich content with traceable, memory-linked context
- π How to prepare output for Studio, CI, and human readers
This embedded knowledge gives the agent the power to generate professional, consistent, and deeply integrated documentation β automatically.
π Process Flow (High-Level)¶
This section presents the high-level workflow of the Documentation Write Agent β showing how it moves from raw structured inputs to complete, cross-linked, edition-aware documentation artifacts.
π High-Level Flow Diagram¶
flowchart TD
INPUT[π₯ Receive Input Artifact]
CONTEXT[π§ Retrieve Trace & Memory Context]
TEMPLATE[π Select Doc Template]
COMPOSE[π Generate Markdown Content]
ENRICH[π Link, Annotate, Format]
VALIDATE[β
Lint + Trace Validation]
OUTPUT[π€ Emit .md + .json + .yaml]
π§© Phases Overview¶
1. π₯ Input Received¶
- Triggered by input artifact (e.g.,
trace.plan.yaml,.feature,fix-summary.md) - May also be triggered by agent event (
FixProposed,FeaturePlanned) traceId,agentId, andeditionIdmust be present
2. π§ Retrieve Context¶
- Access
memory-entry.json,trace-link-map.yaml, andknowledge-index.yaml - Embeds relevant history, tags, capabilities, or changelogs
3. π Select Template¶
- Chooses the correct Markdown template based on:
- Document type (e.g., feature, fix, module)
- Agent cluster (QA, Engineering, Planning)
- Edition (
editionId) - Role (e.g.,
README,test-plan,blueprint)
4. π Generate Content¶
- Fills template with structured data from the input
- Adds summaries, listings, capability tables, or scenario sections
- Optionally injects Mermaid diagrams or YAML blocks inline
5. π Enrich Output¶
- Adds:
traceId,agentId,editionIdheaders- Breadcrumbs
- Cross-links to related
.md,.diff, or.featurefiles
- Applies tone, structure, and branding
6. β Validate¶
- Lints Markdown
- Confirms traceability and edition scope
- Outputs
doc-coverage.metrics.jsonfor Studio
7. π€ Emit Output¶
- Writes to:
README.md,fix-report.md,feature-blueprint.md, etc.studio.preview.jsondocumentation.index.yaml
π Example Trigger Flow: Feature Plan¶
Input: trace.plan.yaml
β
Memory Loaded: vision plan, related capabilities
β
Template: feature-blueprint.md
β
Output:
- /docs/features/notify-clients/feature-blueprint.md
- /docs/features/notify-clients/studio.preview.json
β Summary¶
The high-level flow of the Documentation Write Agent is:
- π₯ Trigger β
- π§ Enrich β
- π Select Template β
- π Compose β
- π Link β
- β Validate β
- π€ Emit
This makes the agent a deterministic, context-aware, and style-aligned content generator for all ConnectSoft documentation layers.
π¬ Process Flow (Detailed)¶
This section expands the agent's workflow into a step-by-step, skill-driven, memory-augmented pipeline, revealing how the agent turns structured inputs into professional documentation while ensuring full traceability, edition-scoping, and downstream compatibility.
π Detailed Workflow Steps¶
flowchart TD
A[π₯ Input Artifact Received] --> B[π§ Retrieve Trace Context]
B --> C[π Search Knowledge Memory]
C --> D[π Select Template (by Doc Type)]
D --> E[π§ Compose Raw Draft from Structured Data]
E --> F[π Enrich with Links, Badges, Diagrams]
F --> G[β
Lint + Structure Validator]
G --> H[π€ Emit Markdown, JSON, YAML]
π§© Detailed Step Breakdown¶
1. π₯ Input Artifact Received¶
- Input types include:
trace.plan.yamlfeature.spec.jsonbug-resolution.yaml.featurefiles
SKContextpopulated with:traceId,editionId,agentCluster,documentType
2. π§ Retrieve Trace Context¶
- Loads from:
trace-link-map.yamlknowledge-index.yamlmemory-entry.json
- Adds cross-references for:
- Related features
- Modules
- Other docs
3. π Memory Query (Optional)¶
- Uses
SimilaritySearchSkillto enrich docs with:- Fix patterns
- Prompt examples
- Architectural precedents
4. π Template Selection¶
- Chooses
.mdtemplate from:feature-blueprint.mdtest-plan.mdfix-report.mdprompt-library.md
- Template includes:
- Static headers
- Markdown tables
- Callouts
- Inline Mermaid or YAML blocks
5. π§ Compose Draft¶
- Injects:
- Summaries
- Key-value tables
- Edition-scoped notes
- Agent responsibility sections
- Applies SK skills for:
- Summarization
- YAML-to-Markdown rendering
- Scenario extraction
6. π Enrich Draft¶
- Adds:
traceId,editionId,agentId- Cross-links to
.diff,.feature,.md,.json - Callouts (e.g.,
:::tip,:::warning) - Mermaid rendering for diagrams if
.mmddetected
7. β Validate Output¶
- Runs:
- Markdown linter
- Internal TOC validator
- Broken link checker
- Outputs:
doc-coverage.metrics.jsondocumentation.index.yaml(updated or appended)
8. π€ Emit Final Artifacts¶
- Files written to:
/docs/features/<featureId>/feature-blueprint.md/docs/modules/<moduleId>/README.md/docs/fixes/<fingerprintId>/fix-report.md
- Also emits:
studio.preview.jsonstudio.status.yaml
β Example: Test Plan Generation¶
flowchart TD
F1[.feature + test-results.json]
F1 --> T1[Classify Scenarios]
T1 --> T2[Summarize Steps]
T2 --> T3[Template Injection: test-plan.md]
T3 --> Output[/docs/tests/<module>/test-plan.md]
β Summary¶
The Documentation Write Agent uses a structured, memory-aware, and modular composition pipeline that:
- π§ Leverages memory and trace context
- π Generates trace-linked Markdown documentation
- π Embeds cross-doc relationships
- π§Ύ Outputs metadata and previews for Studio and CI/CD tools
- β Validates consistency, structure, and coverage
This makes it a production-ready AI doc writer that scales across services, clusters, and editions.
π§© Skills & Kernel Functions Used¶
This section outlines the Semantic Kernel skills and core functions the Documentation Write Agent relies on to convert structured data into traceable, readable, and style-consistent Markdown documentation.
Each skill is modular, observable, and optionally reusable across other agents (e.g., Studio Agent, Knowledge Management Agent).
π§ Core Semantic Kernel Skills¶
| Skill Name | Description |
|---|---|
MarkdownComposerSkill |
Generates body content from structured input using Markdown templates and injected YAML/JSON |
DocumentTemplateSelectorSkill |
Selects the correct .md template based on input type, trace, and edition |
TraceMetadataFormatterSkill |
Formats traceId, agentId, editionId, and module metadata into frontmatter or doc headers |
MemoryLinkingSkill |
Retrieves similar entries from memory-entry.json or knowledge-index.yaml for inline referencing |
ScenarioSummarizerSkill |
Converts .feature test scenarios into summarized test plans or scenario listings |
FixSummaryFormatterSkill |
Translates fix-summary.md and bug-resolution.yaml into a readable fix-report.md format |
MermaidRendererSkill |
Converts .mmd to inline diagram blocks or links to SVG previews |
DocLinterSkill |
Ensures output matches Markdown structure, heading depth, and style guide rules |
π Example: MarkdownComposerSkill¶
You are writing developer-facing documentation for a feature in the ConnectSoft platform.
Using the following YAML input, generate a Markdown document:
Input:
- featureId: notify-clients
- traceId: proj-888
- edition: vetclinic
- capabilities:
- send email after booking
- fallback to SMS
Output:
# Notify Clients (Feature Blueprint)
> Trace: proj-888 | Edition: vetclinic
## Capabilities
- send email after booking
- fallback to SMS
π Cross-Skill Orchestration Example¶
flowchart TD
A[trace.plan.yaml] --> B[DocumentTemplateSelectorSkill]
B --> C[MarkdownComposerSkill]
C --> D[MemoryLinkingSkill]
D --> E[TraceMetadataFormatterSkill]
E --> F[DocLinterSkill]
F --> G[π€ Emit Markdown + Preview JSON]
π§© Utility Functions¶
| Function | Description |
|---|---|
InjectEditionBadge() |
Adds edition-aware callout at top of document |
GenerateTOC() |
Creates or updates Table of Contents block based on headers |
GeneratePreviewSummary() |
Extracts first paragraph or caption for studio.preview.json |
ResolveLocalLinks() |
Converts paths like ../fixes/bug-123.md into full trace-safe relative links |
π Exposed for Other Agents¶
| Agent | Uses |
|---|---|
| Studio Agent | Uses MarkdownComposerSkill, TraceMetadataFormatterSkill for inline previews |
| Knowledge Management Agent | May use MemoryLinkingSkill to backfill tags or doc annotations |
| Bug Resolver Agent | Delegates summary generation to FixSummaryFormatterSkill |
| Prompt Architect Agent | Uses MarkdownComposerSkill for generating prompt-library.md and instruction.md |
β Summary¶
The Documentation Write Agent is powered by a rich set of Semantic Kernel skills that:
- π Compose Markdown content from structured trace and metadata
- π Inject cross-agent, cross-module memory references
- π§ Apply trace metadata, tone, and edition-specific formatting
- β Validate output format, structure, and style compliance
- π€ Emit ready-to-publish content for developers, dashboards, and downstream agents
This skill set makes the agent modular, composable, and fully pluggable in the ConnectSoft documentation lifecycle.
π οΈ Technology Stack¶
This section describes the technology stack and runtime architecture used by the Documentation Write Agent, aligning with ConnectSoftβs clean architecture, modularity, and cloud-native principles.
π» Core Stack¶
| Layer | Technology |
|---|---|
| Runtime | .NET 8 + C# |
| AI Integration | Semantic Kernel (Microsoft.SemanticKernel) |
| LLM Provider | Azure OpenAI (GPT-4, text-davinci-003, gpt-4-32k) |
| Prompt Templating | SK YAML Prompt Format + inline .prompt files |
| Template Storage | Markdown templates in /Templates/Markdown/*.md |
| Memory Access | Azure Blob Storage, vector memory, or memory-entry JSON |
| Doc Output | Filesystem + blob push (docs/ folder) + Studio preview publishing |
| Diagrams | Mermaid.js (.mmd), inline SVG, or external renderer |
π§ Memory and Trace Infrastructure¶
| Component | Role |
|---|---|
memory-entry.json |
Source of knowledge for enrichment, tagging, and trace explanation |
trace-link-map.yaml |
Links trace paths to modules, capabilities, and related documentation |
knowledge-index.yaml |
Lists memory units for reuse, doc enhancement, and cross-linking |
studio.preview.json |
Output consumed by Studio dashboards and review tools |
π Output File Types¶
| Format | Use |
|---|---|
.md |
Human-readable technical documentation (main output) |
.json |
Previews for Studio tiles (e.g., title, tags, edition, agent) |
.yaml |
Indexes, trace maps, and linked documentation graphs |
π§° Markdown Tooling¶
| Feature | Tool |
|---|---|
| Markdown linting | Built-in SK DocLinterSkill or Markdig extensions |
| Diagram rendering | Mermaid + optional integration with GitHub, Docusaurus, or Studio renderer |
| Markdown component support | :::tip, :::note, tab blocks (styled via Studio Markdown theme engine) |
π‘οΈ Clean Architecture Enforcement¶
| Concern | Approach |
|---|---|
| π§± Separation of Concerns | Agent logic, SK skills, and IO writers live in separate layers |
| π Pluggability | Markdown templates, styles, and language rules can be swapped per edition or cluster |
| π§Ύ Testability | Skills and output validators tested via unit/integration tests (e.g., test plan to Markdown validation) |
| π Multi-edition safe | Every output is scoped by editionId with partitioned folders or file blocks |
π‘ Observability and CI/CD Integration¶
| Tool | Description |
|---|---|
| Application Insights | Logs Markdown generation steps, failures, retries |
| OpenTelemetry | Traces each SK skill and output phase (e.g., Compose β Lint β Emit) |
| CI Pipeline Support | Output verified and previewed via Studio deployment checks or lint-docs step |
| Studio Integration | Hooks into Studio UI with preview tiles, summary diffs, and versioned doc review panels |
π Reusability Across Agents¶
| Component | Reused By |
|---|---|
MarkdownComposerSkill |
Studio Agent, Knowledge Management Agent, Prompt Architect Agent |
TraceMetadataFormatterSkill |
Developer Agent, Fix Generator Agent |
MemoryLinkingSkill |
All memory-enhanced agents (e.g., Generator, Reviewer, QA Planner) |
β Summary¶
The Documentation Write Agent is built on a modular, AI-enhanced, markdown-centric tech stack that supports:
- β Semantic Kernel + Azure OpenAI for intelligent doc generation
- π Clean Markdown, YAML, JSON outputs for developer and agent consumption
- π Studio-integrated previews, badges, and cross-agent linking
- π Multi-edition compatibility and trace-linked safety
- π Observability-first execution with full telemetry
This makes the agent robust, testable, reusable, and scalable β the documentation backbone of the ConnectSoft platform.
π§Ύ System Prompt¶
This section defines the System Prompt used to initialize the Documentation Write Agent during execution. The prompt encodes its tone, structure, formatting rules, traceability requirements, and ConnectSoft documentation principles.
π System Prompt (Template)¶
You are the Documentation Write Agent in the ConnectSoft AI Software Factory.
Your task is to generate clear, structured, and traceable technical documentation from structured input artifacts created by other AI agents.
You must:
- Follow ConnectSoftβs documentation style guide: professional, modular, and Markdown-based
- Use structured headers (H1βH3), bullet points, tables, and Mermaid diagrams when applicable
- Always include trace metadata: traceId, agentId, editionId, moduleId
- Generate only documentation formats: `.md`, `.json`, or `.yaml`
- Preserve edition-scoping and label documents accordingly
- Reuse memory when helpful β link to related modules, features, or fixes
Acceptable input includes:
- `trace.plan.yaml`, `feature.spec.json`, `.feature`, `bug-resolution.yaml`, `prompt.plan.yaml`, test logs
- Input always includes a `traceId` and `documentType`
You must output:
- Markdown documentation with clear section headings and relevant summaries
- Optional Studio preview metadata (in JSON)
- YAML indexes or doc coverage updates if needed
Important:
- Do not generate unverified speculation or hallucinate functionality
- All documentation must be deterministic, explainable, and edition-aware
- Avoid repetition, boilerplate, or marketing fluff
Tone: Developer-facing. Clear. Focused. Helpful. Edition-aware. Cross-link capable.
Output only valid Markdown and JSON/YAML where applicable. Include `:::tip` blocks when summarizing suggestions or traceability.
You work closely with VisionArchitectAgent, QA Agent, Generator Agents, and Bug Resolver Agent.
π― Embedded Tone and Constraints¶
| Rule | Description |
|---|---|
| π§Ύ Traceability enforced | Always include trace metadata block at top of document |
| π Consistent tone | Developer-friendly, informative, with minimal fluff |
| π Memory-aware | Suggest links to prior features, modules, or diagrams |
| βοΈ Edition-safe | Include editionId and scope the content accordingly |
| π Markdown-first | Uses Markdown spec with enhancements (callouts, diagrams, tabs) |
π§ Roles Encoded in Prompt¶
| Agent Behavior | Enabled |
|---|---|
| π Technical writer | Writes human-readable doc with headers, sections, links |
| π Trace enhancer | Adds traceId, links to other memory entries, and related artifacts |
| π§ Knowledge linker | Pulls relevant knowledge from memory when available |
| π¦ Publisher | Emits docs for Studio previews, CI integration, or handoff to Developer Agents |
β Sample System Prompt Use Case¶
When given:
The prompt instructs the agent to:
- Generate
feature-blueprint.md - Include trace block
- Use MemoryLinkingSkill to reference other related capabilities
- Emit
studio.preview.json
β Summary¶
The System Prompt of the Documentation Write Agent guarantees that:
- π§ Content is memory-enriched and trace-linked
- π Format adheres to ConnectSoftβs developer documentation standards
- π€ Output is consistent, safe, and Studio-ready
- π Documentation is properly scoped by edition and module
- π Links and explanations are deterministic, explainable, and verifiable
This foundational prompt ensures the agent behaves as a professional AI doc writer embedded in a trace-first, clean architecture platform.
π§Ύ Input Prompt Template¶
This section defines the input prompt template used by the Documentation Write Agent to guide the LLM when composing Markdown content from structured inputs. It ensures that all outputs follow a predictable format, embed trace metadata, and reflect the intended document type.
π Input Prompt Template Structure¶
You are generating technical documentation based on the following structured artifact.
--- Document Type ---
{{documentType}} # e.g. feature-blueprint, fix-report, test-plan, module-readme
--- Trace Metadata ---
traceId: {{traceId}}
agentId: {{agentId}}
editionId: {{editionId}}
moduleId: {{moduleId}}
--- Source Artifact ---
{{rawInput}} # YAML, JSON, or extracted key-value structure
--- Guidelines ---
- Output must be valid Markdown
- Use H1 for title, H2/H3 for sections
- Include traceId and editionId visibly in the document
- If applicable, include Mermaid diagrams or `:::tip` blocks
- Do not hallucinate information not present in the input
- If the input is a fix, include patch summary and reasoning
- If the input is a test plan, list all test cases and coverage notes
π Example Input: Feature Blueprint¶
documentType: feature-blueprint
traceId: proj-811-v2
agentId: VisionArchitectAgent
editionId: vetclinic
moduleId: NotificationService
rawInput:
featureId: notify-clients
capabilities:
- send confirmation email after booking
- fallback to SMS
involvedAgents:
- ProductManagerAgent
- MicroserviceGeneratorAgent
Resulting Output Prompt (injected to LLM):¶
You are generating technical documentation based on the following structured artifact.
--- Document Type ---
feature-blueprint
--- Trace Metadata ---
traceId: proj-811-v2
agentId: VisionArchitectAgent
editionId: vetclinic
moduleId: NotificationService
--- Source Artifact ---
featureId: notify-clients
capabilities:
- send confirmation email after booking
- fallback to SMS
involvedAgents:
- ProductManagerAgent
- MicroserviceGeneratorAgent
--- Guidelines ---
...
π§ Semantic Parameters¶
| Input Parameter | Use |
|---|---|
documentType |
Selects correct Markdown template |
rawInput |
Fills sections with structured YAML or JSON content |
traceId / editionId |
Rendered as part of trace metadata at the top |
agentId |
Used for authorship, attribution, or collaboration diagrams |
includeMemoryLinks (optional) |
Adds cross-links to prior docs or related fixes if available |
π§© Prompt Use Cases¶
| Type | Behavior |
|---|---|
feature-blueprint |
Renders overview, capabilities, and related modules |
fix-report |
Embeds patch summary, root cause, and trace source |
test-plan |
Lists scenarios, modules tested, and expected coverage |
prompt-library |
Converts SK YAML prompts into a human-readable table or reference sheet |
module-readme |
Builds service readme with scope, dependencies, and diagram blocks |
π Format-Driven Prompt Injection¶
Used via Semantic Kernel with context:
context["documentType"] = "test-plan";
context["traceId"] = "proj-821-test-1";
context["editionId"] = "vetclinic-lite";
context["rawInput"] = yamlTestArtifact;
β Summary¶
The input prompt template enables the Documentation Write Agent to:
- π§ Compose structured documentation grounded in YAML/JSON inputs
- π Inject traceability and authorship metadata
- βοΈ Write clear, deterministic, and edition-aware docs
- π Optionally link prior knowledge, diagrams, and test metadata
- π¦ Standardize content for review in Studio, CI, or human workflows
This ensures a clean, repeatable pipeline for autonomous documentation generation across ConnectSoft agents and editions.
π¦ Output Format & Expectations¶
This section describes the expected output structure, formatting rules, and layout conventions for all documentation generated by the Documentation Write Agent. These outputs are traceable, edition-aware, Studio-compatible, and written in developer-friendly Markdown with enhanced features.
π Primary Output Format: Markdown (.md)¶
β Required Structure (Base Template)¶
# {{Document Title}}
> **Trace ID**: `{{traceId}}` | **Edition**: `{{editionId}}` | **Agent**: `{{agentId}}`
## Overview
{{One-paragraph summary of the document purpose}}
## Capabilities / Fix Summary / Scenario Listing
- Bullet points
- Test cases or features
- Key configuration or behaviors
## Details / Steps / Architecture
- Explanations
- Mermaid diagrams (if included)
- YAML blocks (if config specs involved)
:::tip
Cross-reference or guidance note related to trace or edition.
:::
## Related Artifacts
- [Link to source](...)
- [Feature plan](...)
- [Memory entry](...)
π Required Metadata (Embedded)¶
| Metadata | Required? | Format |
|---|---|---|
traceId |
β | Visible in top block |
editionId |
β | Used to scope output path and section |
agentId |
β | For attribution and Studio preview |
moduleId (if applicable) |
β | For folder and content targeting |
fingerprintId (for fixes) |
Conditional | Added in fix-report.md or studio.preview.json |
π¦ Output Types and Expectations¶
| Type | File | Output Rules |
|---|---|---|
| Feature Blueprint | feature-blueprint.md |
One H1, trace block, capabilities list, linked modules |
| Fix Report | fix-report.md |
Includes classification, fix strategy, explanation, diff links |
| Test Plan | test-plan.md |
Lists .feature scenarios with scenario summaries and agent responsibilities |
| Module README | README.md |
Contains architecture notes, usage, and edition badges |
| Studio Preview | studio.preview.json |
Required for all docs; includes title, traceId, agent, edition, tags |
| Coverage Index | documentation.index.yaml |
Tracks document type, location, trace, module, and status |
π¨ Formatting Features¶
| Feature | Markdown |
|---|---|
| Headings | #, ##, ### for H1βH3 |
| Code blocks | ```csharp ``` or YAML |
| Callouts | :::tip, :::note, :::warning |
| Mermaid | ```graph TD``` |
| Links | Relative markdown paths (e.g., `[Feature Doc](./feature-blueprint.md)`) |
| Tables | Markdown tables for prompt inputs, feature lists, etc. |
π§Ύ Style & Tone Expectations¶
| Rule | Description |
|---|---|
| βοΈ Professional tone | Short, factual, helpful explanations β not marketing copy |
| π§ Edition-aware | Call out if the doc applies only to vetclinic-premium, etc. |
| π Trace-enriched | Links to artifacts using traceId and memory paths |
| π Modular | Prefer short documents per feature/module instead of giant monoliths |
| π Cross-linked | Reference related .md, .yaml, .diff, or .feature files with local paths |
π Example: studio.preview.json¶
{
"traceId": "proj-811-v2",
"document": "feature-blueprint.md",
"previewTitle": "Notify Clients After Booking",
"editionId": "vetclinic",
"tags": ["notification", "feature", "email", "SMS"],
"agentId": "VisionArchitectAgent",
"status": "documented"
}
````
---
### β
Summary
The Documentation Write Agent emits outputs that are:
* π Written in **developer-grade Markdown** with trace-aware frontmatter
* π Structured, style-compliant, and enriched with **cross-links and visuals**
* π Augmented by Studio preview files and documentation indexes
* π Scoped by `editionId` and `moduleId`, enabling modular delivery
* β
Conformant to the ConnectSoft documentation spec
This ensures **consistency, auditability, and usability** across the entire AI Software Factory documentation system.
---
## π§ Short-Term Memory
This section defines how the Documentation Write Agent uses **short-term memory (STM)** during execution to track active trace context, enrich documentation with local references, and preserve composition state across skill calls within a single generation session.
---
### π§ Purpose of Short-Term Memory
| Capability | Description |
| ----------------------------- | ------------------------------------------------------------------------------------- |
| π Track trace metadata | Holds `traceId`, `editionId`, `moduleId`, and `agentId` throughout the doc |
| π Maintain current doc state | Stores partial content, current section pointers, and injected components |
| π Orchestrate skill output | Transfers structured input β intermediate Markdown β final linted output |
| π Hold local artifact map | Temporarily caches related `.md`, `.yaml`, `.diff`, `.feature` file paths for linking |
| π§© Preserve enriched memory | Stores summary blocks or knowledge retrieved for inline referencing during doc build |
---
### π§ STM Example Snapshot
```json
{
"traceId": "proj-811-v2",
"editionId": "vetclinic",
"agentId": "VisionArchitectAgent",
"moduleId": "NotificationService",
"documentType": "feature-blueprint",
"currentTemplate": "feature-blueprint.md",
"injectedSections": {
"capabilities": ["send confirmation email", "fallback to SMS"],
"agents": ["ProductManagerAgent", "MicroserviceGeneratorAgent"]
},
"linkedArtifacts": [
"docs/features/notify-clients/fix-report.md",
"docs/modules/NotificationService/README.md"
]
}
π Skills That Use STM¶
| Skill | How It Uses STM |
|---|---|
MarkdownComposerSkill |
Injects values from currentTemplate, injectedSections, and trace metadata |
MemoryLinkingSkill |
Uses traceId + moduleId to preload related docs or memory entries |
DocLinterSkill |
Accesses draft output in STM to validate structure and link consistency |
MermaidRendererSkill |
Tracks diagram reference paths injected into the document |
StudioPreviewGeneratorSkill |
Extracts summary and metadata from STM state for output preview file |
β³ Lifecycle of STM¶
| Phase | Purpose |
|---|---|
| π₯ On Input Load | Populates traceId, rawInput, and input type |
| π οΈ During Composition | Stores partial Markdown fragments and resolved links |
| π During Enrichment | Caches memory snippets and diagrams for injection |
| π€ On Final Output | Used to populate preview, index, and trace overlays |
| π§Ό On Completion | STM flushed and optionally written to logs for debugging or audit trail |
π Scope and TTL¶
| Scope | Value |
|---|---|
| Trace-Scoped | Only persists within single traceId run |
| Agent-Isolated | Not shared across parallel doc generations |
| Expiry | Cleared after output written unless debug mode is enabled |
π§ Memory Fusion (Optional Advanced Behavior)¶
If multiple docs are being generated for a single trace run (e.g., feature-blueprint.md, test-plan.md, fix-report.md), the STM can be extended across runs via a trace composition session, enabling:
- π Shared headers
- π§© Auto-linked doc sections
- π Documentation index co-generation
β Summary¶
The Documentation Write Agent uses short-term memory to:
- π§ Track trace-linked metadata and document state
- π§Ύ Compose, validate, and enrich content consistently across skills
- π Cross-link documents during generation
- π€ Populate preview files and indexes post-generation
STM is a transient but critical component for ensuring every document is trace-aligned, well-structured, and enriched with meaningful local references.
π§ Long-Term Memory¶
This section describes how the Documentation Write Agent interacts with long-term memory (LTM) β accessing previously generated documents, trace-linked knowledge, fix records, and prompt templates β to improve consistency, reusability, and cross-referencing in documentation.
π Role of Long-Term Memory¶
| Function | Description |
|---|---|
| π Retrieve past documentation | Enables linking to previously written documents for the same traceId, moduleId, or editionId |
| π§ Use existing knowledge | Embeds summaries from memory-entry.json, fix-history.yaml, or feature-blueprint.md |
| π Maintain doc continuity | Reuses style, structure, and terminology already approved in prior related documents |
| π‘ Inherit prompt snippets | Pulls documented prompts and response examples from previous prompt-library.md |
| π Inject reusable blocks | Imports intro sections, architecture diagrams, scenario lists, or changelogs from prior docs |
| π Enable coverage reporting | Tracks what has been documented vs. what remains via documentation.index.yaml |
π Accessed Memory Sources¶
| Artifact | Description |
|---|---|
memory-entry.json |
Traceable knowledge unit previously stored by another agent |
documentation.index.yaml |
Registry of docs by trace/module/edition, used for coverage and linking |
fix-report.md |
Summaries of previously applied fixes, used in architecture or changelog docs |
prompt-library.md |
Catalog of existing prompt formats and patterns |
feature-blueprint.md |
Primary reference for cross-linking feature β module β test β fix |
studio.preview.json |
Used for back-referencing docs from preview tiles or dashboards |
π Example: Memory-Based Link Injection¶
Given:
- current doc:
test-plan.mdforNotificationService - traceId:
proj-888 - memory-entry contains previous
feature-blueprint.md
β LTM enables:
## Related Features
- [Notify Clients After Booking](../features/notify-clients/feature-blueprint.md)
π§ Knowledge Reuse Examples¶
| Type | Use |
|---|---|
| π§Ύ Fix summary | Reused in root cause analysis sections of new documentation |
| π§ Feature capabilities | Referenced in README or module index |
| π Diagram blocks | Injected into architecture or blueprint docs |
| π Prompt input/output examples | Embedded into prompt-library.md or instruction guides |
| β Validation outcomes | Used to show test success or bug regression fixes in QA documentation |
π Access Scope¶
| Scope | Behavior |
|---|---|
| Edition-aware | Only memory linked to the same editionId is included unless explicitly overridden |
| Module-scoped | Searches for artifacts in the same service cluster (NotificationService, Appointments, etc.) |
| Trace-mapped | Prior documentation must share traceId lineage or be explicitly mapped via trace-link-map.yaml |
| Confidence-filtered | Memory entries below trust thresholds (e.g., unvalidated fix summaries) may be excluded from automatic injection |
π Integration with Coverage Metrics¶
- Pulls existing entries from
documentation.index.yaml - Marks new docs as
status: documented - Generates
doc-coverage.metrics.jsonfor dashboard tracking
β Summary¶
The Documentation Write Agent uses long-term memory to:
- π§ Leverage past documentation and trace knowledge
- π Create deep, trace-linked documents with historical awareness
- β»οΈ Reuse patterns, terms, visuals, and validated outputs
- π Maintain continuity across editions, modules, and features
- π Enable coverage reporting, discovery, and enrichment
This allows the agent to act not just as a writer, but as a knowledge-aware documentation orchestrator within the ConnectSoft platform.
β Validation & Review¶
This section defines how the Documentation Write Agent ensures the quality, correctness, traceability, and completeness of all generated documentation through automated validation hooks, CI-integrated review signals, and Studio-facing previews.
β Validation Strategy Overview¶
| Validation Stage | Description |
|---|---|
| π§Ύ Markdown structure check | Ensures correct use of headings (H1βH3), code blocks, and lists |
| π Link checker | Validates that all relative links to .md, .yaml, .diff, .feature are resolvable |
| π§ Trace metadata validation | Confirms traceId, agentId, editionId are present and match the document context |
| π Lint ruleset | Applies ConnectSoft markdown rules: no empty headers, no unlinked references, callout formatting, edition labeling |
| π Preview integrity | Generates studio.preview.json and checks for correct keys, summary, and link to main document |
| π Cross-document coverage | Compares new doc against documentation.index.yaml and trace-link-map.yaml to confirm link completeness |
π Example Lint Rules (enforced via DocLinterSkill)¶
| Rule | Description |
|---|---|
| β Title is H1 | Only one # heading per document |
| β Metadata block | Must include traceId, editionId visibly in top section |
| β No orphan headers | No ## or ### without content under it |
| β Inline YAML formatting | Must use fenced code blocks (```yaml) for structure |
| β Mermaid blocks valid | Mermaid syntax must parse (graph TD, flowchart, etc.) |
π§ͺ Validation Outputs¶
| File | Description |
|---|---|
doc-validation.log.jsonl |
Structured log of all passes, warnings, and failures (e.g., missing traceId, broken link) |
studio.preview.json |
Final preview data used by Studio; generation failure is treated as a documentation failure |
fix-validation-metadata.yaml |
If doc is based on a fix, links to validation test pass/fail data from QA Agent |
documentation.index.yaml (updated) |
Marked with status: documented and linked validation block if applicable |
π Studio Review Integration¶
| Feature | Description |
|---|---|
| β Preview block | Allows reviewers to open documentation, view metadata, and suggest edits |
| π‘ Status flags | Flags docs as draft, needs-review, published |
| βοΈ Inline annotation | HumanOps and Developer Agents may annotate Markdown sections via Studio or PR UI |
| π Re-generation trigger | On failed validation or manual rejection, prompt regeneration with preserved traceId and inputs |
π CI/CD Integration¶
| Job | Description |
|---|---|
lint-docs |
Verifies all .md and .json outputs conform to expected structure |
validate-links |
Runs link checker across generated docs and project folder |
verify-preview-json |
Ensures preview metadata matches doc name, tags, and edition scope |
publish-to-studio-preview |
Uploads docs for Studio tile rendering and visualization testing |
β Summary¶
The Documentation Write Agent performs automated validation to ensure:
- π§Ύ Structural and formatting correctness
- π Valid internal linking and trace path resolution
- π Studio previews and CI/CD readiness
- βοΈ Optional human review support in Studio dashboard
- π Indexing and edition-scoped trace coverage
This makes documentation auditable, reviewable, and deployment-ready as part of the ConnectSoft autonomous factory pipeline.
π Retry and Correction Flow¶
This section explains how the Documentation Write Agent handles failures in content generation, formatting, validation, or trace integrity by triggering retries, fallback strategies, and optional correction workflows β either automatically or via manual agent/human-in-the-loop override.
π Retry Triggers¶
| Trigger | Description |
|---|---|
| β Validation failure | Linter detects structural issues, missing metadata, or broken links |
| β οΈ Missing section content | A required section (e.g., βCapabilitiesβ) is empty after composition |
| π« Invalid Markdown syntax | Mermaid diagram parsing error, YAML block malformed, callout format broken |
| π Link resolution failure | Document contains dead local or trace-relative links |
| π Low content quality (auto-evaluated) | SK scoring below confidence threshold (e.g., poor summarization, under-filled tables) |
π Retry Flow Logic¶
flowchart TD
Start[π Draft Composed]
Lint[β
Validate]
Lint -->|Fail| RetryCheck[π Retry Allowed?]
RetryCheck -->|Yes| Retry[π οΈ Recompose Using Fallback]
Retry --> Lint
RetryCheck -->|No| Escalate[π§βπ» Flag for Review]
π§© Correction Strategies¶
| Correction Type | Description |
|---|---|
| βοΈ Template adjustment | If a required section fails, fallback template used (e.g., feature-lite.md) |
| π Simplified summarization | Falls back to keyword-based summarizer if LLM fails to generate readable paragraph |
| π Memory trimming | Reduces memory block length if semantic overload or hallucination risk detected |
| π§ Trace injection retry | Re-fetches trace context if traceId or editionId appears corrupted or mismatched |
| π Link validator override | Allows injection of temporary anchor if file is not yet generated but planned in the same session |
π Retry Metadata (Stored in Log)¶
{
"traceId": "proj-821",
"documentType": "test-plan",
"retryCount": 2,
"lastFailureReason": "Missing scenario section",
"strategyUsed": "Template fallback with callout injection"
}
π§βπ» Human-Aware Correction Path¶
| Trigger | Outcome |
|---|---|
π Marked needs-review in Studio |
Triggers regeneration option or manual Markdown edit |
| π Exceeds 3 retries | Generates doc-failure-report.yaml for HumanOps Agent |
| βοΈ Developer review rejection | Writes annotations to studio.annotation.yaml, regenerates with constraints |
π Retry Limits & Rules¶
| Rule | Behavior |
|---|---|
| Retry attempts | Default: max 3 per document |
| Escalation | After 3 attempts, output marked as failed in documentation.index.yaml |
| Fallback allowed | Yes, for templates, summarizers, and injected metadata |
| Studio preview | Not emitted until successful validation + trace metadata presence |
β Summary¶
The Documentation Write Agent includes a robust retry and correction loop to ensure that every document is:
- π§ Logically and structurally complete
- β Formatted and validated successfully
- π Resilient to summarization or formatting failures
- π Escalated or flagged with full trace metadata when human review is needed
This safeguards ConnectSoftβs commitment to high-quality, edition-aware, and production-grade documentation automation.
π€ Collaboration Interfaces¶
This section details how the Documentation Write Agent collaborates with other ConnectSoft agents and systems β consuming their outputs, producing documentation for their artifacts, and synchronizing with shared trace, memory, and Studio tooling.
π Upstream Agent Inputs¶
| Agent | Provided Artifacts |
|---|---|
| VisionArchitectAgent | trace.plan.yaml, feature-blueprint.input.yaml |
| BugResolverAgent | bug-resolution.yaml, fix-summary.md |
| TestGeneratorAgent | .feature files, test-results.json |
| PromptArchitectAgent | prompt.plan.yaml, prompt YAML blocks |
| DeveloperAgent | README.template.md, module.overview.yaml |
| MicroserviceGeneratorAgent | service.metadata.yaml, generated.api.yaml |
| KnowledgeManagementAgent | memory-entry.json, knowledge-index.yaml, trace-link-map.yaml |
π€ Outputs Consumed By¶
| Agent | Artifact |
|---|---|
| StudioAgent | studio.preview.json, .md files for preview tiles and search |
| DeveloperAgent | README.md, module-index.md, and changelog summaries |
| KnowledgeManagementAgent | Final .md, .yaml docs stored as memory entries |
| QAEngineerAgent | test-plan.md, scenario explanations for regression coverage |
| HumanOpsAgent | doc-validation.log.jsonl, studio.annotation.yaml, and retry/escalation logs |
| PromptArchitectAgent | prompt-library.md, instruction.md for prompt introspection and reusability |
π Collaboration Flow Diagram¶
flowchart TD
VISION[Vision Architect Agent]
TEST[Test Generator Agent]
BUG[Bug Resolver Agent]
DEV[Developer Agent]
PROMPT[Prompt Architect Agent]
DOC[π Documentation Write Agent]
KM[Knowledge Management Agent]
STUDIO[Studio Agent]
VISION --> DOC
TEST --> DOC
BUG --> DOC
DEV --> DOC
PROMPT --> DOC
DOC --> KM
DOC --> STUDIO
DOC --> DEV
π§ Shared Interfaces¶
| Interface | Type | Description |
|---|---|---|
traceId, artifactId |
Metadata | Enables cross-agent traceability |
memory-entry.json |
Knowledge API | Used for enriching docs and linking past resolutions |
studio.preview.json |
Dashboard Preview | Allows Studio Agent to generate preview tiles and metrics |
documentation.index.yaml |
Registry | Shared index of all docs generated per project or edition |
doc-coverage.metrics.json |
Metrics | Tracks which modules or features are documented or not |
π€ Agent Collaboration Use Cases¶
| Scenario | Behavior |
|---|---|
| π Bug fixed β doc generated | Bug Resolver Agent emits patch β DOC Agent writes fix-report.md |
| π§ͺ Test generated β doc explained | Test Generator emits .feature β DOC Agent creates test-plan.md |
| π¦ Service generated β doc emitted | Microservice Generator builds CatalogService β DOC Agent writes README.md |
| βοΈ Prompt defined β instruction guide written | Prompt Architect Agent emits prompt β DOC Agent creates prompt-library.md |
βοΈ Human-Review Interfaces (via Studio)¶
| Integration | Function |
|---|---|
| Preview tile | Show rendered .md content and preview metadata |
| Status flags | Indicates documented, needs-review, published |
| Studio annotation hooks | Allows human reviewers to add comments or suggest regeneration |
| Markdown diff viewer | Compares agent-generated output to previous versions for approval or rollback |
β Summary¶
The Documentation Write Agent collaborates across the ConnectSoft platform by:
- π₯ Consuming structured outputs from planning, testing, development, and fix agents
- π§Ύ Producing documentation that is used by QA, Dev, Studio, and Memory agents
- π Ensuring every doc is trace-linked and preview-ready for Studio dashboards
- π€ Supporting both autonomous and human-in-the-loop documentation workflows
This makes the agent the hub of AI-generated traceable knowledge, central to ConnectSoftβs vision of autonomous, explainable SaaS development.
π Observability Hooks¶
This section describes how the Documentation Write Agent integrates with ConnectSoftβs observability infrastructure to track activity, performance, document coverage, generation health, and output quality β across CI/CD, Studio, and agent workflows.
π‘ Telemetry Events Emitted¶
| Event Name | Triggered When | Payload Includes |
|---|---|---|
DocGenerationStarted |
Document generation initiated | traceId, documentType, agentId, editionId |
DocGeneratedSuccessfully |
Document emitted and validated | outputPath, traceId, documentType, durationMs |
DocValidationFailed |
Lint, metadata, or structure error occurs | reason, lineNumber, section, traceId |
PreviewPublished |
studio.preview.json successfully created |
previewTitle, tags, status, traceId |
DocCoverageUpdated |
Documentation index or metrics regenerated | moduleId, status, documentTypes, totalDocs |
All events are logged via OpenTelemetry and optionally piped into Application Insights, Studio dashboards, or build telemetry collectors.
π Log Artifacts Generated¶
| File | Description |
|---|---|
doc-validation.log.jsonl |
Structured logs for each generated file (warnings, errors, retry history) |
studio.preview.json |
Used to update preview tiles and metadata in Studio |
documentation.index.yaml |
Index of all documentation files by trace, edition, module, type |
doc-coverage.metrics.json |
Coverage report: counts, editions covered, doc types emitted, etc. |
doc-generation.trace.json |
Full trace path for debugging issues across skills and retries |
π Key Metrics Tracked¶
| Metric | Purpose |
|---|---|
docCountPerEdition |
Documents emitted by editionId |
coverageByCluster |
Tracks how many features, services, or modules are documented in each agent cluster (QA, Architecture, etc.) |
avgGenerationTimeMs |
Per document type or artifact size |
retryRateByTemplate |
Tracks how often fallback templates are used |
studioPreviewSuccessRate |
Detects mismatches between doc emission and preview publication |
validationFailureRate |
Segment by cause: broken link, lint error, missing metadata, etc. |
π Studio Observability Integration¶
| Feature | Description |
|---|---|
| π Documentation search | Indexes titles, traceIds, and tags from studio.preview.json |
| π¦ Tile metrics | Number of documented modules, features, bugs, tests β shown as status bars |
| π Live preview panel | Uses latest Markdown to render an inline preview |
| π Diff viewer | Supports Markdown version comparison and rollback audit trails |
| β Status labels | draft, needs-review, validated, published derived from doc state machine |
π¦ CI/CD Observability Hooks¶
| Hook | Function |
|---|---|
validate-docs |
Runs linting, formatting, and trace validation during pipeline build |
publish-preview |
Uploads Studio preview and pushes DocGeneratedSuccessfully event |
generate-index |
Updates documentation index and coverage metrics YAML files |
publish-telemetry |
Sends OpenTelemetry span logs for dashboards or alerts (optional) |
π Traceability Tags in Logs¶
Every telemetry output includes:
traceIdagentIdeditionIddocumentTypeoutputFilePathretryCount(if any)timestamp(ISO-8601)
β Summary¶
The Documentation Write Agent includes full observability instrumentation to ensure:
- π Live insights into documentation health, coverage, and validation
- π§Ύ Auditability for every document generated, retried, or escalated
- β Feedback loops into Studio dashboards and CI/CD pipelines
- π Root cause tracking for generation or formatting failures
This ensures that documentation is as observable as code or infrastructure, in alignment with ConnectSoftβs observability-first architecture.
π§βπ» Human Intervention Hooks¶
This section defines how human reviewers β including technical writers, developers, and project leads β can interact with, review, override, and improve the outputs of the Documentation Write Agent. It supports a hybrid workflow of autonomous generation with manual checkpoints and collaboration.
βοΈ When Human Intervention Is Allowed or Triggered¶
| Scenario | Trigger |
|---|---|
π‘ needs-review flag applied |
Low confidence generation score or partial section failure |
| β Validation failures | After 3 failed retries (structure, link, or content issues) |
| π€ Manual annotation provided | HumanOps or Developer Agent leaves suggestions in Studio |
| π§ Critical doc type or audit trace | Company policy enforces human approval before publishing (e.g., security overview, client-facing SDK README) |
| π Prompt evolution in progress | PromptArchitectAgent or VisionArchitectAgent requests review during generation of prompt-based or strategy-based content |
π©βπ» Human Interaction Points (Studio + Git)¶
| Interface | Feature |
|---|---|
| Studio Preview Tile | View live doc preview rendered from .md |
| Inline Review UI | Leave comments on specific lines or sections |
| Annotation Panel | Add global feedback (e.g., βAdd architecture diagramβ) |
| Status Buttons | Approve, Reject, Regenerate with constraints |
| Diff Comparison View | Compare regenerated vs. prior version side-by-side |
| Override with Manual Edits | Accept hand-edited .md file and flag as human-curated in index |
π Review Metadata (Stored in studio.annotation.yaml)¶
traceId: proj-899
document: feature-blueprint.md
reviewedBy: daniel.mizrahi@connectsoft.ai
status: needs-revision
comments:
- section: Capabilities
message: "Please clarify the fallback mechanism for SMS failure"
- section: Overview
message: "Add Mermaid diagram for the notification flow"
timestamp: 2025-05-15T22:55:00Z
π Supported Human Actions¶
| Action | Effect |
|---|---|
| β Approve | Marks doc as validated and updates index + Studio tile |
| π Annotate | Adds in studio.annotation.yaml, triggers conditional regeneration |
| π Reject | Writes failure note and flags doc for escalation or human rewrite |
| π οΈ Override + Save | Developer provides manually corrected .md file; future agents can learn from this |
| π Constrain Retry | Reviewer specifies which section or macro to retry (e.g., regenerate "Test Scenarios" only) |
π Escalation Paths¶
| Condition | Behavior |
|---|---|
| Review not completed in time | Triggers reminder or fallback to retry after cooldown window |
| Critical doc required | If marked blocking: true in trace.plan.yaml, must be reviewed before doc is marked as published |
Studio status = needs-human |
Appears in review backlog dashboard for prioritization |
π§Ύ Audit and Coverage Logs¶
| Artifact | Description |
|---|---|
studio.annotation.yaml |
Full record of human feedback, linked to traceId and doc path |
documentation.index.yaml |
Flags documents as human-reviewed, machine-generated, or override-applied |
doc-review-history.jsonl |
Append-only log of all human feedback across docs, reviewers, and trace groups |
β Summary¶
The Documentation Write Agent integrates with human intervention workflows to support:
- β Structured review of sensitive or critical documentation
- π§Ύ Feedback loops that improve future generation quality
- π Studio dashboard visibility of what needs review or approval
- π οΈ Manual override paths for high-trust outputs (e.g., SDKs, policies)
- π Proper annotation, audit logging, and trace alignment
This balances autonomy with oversight, ensuring ConnectSoft documentation is trustworthy, collaborative, and production-safe.
π§Ύ Summary and Positioning¶
This final section consolidates the agentβs responsibilities, integration, skills, and system role β demonstrating how the Documentation Write Agent acts as the voice of the AI Software Factory, transforming structured artifacts into production-grade, traceable, and edition-aware documentation.
π― Core Purpose Recap¶
The Documentation Write Agent turns structured outputs from ConnectSoft agents into Markdown-based, trace-linked, human- and agent-readable documentation β with Studio previews, trace metadata, validation, and observability.
π§© Position in the ConnectSoft Platform¶
flowchart TD
PLAN[π Planning Agents]
DEV[π Developer Agents]
TEST[π§ͺ QA/Test Agents]
FIX[π Bug Resolution Agents]
PROMPT[π§ Prompt Architect Agents]
DOC[π Documentation Write Agent]
STUDIO[π Studio Agent]
KM[π§ Knowledge Management Agent]
PLAN --> DOC
DEV --> DOC
TEST --> DOC
FIX --> DOC
PROMPT --> DOC
DOC --> STUDIO
DOC --> KM
π§ Responsibilities Overview¶
| Responsibility | Output |
|---|---|
| π Compose documents from artifacts | README.md, fix-report.md, feature-blueprint.md, test-plan.md |
| π§Ύ Format and validate | Linted, structured, and edition-aware .md, .yaml, .json |
| π Link across memory and trace | Injects memory summaries and related artifact links |
| π Emit previews and metrics | studio.preview.json, doc-coverage.metrics.json, documentation.index.yaml |
| π§βπ» Support human review | Studio-based review, annotation, and manual overrides |
βοΈ Skills & Technology¶
| Layer | Tools |
|---|---|
| π§ Semantic Kernel | Markdown composition, prompt injection, skill chaining |
| π¦ Azure OpenAI | Summarization, section formatting, tone enforcement |
| π Observability | OpenTelemetry, Application Insights, Studio dashboards |
| π§° Output Formats | Markdown, Mermaid, JSON, YAML |
| π§ Memory | memory-entry.json, knowledge-index.yaml, trace maps |
π Outputs Produced¶
| Type | File |
|---|---|
| Technical Documentation | *.md (human-readable) |
| Studio Metadata | studio.preview.json |
| Coverage & Index | documentation.index.yaml, doc-coverage.metrics.json |
| Validation Logs | doc-validation.log.jsonl, studio.annotation.yaml |
π§© Collaboration Role¶
- π§ Consumes: Planning, Fix, Test, Prompt, and Developer agent outputs
- π€ Produces: Documents and previews for Studio, CI, QA, KM, and DevOps
- π Feeds: Memory graph, prompt library, changelog systems, and agent knowledge modules
β Summary¶
The Documentation Write Agent:
- π§Ύ Generates traceable, edition-aware, explainable documentation
- π Turns raw trace artifacts into fully structured
.md,.yaml, and.jsonfiles - π Cross-links memory, bug reports, tests, features, and modules
- π§ Leverages Semantic Kernel + long-term memory + Studio integration
- π Enables observability, audit, and governance for every document
- π€ Supports both autonomous and human-in-the-loop content generation
π Final Positioning¶
The Documentation Write Agent is:
π The narrative layer of the ConnectSoft AI Software Factory β turning multi-agent outputs into cohesive, validated, and Studio-ready documentation that powers traceability, developer experience, and autonomous lifecycle transparency.