Skip to content

๐Ÿ“˜ Documentation Blueprint

๐Ÿงญ Purpose of the Documentation Blueprint**

๐ŸŽฏ Objective

Define the role and rationale of the documentation-blueprint.md within the ConnectSoft AI Software Factory โ€” clarifying why it exists, what it governs, and how it serves both agents and humans in a modular, autonomous development system.


๐Ÿ“˜ What Is the Documentation Blueprint?

The documentation-blueprint.md is a meta-standard that defines how all documentation across the AI Software Factory is:

  • Generated by agents
  • Structured using templates and metadata
  • Stored in retrievable, observable formats
  • Linked to memory, traces, modules, and features
  • Consumed by humans, agents, CI/CD, and copilots

It serves as the governing contract for all documentation-related behavior in the platform.


๐Ÿค– Why It Matters in an AI Software Factory

In traditional software systems, documentation is an afterthought. In ConnectSoft, documentation is:

  • A first-class output of the generation pipeline
  • A source of knowledge and memory for future agent runs
  • A validation surface during CI/CD and policy enforcement
  • A guidance layer for human developers via copilots and Studio

โ€œIf an agent emits a module without documentation, itโ€™s incomplete. If a human reads a doc without traceability, itโ€™s untrustworthy.โ€


๐Ÿ”„ Documentation as Code, Memory, and Signal

In ConnectSoft, documentation isn't static:

Dimension Role
As Code It is versioned, diffed, structured, and validated
As Memory It becomes part of the knowledge graph and vector-retrievable context
As Signal It emits trace metadata, quality scores, and audit events

๐Ÿงฉ Blueprint Scope

The documentation blueprint governs all documentation outputs including:

  • README.md, HowItWorks.md, vision-blueprint.md
  • Feature specs, test docs, glossary files, architecture diagrams
  • Execution summaries, prompt rationales, memory manifests
  • DevOps logs, agent notes, and Studio view fragments

๐Ÿ” Trust, Scale, and Traceability

The blueprint ensures documentation can scale securely and traceably by:

  • Enforcing tenant and module scoping
  • Embedding agentId, traceId, and skillId in every doc
  • Validating format and metadata via CI
  • Linking documentation to Studio views, agent memory, and semantic graphs

โœ… Summary

The Documentation Blueprint defines:

  • What constitutes documentation in the Factory
  • How it is structured, generated, versioned, and consumed
  • How it aligns with memory, observability, and autonomy goals

โ†’ It transforms documentation from passive text into machine-actionable, traceable knowledge across the lifecycle of autonomous SaaS generation.


๐Ÿ—‚๏ธ Types of Documentation in the Factory

๐ŸŽฏ Objective

Define and categorize the full spectrum of documentation types produced, consumed, and reused throughout the ConnectSoft AI Software Factory โ€” spanning technical, architectural, operational, and memory-bound knowledge.


๐Ÿ“š Core Documentation Categories

Category Purpose
Blueprints High-level design intents, vision artifacts, service specs
Architecture Docs System design, decisions, diagrams, and modular decomposition
API and Contract Specs OpenAPI, gRPC, GraphQL, and event schemas
Execution Summaries execution-metadata.json, agent logs, status reports
Test Documentation BDD .feature files, coverage maps, test outcomes
How-To Guides Procedural guidance for developers, ops, and integrators
Agent Notes Contextual explanations of why decisions were made
Glossaries Domain-specific and system-wide terminology definitions
Diagrams and Views Visual representations (e.g., Mermaid, SVG, PlantUML)
Prompt Trace Records Original prompts, planner flows, AI responses
Validation Artifacts Checklists, approvals, rationale docs from governance flows
Module Snapshots README.md, changelogs, module.json summaries per microservice or lib

๐Ÿงฉ By Output Format

Documentation in ConnectSoft is natively multi-format and composable:

Format Examples Generated By
.md Vision, architecture, how-to, feature specs Documentation Writer Agent
.json Metadata, trace logs, summaries, embedding indexes Coordinator, Validator Agents
.yaml Blueprints, configs, CI pipelines Solution Architect, DevOps Agent
.feature BDD scenarios Test Generator Agent
.bicep Infrastructure diagrams-as-code IaC Agent
.svg Visuals for architecture or flows Diagram Generator Agent

๐Ÿง  By Memory Function

Docs are also classified by how they contribute to long-term memory:

Memory Role Example
Context Recall VisionDocument.md, prompt-original.md
Reasoning Aid generator-notes.md, design-decisions.md
Execution Trace execution-metadata.json, agent-status.md
Semantic Vector Embedded blueprint text, prompt-response logs

๐Ÿ” Cross-Stage Coverage

Documentation is emitted at every stage of the factory pipeline:

Stage Example Docs Generated
Vision / Planning VisionDocument.md, domain overview
Architecture service maps, module decomposition diagrams
Engineering README, spec files, how-to, validation reports
Testing .feature, test logs, coverage
Deployment changelogs, configs, release manifests
Observability trace overviews, alerts, system health views

โœ… Summary

The AI Software Factory treats documentation as a modular, memory-bound, lifecycle-spanning output. It goes beyond static README files, embracing:

  • Multi-agent, multi-format, multi-language artifacts
  • Systemic traceability, quality signals, and semantic indexing
  • Rich, layered content tied to blueprints, prompts, and memory

โ†’ Every doc has a purpose, producer, consumer, and trace identity.


๐Ÿ‘ฅ Who Produces and Who Consumes Docs

๐ŸŽฏ Objective

Define the roles, agents, tools, and stakeholders involved in the generation, validation, consumption, and refinement of documentation across the ConnectSoft AI Software Factory.


๐Ÿค– Primary Producers

Producer Agent Responsibilities
Documentation Writer Agent Generates README.md, HowItWorks.md, summaries, changelogs, etc.
Solution Architect Agent Emits architectural overviews, system maps, blueprint YAMLs
DevOps Agent Outputs deployment diagrams, CI/CD pipelines, execution-metadata.json
Test Generator Agent Generates .feature specs, coverage reports, test summaries
UX Designer Agent Provides human-readable flows, onboarding docs, glossary terms
Prompt Planner Agents Capture prompt intent, reasoning traces, planner flows

๐Ÿ‘จโ€๐Ÿ’ป Human Authors and Editors

While most documentation is agent-generated, human engineers enhance it via:

  • Manual edits in version-controlled markdown
  • Injecting additional rationale or context
  • Reviewing output in Studio or VSCode Copilot
  • Linking external artifacts (e.g., screenshots, attachments)

Humans act as curators, validators, and quality editors โ€” not just readers.


๐Ÿง  Embedded AI Consumers

Documentation is also consumed by agents at runtime:

Agent Role How It Uses Documentation
Planner Agent Pulls blueprint documents to reason over system scope
Developer Agent Uses feature specs to generate modules, handlers, events
Validator Agent Reads test plans and quality criteria
Release Manager Agent Extracts version info and changelogs to label releases
Studio Interface Agent Maps docs to timeline, trace tree, and previews in user interface

๐Ÿง‘โ€๐Ÿ’ผ Human Consumers

