🧬 DSL Knowledge Index¶
Purpose and Scope¶
🎯 What Is a DSL in ConnectSoft?¶
In the context of the ConnectSoft AI Software Factory, a Domain-Specific Language (DSL) is a structured, declarative representation that defines:
- The expected format, constraints, and relationships of generated artifacts
- The intent behind blueprints, spans, test cases, telemetry, UI components, etc.
-
A language-level contract used by agents to:
-
Generate reusable code
- Validate output
- Drive prompt injection
- Enforce consistency across domains and tenants
📚 Examples of DSLs¶
| DSL Name | Domain | Purpose |
|---|---|---|
dsl-actor-handler |
Backend | Defines a message-based actor that processes a command and emits a response |
dsl-feature-flow |
Orchestration | Describes the flow of steps for a specific business scenario |
dsl-telemetry-span |
Observability | Defines telemetry span structure for tracing a user or system action |
dsl-ai-skill-call |
AI Kernel | Declares inputs and outputs of a skill or planner action |
dsl-ui-form-section |
Frontend | Declaratively specifies UI input fields, validation, and layout |
dsl-specflow-scenario |
Testing | Represents a BDD scenario outline for use in SpecFlow or Gherkin |
🎯 Purpose of the DSL Knowledge Index¶
The DSL Knowledge Index is a first-class knowledge document that:
- 📦 Stores all DSL definitions, metadata, tags, and versions
- 📚 Enables semantic search and similarity-based retrieval
- 🔗 Powers prompt enrichment by injecting DSL examples and schemas
- 🧠 Drives agent decision-making based on DSL availability and compatibility
- 🔄 Supports regeneration, validation, and evolution of code artifacts
- 🤝 Enables multi-agent coordination through shared DSLs
🌐 Scope of This Document¶
This documentation defines:
- The structure of the DSL registry (index, graph nodes, vector memory)
- How DSLs are linked to generated assets
- How DSLs influence prompt construction and validation
- Which agents use DSLs and how
- How DSLs evolve across versions, forks, and tenants
- How DSL coverage, reuse, and quality are measured
It is not a DSL specification guide (that’s per DSL). Instead, this document defines the knowledge and infrastructure around DSLs.
🔖 Tags and Indexes Used¶
Each DSL entry will contain tags like:
domain:backend,layer:frontend,purpose:test,tenant:sharedconfidence: 0.93,sourceAgent: DSLDesignerAgent,usedIn: prompt-blueprint-login
This supports advanced queries like:
Or vector lookups like:
✅ Summary¶
The DSL Knowledge Index:
- Serves as a centralized, evolving, multi-agent registry of semantic DSL definitions
- Powers prompt injection, artifact validation, and reuse strategies
- Bridges template generation, code output, trace validation, and feedback loops
🧱 DSL Types and Domains¶
🧬 Why Categorize DSLs?¶
The ConnectSoft AI Software Factory must support thousands of DSL definitions across varying:
- Engineering layers (frontend, backend, observability, test, data)
- Functional domains (identity, messaging, payments, reporting)
- Artifact targets (models, events, UI, tests, spans, skills)
- Agent workflows (blueprint generation, prompt planning, validation)
To support discoverability, prompt injection, and smart reuse, each DSL is categorized by type and domain.
📂 DSL Type Taxonomy¶
| Type | Description | Typical Output |
|---|---|---|
| Blueprint DSL | Logical feature model or service spec | Classes, handlers, commands |
| Model DSL | Entities, aggregates, DTOs, records | NHibernate or EF models |
| UI DSL | Screens, form sections, UX flows | Blazor/Angular components |
| API DSL | Request/response pairs, endpoint definitions | REST or gRPC controllers |
| Event DSL | Domain events, integration events | Message classes |
| Span DSL | Observability/tracing structure | OpenTelemetry span spec |
| Test DSL | Scenarios, conditions, assertions | SpecFlow, BDD, MSTest |
| AI Skill DSL | Semantic Kernel skill definitions | Planner-friendly skill structure |
| Prompt DSL | Parameterized prompt + schema | Reusable prompt patterns |
| Validation DSL | Input validation and business rules | FluentValidation or JSON Schema |
| Infrastructure DSL | Health checks, queues, configs | Bicep/YAML/Infra-as-Code templates |
🌍 DSL Domain Examples¶
Each DSL also belongs to a functional domain, allowing:
- Tenant/domain-scoped reuse
- Agent filtering during generation
- Semantic trace linking
| Domain | Example DSLs |
|---|---|
authentication |
dsl-login-handler, dsl-auth-span, dsl-session-model |
user-management |
dsl-user-profile, dsl-invite-user, dsl-deactivate-flow |
messaging |
dsl-sms-event, dsl-email-template, dsl-retry-policy |
notifications |
dsl-notify-user, dsl-alert-type, dsl-push-channel |
reporting |
dsl-report-query, dsl-export-csv, dsl-scheduled-task |
ai-agents |
dsl-skill-call, dsl-agent-flow, dsl-memory-embedding |
DSLs can be reused across domains with explicit tags (
shared,tenant-specific,agent-internal).
🔖 Recommended Tagging Convention¶
id: dsl-user-registration-flow
type: blueprint
domain: authentication
tags:
- layer:backend
- tenant:shared
- usedIn: prompt-blueprint-user-registration
- confidence: 0.91
📌 Key Takeaways¶
- DSLs are not flat — they are typed, scoped, and linked
- This categorization powers:
- 🔍 Better search and indexing
- 🤖 Agent compatibility and filtering
- 🔄 Prompt reuse and alignment
- 🧠 Semantic similarity retrieval
- DSLs span the full stack — from telemetry to UI, events to validation
🧾 DSL Structure & Metadata Model¶
🧱 What Is a DSL Structurally?¶
Each DSL entry in the ConnectSoft Knowledge Graph is stored as a versioned semantic unit in YAML or JSON format. It includes:
- A schema definition for generated artifacts
- Metadata for indexing, discovery, and memory
- Optionally, examples, injections, and validation rules
DSLs are not just definitions — they are knowledge-first building blocks.
📦 DSL Knowledge Unit Schema¶
id: dsl-user-handler
version: v1.2.0
type: blueprint
domain: user-management
layer: backend
description: >
Declares a message-based command handler for user operations.
Emits a response DTO and triggers a domain event.
fields:
commandName: string
responseType: string
emitsEvent: bool
retryPolicy: enum[None, Linear, Exponential]
tags:
- tenant:shared
- usedIn: prompt-blueprint-user-registration
- status: active
- createdBy: DSLDesignerAgent
confidence: 0.93
examples:
- commandName: InviteUserCommand
responseType: InviteUserResponse
emitsEvent: true
retryPolicy: Exponential
validationRules:
- rule: "commandName must end with 'Command'"
severity: error
appliesTo: commandName
storage:
location: blob://dsls/dsl-user-handler-v1.2.0.yaml
embedded: true
embedding:
vectorId: vec-dsl-user-handler-v1.2
tags: [blueprint, backend, handler]
🧠 Metadata Breakdown¶
| Field | Description |
|---|---|
id |
Unique identifier for the DSL |
type |
What kind of artifact the DSL defines |
domain |
Functional context (e.g., messaging, auth) |
layer |
Architecture layer (frontend, backend, test) |
version |
SemVer-style version string |
tags |
Semantic tags for indexing and filtering |
confidence |
Quality score based on feedback and reuse |
examples |
Canonical or tenant-specific samples |
validationRules |
Optional static checks |
storage |
Where the DSL file resides |
embedding |
Vector representation metadata |
🔐 Reserved Tags¶
To support factory-level consistency:
| Tag | Purpose |
|---|---|
tenant:shared |
Global DSL available to all tenants |
status:deprecated |
Obsolete and should not be used in new generation |
createdBy:AgentX |
Attribution to source agent |
linkedTo:template-user-registration |
Usage traceability |
💡 Embedding DSLs¶
Each DSL is also embedded into a vector store (e.g., Azure Cognitive Search or Qdrant) using the DSL body and description.
This enables:
- Prompt injection via similarity search
- Agent lookup: “Find DSLs like this”
- Drift detection based on structure changes
🧬 DSL Example: UI Form Section¶
id: dsl-ui-form-section
type: ui
domain: user-profile
layer: frontend
fields:
label: string
fieldName: string
inputType: enum[text, email, phone, date]
required: bool
placeholder: string
hint: string
Used in Blazor form generators and prompt UI design flows.
✅ Summary¶
Each DSL knowledge unit is:
- 📦 Structured as a YAML/JSON schema with metadata
- 🔗 Linked to tags, vectors, and generation usage
- 🧠 Fully embeddable for memory and prompt injection
- 🧪 Validatable with optional static rules
🔄 Lifecycle of a DSL¶
📘 Why Define a DSL Lifecycle?¶
DSLs in the ConnectSoft AI Software Factory are not static files — they are living semantic contracts. A clear lifecycle ensures:
- Controlled introduction of new DSLs
- Safe evolution and deprecation
- Versioning across agents, tenants, and generations
- Visibility into which versions are active, stable, or outdated
A broken DSL breaks everything that uses it: prompts, templates, outputs, validation, and feedback.
🧬 DSL Lifecycle States¶
| State | Description | Who Can Transition |
|---|---|---|
| Draft | New DSL under design, not used in generation | DSLDesignerAgent, human |
| Active | DSL approved and ready for generation | ValidatorAgent, DSLCurator |
| Stable | Used in validated traces and production; locked for changes | CoordinatorAgent, Governance layer |
| Deprecated | Marked for removal; replaced by successor DSL | DSLJanitorAgent, DSLCurator |
| Archived | Read-only, no longer usable or referenced | ArchiverAgent, Admins only |
🔁 Lifecycle Transition Rules¶
flowchart TD
D[Draft] --> A[Active]
A --> S[Stable]
A --> Dep[Deprecated]
S --> Dep
Dep --> Arc[Archived]
D --> Dep
Transitions require agent approval or confidence thresholds.
📦 DSL Evolution Patterns¶
| Pattern | Use Case | Result |
|---|---|---|
| Minor version update | Add optional field | v1.2.0 → v1.3.0 |
| Major version update | Breaking change to structure | v1 → v2 fork |
| Fork for tenant | Customization by tenant | dsl-login-handler → dsl-login-handler-petclinic |
| Composition | Merge multiple DSLs | dsl-feature → dsl-feature + dsl-metrics |
| Extension | Add fields via inheritance | DSL uses extends tag or schema |
🔖 Metadata for Lifecycle Tracking¶
status: stable
version: v1.2.0
replaces: dsl-user-handler-v1.1.0
replacedBy: null
createdOn: 2025-04-30
lastUsedInTrace: trace-id-872
validatedBy: TestAgent, BlueprintAgent
Each lifecycle action is auditable via the graph changelog and DSL index logs.
🤖 Agent Roles in DSL Lifecycle¶
| Agent | Role |
|---|---|
DSLDesignerAgent |
Proposes and defines new DSL |
ValidatorAgent |
Runs conformance checks before activation |
FeedbackAgent |
Collects votes and trace impact to evaluate readiness |
CoordinatorAgent |
Marks DSL as stable when used successfully |
DSLJanitorAgent |
Identifies unused or obsolete DSLs for deprecation |
GovernanceOrchestrator |
Enforces policies on DSL ownership and lifecycle state |
✅ Summary¶
DSL lifecycle is structured and controlled:
- Prevents regressions and unsafe generation
- Encourages stability before widespread reuse
- Enables scoped customization by tenant/project
- Links generation, usage, and memory with traceability
🧾 Versioning and Forking Rules¶
🎯 Why Version and Fork DSLs?¶
In a large-scale AI Software Factory, DSLs evolve due to:
- New requirements
- Breaking schema changes
- Tenant-specific customizations
- Feature specialization
- Technology stack variations
To preserve trace integrity, reproducibility, and compatibility, we enforce clear rules for versioning and forking.
🔢 Semantic Versioning for DSLs¶
DSLs follow a SemVer-like scheme:
| Version Part | Meaning | Rules |
|---|---|---|
MAJOR |
Incompatible schema change | Requires deprecation or fork of prior version |
MINOR |
Backward-compatible enhancement | Existing traces remain valid |
PATCH |
Metadata or tag fix | No structural change; reindex only |
DSLs with the same major version are assumed structurally compatible.
🔁 Example¶
v1.2.0: adds retry policy (optional field)v2.0.0: changes field name fromcommandNametoactionName→ breaking
🌱 Forking DSLs¶
A fork is a derived DSL with intentional schema divergence for a:
- Tenant (
petclinic,ecomx,financeplus) - Project (
connectsoft-gateway) - Architecture variation (e.g., actor-based vs HTTP-based)
Forks are linked via the forkedFrom and forks graph edge:
id: dsl-login-handler-petclinic
forkedFrom: dsl-login-handler
tenant: petclinic
changes:
- renamed field `userId` → `vetId`
- added field `clinicContextId`
Forks are treated as distinct nodes in the knowledge graph.
🧠 Versioning Rules Summary¶
| Action | Allowed? | Result |
|---|---|---|
| Change required field → optional | ✅ MINOR version bump | |
| Add new optional field | ✅ MINOR | |
| Rename existing field | ❌ Must create a new MAJOR version or fork | |
| Remove field | ❌ Fork or MAJOR required | |
| Metadata/tag update only | ✅ PATCH | |
| Schema override by tenant | ✅ Fork required |
🔄 Graph Edges for Version and Fork Lineage¶
| Edge | Purpose |
|---|---|
replaces → |
Shows upgrade path between versions |
forkedFrom → |
Links derived DSL to original |
extends → |
Reuse + override base DSL structure |
linkedTo → |
Shows usage in prompts/templates/tests |
All versioning and forking history is queryable and visualizable.
📊 Version Coverage and Usage Metrics¶
Track:
- Most used version per DSL
- Fork divergence metrics
- Obsolete DSLs used in old traces
- Number of tenants sharing same DSL major version
- Confidence trends per version
🛠️ Automation Support¶
- Agents automatically detect incompatible changes and suggest forks
- Coordinators trigger regeneration if DSL version becomes invalid
- Prompts adapt DSL version via vector matching or upgrade rules
✅ Summary¶
Versioning and forking are core to safe DSL evolution:
- MAJOR = break, MINOR = add, PATCH = fix
- Forks isolate tenant-specific logic
- Traceability ensures reproducibility and recovery
- Agents collaborate via lineage metadata
🌐 DSL in the Knowledge Graph¶
🧠 Why Model DSLs in the Graph?¶
DSLs aren’t just isolated definitions — they’re semantic knowledge entities that participate in:
- Prompt planning
- Multi-agent collaboration
- Memory embedding
- Trace completeness scoring
- Template and test generation
Representing them in the Knowledge Graph allows:
- 🔗 Linkage to outputs, prompts, tests, and telemetry
- 🧠 Similarity-based lookup using vector embeddings
- 🧬 Structural introspection (fields, versions, examples)
- 🔄 Automated lifecycle tracking
🔗 Graph Node Structure for DSL¶
Each DSL becomes a typed node in the Knowledge Graph:
type: DSL
id: dsl-user-handler-v1.2.0
title: User Handler DSL (v1.2.0)
layer: backend
domain: user-management
embeddingId: vec-dsl-user-handler-v1.2
confidence: 0.91
linkedArtifacts:
- template-user-handler
- span-user.handler.invoked
- test-user-handler.feature
createdBy: DSLDesignerAgent
forkedFrom: dsl-user-handler-v1.0.0
tags: [blueprint, handler, shared]
🔁 Example DSL Graph Edges¶
graph LR
DSL1[dsl-user-handler-v1.2.0]
T1[template-user-handler]
P1[prompt-blueprint-user-handler]
S1[span-user.handler.invoked]
TEST1[test-user-handler.feature]
DSL1 -->|usedBy| T1
DSL1 -->|usedIn| P1
DSL1 -->|spans| S1
DSL1 -->|validates| TEST1
🧬 Graph Relations¶
| Relation | Meaning |
|---|---|
usedBy → template |
Template generation driven by this DSL |
usedIn → prompt |
Prompt planning enriched by this DSL |
defines → span/event |
DSL formalizes a trace/telemetry shape |
validatedBy → test |
Test references fields in this DSL |
forkedFrom → DSL |
Fork lineage |
replaces → DSL |
Version lineage |
extends → DSL |
Inheritance across DSLs |
🔍 Example Query Use Cases¶
- “Find all DSLs used in authentication flows”
- “List prompts linked to deprecated DSLs”
- “Which templates are still using v1.x of dsl-user-handler?”
- “Show all DSLs related to user-invite span traces”
- “Trace → what DSLs, templates, and tests it depends on”
📊 Graph Enrichment Over Time¶
As DSLs are used:
- New nodes and edges are added (
usedIn,linkedTo,forkedFrom) - Confidence scores increase or decay
- Agents query DSLs based on vector proximity, not hard IDs
- DSLs become routing surfaces for prompt orchestration and trace validation
🧠 Memory and Embeddings¶
Each DSL node also has:
| Field | Purpose |
|---|---|
embeddingId |
Reference to vector index entry |
vectorTags |
Domain, layer, purpose, tenant |
embeddingSource |
DSL schema + examples + description |
Agents can do queries like:
And get a graph-matched DSL ready for prompt or code injection.
✅ Summary¶
Modeling DSLs in the graph gives:
- First-class traceability and observability
- Smart agent planning based on actual usage
- Rich query, fork, and impact tracking
- Embedding-powered similarity for prompt adaptation
🗂️ Indexing Strategy¶
🎯 Why Index DSLs?¶
DSLs must be:
- 🔍 Searchable by agents (semantic, metadata, usage context)
- ⚡️ Fast to retrieve for prompt injection
- 🧠 Embeddable into memory systems (vector search, hybrid search)
- 📈 Filterable by tags, layers, versions, tenants, and confidence levels
The DSL index is a high-performance semantic registry — not just a flat list.
🗂️ Types of Indexes¶
| Index Type | Purpose |
|---|---|
| Tag Index | Fast filtering by metadata (type, domain, layer) |
| Vector Index | Similarity-based DSL retrieval using semantic embedding |
| Text Index | Full-text search on DSL description, examples, field names |
| Tenant/Project Index | Partitioned retrieval scoped to tenant, workspace, or project |
| Usage Index | Links DSLs to artifacts like prompts, templates, spans |
| Confidence Index | Score-based prioritization and decay tracking |
| Lifecycle Index | Status-based filtering (draft, active, deprecated) |
| Change Index | Diff- and version-aware change history |
| Agent Compatibility Index | DSLs usable by given agent role/type |
| Injection Suitability Index | Determines DSL’s usability for prompt injection |
| Span-Linked Index | Shows DSLs defining telemetry shapes |
| Fork Lineage Index | Cross-version and cross-tenant lineage browsing |
🏷️ Example Tag-Based Index Fields¶
- id: dsl-notify-user-v1.1.0
tags:
type: event
domain: notifications
layer: backend
confidence: 0.94
status: active
tenant: shared
usedIn: prompt-user-invite
linkedTo: span.notify_user.sent
createdBy: DSLDesignerAgent
📦 Vector Embedding Strategy¶
- Source:
description,fields,examples,domain,prompt usage - Stored in: Azure AI Search, Qdrant, or Pinecone
- Retrieval:
topK,threshold,semantic match + tag filter
Example:
🔍 Search Examples¶
| Query | Result |
|---|---|
tag:frontend AND domain:user-profile |
All UI DSLs for user profile forms |
similarTo: span-user.login → type:test |
DSLs defining test flows for login span |
usedIn: prompt-notify-user |
DSLs linked to notification prompt |
confidence < 0.6 AND status:active |
Weak DSLs needing review |
forkedFrom: dsl-auth-handler |
All forks of the auth DSL |
extends: dsl-feature-base |
Inherited DSLs for features |
🤖 Agent Retrieval APIs¶
Agents will use DSLIndex.GetDSL(criteria) or DSLIndex.QueryByVector(text).
Retrieval Modes:¶
GetById("dsl-user-handler-v1.2.0")SearchByTags({ type: "test", domain: "auth" })FindSimilar("retryable backend command DSL")
📊 Confidence-Weighted Ranking¶
When retrieving DSLs:
- DSLs with high confidence are ranked higher
- Confidence affected by:
- Feedback votes
- Successful trace completions
- Prompt outcome quality
- Failed generations or missing spans
✅ Summary¶
The DSL indexing system supports:
- 🔍 Fast, tag-based filtering
- 🧠 Semantic similarity via embeddings
- 🤖 Agent-friendly APIs for prompt planning
- 🔄 Dynamic ranking based on usage and feedback
- 🧬 Multi-dimensional cross-indexing (domain, layer, lifecycle, tenant)
🔗 Linking DSLs to Templates and Prompts¶
🤖 Why Link DSLs to Prompts and Templates?¶
DSLs are not passive metadata — they are active drivers of:
- 🔧 Code template configuration
- 📤 Prompt-based artifact generation
- ✅ Output validation and trace alignment
- 🔄 Cross-agent planning (between DSL designers, blueprint builders, test agents)
A prompt without DSL is generic. A prompt enriched by a DSL is domain-aware, testable, and reusable.
🔗 Link Types in Knowledge Graph¶
| From | Relation | To | Purpose |
|---|---|---|---|
DSL |
usedIn |
Prompt |
Injects structure into generation |
DSL |
linkedTo |
Template |
Guides template selection and validation |
DSL |
defines |
Span/Test/Model |
Drives expected structure |
Prompt |
requiresDSL |
DSL |
Prompt dependency declared explicitly |
Agent |
usesDSL |
DSL |
Agent relies on the DSL at runtime |
📥 Prompt DSL Injection Example¶
Prompt Template:
promptId: blueprint-user-handler
requiresDSL: dsl-user-handler
template:
"Generate a command handler using the following structure:
{{dsl-user-handler | inject: fields, examples}}"
Result:
- Prompt is dynamically updated with DSL content
- Agent receives schema + examples for generation
- Prompt adapts per tenant/fork/version
🧩 Template-Derived Generation Example¶
Template: template-user-handler.cs
Linked DSL: dsl-user-handler
Usage:
- DSL fields → code snippets
- DSL retry policy → Polly retry block
- DSL emitsEvent → auto-generate domain event class
- DSL used to validate generated class shape during test
🧠 Prompt Construction from DSL¶
Some prompts are generated on the fly from DSL using prompt blueprints:
dsl: dsl-telemetry-span
promptBlueprint:
"You are designing a telemetry span for {{dsl.domain}}. The operation name should be: {{dsl.spanName}}.
Include the following tags: {{dsl.tags}}.
Ensure the span duration logic follows: {{dsl.durationLogic}}."
This allows agents like PromptPlannerAgent to generate DSL-aware prompt candidates automatically.
🔍 Query Examples¶
| Use Case | Query |
|---|---|
| Prompts using deprecated DSLs | prompt.usedIn → DSL[status=deprecated] |
| Templates using outdated DSL versions | template.linkedTo → DSL[version < v2.0.0] |
| All prompts powered by UI DSLs | prompt.requiresDSL → DSL[type=ui] |
| DSLs used in prompt injection but never in template validation | Cross-link inconsistency |
✅ Summary¶
DSLs power prompt and template generation:
- 💬 Prompts are semantically enriched with DSL content
- 🧱 Templates are scaffolded using DSL-defined structure
- 🔄 Graph tracks all
usedIn,linkedTo,defines, andrequiredByrelations - 🧠 Agent prompts adapt based on DSL context (tenant, version, fork)
- 📊 DSL usage across prompts and templates drives traceability and refactor planning
🔍 Search and Retrieval Patterns¶
🔎 Why Searchable DSLs Matter¶
Agents must dynamically discover DSLs in order to:
- Plan prompts with the most suitable DSLs
- Reuse previously successful blueprints and examples
- Avoid broken or deprecated versions
- Match tenant-specific needs (e.g., forks, extensions)
- Automatically validate trace completeness against DSL definitions
The system provides multi-modal search capabilities:
- Textual
- Tag-based
- Vector semantic similarity
- Graph-traversal queries
🛠️ Search Modes Supported¶
| Search Mode | Purpose | Example |
|---|---|---|
| Text search | Search DSL titles, descriptions, and examples | "login handler" |
| Tag search | Filter by metadata tags | type: blueprint AND domain: auth |
| Vector similarity | Retrieve DSLs close to a textual concept | "retryable async span for email" |
| Graph queries | DSLs connected to certain prompts, spans, or tests | usedIn → prompt-login-user |
| Field match | DSLs with specific field structures or types | fields[*].inputType = phone |
🧠 Agent-Level Retrieval API¶
Agents access DSLs using the DSLSearchService with layered query strategies:
var dsl = dslSearchService.FindBestMatch(new DSLSearchQuery {
SemanticHint = "form to collect user's birthdate",
RequiredTags = ["type: ui", "domain: user-profile"],
MinConfidence = 0.85,
MustBeActive = true
});
This returns DSL definitions injected into the prompt planner or generation step.
📦 Result Scoring and Ranking¶
- Confidence-based prioritization
- Reuse-based weighting (seen in successful traces)
- Agent compatibility (linked to same agent family)
- Tenant specificity (e.g., prefer fork for
petclinic) - Semantic closeness (via embedding cosine similarity)
📘 Example: Semantic Retrieval Workflow¶
PromptPlannerAgent → wants to generate a UI form
DSLSearchQuery:
- "Form section for user contact info"
- Type: ui
- Domain: user-profile
→ Result: dsl-ui-form-section-v1.3.1
→ Inject into prompt → Generate form scaffold
If tenant is ecomx, the agent may retrieve:
🔍 Advanced DSL Queries (Human or Agent)¶
| Query | Interpretation |
|---|---|
DSLs used in user-login prompt |
Reverse-lookup via graph edge usedIn → prompt-login-user |
Forks of dsl-user-handler still active |
forkedFrom: dsl-user-handler AND status:active |
All telemetry span DSLs with retry logic |
type: span AND fields[*].name = retryPolicy |
Most reused DSLs in the onboarding domain |
Usage index + domain filter |
🧠 Smart DSL Suggestions¶
- Prompt planners can query for:
- “Top 3 DSLs similar to current prompt”
- “DSLs most used with current agent’s output type”
- “DSLs seen in successful test traces with same tags”
✅ Summary¶
DSL search and retrieval is multi-layered and agent-aware:
- 🔎 Enables both precise lookup and fuzzy discovery
- 🧠 Vector search unlocks semantic-based planning
- 🧱 DSLs can be filtered, ranked, embedded, and injected at runtime
- 🌐 Graph links power reverse-trace and lineage queries
- 🤖 Planners, validators, and prompt builders rely on it daily
⚔️ DSL Conflict Resolution & Override¶
🎯 Why Do DSL Conflicts Happen?¶
In a multi-tenant, agentic AI system like ConnectSoft, DSL collisions can occur due to:
- Different teams/agents defining similar DSLs independently
- Forks evolving in incompatible directions
- Deprecated DSLs still referenced in old prompts
- Multiple DSLs with similar vector embeddings
- Prompt injection using conflicting or ambiguous DSL structures
Without conflict resolution, the factory may generate invalid, mismatched, or duplicate artifacts.
⚠️ Types of DSL Conflicts¶
| Type | Description | Example |
|---|---|---|
| Structural Conflict | Same DSL ID, different field structure | dsl-user-handler changed field userId → userIdentifier |
| Semantic Overlap | Different DSLs with nearly identical meaning | dsl-auth-session vs dsl-session-auth |
| Version Inconsistency | Prompt uses DSL v1 but template expects v2 | template-user-handler requires emitsEvent, missing in v1 |
| Fork Drift | Tenant fork diverges from base and breaks compatibility | dsl-user-form-ecomx no longer aligns with parent |
| Injection Override | Multiple DSLs match a prompt, both injected | Causes ambiguous prompt inputs |
🔍 Conflict Detection Strategies¶
✅ Structural Diffing¶
- Automatically compare field sets, types, constraints
✅ Embedding Similarity Collision¶
- Flag DSLs with
cosine similarity > 0.9and different IDs
✅ Prompt Incompatibility Check¶
- Detect if injected DSL violates prompt expectations
✅ Fork Validation¶
- Check if forks removed required fields from base
✅ Feedback Score Divergence¶
- High reuse DSLs with dropping confidence → investigate
🔄 Resolution Mechanisms¶
| Scenario | Resolution Strategy |
|---|---|
| Same ID, different structure | ❌ Invalid – block and require version bump |
| Conflicting semantic DSLs | Merge or rename with clearer scope |
| Fork drift | Freeze fork and regenerate from parent |
| Prompt-version mismatch | Auto-upgrade prompt or provide migration mapping |
| Duplicate injections | PromptPlannerAgent selects highest-confidence match or defers to user prompt |
🧠 Conflict Metadata Example¶
conflictId: cfl-dsl-user-handler-v1.1-vs-v1.2
type: structural
description: v1.2 changes field name, breaks dependent templates
detectedBy: DSLValidatorAgent
severity: high
resolution: "Mark v1.1 as deprecated, regenerate trace plan"
linkedArtifacts:
- prompt-user-handler
- template-user-handler
All conflicts are indexed and linked to their origin DSLs and affected artifacts.
🤖 Agent Collaboration on Conflict Resolution¶
| Agent | Role |
|---|---|
DSLValidatorAgent |
Detects structural/schema incompatibilities |
PromptPlannerAgent |
Flags prompt collisions and injection ambiguity |
TraceReplayerAgent |
Detects DSL-version mismatch from past trace |
GovernanceOrchestrator |
Approves major DSL changes and forks |
FeedbackAgent |
Surfaces usage errors that may stem from DSL issues |
🧱 Prompt Injection Protection¶
Prompts define DSL strictness settings:
If a conflicting DSL is suggested, prompt planning fails or requests resolution.
✅ Summary¶
DSL conflict management is essential to maintain:
- ✨ Generation consistency
- 🧪 Test and span validation accuracy
- 🔄 Prompt injection safety
- 📚 DSL lineage clarity
- 🤖 Multi-agent reliability
The DSL Knowledge Graph tracks and resolves conflicts through versioning, tagging, and semantic analysis.
📦 Common DSL Examples¶
🎯 Purpose of Examples¶
Concrete examples:
- Clarify the shape and structure of typical DSLs
- Help agents understand how to generate, validate, and inject DSLs
- Demonstrate cross-layer and cross-domain DSL usage
- Act as reference patterns in prompt construction and regeneration flows
🔁 Example: Backend Command Handler DSL¶
id: dsl-user-handler
type: blueprint
domain: user-management
layer: backend
version: v1.2.0
fields:
commandName: string
responseType: string
emitsEvent: bool
retryPolicy: enum[None, Linear, Exponential]
description: Declares a command handler used to manage user actions.
examples:
- commandName: "InviteUserCommand"
responseType: "InviteUserResponse"
emitsEvent: true
retryPolicy: "Exponential"
Used by:
- Prompt:
prompt-blueprint-user-handler - Template:
template-user-handler.cs - Test:
test-user-handler.feature - Span:
span.user.handler.invoked
🧬 Example: UI Form Section DSL¶
id: dsl-ui-form-section
type: ui
domain: user-profile
layer: frontend
version: v1.0.0
fields:
label: string
fieldName: string
inputType: enum[text, email, phone, password]
required: bool
placeholder: string
description: Represents a UI input field for form section layout.
examples:
- label: "Email Address"
fieldName: "email"
inputType: "email"
required: true
placeholder: "example@site.com"
Used in:
- Blazor form generators
- UI schema injection in prompts
- Frontend spec generation for QA scenarios
📊 Example: Observability Span DSL¶
id: dsl-span-notify-user
type: span
domain: notifications
layer: observability
version: v2.1.0
fields:
spanName: string
tags:
userId: string
channel: enum[email, sms, push]
successCondition: string
failureEvent: string
description: Defines a tracing span emitted when a user is notified.
examples:
- spanName: "notify_user"
tags:
userId: "{{user.id}}"
channel: "email"
successCondition: "response.status == 200"
failureEvent: "NotifyUserFailed"
Used to:
- Inject OpenTelemetry specs
- Validate trace spans
- Generate
span-metrics.json
🧪 Example: SpecFlow Test DSL¶
id: dsl-specflow-user-invite
type: test
domain: user-management
layer: testing
version: v1.0.0
fields:
scenarioTitle: string
preconditions: list[string]
steps: list[string]
expectedOutcome: string
description: BDD-style SpecFlow test definition for user invite flow.
examples:
- scenarioTitle: "Invite new user with valid email"
preconditions: ["User does not exist"]
steps:
- "When admin submits invite form"
- "Then system sends invite email"
expectedOutcome: "User receives invite"
Used by:
- QA Engineer Agent
- TestTemplateAgent
- Regression trace planners
🤖 Example: AI Skill Invocation DSL¶
id: dsl-skill-call-user-recommender
type: ai-skill
domain: recommendation
layer: ai-kernel
version: v1.0.0
fields:
inputUserId: string
recommendationType: enum[course, article, video]
responseFormat: string
description: Semantic Kernel-compatible skill invocation spec for user recommendation.
examples:
- inputUserId: "user-123"
recommendationType: "course"
responseFormat: "json"
Injected into:
- PromptPlannerAgent
- SK Planner DSL builder
- AI observability traces
✅ Summary¶
These examples show DSLs across:
- 🧱 Layers: frontend, backend, observability, testing, AI
- 🎯 Domains: auth, user-management, notifications, UI, skill execution
- 🔗 Graph usage: templates, prompts, spans, tests
- 🧠 Prompt enrichment and code generation integration
🔄 DSL-Driven Generation Flow¶
🎯 Why Use DSLs to Drive Generation?¶
DSLs act as structured semantic anchors that guide:
- Prompt planning
- Template parameterization
- Test scenario generation
- Event and span shaping
- Validation across all outputs
They turn generation from "free text prompting" into a deterministic, observable, and reusable process.
🧩 Generation Flow Powered by DSLs¶
flowchart TD
A[PromptPlannerAgent] -->|Query DSL| B[DSL Index]
B --> C[DSL Injection]
C --> D[Prompt Generation]
D --> E[Template Injection]
E --> F[Test Planner]
F --> G[Span Generator]
G --> H[FeedbackAgent]
H -->|Trace score| A
Each step uses the DSL to align generation outputs across agents and artifacts.
📥 1. DSL Retrieval¶
- Agent searches
DSLIndexby semantic intent, tags, or tenant context - Retrieves full schema, examples, usage history, vector ID
- DSL is loaded into short-term memory for immediate planning
💬 2. Prompt Construction¶
- Inject DSL into structured prompt template
- Adapt fields and values using DSL structure
- Resolve forks or extensions if tenant-specific
- Ensure version and tag compliance
Example:
Prompt: "Create a command handler for {{dsl.commandName}}"
→ DSL field: commandName = InviteUserCommand
🧱 3. Template Mapping¶
- Template contains markers linked to DSL fields
- Optional blocks (e.g., retry logic) toggled by DSL flags
- DSL → Code DSL Translator generates base classes/interfaces
- Ensures reproducibility and compliance
🧪 4. Test Case Generation¶
- If DSL has
examples, convert to test cases - Create BDD-style feature file or xUnit scenario
- Mark trace expectations based on DSL constraints
Example:
Given the command is InviteUserCommand
When the command is processed
Then a domain event InviteUserIssued should be emitted
📊 5. Span & Telemetry Planning¶
- DSL defines span name, tags, success conditions
- Used to generate OpenTelemetry spans or
span-metrics.json - Aligns with Observability Agent workflows
🧠 6. Memory Embedding & Indexing¶
- DSL instance used in generation is embedded into trace memory
- Feedback from success/failure tied back to DSL confidence score
- DSL is linked to output artifacts for traceability
📤 7. Output Validation¶
- Output artifacts (code, prompt, span, test) are validated against the originating DSL
- ValidatorAgent checks structural conformance
- TraceReplayerAgent ensures runtime alignment
📈 Trace Score Contributions¶
DSLs influence:
GenerationCompletenessScoreTraceValidationScorePromptInjectionSuccessRateTemplate-DSL Alignment Index
Each metric contributes to the DSL's evolving confidence level.
✅ Summary¶
The DSL-driven generation flow ensures:
- 🧱 Structure-aware generation
- 🔄 Repeatable and traceable outputs
- 🤖 Agent interoperability
- 🧪 Prompt + Template + Test + Trace coherence
- 📊 Feedback loops for quality improvement
🧬 DSL Extension and Composition¶
🎯 Why Compose and Extend DSLs?¶
As the platform grows, DSLs must support:
- 🧱 Reuse of base structures
- 🔀 Mix-and-match of DSL fragments
- 🧩 Specialization per domain or layer
- 🧬 Inheritance without redundancy
- 🧠 Modular planning by AI agents
A composable DSL system reduces duplication and enables semantic layering — like building blocks for generation.
🧩 Extension via extends¶
A DSL can inherit another DSL's fields and constraints:
id: dsl-user-invite-handler
extends: dsl-user-handler
fields:
inviteTokenExpiry: int
roleAssignment: string
In graph:
- Edge:
extends → dsl-user-handler - Result: full merged field schema
- Agents are aware of both base and derived DSLs
➕ Composition via includes¶
DSLs can embed multiple fragments modularly:
id: dsl-composite-onboarding
includes:
- dsl-ui-form-user
- dsl-span-user-registration
- dsl-test-onboarding
All included DSLs are logically merged, but not structurally inherited.
Useful for bundle planning or full-feature flows.
🧠 Example: DSL Composition Tree¶
graph TD
A[dsl-composite-onboarding]
A --> B[dsl-ui-form-user]
A --> C[dsl-span-user-registration]
A --> D[dsl-test-onboarding]
This composite DSL is used by:
- CoordinatorAgent to plan onboarding flow
- BlueprintAgent to match correct artifacts
- FeedbackAgent to trace coverage
🌍 Use Case Examples¶
| Case | Approach |
|---|---|
| Common base handler + specialized features | extends: dsl-handler-base |
| Bundled user registration spec | includes: [dsl-ui, dsl-span, dsl-test] |
| UI form with nested reusable sections | DSL fragment composition (nested includes) |
| Tenant-specific override | Fork → extend parent DSL with tenant fields |
🧠 Extension Semantics¶
| Rule | Behavior |
|---|---|
| Extended fields are merged | Available to prompt/template/planner |
| Conflicts are flagged | Override must be explicit |
| Composition does not imply inheritance | Included DSLs remain semantically linked |
| Composed DSLs can be versioned independently | Each fragment version is tracked separately |
🛠️ DSL Transformer Support¶
Agents like DSLTransformerAgent and PromptPlannerAgent support:
- 🧬 Extension resolution (flattened DSL view)
- 🧩 Composition parsing for modular workflows
- 🧪 Test matrix expansion across composed DSLs
- 🔗 Graph enrichment for cross-DSL traceability
📘 Composition Example (Flattened)¶
flattenedFields:
- commandName
- responseType
- emitsEvent
- inviteTokenExpiry
- roleAssignment
- spanName
- tags.userId
- tags.channel
- testSteps[]
This flattened DSL is injected into prompts or templates for generation.
✅ Summary¶
DSL extension and composition unlock:
- 🧱 Reuse across domains and layers
- 🧩 Bundled generation and planning
- 🔄 Semantic graph enrichment
- 🤖 Intelligent modularity for agents
- 📦 DSL-as-blueprint for complete flows
🧭 DSL Traceability and Lineage¶
🎯 Why Trace DSL Usage?¶
In a factory that creates 3000+ microservices and components:
- Every artifact should be traceable to its semantic root (DSL)
- Lineage tracking ensures observability, reusability, and auditability
- Enables rollback, revalidation, and compliance checks
- Agents must reason about what generated what — not just the final output
DSLs are the semantic DNA of the software factory. Their lineage builds semantic observability.
📊 DSL Traceability Graph¶
Each DSL participates in a knowledge lineage graph:
graph TD
DSL[dsl-user-handler-v1.2.0]
P[prompt-user-handler]
T[template-user-handler.cs]
S[span-user.handler.invoked]
TEST[test-user-handler.feature]
TRACE[trace-run-983]
DSL -->|usedIn| P
DSL -->|linkedTo| T
DSL -->|defines| S
DSL -->|validatedBy| TEST
P -->|produced| TRACE
T -->|usedIn| TRACE
TEST -->|executesIn| TRACE
This forms a full traceability chain from DSL → generation → runtime traces.
🔗 Lineage Metadata in DSL Nodes¶
Each DSL node has lineage metadata:
lineage:
createdBy: DSLDesignerAgent
usedIn:
- prompt-user-handler
- template-user-handler
- span-user.handler.invoked
produces:
- trace-user-handler-onboarding
replacedBy: dsl-user-handler-v2.0.0
forkedBy:
- dsl-user-handler-petclinic
🧠 Agent Lineage Queries¶
| Agent | Query Example | Purpose |
|---|---|---|
| PromptPlannerAgent | GetDSLTraceSources(dsl-user-handler) |
Inject original examples |
| DSLValidatorAgent | TraceImpactOfDeprecatedDSL(dsl-v1.1.0) |
Mark downstream invalid |
| GovernanceAgent | ListForksOfBaseDSL(dsl-user-handler) |
Approve/reject divergent branches |
| FeedbackAgent | TraceConfidenceDrop(dsl-auth-span) |
Analyze usage failures |
📂 DSL Trace Record Format¶
Each generation run linked to a DSL includes a record like:
traceId: trace-user-handler-202406
dslId: dsl-user-handler-v1.2.0
promptId: prompt-user-handler
templateId: template-user-handler.cs
testId: test-user-handler.feature
spanId: span-user.handler.invoked
confidenceImpact: +0.06
forkContext: null
Used to:
- Rebuild generation history
- Re-evaluate test coverage
- Visualize impact across DSL versions
🔄 Fork and Replace Tracking¶
The lineage graph supports:
replaces →: version migrationforkedFrom →: tenant specializationextends →: inheritance treesusedIn →: artifact dependencyinvalidates →: trace deprecation upon DSL removal
🧬 Temporal Lineage Support¶
The factory supports temporal queries:
- “What version of DSL was active in March 2024?”
- “Show all generation traces from v1.1 to v1.2 transition”
- “Detect regressions introduced after fork divergence”
Time-aware lineage allows snapshot comparison and compliance audit.
📊 Confidence & Decay from Trace Lineage¶
Each DSL’s confidence score is dynamically updated via:
- Trace usage frequency
- Trace success/failure ratio
- Number of forks/version bumps
- Feedback signals on prompt effectiveness
This helps identify:
- 🟢 DSLs that are healthy and reusable
- 🔴 DSLs that cause regressions or conflicts
✅ Summary¶
DSL traceability and lineage enables:
- 📈 End-to-end semantic observability
- 🔁 Historical regeneration and debugging
- 🧠 Agent-level context awareness
- 🔍 Impact analysis for upgrades or forks
- 🤖 Continuous confidence learning via trace feedback
🏷️ DSL Metadata and Enrichment Fields¶
🎯 Why Metadata Matters¶
DSLs are not just schemas — they’re semantic assets. Rich metadata allows:
- 🔍 Advanced filtering and discovery
- 📊 Observability and lineage tracking
- 🤖 AI-driven prioritization and planning
- 🧠 Cross-agent reasoning (Who? What? Where? When? Why?)
Metadata fields help DSLs participate in search, scoring, injection, validation, and graph indexing.
📦 Core Metadata Fields¶
| Field | Purpose |
|---|---|
id |
Unique DSL identifier (dsl-user-handler-v1.2.0) |
title |
Human-readable DSL name |
description |
What the DSL represents |
type |
Category: blueprint, span, ui, test, ai-skill, etc. |
domain |
Business domain (auth, user-management, notifications) |
layer |
Architecture layer (frontend, backend, observability) |
version |
DSL semantic version |
status |
draft, active, deprecated, replaced |
createdBy |
Originating agent or user |
tags |
Searchable keywords (retry, feature, email, critical) |
tenant |
Source context: shared, petclinic, custom |
confidence |
DSL trust score (0–1.0) based on usage/feedback |
🧪 Enrichment Fields¶
| Field | Purpose |
|---|---|
examples |
Example values, helps generation and embedding |
embeddingId |
Link to vector DB index entry |
embeddingTags |
Additional semantic indexing context |
linkedArtifacts |
Prompts, templates, spans, tests using this DSL |
forkedFrom |
Parent DSL (for tenant-specialized forks) |
replaces |
Previous version lineage |
extends |
Inherited DSL ID |
includes |
Composed DSLs (for bundling) |
metrics |
Usage count, success ratio, trace frequency |
🧠 Observability Hooks¶
| Field | Function |
|---|---|
definesSpan |
Declares OpenTelemetry span structure |
linkedTraceTypes |
List of trace types using this DSL |
metricTags |
Tags expected in span output |
spanInjectionPrompt |
Predefined prompt to inject span spec |
failurePattern |
Regex or rule to detect trace failure against DSL |
feedbackImpact |
Adjusts confidence based on success/failure events |
🧑🎓 Authorship and Ownership Fields¶
| Field | Meaning |
|---|---|
authorId |
Original human contributor (if applicable) |
agentGenerated |
true/false flag if generated autonomously |
approvedBy |
Governance entity validating the DSL |
teamContext |
DevOps or Git project/repo context |
sourceRepo |
Where the DSL originated from (lib-dsl-models) |
These fields are useful for auditing, governance, and traceback.
📥 Prompt Injection Hints¶
| Field | Meaning |
|---|---|
promptInjectionMode |
full, partial, composed, optional |
injectionConstraints |
Must include fields, block conflicts, etc. |
promptTemplateId |
Preferred prompt template to use with this DSL |
agentAffinity |
Agent types this DSL is most compatible with |
📘 Sample DSL Metadata Block¶
id: dsl-notify-user-v1.1.0
type: blueprint
domain: notifications
layer: backend
version: v1.1.0
description: Handles async notification delivery
createdBy: DSLDesignerAgent
status: active
confidence: 0.87
tags: [email, retry, feature]
tenant: shared
examples:
- notifyType: "email"
template: "WelcomeEmail"
embeddingId: vec-dsl-notify-user-v1.1
linkedArtifacts:
- prompt-notify-user
- template-notify-user
- span.notify_user
✅ Summary¶
Metadata fields power:
- 🔍 Search and filtering
- 🧠 Semantic embedding
- 📊 Trace analysis and feedback learning
- 🤖 AI prompt planning and agent orchestration
- 📚 Governance and auditing
The richer the DSL metadata, the smarter the system becomes.
📈 DSL Confidence Score Model¶
🎯 Why Track DSL Confidence?¶
The factory needs to:
- 🧠 Prioritize reliable DSLs during generation
- ⚠️ Flag risky or decaying DSLs for review
- 🔄 Learn from successful vs. failed traces
- 🚦 Decide injection eligibility based on trust level
Confidence is a dynamic, learned metric that governs DSL prioritization, validation, and deprecation readiness.
📊 Confidence Score Model¶
Each DSL has a confidence value in the range 0.0 – 1.0.
It is calculated using a weighted signal model:
| Signal Type | Examples | Weight |
|---|---|---|
| ✅ Usage Successes | Successful traces, valid generations, test pass rate | +++ |
| ❌ Usage Failures | Broken traces, generation mismatches, user feedback | --- |
| 🧠 Feedback Events | Human/AIAgent upvotes/downvotes | ++ / -- |
| ⏳ Inactivity | Stale or unused over time | − |
| ⚠️ Conflict Alerts | Structural diffs, overlapping matches | -- |
| 🔀 Fork Divergence | Rapid forking from base | - |
| 🏗️ Prompt Rejections | Failed injection or mismatched schemas | - |
🧠 Signal Sources¶
Signals are collected from:
- 🟢 TraceRun Logs → span/test/result match
- 🔁 Generation History → prompt → template → trace alignment
- 👤 FeedbackAgent → upvote/downvote traces tied to DSL
- 🤖 ValidatorAgent → conformance analysis
- 📉 ConflictResolverAgent → warnings and diffs
- 📦 ForkTrackerAgent → mutation tracking across tenants
🧮 Confidence Update Cycle¶
Confidence scores are periodically recalculated:
- 📆 Daily batch update from trace system
- 🔁 Real-time adjustments for major success/failure events
- 🔄 Decay model for stale DSLs
Decay example:
🚥 Confidence Thresholds (Usage Policy)¶
| Range | Meaning | Platform Behavior |
|---|---|---|
> 0.9 |
Strong, validated | Auto-injected and reused |
0.7 – 0.9 |
Acceptable | Available for reuse and planning |
0.5 – 0.7 |
Risky | Requires validation before reuse |
< 0.5 |
Untrusted | Blocked from injection, flagged for fix |
= 0 |
Deprecated | Marked invalid or removed |
🛠️ Example DSL Record with Confidence¶
id: dsl-auth-span
version: v1.2.1
confidence: 0.71
signals:
traceSuccessRate: 92%
testFailureRate: 5%
promptRejection: 2
forkCount: 3
userVotes: +15 / -1
lastUpdated: 2025-06-01
🧠 DSL Selection with Confidence¶
Agents can filter with MinConfidence:
dslSearchService.FindBestMatch(new DSLSearchQuery {
domain: "auth",
type: "span",
minConfidence: 0.8
});
This ensures agents prefer healthy DSLs.
📊 Confidence Heatmap (Future Visualization)¶
A future dashboard will visualize:
- Confidence over time (line chart)
- DSL family comparison (fork vs. parent)
- Signal breakdown pie chart
- Correlation to trace coverage
✅ Summary¶
DSL confidence scoring enables:
- 📈 Trust-based reuse
- 🧠 Continuous learning
- ❌ Fault propagation detection
- 🧪 Quality-aware generation
- ⚖️ Governance and review prioritization
✅ DSL Review and Approval Workflows¶
🎯 Why a Review Workflow Is Critical¶
In a multi-agent system generating production-grade software:
- DSLs encode logic, structure, and intent
- Errors or misalignments in a DSL propagate into all generated outputs
- Forks and tenant-specific DSLs must be curated
- Security-sensitive or observability DSLs require human approval
- Auditability is mandatory for compliance and traceability
DSLs are the core of semantic control — their lifecycle must be governed, reviewed, and approved.
🔁 DSL Lifecycle Stages¶
| Stage | Description |
|---|---|
draft |
Created but not yet validated |
under-review |
Submitted for human/agent validation |
active |
Approved and available for use |
deprecated |
Marked for replacement, not recommended |
replaced |
Superseded by a new DSL version |
archived |
Removed from prompt injection pool |
🛠️ Review Triggers¶
A DSL enters review when:
- Created manually by human (UI/CLI)
- Generated by agent with low initial confidence
- Forked from a shared DSL
- Version bump introduces breaking change
- Conflict with existing DSL detected
- Confidence drops below threshold
🧠 Review Agents and Roles¶
| Agent | Role |
|---|---|
DSLValidatorAgent |
Schema integrity, structural soundness, conformance to standards |
PromptPlannerAgent |
Ensures the DSL injects cleanly into prompts |
ConflictResolverAgent |
Checks for overlap, fork divergence, version drift |
GovernanceAgent |
Enforces review policy (approvals, merges, freezes) |
FeedbackAgent |
Surfaces usage results and human feedback during review |
TraceCoverageAgent |
Confirms test + span + trace coverage from DSL |
👤 Human Review Workflow (Optional)¶
Humans may review high-risk DSLs using:
- A web UI with full metadata, confidence scores, impact analysis
- Review checklist (schema, examples, tags, trace coverage)
- Approval/rejection comments
- Merge/fork resolution tools
Example:
review:
status: pending
assignedTo: "Platform Architect"
checklist:
- [x] Valid JSON/YAML
- [x] Prompt Injection Passed
- [ ] Span Coverage ≥ 90%
- [ ] Conflict Check Cleared
comments: "Please add a test example and clarify field `retryPolicy`"
📦 Fork Handling & Merging¶
| Scenario | Action |
|---|---|
| Tenant fork matches parent | Auto-approve inheritance |
| Fork diverges semantically | Require review/merge |
| Fork has conflicting ID | Auto-reject, request rename |
| Fork introduces observability changes | Mandatory human review |
All fork events are logged and linked to original DSL.
🚦 Automated Review Rules (Policy Engine)¶
Rules can be defined in governance policy:
reviewRules:
- type: "span"
domain: "auth"
requiredConfidence: 0.85
requireHumanApproval: true
minTraceCoverage: 95%
- type: "ui"
autoApproveIf:
confidence > 0.9
AND examples.count ≥ 2
🔍 Review Status and History¶
Each DSL contains a review block:
review:
status: approved
approvedBy: GovernanceAgent
approvedAt: 2025-06-03
comments: "Reviewed for onboarding use case"
Full history is preserved for compliance and observability.
✅ Summary¶
The DSL review workflow ensures:
- 🧠 Safety and accuracy of generation flows
- 🧪 Full trace and test coverage
- 🔀 Fork and version sanity
- 🧑⚖️ Governance and audit readiness
- 🔁 Collaboration between agents and humans
🌐 DSL Fork Management and Multi-Tenant Specialization¶
🎯 Why Forking DSLs Is Essential¶
In a platform supporting many SaaS domains and tenants:
- DSLs need to evolve per-tenant, per-feature, or per-regulation
- Forking enables custom logic without rewriting everything
- Preserves semantic lineage and composability
- Supports internal marketplaces of specialized DSLs
- Avoids cross-tenant conflict while keeping inheritance traceable
Forking creates isolated yet traceable variations, enabling true SaaS multi-tenancy.
🌿 Forking Semantics¶
When a DSL is forked:
| What Happens | Notes |
|---|---|
| New DSL ID is assigned | Often appends tenant suffix (e.g., -ecomx, -vet) |
forkedFrom metadata is set |
Links to source DSL |
| Field schema is cloned | Editable independently |
Confidence resets to 0.5 |
Needs local trace validation |
Tags may include fork or tenant:<id> |
Helps indexing and filtering |
| Prompt and template links are retained | But version mismatch may block injection |
📘 Example: Forked DSL Metadata¶
id: dsl-user-handler-ecomx-v1.0.0
forkedFrom: dsl-user-handler-v1.2.0
tenant: ecomx
tags: [user, handler, ecomx, fork]
status: draft
confidence: 0.5
differences:
- changedField: emitsEvent → false (was true)
- addedField: segmentId
- removedField: retryPolicy
The fork may redefine logic for specific use cases like segmentation or auditing.
🛠️ Fork Management Lifecycle¶
| Stage | Description |
|---|---|
forked |
New DSL forked from a base |
edited |
Custom fields added, removed, or updated |
validated |
Trace, prompt, and span integration tested |
approved |
Ready for tenant-specific generation |
mergedBack (optional) |
If fork represents global improvement |
deprecated |
No longer used for tenant or use case |
🔁 Fork vs. Extend¶
| Criteria | Fork | Extend |
|---|---|---|
| Use case | Structural change, independence | Logical layering, reuse |
| Inheritance | Breaks it | Maintains it |
| Use in prompts | May conflict | Compatible |
| Agent behavior | Treats as distinct lineage | Treats as overlay |
| DSL Index Impact | Indexed separately | Linked hierarchically |
🧠 Agent Behavior with Forks¶
| Agent | Behavior |
|---|---|
PromptPlannerAgent |
Picks fork if tenant context matches |
ValidatorAgent |
Ensures fork doesn't break downstream |
ForkTrackerAgent |
Logs divergence, visualizes drift |
GovernanceAgent |
May require approval for sensitive forks |
ConflictResolverAgent |
Warns if fork overlaps another active DSL |
FeedbackAgent |
Tracks fork usage separately for scoring |
🧠 Fork-aware Prompt Injection¶
promptContext:
tenant: ecomx
dslSearch:
domain: user-management
type: blueprint
allowForks: true
preferTenantForks: true
This ensures tenant-specific DSLs are prioritized over global ones.
🗂️ Fork Dashboard View (Planned)¶
Future tooling will allow:
- 🌿 Fork trees by domain, tenant, type
- 🔍 Drift diff visualization (e.g., field added/removed)
- 🧪 Fork-specific test/trace coverage
- 📉 Fork decay tracking (inactive forks)
- 📤 Merge-back recommendations
✅ Summary¶
Fork management supports:
- 🌍 Tenant-specific customization
- 🧬 Semantic divergence without fragmentation
- 🔁 Traceable lineage and inheritance
- 🧠 Agent-awareness of scope and compatibility
- 🧪 Domain-specific DSL lifecycle management
🧠 DSL Indexing and Embedding Infrastructure¶
🎯 Why Embed and Index DSLs?¶
To enable scalable multi-agent collaboration and real-time discovery, the DSL system must support:
- 🧠 Semantic similarity search
- 🔍 Tag- and domain-based filtering
- 🧩 Prompt-to-DSL matching
- 🔄 Fast injection and regeneration lookups
DSLs are embedded and indexed to function as semantic APIs for intelligent agents.
📦 DSL Index Types¶
Each DSL is stored in one or more indexed stores, each with a different indexing strategy:
| Index Type | Description |
|---|---|
DSLMetadataIndex |
Fast lookup by ID, tags, type, domain, status |
DSLVectorIndex |
Vector embeddings for similarity matching |
DSLForkGraph |
Inheritance and fork lineage relationships |
DSLTraceIndex |
Usage history, test/trace results |
DSLInjectionIndex |
Prompt compatibility, conflicts, history |
DSLSpanMetricIndex |
Observability tag-to-span relationships |
DSLFeedbackIndex |
Human and agent voting logs |
DSLConfidenceModelStore |
Dynamic trust computation metadata |
DSLTemporalIndex |
Time-based version and decay tracking |
TenantScopedDSLIndex |
Isolated view per tenant for forked/overridden DSLs |
🧠 Semantic Embedding Pipeline¶
Every DSL is embedded using the DSL Embedding Service, which performs:
- DSL normalization → removes ID/version/comments
- Field + example flattening → into structured string
- Prompt-style representation → e.g.,
"commandName: InviteUserCommand, emitsEvent: true..." - Vector embedding generation → via Azure OpenAI / custom model
- Push to vector store → Pinecone, Qdrant, Azure AI Search, etc.
The result is stored in DSLVectorIndex.
🧠 Example Embedding Input¶
type: blueprint, domain: user-management
Fields:
- commandName: string
- emitsEvent: bool
Examples:
- commandName: InviteUserCommand, emitsEvent: true
Becomes an embedding vector linked to:
embeddingId: vec-dsl-user-handler-v1.2
vectorStore: AzureCognitiveSearch
semanticTags: ["invite", "user", "command", "event"]
🔍 Semantic Search Example¶
When an agent receives a task:
It performs:
- Embed query → vector
- Search
DSLVectorIndexfor cosine similarity - Return ranked DSL matches
- Filter by:
minConfidencetenantContextstatus != deprecated
📁 Tag-Indexing (MetadataIndex)¶
All DSLs are also searchable by:
type,domain,layer,tags,status,tenant,extends,forkedFrom, etc.
Used in filtering, dashboards, governance tools.
Example query:
dslIndex.FindAll(d =>
d.domain == "auth" &&
d.type == "span" &&
d.status == "active" &&
d.tags.Contains("login"));
🔁 Real-Time Index Updates¶
When a DSL is:
- Created → new embedding, indexing
- Forked → cloned metadata and index pointers
- Updated → version re-embedded
- Used → trace record updates signal success/failure
- Reviewed → tags like
approved,sensitiveapplied - Deprecated → removed from injection pool
All updates are propagated via event-driven triggers into the appropriate indexes.
🛠️ Multi-Store Architecture (Pluggable)¶
Indexes are decoupled and can use different backends:
| Index | Backing Store |
|---|---|
| Metadata | Azure Table / CosmosDB / PostgreSQL |
| Embedding | Pinecone / Qdrant / Azure AI Search |
| Fork Graph | Neo4j / GremlinDB / GraphQL |
| Trace Usage | ElasticSearch / Redis / SQL |
| Confidence Store | In-memory + Redis + Blob for snapshots |
✅ Summary¶
The DSL Indexing and Embedding Infrastructure enables:
- 🔎 Fast semantic discovery
- 🧠 Cross-agent knowledge reuse
- 🤖 Prompt-to-DSL alignment
- 📊 DSL health and usage tracking
- 🔄 Real-time updates and trace-linked learning
🧩 DSL-Prompt Inference and Semantic Matching¶
🎯 Why Prompt-DSL Inference Matters¶
Agents often receive freeform instructions:
"Create a handler that invites a user and emits an event."
To ground this in structured generation, they must:
- 🧠 Match this intent to an existing DSL
- 📦 Inject the correct schema into prompt planning
- 📊 Use DSL metadata to constrain, enrich, and validate generation
- 🔍 Avoid ambiguity or semantic collisions
Prompt-DSL inference transforms natural language into actionable structured generation.
🧠 Inference Flow¶
flowchart TD
A[Agent Prompt or Task Input] --> B[Embed Prompt Intent]
B --> C[Query DSL Vector Index]
C --> D[Filter by Tags + Domain + Tenant]
D --> E[Select Top-N DSL Candidates]
E --> F[Prompt Injection Planner]
F --> G[Selected DSL Injected into Prompt Template]
📘 Example Prompt → DSL Flow¶
Prompt Input:
Matched DSL:
id: dsl-user-handler-v1.2
domain: user-management
type: blueprint
fields:
- commandName: InviteUserCommand
- emitsEvent: true
- eventType: UserOnboarded
Injected into prompt like:
Prompt:
You are generating a domain handler.
Use this DSL:
{
commandName: "InviteUserCommand",
emitsEvent: true,
eventType: "UserOnboarded"
}
📦 Prompt-to-DSL Matching Criteria¶
| Dimension | Strategy |
|---|---|
| Semantic similarity | Vector cosine similarity from embedded prompt |
| Metadata filters | DSL domain/type/tags/layer |
| Prompt hints | requiresDSL, preferTags, tenantContext |
| Trace reuse | Prior successful traces with same intent |
| DSL confidence | Score > min threshold (default 0.7) |
| Tenant scope | Prefer fork if available for tenant |
🧠 DSL-Aware Prompt Templates¶
Templates are DSL-bound:
promptTemplateId: prompt-domain-handler
requiresDSL:
domain: user-management
type: blueprint
enforceFields:
- emitsEvent
- commandName
preferConfidence: 0.85+
Ensures only high-trust DSLs are injected.
🔁 Runtime Injection Handling¶
| Case | Result |
|---|---|
| Multiple DSL matches | Planner selects highest-score OR requests user clarification |
| No DSL match found | Agent may fallback to open generation (risky) or raise warning |
| Deprecated DSL matched | Planner blocks injection unless override specified |
| Tenant-specific fork | Prefer fork DSL if tenant context matches |
| Version mismatch | DSL updated automatically or planner flags injection version |
📊 DSL Selection Debug Trace (Logged)¶
promptId: prompt-notify-user
queryVectorMatch:
- dsl-notify-user-v1.1.0 (0.92)
- dsl-email-dispatch (0.89)
- dsl-user-message (0.73)
filters:
domain: notifications
status: active
tenant: shared
selectedDSL: dsl-notify-user-v1.1.0
reason: Highest semantic match + active + confidence > 0.9
🧠 PromptPlannerAgent Skills Used¶
| Skill | Description |
|---|---|
FindClosestDSLMatch |
Vector + metadata + confidence search |
EvaluateInjectionCompatibility |
Validates if DSL fits prompt slots |
ExplainInjectionDecision |
Logs injection rationale |
RequestClarificationPrompt |
Used if multiple DSLs conflict |
FallbackToOpenPrompt |
Used as last resort (guarded) |
✅ Summary¶
Prompt-to-DSL inference enables:
- 🧠 Structured generation from freeform prompts
- 🔍 Semantic precision in matching DSLs
- 📦 Reliable injection of trusted schemas
- 🔁 Traceable alignment across planning, code, test, span
- 🤖 Autonomous agent behavior grounded in DSL knowledge
🧩 DSL-Aware Prompt Templates and Tokens¶
🎯 Why Use DSL-Aware Prompt Templates?¶
Prompt templates act as semantic bridges between agents and generation outputs. When DSLs are injected:
- 🧠 Prompts become structured, context-aware, and reproducible
- 🧩 DSL fields are mapped to placeholders or tokens in the template
- 📦 Generation is constrained and aligned to architectural contracts
- 🔍 Validation and trace replay become deterministic
DSL-aware prompt templates ensure every agent response remains tightly aligned with factory intent.
📦 Prompt Template Metadata¶
id: prompt-domain-handler
boundDSL:
domain: user-management
type: blueprint
requiresFields:
- commandName
- emitsEvent
tokens:
- {{CommandName}}
- {{EmitsEvent}}
- {{HandlerLogic}}
outputType: csharp-handler
version: v1.3
confidenceBoost: +0.05
This metadata defines:
- Which DSLs are allowed
- Which tokens must be filled
- Which DSL fields are mapped to which tokens
🧩 Token Mapping¶
DSL fields are dynamically mapped to tokens:
fieldToTokenMap:
commandName: "{{CommandName}}"
emitsEvent: "{{EmitsEvent}}"
retryPolicy: "{{RetryLogic}}"
Prompt rendering example:
Generate a C# domain handler for {{CommandName}}.
It should emit an event: {{EmitsEvent}}.
Use this retry logic: {{RetryLogic}}.
🧠 Types of Tokens¶
| Token Type | Description |
|---|---|
FieldToken |
Injects value of DSL field |
ExampleToken |
Uses example value or test case |
SchemaToken |
Injects full DSL field schema |
SpanToken |
Injects trace/span hints |
FeedbackToken |
Injects prior user feedback as context |
ConstraintToken |
DSL validation rules or limits |
Each token can be static, dynamic, or runtime evaluated.
🤖 DSL-Aware PromptPlanner Behavior¶
- Selects matching prompt template by DSL type/domain
- Maps DSL fields to tokens
- Validates all
requiresFieldsare present - Fills tokens in template
- Injects structured input into Semantic Kernel planner
🔍 Prompt Selection Decision Log¶
selectedPromptTemplate: prompt-notify-handler
boundDSL: dsl-notify-user-v1.1.0
missingTokens: []
confidenceBoost: +0.05
outputType: csharp-command-handler
templateVersion: v1.3
All prompt selection decisions are auditable and linked to trace metadata.
🔁 Dynamic Prompt Composition (Advanced)¶
Prompts may also be composed from:
- DSL metadata (title, description, tags)
- Prior generation logs
- Related DSLs via
includesorextends
Example:
You are generating a handler using the DSL: {{DSLTitle}}.
Tags: {{Tags}}
Inherited logic: {{ExtendedFieldDescriptions}}
✅ Summary¶
DSL-aware prompt templates:
- Ensure precise alignment between DSLs and generation
- Use token mapping to expose DSL semantics to LLMs
- Are validated, versioned, and traceable
- Support multiple output types (code, test, span, config, docs)
- Drive reliable and controlled code generation
🧪 DSL-Driven Code Generation, Test Scaffolding, and Span Injection¶
🎯 How DSLs Drive Full-Stack Artifact Generation¶
In the ConnectSoft AI Software Factory, a well-defined DSL can generate:
- ✅ Source code (e.g., handlers, services, controllers)
- ✅ Unit and BDD-style tests (e.g., MSTest, SpecFlow)
- ✅ Observability spans and metrics (OpenTelemetry)
- ✅ Documentation fragments
- ✅ Validation rules and UI schemas
DSLs act as semantic generators, encoding not only structure but full intent coverage across factory layers.
🔧 1. Code Generation from DSL¶
Example DSL:
id: dsl-user-handler-v1.2
fields:
commandName: InviteUserCommand
emitsEvent: true
eventType: UserInvited
Output handler:
public class InviteUserHandler : ICommandHandler<InviteUserCommand>
{
public async Task Handle(InviteUserCommand command)
{
// business logic here
_eventBus.Publish(new UserInvitedEvent { UserId = command.UserId });
}
}
🧠 Generated using: prompt-domain-handler with dsl-user-handler-v1.2
🧪 2. Test Scaffolding via DSL¶
From the same DSL:
Scenario: Invite user successfully
Given a valid InviteUserCommand
When the handler is invoked
Then a UserInvited event should be published
➡️ Used by: TestAutomationAgent, SpecFlowPlannerAgent
🔍 3. Span Injection and Tracing¶
DSL span definition:
span:
name: user.handler.invite
tags:
- commandName
- userId
- correlationId
emitOn:
- success
- failure
Agent generates:
{
"span": "user.handler.invite",
"tags": {
"commandName": "InviteUserCommand",
"userId": "1234",
"correlationId": "abc-xyz"
},
"result": "success"
}
➡️ Injected into observability templates via TelemetrySpanAgent
📄 4. Documentation and DSL Snapshots¶
DSL fields are used to auto-generate:
- Markdown summary of command handlers
- Code annotation blocks
- DSL tables in API documentation
- Links to examples and traces
Example:
## DSL: Invite User Handler
| Field | Type | Description |
|-------|------|-------------|
| commandName | string | Name of the command |
| emitsEvent | boolean | Whether an event is emitted |
| eventType | string | Name of emitted event |
🧩 5. Validation from DSL Rules¶
DSL can include rules:
rules:
commandName must match pattern: ^[A-Z][a-zA-Z]+Command$
emitsEvent is required
eventType is required if emitsEvent is true
➡️ Injected into validation pipelines and code linting
🔁 Trace Feedback Loop¶
When the DSL-generated code runs in production:
- ✅ Spans confirm successful execution
- ❌ Broken spans feed into
FeedbackAgent - 🔁 DSL confidence is adjusted
- 📦 Future generations adapt or fork
🧠 DSL → Artifact Mapping Summary¶
| DSL Type | Output Artifact | Agent |
|---|---|---|
blueprint |
Code, handler, controller | CodeGenAgent |
span |
OpenTelemetry config | ObservabilityAgent |
test |
SpecFlow, MSTest file | TestAutomationAgent |
prompt |
AI input schema | PromptPlannerAgent |
ui-form |
Blazor/Angular form | UIDesignerAgent |
doc |
Markdown/Swagger notes | DocWriterAgent |
✅ Summary¶
DSLs power end-to-end generation:
- 🎯 DSL → Prompt → Template → Artifact → Trace
- ✅ Test, trace, doc, and code all stem from the same semantic root
- 🔁 Feedback loops keep DSLs accurate and evolving
- 📊 Confidence and quality are measurable and traceable
⚠️ DSL Conflict Detection and Semantic Collision Resolution¶
🎯 Why Detect Conflicts?¶
As the factory scales with:
- 🧩 Multiple agents contributing DSLs
- 🧠 Forks and tenant overrides
- 🔁 Inherited templates and prompts
- 🤖 Real-time generation across domains
It becomes inevitable that DSLs:
- ❌ Overlap semantically
- 🧨 Contradict in structure or purpose
- 🧪 Interfere during injection or generation
Unresolved DSL collisions degrade generation quality, trace accuracy, and test coverage.
🔍 Types of Conflicts¶
| Conflict Type | Example | Severity |
|---|---|---|
| 🪞 ID Conflict | Two DSLs with same id but different structure |
High |
| 📚 Field Overlap | Two DSLs defining commandName with incompatible types |
Medium |
| 🧠 Semantic Collision | Two DSLs modeling the same concept with different names | Medium |
| 🧩 Injection Ambiguity | Multiple DSLs matching the same prompt intent | High |
| 🔄 Fork Drift | Forked DSL diverging too far from original without change tracking | Medium |
| 🚧 Cross-layer Conflict | Frontend DSL and backend DSL generate incompatible types | High |
🛠️ Conflict Detection Engine¶
The ConflictResolverAgent detects:
- Exact ID collision (same
idacross tenants) - Overlapping tags + domain + type
- Prompt mapping ambiguity (same prompt, multiple DSLs match > 0.9)
- Structure similarity with incompatible outputs
- Forks with critical field mutation
- Span tags overlapping with conflicting observability rules
Logged with:
conflictId: conflict-dsl-user-handler-dup
detectedBy: ConflictResolverAgent
type: id-structure-mismatch
dslIds:
- dsl-user-handler-v1.2
- dsl-user-handler-vet-v1.0
impact: high
resolution: manual review required
⚖️ Collision Resolution Strategies¶
| Strategy | Description |
|---|---|
| 🏷️ Rename + Fork | Create tenant-specific variant |
| 🧩 Merge | Reconcile fields and collapse into one DSL |
| 🛡️ Suppress | Deactivate conflicting DSL temporarily |
| 🔍 Isolate by Tag | Use disjoint tags/domains to separate matching logic |
| 🧠 Add Prompt Constraint | Prevent conflicting injection by refining requiresDSL filters |
| 🔁 Drift Tracker | Alert if fork deviates > N% from base |
🧠 Auto-Triage Rules¶
conflictPolicies:
- if: id-conflict
then: block injection + notify governance
- if: prompt-injection-ambiguity and confidence < 0.7
then: deprioritize + log
- if: fork diverges > 30%
then: trigger ForkDriftReview
📊 Conflict Heatmap & Dashboard (Planned)¶
- 🔥 Show domains with highest collision rate
- ⚖️ Breakdown by DSL type (e.g.,
blueprint,span) - 🔄 Conflict over time chart
- 📍 Trace failures due to DSL mismatch
🤖 Agents That Use Conflict Signals¶
| Agent | Usage |
|---|---|
PromptPlannerAgent |
Avoids ambiguous DSLs |
GovernanceAgent |
Flags conflicting DSLs for review |
ForkTrackerAgent |
Triggers drift alerts |
TraceValidatorAgent |
Detects runtime DSL mismatches |
KnowledgeGraphAgent |
Annotates graph nodes as conflicting or deprecated |
✅ Summary¶
Conflict detection:
- 🧠 Preserves semantic clarity and generation precision
- 🔍 Prevents trace failures and prompt ambiguity
- 🧩 Enables graceful fork evolution
- 📊 Supports governance and review workflows
- 🛠️ Resolves inconsistencies early in the generation chain
🧷 DSL-Enabled Governance, Freezing, Deprecation, and Audit Trails¶
🎯 Why Governance Matters for DSLs¶
As DSLs encode the semantic contracts of the AI Software Factory, governing their lifecycle ensures:
- 🛡️ Security and compliance
- 🔄 Controlled evolution
- ❌ Safe deprecation without regressions
- 📜 Traceable audit logs for every change
- ⚖️ Multi-tenant integrity and separation
DSL governance is the policy backbone of semantic generation.
📜 Governance Controls¶
| Control | Description |
|---|---|
frozen |
DSL is locked from further edits unless explicitly unfrozen |
deprecated |
Marked for no further use, replaced by successor |
requiresApproval |
Only usable after manual or agent review |
tenanted |
DSL is scoped to a specific tenant, isolated |
immutableFields |
Prevent structural changes to protected fields |
reviewChecklist |
DSL cannot be activated until checklist is complete |
🧊 Freezing DSLs¶
status: active
frozen: true
frozenBy: GovernanceAgent
reason: Used in 47 prompt templates and 123 trace runs
- No updates allowed unless unfrozen
- Protects critical DSLs in production
- Can be time-based or usage-based
⚰️ Deprecating DSLs¶
status: deprecated
replacedBy: dsl-user-handler-v2.0
reason: New version aligns with refactored command model
Agents using deprecated DSLs:
- ⚠️ Receive warning
- 🔁 Are guided to replacement
- 📦 PromptPlanner falls back to
replacedByautomatically
🧾 Audit Trail Structure¶
Each DSL has a full changelog:
audit:
createdAt: 2025-04-12
createdBy: VisionArchitectAgent
changes:
- at: 2025-05-01
by: DSLValidatorAgent
change: "Added field: retryPolicy"
- at: 2025-05-08
by: GovernanceAgent
change: "Frozen due to production usage"
Stored in DSLChangeLogIndex, queryable by time, field, agent, or status.
🛡️ Enforcement Agents¶
| Agent | Governance Role |
|---|---|
GovernanceAgent |
Freezing, deprecation, approvals |
AuditLogAgent |
Tracks lifecycle and publishes change events |
PolicyEngineAgent |
Evaluates DSL policies per tenant |
InjectionGuardAgent |
Prevents prompt injection of blocked DSLs |
ReviewChecklistAgent |
Enforces completion of human/agent validation before status change |
✅ Governance Policy Example¶
dslPolicies:
- type: span
domain: security
frozenIf: usedInTrace > 50 AND confidence > 0.9
- type: blueprint
requireHumanApproval: true
immutableFields: [commandName, emitsEvent]
- tenant: all
enforceReviewChecklist: true
🔄 Freeze/Unfreeze Triggers¶
| Trigger | Result |
|---|---|
| Used in > 50 successful traces | Auto-freeze |
| Conflict with newer DSL | Freeze old one, activate new |
| Tenant override detected | Freeze global, fork DSL |
| Policy update | Apply rules retroactively via audit run |
🔍 Visual Governance Tools (Planned)¶
- Status view:
draft→reviewed→active→frozen→deprecated - DSL lifecycle timelines
- Who approved or rejected which DSL
- DSL family trees with freeze/deprecate annotations
- Policy violation alerts
✅ Summary¶
Governance and audit tracking empower the platform to:
- 🔒 Lock trusted DSLs in place
- 🧯 Safely phase out legacy models
- 📜 Maintain full audit history
- 🧠 Enforce lifecycle and usage policy
- 🔍 Enable security, observability, and regulatory compliance
🌐 DSL Federation Across Projects and Agent Clusters¶
🎯 Why Federation Is Necessary¶
ConnectSoft’s AI Software Factory operates across:
- 💼 Multiple customer domains (e.g., HR, Healthcare, eCommerce)
- 🏗️ Multiple projects (microservices, libraries, UIs)
- 🤖 Multiple agent clusters (architecture, testing, observability, UX)
To support scalability, DSLs must:
- Be discoverable, composable, and scoped
- Allow reuse across agents and templates
- Enable tenant-specific specialization without duplication
- Maintain semantic coherence across clusters
DSL federation enables controlled sharing, versioning, and cross-domain interoperability.
🧩 Federation Principles¶
| Principle | Description |
|---|---|
| 📦 Shared Core | Foundational DSLs (e.g., command-handler, span) live in the shared/core namespace |
| 🌱 Scoped Forks | Each project or tenant forks DSLs as needed, preserving lineage |
| 🧠 Cross-Cluster Compatibility | DSLs contain type tags, version metadata for validation across agent clusters |
| 🔁 Lifecycle Synchronization | DSL updates propagate via trace usage and approval events |
| 🧭 Knowledge-Aware Routing | Agents query DSLs based on scoped federation rules |
🗂️ DSL Namespace Convention¶
dsl/
shared/core/blueprints/
shared/core/spans/
tenants/vetsoft/blueprints/
tenants/hrvault/forms/
domains/ecommerce/prompts/
This structure enables:
- 👁️ Clear visibility of DSL ownership and reuse
- ✅ Traceable governance paths
- 📚 Multi-layer agent lookup
📘 Example: Federated DSL Query¶
agentContext:
project: vetsoft-user-service
tenant: vetsoft
agentCluster: backend
dslQuery:
type: blueprint
domain: user-management
preferTenantDSL: true
fallbackToShared: true
→ Searches in order:
tenants/vetsoft/blueprints/shared/core/blueprints/
🧠 Agent Federation Capabilities¶
| Agent | Federation Behavior |
|---|---|
PromptPlannerAgent |
Searches across federated DSL layers based on context |
ForkTrackerAgent |
Maintains lineage between shared and scoped DSLs |
GovernanceAgent |
Enforces scope-based policies |
TraceValidatorAgent |
Resolves DSL usage by project scope |
KnowledgeGraphAgent |
Links DSLs to their federated variants in graph view |
🧠 DSL Federation Use Cases¶
| Scenario | Federation Pattern |
|---|---|
| Shared login flow | shared/core/blueprints/dsl-login-handler |
| Custom marketing span | tenants/commerce360/spans/dsl-campaign-click |
| Project-specific retry logic | domains/infra/blueprints/dsl-retry-policy |
| Prompt-style adaptation | shared/core/prompts/dsl-response-prompt-basic + fork in tenants/eduai/ |
🌐 Federation Graph Node Example¶
dslId: dsl-login-handler-v1.2
scopedCopies:
- dsl-login-handler-vetsoft-v1.2
- dsl-login-handler-eduai-v1.1
linkedTemplates:
- prompt-login-handler
usedInProjects:
- vetsoft-login-api
- hrvault-identity
confidenceAcrossScopes:
shared: 0.92
vetsoft: 0.88
eduai: 0.75
✅ Summary¶
DSL federation enables:
- 🧩 Scalable semantic reuse
- 🧠 Multi-agent, multi-tenant generation alignment
- 🔁 Version-safe propagation
- 🧭 Project + cluster scoped DSL lookups
- 📊 Unified governance with scoped enforcement