Persona Consumption Mode
Architects Architecture diagrams, service overviews, system maps
Developers API specs, README, test cases, feature specs
Testers Test plans, .feature files, validation reports
Product Owners Vision docs, capability summaries, glossary entries
DevOps Engineers Pipeline manifests, environment-specific configs
Support Teams Troubleshooting guides, change logs

๐Ÿ”„ Feedback and Update Flows

Documentation is a living memory updated by:

  • Agent re-generation based on trace feedback
  • Human pull requests with manual refinements
  • Observability agents flagging outdated or missing docs
  • Copilots suggesting doc improvements inline (e.g., VS Code)

๐Ÿงญ Dual Nature: Machine and Human-Oriented

Every documentation artifact must be:

Machine-Readable Human-Friendly
Structured metadata Natural language, readable Markdown
Semantic embeddings Visual diagrams and contextual guides
Memory-indexed for retrieval Linked for Studio navigation
Referenced in CI validations Reviewed in Git or Copilot interfaces

โœ… Summary

Documentation in the ConnectSoft Factory is a shared asset:

  • Produced by agents
  • Refined by humans
  • Read by both
  • Indexed in memory
  • Used in copilots, Studio, CI/CD, and runtime agents

โ†’ It's the linking tissue between intelligence, execution, and understanding.


๐Ÿค AI-Generated, Human-Augmented

๐ŸŽฏ Objective

Define how documentation is created as a collaborative artifact between autonomous agents and human engineers โ€” blending machine precision with human insight to produce high-quality, traceable, and useful documentation.


๐Ÿง  Generation by Intelligent Agents

The majority of documentation in the Factory is initially produced by agents. These agents:

  • Operate based on prompts, blueprints, and memory
  • Follow structural and metadata schemas
  • Leverage past documentation as semantic examples
  • Produce consistent formats such as .md, .json, .yaml, .svg

Examples:

Agent Output Example
Documentation Writer Agent README.md, HowItWorks.md, changelogs
Test Generator Agent BDD .feature files, test docs, coverage
Solution Architect Agent service-maps, domain-overviews, system diagrams

โœ๏ธ Augmentation by Humans

Human engineers enhance generated docs through:

  • Clarification of business rationale
  • Refinement of examples, explanations, and visuals
  • Fixing contextual gaps or outdated terminology
  • Linking additional source references
  • Converting agent-output to production-quality writing

These changes are tracked via Git, Studio audit logs, or CI doc checks.


๐Ÿ” Iterative Co-Authoring Loop

sequenceDiagram
    participant Agent as AI Agent
    participant Git as Git Repo
    participant Human as Developer
    participant Studio as Studio

    Agent->>Git: Commit generated doc
    Human->>Git: Refine and commit improvements
    Studio->>Git: Track versions and metadata
    Git-->>Agent: Feed back changes for future prompts
Hold "Alt" / "Option" to enable pan & zoom

This loop ensures that agents learn from human refinements and future generations become more accurate, contextual, and complete.


๐Ÿ“Œ Co-Ownership Model

Responsibility Agent Role Human Role
Initial generation Generate complete doc structure + content Review and contextualize
Metadata + trace links Inject traceId, agentId, type, tags Validate and update scope/context
Visual assets Generate diagrams and layout Refine narrative, polish, or override
Observability signals Emit quality metrics, stale flags Confirm status and documentation health

๐Ÿง  Memory-Driven Improvement

Agent-generated docs improve through:

  • Memory embeddings of human-updated examples
  • Trace feedback loops (e.g., DocCorrected, MisleadingDocFlagged)
  • Copilot suggestion mining and auto-refactor injection

๐Ÿงญ Governance Rules

All agent-produced docs include:

  • generatedBy and generatedAt metadata
  • traceId, skillId, and docType tags
  • Clear section delimiters for human edits
  • Change audit trail (doc-revision.json or commit diff)

โœ… Summary

The AI Software Factory uses a co-authoring paradigm for documentation:

  • Agents ensure speed, structure, and memory linkage
  • Humans ensure clarity, trust, and contextual relevance

โ†’ Together, they produce documentation thatโ€™s alive, intelligent, and production-grade.


๐Ÿ”„ Documentation Lifecycle and Statuses

๐ŸŽฏ Objective

Define the lifecycle stages and status management of documentation artifacts โ€” from initial generation to production approval, deprecation, or regeneration โ€” ensuring auditability, clarity, and consistency across modules and agents.


๐Ÿ“˜ Key Lifecycle States

Status Description
Draft Initial version, generated by agent or human, not yet reviewed
InReview Pending human/agent review or approval process
Approved Validated for production use; included in Studio, CI/CD, and release views
Outdated Valid but flagged as stale or superseded by a newer trace
Deprecated No longer recommended; archived or auto-excluded from runtime use
Regenerated Recreated from a new traceId or feature input

Each document includes a status field in its metadata for traceability.


๐Ÿงฌ Metadata Example

{
  "docType": "FeatureSpec",
  "moduleId": "BookingService",
  "status": "InReview",
  "generatedBy": "test-generator-agent",
  "traceId": "trace-9c28a1f",
  "version": "v1.3.0",
  "createdAt": "2025-06-13T12:14:00Z",
  "reviewedBy": null
}

โœ… Status Workflow Overview

flowchart TD
  Draft --> InReview
  InReview --> Approved
  Approved --> Outdated
  Approved --> Deprecated
  Outdated --> Regenerated
Hold "Alt" / "Option" to enable pan & zoom

โœ… Each transition is logged in doc-revision.json and reflected in Studio views.


๐Ÿ” Agent-Aware Lifecycle Behaviors

Agent Type Lifecycle Integration
Documentation Writer Sets initial Draft status
Validator Agent Triggers move to InReview or flags inconsistencies
Release Manager Agent Requires Approved docs before tagging deployments
Observability Agent Flags Outdated docs via freshness heuristics and trace gaps
Copilot Plugin Excludes Deprecated or low-trust docs from injected memory

๐Ÿง  Factors That Trigger Status Change

  • Time since last trace match โ†’ Outdated
  • Feature or module deleted โ†’ Deprecated
  • Manual override in Studio or Git โ†’ Any state
  • CI validation failure โ†’ Blocks Approved
  • Human review โ†’ Promotes from InReview to Approved

๐Ÿšฅ Enforcement in CI/CD

CI pipelines validate:

  • All modules must include at least 1 Approved README and test doc
  • Documentation without required metadata is blocked
  • Deprecated docs cannot be linked from blueprints or included in releases

๐Ÿ“Š Studio and Trace View Integration

  • Status badge shown per document
  • Filters available: Only Approved, Needs Review, Deprecated
  • Visual history diff and trace-linked revision logs

โœ… Summary

Documentation in the Factory is versioned, governed, and traceable across its lifecycle:

  • Each doc moves through clear statuses (Draft โ†’ Approved โ†’ Deprecated)
  • Transitions are enforced by CI, agents, and Studio views
  • Status metadata is required and consistently applied

โ†’ Enabling trust, governance, and automation of knowledge evolution.


๐Ÿ“ Folder Structures and Naming Conventions

๐ŸŽฏ Objective

Establish consistent, predictable, and traceable conventions for where documentation is stored, how it's named, and how it's resolved across modules, agents, and Studio views โ€” supporting modularity, discovery, and trace linking at scale.


๐Ÿ—‚๏ธ Core Folder Structure

Every module or service in the Factory includes a standardized docs/ directory:

/modules/
  BookingService/
    docs/
      README.md
      feature-booking-availability.md
      test-scenarios.feature
      changelog.md
      execution-metadata.json
      diagrams/
        booking-flow.mmd
        service-structure.svg

Top-level documentation exists at the project or tenant scope:

/blueprints/
  vision/
    vision-overview.md
    system-decomposition.md
  architecture/
    service-map.mmd
    context-boundaries.md
  glossary/
    terms-en.md
    terms-ru.md

๐Ÿ“„ Naming Convention Rules

Element Convention
README files README.md, HowItWorks.md
Feature docs feature-<feature-name>.md or .feature
Test scenarios test-<module/feature>.feature
Execution metadata execution-metadata.json
Trace-linked docs trace-<traceId>-<docType>.md
Agent notes agent-<agentId>-<skill>.md
Diagrams Use .mmd, .svg, .plantuml โ€” inside docs/diagrams/ folder
Change logs changelog.md, release-notes.md per version folder

โ†’ These filenames are parsed and verified by both the CI and Studio indexer.


๐Ÿ“ฆ Multi-Version Folder Layout

Versioned outputs use:

/modules/InvoiceService/
  v1.0.0/
    docs/
  v1.1.0/
    docs/
  latest -> v1.1.0/

Each version folder includes trace-linked and status-tagged documentation with its own execution-metadata.json.


๐Ÿง  Traceable Location Resolution

Documentation is resolved using a 3-part identity:

docIdentity:
  moduleId: "BookingService"
  traceId: "trace-7a82f9"
  docType: "FeatureSpec"

โ†’ This allows Studio, CI/CD, and memory agents to locate the correct document without hardcoded paths.


๐Ÿ” Discovery Rules

Studio, copilots, and agents resolve docs by:

  1. Checking docs/ folders in module path
  2. Falling back to /blueprints/ for shared/system-wide docs
  3. Resolving via traceId, agentId, docType when embedded in metadata
  4. Filtering by status: Approved by default

๐Ÿ› ๏ธ Enforcement and Linting

CI pipelines include a Doc Structure Validator:

  • Flags misplaced or misnamed files
  • Warns if required docs (e.g., README.md, execution-metadata.json) are missing
  • Validates semantic folders like diagrams/, glossary/, architecture/

โœ… Summary

Consistent folder and naming structures:

  • Enable machine lookup, Studio rendering, and search
  • Improve reusability, versioning, and memory indexing
  • Reduce ambiguity for both agents and humans

โ†’ Every documentation artifact is discoverable, structured, and trace-linked by design.


๐Ÿท๏ธ Documentation Metadata Schema

๐ŸŽฏ Objective

Define the required and optional metadata fields that every documentation artifact must include to support traceability, versioning, status tracking, semantic search, Studio indexing, and memory embedding.


๐Ÿ“„ Required Metadata Fields

All docs โ€” whether Markdown, JSON, YAML, or .feature โ€” must include a machine-readable metadata block.

Example (YAML frontmatter or embedded JSON):

---
docType: FeatureSpec
moduleId: BookingService
traceId: trace-7a82f9
agentId: test-generator-agent
status: Approved
version: v1.1.0
generatedAt: 2025-06-13T15:04:00Z
tags: [appointments, testing, BDD]
language: en
memoryEmbedding: true
---

๐Ÿงฌ Field Definitions

Field Type Description
docType string Type of doc (e.g., FeatureSpec, Readme, Changelog, VisionDoc)
moduleId string The module, service, or library this doc belongs to
traceId string The trace that triggered this documentation's generation
agentId string Which agent created this doc (e.g., documentation-writer-agent)
status string Lifecycle stage: Draft, InReview, Approved, Deprecated, etc.
version string Version of the associated module or artifact
generatedAt timestamp ISO 8601 timestamp of when this doc was produced
tags array Semantic tags (used in search, filtering, memory graphs)
language string Language code (e.g., en, ru, es)
memoryEmbedding boolean Whether this doc should be embedded for semantic retrieval

๐Ÿ” Optional Fields

Field Type Purpose
relatedDocs array References to related docIds or paths
sourcePromptId string ID of prompt that led to this doc's generation
reviewedBy string Human reviewer (if applicable)
correctedFrom string traceId of earlier version this doc was regenerated from
embeddingVectorId string ID used in vector store if semantically indexed

๐Ÿ“ Storage Format Examples

  1. YAML Frontmatter in Markdown Used for docs like README.md, HowItWorks.md, or feature specs.

  2. JSON Metadata Block in .feature or .mmd Embedded as comments or sidecar .meta.json files.

  3. Separate doc-metadata.json Used when the primary format is not text-editable (e.g., .svg, .bicep).


๐Ÿง  Why This Matters

Consistent metadata enables:

  • Studio navigation and visual overlays
  • Search and filtering in copilots and dashboards
  • Observability signals (e.g., stale docs, missing tags)
  • Memory graph integration for retrieval-augmented generation

๐Ÿ” Validation Rules

CI pipelines and the Doc Structure Validator enforce:

  • Presence of all required fields
  • Correct typing and format
  • Consistency between folder structure and metadata values

โœ… Summary

Metadata transforms documentation into a machine-consumable, traceable, and AI-integrable asset:

  • Required for search, filtering, CI/CD, and memory indexing
  • Drives trace-first visibility and semantic discovery
  • Aligns every document with the platform's modular and observable nature

โ†’ Every doc becomes a first-class citizen in the autonomous software factory.


๐Ÿงฑ Documentation Templates and Layouts

๐ŸŽฏ Objective

Establish reusable, modular, and memory-compatible layout templates for every major documentation type โ€” ensuring consistency, automation compatibility, and human readability across all docs produced by the factory.


๐Ÿ“˜ Standardized Template Types

Each doc type in the factory is backed by a predefined layout template, structured with reusable sections, optional fields, and embedded metadata.

Doc Type Template File Description
README.md templates/docs/readme-template.md Overview, usage, trace info, status, links
HowItWorks.md templates/docs/howitworks.md Runtime logic, workflows, diagrams, decisions
FeatureSpec.md templates/docs/feature-spec.md Requirements, user stories, inputs/outputs
.feature templates/docs/test-scenario.feature BDD Given/When/Then for QA and automation
changelog.md templates/docs/changelog.md Versioned release notes + trace logs
execution-metadata.json templates/docs/execution-metadata.json Trace, agent, and runtime data summary

๐Ÿงฉ Composable Layout Sections

Templates are composed of named sections that can be reused or injected independently by agents:

Section Name Usage Context
## Purpose README, feature docs
## Trace Metadata All doc types
## Inputs / Outputs Feature specs, use cases
## Prompt Rationale AI-generated decisions and flows
## Visual Flow HowItWorks, architecture views
## Related Artifacts Links to code, blueprints, tests
## Audit History Reviewed by, status changes, commits

Each section is labeled for Studio parsing, copilot highlighting, and memory chunking.


๐Ÿ“„ Sample: Feature Spec Template

---
docType: FeatureSpec
traceId: trace-abcdef12
moduleId: InvoiceService
generatedBy: business-analyst-agent
status: Approved
version: v1.2.0
---

## Purpose
Describes the requirements for generating recurring invoices.

## Inputs / Preconditions
- Valid subscription
- Defined billing cycle

## Outputs / Postconditions
- New invoice created
- Payment schedule updated

## User Story
> As a platform admin, I want recurring invoices generated automatically...

## Prompt Rationale
Generated based on `vision-billing.md` + planner-agent suggestion.

## Related Artifacts
- `test-recurring-invoice.feature`
- `InvoiceCreatedEvent.cs`
- `HowItWorks.md`

๐Ÿ“ Visual Templates

Docs that contain diagrams reference .mmd, .plantuml, or .svg components, either inline or via:

![Service Diagram](./diagrams/service-overview.mmd)

โ†’ These are parsed by Studio or rendered by CI markdown pipelines.


๐Ÿง  Injection by Agents

  • Agents can inject section fragments dynamically
  • Each section is optional unless required by docType
  • Templates support parameterization via {{placeholders}} during prompt composition

โœ… Summary

Documentation templates provide:

  • Consistency for humans, agents, and validation tools
  • Structured injection and composition of content sections
  • Reusable scaffolding for every docType, traceable across versions and modules

โ†’ The factory doesnโ€™t just generate content โ€” it formats it for traceability, reuse, and quality.


๐Ÿง  Modular Knowledge Blocks

๐ŸŽฏ Objective

Define how documentation is composed of modular, reusable knowledge blocks โ€” allowing agents and humans to assemble, reuse, and trace documentation components across modules, tenants, and systems.


๐Ÿงฉ What Is a Knowledge Block?

A knowledge block is a self-contained, semantically tagged, and trace-linked documentation fragment that:

  • Has a clear scope (e.g., โ€œInvoice flow diagramโ€ or โ€œRetry policy rationaleโ€)
  • Is versioned and optionally embedded in vector memory
  • Can be referenced, reused, or injected into other documentation

๐Ÿ“ฆ Block Format and Metadata

---
blockId: kb-74df12
type: Diagram
title: Invoice Flow Logic
tags: [invoicing, billing, retry]
traceId: trace-7a2b81
moduleId: InvoiceService
version: v1.0.1
generatedBy: architect-agent
memoryEmbedding: true
---
## ๐Ÿงพ Invoice Flow Logic (kb-74df12)

```mermaid
sequenceDiagram
  Customer->>BillingService: Subscribe
  BillingService->>Scheduler: Schedule Invoice
  Scheduler-->>BillingService: Timer Trigger
  BillingService->>InvoiceService: CreateInvoice
---

### ๐Ÿง  Types of Knowledge Blocks

| Type              | Description                                                |
|-------------------|------------------------------------------------------------|
| `Definition`       | A glossary entry or domain explanation                     |
| `Rationale`        | Prompt decision or architectural choice explanation        |
| `Diagram`          | A `.mmd`, `.plantuml`, or `.svg` visual element            |
| `Checklist`        | A validation or approval list for agents/humans            |
| `Prompt Trace`     | Original planner input and output summary                  |
| `Code Snippet`     | Agent-generated example embedded in explanation            |
| `Reference Link`   | Cross-module or cross-service doc or code reference        |
| `Audit Block`      | Reviewer comments, status change records, decision logs    |

---

### ๐Ÿ”„ Block Injection and Referencing

Knowledge blocks can be **injected** using link-style references:

```markdown
:::kb[Invoice Flow Logic](kb-74df12)

Or embedded inline during generation:

{{inject:kb-74df12}}

โ†’ Both methods allow agents and copilots to resolve, version, and embed the block during generation.


๐Ÿ“š Registry and Reuse

Knowledge blocks are stored in:

  • /knowledge-blocks/ folders per module, domain, or feature
  • kb-index.json for Studio, CI, and memory ingestion
  • Referenced by traceId, tags, or logical grouping (e.g. payment-domain/)

They can be reused in:

  • Multiple feature specs
  • Agent reasoning steps
  • README summaries
  • CI validation outputs

๐Ÿง  Memory Graph Linking

Each knowledge block is:

  • Stored as a vector-embedded memory chunk if memoryEmbedding: true
  • Cross-linked to other blocks using shared tags, source prompts, or usage traces
  • Included in search, similarity, and prompt reasoning

โœ… Summary

Modular knowledge blocks:

  • Enable composability of documentation like Lego pieces
  • Reduce duplication across modules and teams
  • Improve traceability and memory-driven reuse
  • Power AI copilots and Studio views with context-aware injection

โ†’ Every block becomes a building unit of the Factoryโ€™s living documentation graph.


๐Ÿ”— Linking to Blueprints and Modules

๐ŸŽฏ Objective

Define how documentation artifacts are tightly linked to the blueprints, features, and modules they describe โ€” enabling trace-based navigation, memory integrity, reuse across components, and accurate semantic associations.


๐Ÿงฑ What Should Be Linked

Every documentation file must be explicitly associated with at least one of the following:

Link Target Description
BlueprintId E.g., vision-booking-platform, infra-template-aks
FeatureId E.g., recurring-invoicing, multi-tenant-isolation
ModuleId E.g., InvoiceService, UserGateway, LocalizationLibrary
AgentTraceId E.g., trace-f2b98d8a that represents the planning or generation flow
PromptTemplateId ID of the template or persona skill that initiated the doc

๐Ÿงฌ Embedded Metadata Fields

All documentation must include linkage metadata:

---
moduleId: InvoiceService
blueprintId: billing-core-blueprint
featureId: recurring-invoices
traceId: trace-a1b2c3
promptTemplateId: ft-generate-recurring
---

This enables Studio, memory graphs, copilots, and CI validation to link documentation directly to:

  • Source modules and code
  • Feature specs and BDDs
  • Prompt reasoning flows and AI-generated blueprints

๐Ÿงฉ Practical Linking Examples

Doc Type Expected Linkage
README.md moduleId only
feature-recurring.md featureId, moduleId, optional blueprintId
execution-metadata.json traceId, moduleId, agentId
vision-overview.md blueprintId, agentId, no module required
agent-rationale.md traceId, promptTemplateId, possibly featureId

๐Ÿง  Why Linking Matters

Capability Enabled By Linking
Trace Visualization Studio shows upstream โ†’ downstream links
Memory Indexing Search relevance improves via shared links
Modular Reuse Shared features/docs across microservices
Prompt Debugging Reverse-trace what prompt produced which doc
Multi-Agent Coordination Different agents contribute linked docs to the same entity
CI/CD Validation Blocks release if required links are missing

๐Ÿ“š Studio and Copilot Integration

  • Studio renders a linked graph of all documentation per blueprint/module
  • Copilots resolve links to inject additional context during code or prompt generation
  • Hover or click reveals inline preview from related docs

๐Ÿ” Cross-Linking Patterns

Documentation can also link to other docs explicitly:

๐Ÿ“Ž Related:
- [Recurring Invoice Feature Spec](./feature-recurring.md)
- [Test Scenarios](./test-recurring.feature)
- [System Diagram](./diagrams/invoice-flow.mmd)

These are parsed and validated by the Studio indexer and injected into Studio navigation panels.


โœ… Summary

Linking documentation to features, modules, and blueprints:

  • Enables trace-based doc discovery, validation, and reuse
  • Powers memory graphs, prompt reasoning, and agent coordination
  • Establishes a semantic mesh of documentation as part of the systemโ€™s intelligence

โ†’ Every doc becomes part of a resolvable, navigable, and composable network of system knowledge.


๐Ÿ›ฐ๏ธ Traceability and Observability Fields

๐ŸŽฏ Objective

Define the required traceability and observability metadata that must be embedded into documentation artifacts to support end-to-end visibility, lifecycle tracking, change audits, and semantic memory correlation.


๐Ÿ” Why Traceability Is Critical

Traceability ensures that documentation is:

  • Linked to who/what/why/when it was generated
  • Trustworthy (has clear provenance)
  • Fully observable, versioned, and validated
  • Usable in Studio dashboards, copilot memory, and CI pipelines

โ†’ Traceability is the foundation of governance, automation, and knowledge integrity in the factory.


๐Ÿ“„ Required Traceability Fields

Field Purpose
traceId Ties doc to a specific execution or generation flow
agentId Identifies which agent produced the doc
generatedAt ISO timestamp of generation
generatedBy Agent type or skill responsible for doc creation
promptTemplateId Template or planner used to generate doc
docVersion Version of the documentation or its schema
status Draft, InReview, Approved, Deprecated, etc.
reviewedBy Human reviewer (optional for audit trail)
observabilityTags Tags used in logging/metrics (e.g. docs.module.invoice)

๐Ÿง  Observability Hooks in Documentation

Agents and CI systems emit observability signals such as:

  • DocGenerated โ€“ when a doc is created
  • DocValidated โ€“ when format or links are checked
  • DocFlaggedOutdated โ€“ when last update exceeds freshness policy
  • DocModifiedByHuman โ€“ tracked via Git or Studio editor
  • DocMissingRequiredSection โ€“ emitted by the doc validator
  • DocEmbeddedToMemory โ€“ used in semantic memory indexing

These are used to generate documentation quality dashboards, Studio alerts, and copilot quality scores.


๐Ÿ“Š Observability Fields in Execution Metadata

execution-metadata.json captures structured trace logs:

{
  "traceId": "trace-28bfa0",
  "agentId": "documentation-writer-agent",
  "moduleId": "InvoiceService",
  "docTypesGenerated": ["README", "FeatureSpec", "Changelog"],
  "durationMs": 920,
  "status": "success",
  "qualityScore": 0.93,
  "issues": [],
  "emittedAt": "2025-06-13T16:32:01Z"
}

๐Ÿ“ˆ Studio Integration

  • Studio dashboards use traceId to group related docs
  • Visual diff and timeline views depend on generatedAt, status, and reviewedBy
  • Missing trace metadata triggers warning banners in the Studio UI
  • Quality heatmaps are built from observabilityTags and qualityScore

๐Ÿ› ๏ธ CI Enforcement

The CI pipeline checks:

  • All documentation includes required trace and observability fields
  • Agent ID and status match known platform agents and status enum
  • Prompt template ID (if present) resolves to a known planner/skill
  • traceId exists in execution logs and trace registry

โœ… Summary

Traceability and observability fields transform documentation into a trustworthy, validated, and measurable artifact:

  • Traceable across its origin, lifecycle, and usage
  • Observable across the pipeline and Studio
  • Auditable and quality-assessable via metadata and telemetry

โ†’ Every doc is part of a trace-first, memory-aware, and CI-validated documentation mesh.


๐Ÿ•˜ Versioning, Change Logs, and Audit Trails

๐ŸŽฏ Objective

Define how documentation artifacts are versioned, tracked, and audited โ€” ensuring historical integrity, traceable changes, reproducibility across builds, and alignment with code, prompts, and features over time.


๐Ÿงพ Versioning Strategy

Every documentation artifact is assigned:

Field Description
version Corresponds to the version of the module, feature, or platform release
docVersion Optional field for independently versioning a document structure or content
traceId Unique per generation flow (acts as implicit version ID)
gitCommit If authored/updated manually, includes the corresponding commit hash

Docs may live under versioned folders:

/modules/InvoiceService/v1.0.0/docs/README.md
/modules/InvoiceService/v1.1.0/docs/README.md
/modules/InvoiceService/latest -> v1.1.0

Studio resolves the correct version via version + status: Approved.


๐Ÿ“ Changelog Conventions

Each module must include a changelog.md:

# InvoiceService โ€“ Changelog

## [v1.1.0] - 2025-06-12
- Added retry logic for invoice creation
- Improved error handling (linked to `execution-metadata.json`)
- Feature: `recurring-invoicing`

## [v1.0.0] - 2025-05-10
- Initial release

Generated changelogs include:

  • Features added or modified
  • Related trace IDs and links to prompts
  • Known regressions, manual edits, or deprecations

๐Ÿ“œ Audit Trail Elements

Metadata Field Purpose
createdBy Which agent or human generated the first version
lastModifiedBy Agent or human who last modified the document
reviewedBy Optional human reviewer, linked to change log or Studio action
changeType Generated, Corrected, Reviewed, Refactored, Merged, etc.
sourcePromptId Links to the original prompt that produced the doc (if AI-generated)
previousTraceId Link to an older version that this replaces

๐Ÿ” Regeneration Logic

If a module is regenerated:

  • New traceId is issued
  • Prior trace is marked Deprecated or Outdated
  • correctedFrom metadata links back to the previous doc
  • Changelog automatically notes regeneration in context of feature or blueprint

๐Ÿง  Studio Timeline View

Studio provides:

  • Version diffs per document, per section
  • Timeline of changes with who/what/when
  • Compare between versions or branches
  • Audit log of prompt โ†’ document โ†’ human edits

๐Ÿ”’ CI Enforcement

Pipeline ensures:

  • No Approved document is missing version or traceId
  • Every README.md must be listed in changelog.md
  • Deprecated docs are excluded from active feature graphs
  • Semantic diffs are validated (if configured)

โœ… Summary

Versioning and audit trails turn documentation into a controlled, historical, and explainable artifact:

  • Traced through every change, reviewer, and version
  • Supports reproducibility and root-cause analysis
  • Aligns with clean architecture and release integrity

โ†’ Docs donโ€™t just exist โ€” they have a life cycle, a lineage, and a ledger.


๐Ÿ–จ๏ธ Multi-Output Targets and Formats

๐ŸŽฏ Objective

Define the output formats and rendering targets for documentation artifacts โ€” ensuring compatibility across developers, agents, pipelines, Studio interfaces, and external tools.


๐Ÿ“ฆ Supported Output Formats

Each documentation artifact can be rendered or exported into multiple formats, depending on context and consumer:

Format Purpose / Consumer Rendered By
.md (Markdown) Default authoring format; human-readable source Agents, humans, MkDocs, GitHub
.html Rich Studio preview, exportable documentation MkDocs, Studio Renderer, Docs Viewer Agent
.pdf Offline, printable docs, QA specs, reports PDF Generator Agent or CI export plugin
.json Structured metadata, execution info, memory block Execution agents, memory graphs, plugins
.yaml Configs, IaC, changelogs, schema-driven outputs Infra agents, validators, Studio panels
.feature BDD scenarios; parsed by test runners QA agents, test runners, coverage validators
.mmd, .svg, .plantuml Diagrams-as-code + visual embeds Mermaid/PlantUML renderers in Studio/CI

๐Ÿ“ค Output Targets and Interfaces

Output Target Description
MkDocs Site Canonical, searchable portal for project documentation
ConnectSoft Studio Rich embedded documentation linked to modules and features
VSCode Copilot Inline injected Markdown or metadata fragments
ChatGPT Plugin Queried docs used in assistant-based conversations
GitHub View Source view + preview in GitHub UI
PDF Archive Formal document bundles for review, audit, or compliance
CI/CD Logs Docs included in job outputs, coverage, or diff summaries

๐Ÿ“ฅ Source โ†’ Output Conversion Flow

flowchart TD
    A[Markdown + Metadata] --> B(Memory & Semantic Vector)
    A --> C(MkDocs HTML)
    A --> D(PDF Generator)
    A --> E(Studio Preview Engine)
    A --> F(Copilot Context Snippet)
    A --> G(Chat Plugin Formatter)
Hold "Alt" / "Option" to enable pan & zoom

๐Ÿ› ๏ธ Output Configuration by Doc Type

Doc Type Markdown HTML PDF JSON Studio Memory
README.md โœ… โœ… โœ… ๐Ÿ”ถ โœ… โœ…
FeatureSpec.md โœ… โœ… โœ… ๐Ÿ”ถ โœ… โœ…
changelog.md โœ… โœ… โœ… โœ… โœ… ๐Ÿ”ถ
.feature โœ… โœ… โœ… โœ… โœ… ๐Ÿ”ถ
execution-metadata.json ๐Ÿ”ด ๐Ÿ”ถ ๐Ÿ”ถ โœ… โœ… โœ…

Legend:

  • โœ… = Fully supported
  • ๐Ÿ”ถ = Optional / conditional
  • ๐Ÿ”ด = Not applicable

๐Ÿง  Copilot and Memory Optimization

To support AI copilots, documentation is:

  • Chunked into memory embeddings
  • Converted into structured JSON if needed (context-snippet.json)
  • Indexed by docType, moduleId, and traceId
  • Rendered as summaries or hoverable help inside tools like Studio or VS Code

๐Ÿ“Š Export Examples

  • pdf-bundle/InvoiceService/v1.0.0.pdf
  • docs-site/BookingFeature/index.html
  • memory/chunks/feature-recurring.vector.json
  • copilot/context-snippet-recurring-invoicing.json

These are created automatically by agents or CI processors and attached to releases or visualized in Studio.


โœ… Summary

Supporting multiple formats and output targets enables:

  • Broad accessibility (devs, managers, tools)
  • Rich visualization in Studio and GitHub
  • Machine integration with CI/CD, copilots, and memory systems
  • Offline compatibility via PDF bundles

โ†’ Every documentation artifact becomes multi-surface, multi-format, and multi-intelligence ready.


๐Ÿงฎ Support for Diagrams-as-Code

๐ŸŽฏ Objective

Define the standards and mechanisms for integrating visual documentation as diagrams-as-code, ensuring that all diagrams are:

  • Version-controlled
  • Agent-generable
  • Semantic and reusable
  • Directly linked to features, modules, and traces

๐Ÿ“Š Supported Diagram Formats

Format Description Tools Used
.mmd Mermaid for sequence, flow, state, class diagrams Mermaid.js renderer (Studio, MkDocs)
.plantuml PlantUML syntax for component and architecture views PlantUML server, plugin
.svg Vector-based exported diagrams Embedded in Markdown
.png, .jpg Optional fallback for static renders Generated from .mmd or .svg

โ†’ All source diagrams should be stored as code-first files (.mmd, .plantuml) to support regeneration.


๐Ÿ“ Folder and Naming Convention

Diagrams are stored under:

/modules/BookingService/docs/diagrams/
  service-overview.mmd
  booking-flow-sequence.mmd
  context-map.plantuml
  legacy-flow.svg

Linked from Markdown using:

![Booking Flow](./diagrams/booking-flow-sequence.mmd)

Studio renders .mmd and .plantuml inline and interactively.


๐Ÿง  Diagram Metadata

Each diagram file (or its sidecar .meta.json) includes traceable metadata:

---
diagramId: diag-82bf6a
title: Booking Flow (Sequence)
moduleId: BookingService
traceId: trace-9f83d1
type: sequence
generatedBy: architect-agent
tags: [flow, booking, operations]
memoryEmbedding: false
---

โ†’ Enabling trace-based retrieval, memory linking, and observability triggers.


๐Ÿ› ๏ธ Agent Diagram Injection

Agents like the Architect Agent and DevOps Agent:

  • Generate .mmd or .plantuml using templates

  • Insert diagrams as sections in documentation:

## System Sequence

:::diagram[diag-82bf6a]
  • Emit separate .mmd or .svg files for rendering

Studio supports editing or regenerating diagrams through UI actions.


๐Ÿ” Lifecycle and Diffing

All diagrams:

  • Are version-controlled in Git
  • Include a corresponding trace or feature link
  • Are diffable via semantic renderers (showing nodes/edges/flow changes)
  • Support human override or annotation

โœ… Studio Rendering Features

  • Interactive zoom and pan
  • Node/edge annotations
  • Link nodes to doc sections or code references
  • Tooltip previews for features or modules

๐Ÿ“ˆ Observability Hooks

Agents emit:

  • DiagramGenerated
  • DiagramInvalid (syntax issues)
  • DiagramOutdated (based on trace delta)
  • DiagramLinkedToDeprecatedDoc

These show up in Studio health panels and CI outputs.


โœ… Summary

Diagrams-as-code enable:

  • Fully generable, editable, and traceable visual assets
  • Seamless integration into documentation and Studio
  • CI-validatable visual outputs for feature or system explanation

โ†’ Making visuals first-class citizens of the autonomous documentation lifecycle.


๐Ÿง  Semantic Embedding and Memory Integration

๐ŸŽฏ Objective

Define how documentation is embedded into memory graphs and semantic vector stores, enabling AI agents, copilots, and Studio interfaces to perform contextual reasoning, search, retrieval, and knowledge reuse.


๐Ÿงฌ What Is Semantic Embedding?

Semantic embedding is the process of:

  • Chunking documentation into meaningful segments
  • Encoding them as vectors using embedding models (e.g., OpenAI, Azure OpenAI, HuggingFace)
  • Storing them in memory stores for fast similarity search and AI prompt augmentation

This allows agents to recall relevant documentation fragments at runtime, even across services and features.


๐Ÿ“ฆ Supported Embedding Targets

Target Type Description
README.md Core service overview and usage context
feature-*.md Functional requirements, input/output contracts
execution-metadata.json Trace summary and generation history
agent-notes.md Prompt reasoning, rationale, known constraints
kb-*.md (Knowledge Blocks) Self-contained reusable documentation blocks
Diagrams (converted to text) Titles, labels, flows extracted from diagrams

๐Ÿง  Embedding Metadata

Each document or fragment that is semantically indexed must include:

memoryEmbedding: true
embeddingVectorId: vector-998b21
embeddingSource: doc|diagram|kb
embeddingScope: module|feature|tenant

Studio and memory agents use this to locate and query relevant vectors for:

  • Prompt composition
  • Refactoring suggestions
  • Planning new features
  • Answering user queries

๐Ÿงฉ Embedding Granularity

Documents are automatically chunked into semantically meaningful blocks:

  • Paragraph-level for explanations
  • Section-level for specs or prompts
  • Code snippet-level for examples

Chunks are individually indexed with:

{
  "chunkId": "chunk-f02",
  "sourceDoc": "feature-booking.md",
  "section": "## Inputs and Preconditions",
  "vector": [0.123, -0.228, ...]
}

๐Ÿ” Memory Graph Linking

Embedded documents are cross-linked in the memory graph:

  • By traceId, featureId, agentId, and moduleId
  • With graph edges like inspiredBy, usedIn, derivedFrom
  • Used by planners and copilots for reasoning over context and history

Example:

feature-recurring-invoice.md
  โ†ช usedIn โ†’ recurring-invoice-handler.cs
  โ†ช derivedFrom โ†’ vision-billing-blueprint.md

๐Ÿงช Validation in CI

  • CI checks that memoryEmbedding: true is respected
  • All required sections are semantically chunked
  • Agents log MemoryChunkStored, MemoryEmbeddingFailed, etc.
  • Copilot can suggest missing embeddings or stale vectors

๐Ÿง  Use in Prompt Composition

When an agent is composing a prompt, it queries the memory graph:

"Find all embedded chunks tagged with [billing, retry, monthly-schedule] in modules tagged InvoiceService."

Top-ranked results are injected as memory context into the planner or code generator.


โœ… Summary

Semantic embedding transforms documentation into context-aware, memory-addressable knowledge:

  • Powers AI agent memory, copilots, and Studioโ€™s reasoning layer
  • Enables context-driven prompt construction and plan generation
  • Forms a semantic mesh linking code, docs, and trace

โ†’ Every doc becomes a living memory node in the AI Software Factoryโ€™s brain.


๐Ÿค– Copilot and Plugin Support for Documentation

๐ŸŽฏ Objective

Define how documentation is exposed to and enhanced by AI copilots, IDE plugins, and studio extensions, enabling real-time suggestions, inline explanations, memory injection, and automated authoring/refactoring support.


๐Ÿง‘โ€๐Ÿ’ป Copilot Use Cases

Scenario How Documentation Is Used
Writing code in VS Code Copilot injects related README.md, spec, or diagram context
Reviewing a PR Displays linked feature doc, test cases, and execution metadata
Writing a new feature spec Suggests reusable knowledge blocks or past similar features
Editing documentation Offers section templates, glossary terms, and formatting fixes
Answering questions via ChatGPT Plugin Accesses structured documentation using traceId and docType

๐Ÿงฉ Plugin-Accessible Documentation APIs

Documentation is exposed through the following plugin APIs:

Plugin Interface Description
getDocByTrace(traceId) Returns the latest doc associated with a trace
searchDocs(tags, docType) Finds docs with specific semantic tags
getModuleDocs(moduleId) Fetches all docs (README, changelog, specs) for a module
injectContext(docId, section) Inserts a markdown fragment into editor/prompt
getGlossaryTerm(term) Retrieves explanation from generated glossaries

๐Ÿง  Context Injection Logic

Copilots use retrieval heuristics from memory + metadata:

  1. Match moduleId, featureId, traceId based on current file
  2. Query vector store with current cursor context
  3. Rank relevant chunks from README.md, feature.md, execution-metadata.json
  4. Inject top-k context chunks inline or as hover tooltips
{
  "injectedFrom": "feature-payment-retry.md",
  "section": "## Retry Logic",
  "confidence": 0.91
}

๐Ÿ› ๏ธ Supported Tools and Extensions

Environment Plugin/Extension
VS Code connectsoft-copilot-docs extension
Studio Copilot sidebar + hover memory injectors
ChatGPT Plugin integration with memory search API
GitHub PR copilot plugin showing related docs
CLI cs-docs get --trace trace-xyz

๐Ÿ” Access Control and Filtering

  • Copilots only access status: Approved or InReview docs
  • Deprecated or stale documents are excluded unless explicitly queried
  • Plugin context includes user role to tailor suggestions

โœจ Inline Smart Features

Copilot plugins can:

  • Auto-suggest documentation sections based on file type
  • Detect and flag missing diagrams or spec links
  • Recommend glossary entries when writing docs
  • Offer AI-based grammar and structure corrections

"It looks like you're documenting a microservice. Do you want to insert a ## Trace Metadata block?"


๐Ÿง  Memory Feedback Loop

Changes made via plugin interfaces trigger:

  • DocAccessedByCopilot โ†’ updates popularity/usage signals
  • DocSuggestedRefactor โ†’ logged for validation agent review
  • DocUsedInPrompt โ†’ links prompt trace to documentation node

โœ… Summary

Copilot and plugin integration turns documentation into an active, intelligent, and interactive experience:

  • Enhances developer productivity with just-in-time context
  • Brings documentation into the code and planning flow
  • Enables AI-aware tooling across the Factoryโ€™s ecosystem

โ†’ Every doc becomes an assistant-enabled, plugin-resolved knowledge asset.


๐Ÿ“„ Documentation Snippets, Templates, and Auto-Expansion

๐ŸŽฏ Objective

Define how reusable documentation snippets and section templates can be auto-injected or expanded by agents, copilots, or CI โ€” enabling composable docs, reducing repetition, and accelerating structured authoring.


๐Ÿงฉ What Is a Documentation Snippet?

A snippet is a reusable, parameterized block of markdown or metadata that can be:

  • Injected into documents during generation
  • Suggested by copilots as structured sections
  • Automatically filled with trace-linked or prompt-generated content

Each snippet includes:

snippetId: doc-snippet-0012
title: Retry Policy Section
tags: [resiliency, policy, microservice]
parameters: [maxRetries, backoffStrategy]
scope: module
## Retry Policy

This service supports a retry mechanism with the following configuration:

- Max retries: {{maxRetries}}
- Backoff strategy: {{backoffStrategy}}

Retries apply to transient failures such as timeouts or 5xx errors.

๐Ÿงฑ Snippet Libraries

Documentation snippets are stored in:

/templates/docs/snippets/
  trace-metadata.md
  retry-policy.md
  inputs-outputs.md
  prompt-rationale.md

Snippets are indexed and tagged to support smart injection and semantic retrieval.


๐Ÿ”„ Auto-Expansion by Agents

Agents may auto-expand snippet references such as:

{{inject:trace-metadata}}

or

:::snippet[retry-policy] { maxRetries=3, backoffStrategy="exponential" }

Resulting in a fully expanded, formatted markdown section during generation.


๐Ÿง  Copilot-Assisted Suggestions

Copilots can suggest:

  • Snippet templates for missing sections (e.g., ## Inputs and Preconditions)
  • Parameter completion based on memory context
  • Inline expansion previews for human confirmation

โ€œWould you like to auto-fill the ## Related Artifacts section using trace links?โ€


๐Ÿ› ๏ธ Snippet Governance Rules

Rule Description
Traceable Each injected snippet logs its snippetId, origin, and parameters
Overridable Human edits are respected; expansion is one-time unless re-triggered
Diff-aware CI and Studio track differences between template and injected content
Memory-linkable Snippet chunks are eligible for memory embedding and vector search

๐Ÿ“œ Template Types vs. Snippets

Item Description Use Case
Template Full document scaffold (e.g., README.md) Initial document creation
Snippet Partial reusable block (e.g., retry-policy) Section-level injection or reuse

Both use shared syntax, tagging, and trace metadata.


๐Ÿ“ˆ CI Integration

CI validates:

  • Snippet expansion completeness
  • Parameter correctness
  • Version drift detection (e.g., snippet-v2 used when snippet-v3 exists)
  • Missing required snippets (e.g., trace-metadata block in all generated docs)

โœ… Summary

Documentation snippets and template expansion:

  • Promote structured, high-quality, and consistent documentation
  • Enable partial reuse across modules, agents, and teams
  • Reduce human effort while increasing completeness and traceability

โ†’ Documentation becomes modular, composable, and automation-friendly at every level.


๐Ÿ“Š Documentation Quality Metrics and Observability Hooks

๐ŸŽฏ Objective

Define how the Factory evaluates documentation quality, freshness, and coverage through observability metrics and hooks โ€” enabling automated feedback loops, stale detection, and AI-assisted improvement.


๐Ÿ“ˆ Quality Signals

Each documentation artifact is scored using multiple signal dimensions:

Metric Description
structureCompleteness All required sections and metadata present
traceCoverageScore How well it links to traceId, features, and modules
lastModifiedAgeDays Days since last update (used to flag staleness)
agentConfidenceScore Agent's self-assessed output confidence (e.g., via LLM scoring heuristics)
humanReviewed Boolean flag for whether it was reviewed and approved
copilotUsageFrequency Number of times this doc was accessed by plugins or copilots
similarityToPeerDocs Embedding-based consistency score vs. similar modules

These are visualized in Studio and available via CI annotations.


๐Ÿงช Example Quality Summary

{
  "docId": "feature-recurring-invoice.md",
  "structureCompleteness": 0.95,
  "traceCoverageScore": 1.0,
  "lastModifiedAgeDays": 43,
  "agentConfidenceScore": 0.87,
  "humanReviewed": true,
  "copilotUsageFrequency": 17,
  "qualityGrade": "B+"
}

๐Ÿ› ๏ธ Observability Events and Hooks

Agents and pipelines emit:

Event Purpose
DocGenerated When a new doc is created
DocValidated Structural checks pass/fail
DocFlaggedOutdated Detected staleness threshold breached
DocAutoSuggestedUpdate AI detects terminology drift or trace delta
DocUsedInPrompt Memory chunk included in prompt context
DocUsedByCopilot Fetched by plugin for suggestion or context
DocModifiedByHuman Changed via Studio editor or Git commit

These are ingested into observability dashboards.


๐Ÿ“‰ Quality Risk Levels

Grade Meaning Action Recommended
A / A+ Fully aligned and up-to-date No action
B / B+ Minor issues or aging Review or refresh if possible
C Missing metadata or links Agent or human correction needed
D / F Obsolete, unlinked, or outdated Flag for deprecation or regen

๐Ÿ” CI Checks and Thresholds

CI/CD pipelines enforce quality gates:

  • Block promotion if qualityGrade < B
  • Warn for documents older than X days with no human review
  • Require at least structureCompleteness > 0.8
  • Annotate PRs with document quality diffs

๐Ÿง  Studio Visualizations

  • Color-coded heatmap per module or doc
  • Timeline of quality score trends
  • Suggested next actions (e.g., โ€œUpdate trace linksโ€)
  • Audit history of quality changes and event logs

โœ… Summary

Documentation quality signals and observability hooks:

  • Turn static docs into measurable, improvable assets
  • Enable proactive agent feedback and human governance
  • Power dashboards, validation gates, and copilot confidence

โ†’ Every doc is scored, tracked, and continuously improved in the software factoryโ€™s knowledge system.


๐Ÿงพ Final Blueprint Snapshot and Trace Injection Summary

๐ŸŽฏ Objective

Conclude the documentation blueprint by summarizing:

  • What artifacts were generated
  • What trace metadata was injected
  • Where this blueprint lives within the memory and module graph
  • How it is used by agents and humans going forward

๐Ÿงฑ Blueprint Summary Structure

Each blueprint concludes with a structured blueprint-summary.md block or json/yaml equivalent:

blueprintId: documentation-blueprint
docType: Blueprint
version: v1.0.0
status: Approved
traceId: trace-docs-421ba3
generatedBy: documentation-writer-agent
linkedModules: [core/DocumentationWriterAgent, plugins/CopilotDocs]
createdAt: 2025-06-13T15:42:00Z
tags: [blueprint, documentation, agent-process]
embedding: true

๐Ÿ“ฆ Artifacts This Blueprint Covers

Category Description
๐Ÿ“˜ Blueprint Itself documentation-blueprint.md
๐Ÿ“„ Metadata Template YAML frontmatter spec + example blocks
๐Ÿงฑ Templates README.md, FeatureSpec.md, execution-metadata.json, etc.
๐Ÿงฉ Snippets trace-metadata, retry-policy, inputs-outputs, etc.
๐Ÿ–ผ๏ธ Diagram Patterns .mmd, .plantuml templates with injection hooks
๐Ÿง  Embedding Logic Memory chunk schema, indexing policies, and trace-linked memory anchors
๐Ÿ” CI Hooks DocGenerated, DocValidated, DocFlaggedOutdated, etc.
๐Ÿ“Š Observability Quality scores, usage telemetry, plugin access frequency metrics

๐Ÿง  Memory and Trace Injection

The blueprint injects itself into the platform memory graph as:

  • A canonical doc type definition for agent awareness
  • A schema registry entry for Studio validation
  • A copilot hint layer for doc suggestion templates

Trace injection emits:

{
  "traceId": "trace-docs-421ba3",
  "emittedBy": "documentation-writer-agent",
  "linkedDocs": ["documentation-blueprint.md", "snippet-trace-metadata.md"],
  "status": "Approved",
  "qualityScore": 0.98
}

This is stored in:

  • trace-registry.json
  • memory/chunks/blueprints/documentation-blueprint.vector.json

๐Ÿงฉ Reuse in Other Agents

Agents use this blueprint as input when:

Agent How Blueprint Is Used
Documentation Writer Agent Core schema for generating, validating, and chunking docs
Copilot Context Agent Resolves templates and snippets for inline support
Test Generator Agent Parses .feature trace blocks and links to memory graphs
Blueprint Validator Agent Scores structure, freshness, linkage, and snippet coverage

๐Ÿ“œ Version and Evolution Plan

  • v1.0.0: Initial release (25 cycles completed)
  • Future: v1.1.0 may include real-time collaborative editing, diagram diffing, glossary injection

Studio will detect version drifts, prompt upgrades, and render visual deltas.


โœ… Summary

The documentation-blueprint.md is now a complete, traceable, and operational blueprint that:

  • Powers autonomous doc generation, validation, and memory embedding
  • Links every documentation artifact to modules, agents, and features
  • Drives copilot suggestions, Studio visualization, and quality metrics

โ†’ Documentation is no longer static โ€” it is modular, semantic, and alive inside the software factory.