DivineTree.DCP 1.0.0

dotnet add package DivineTree.DCP --version 1.0.0
                    
NuGet\Install-Package DivineTree.DCP -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DivineTree.DCP" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DivineTree.DCP" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="DivineTree.DCP" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DivineTree.DCP --version 1.0.0
                    
#r "nuget: DivineTree.DCP, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DivineTree.DCP@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DivineTree.DCP&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=DivineTree.DCP&version=1.0.0
                    
Install as a Cake Tool

DivineTree.DCP

DataMolecule Carrier Pattern — Sovereign Intelligence Carrier for Agentic Systems

NuGet License: MIT .NET 9


The Problem

In agentic systems, data moves across service boundaries — from intake to parsing, from validation to decision, from decision to audit. At each boundary, context is lost.

RAG reconstructs context. DataEnvelope carries it permanently.

Traditional approaches:

  • Pass raw data between services — context stripped at every boundary
  • Reconstruct context from logs — expensive, lossy, unreliable
  • Embed context in payload — couples business data to infrastructure concerns

The DataMolecule Carrier Pattern solves this by making the envelope — not the payload — the unit of intelligence.


What Is DCP?

The DataMolecule Carrier Pattern wraps every domain payload in a DataEnvelope<T> that carries four intelligence layers:

Layer Interface The Question It Answers
Lineage ILineageChain What transformations has this data undergone?
Context IEnvelopeContext Where did this data come from? When? Who created it?
Intent IIntentHints Why is this data being processed?
Observability IObservabilityHooks How much did this transformation cost?

The envelope travels with the payload across every service boundary. When the workflow completes, the envelope contains a complete, tamper-evident record of everything that happened to the data.


Installation

dotnet add package DivineTree.DCP

Quick Start

using DivineTree.DCP;

// 1. Create your context
var context = new MyEnvelopeContext(
    correlationId: traceId,
    workflowId:    applicationId,
    facadeId:      "AF-LoanAgent");

// 2. Wrap your payload in an envelope
var envelope = new DataEnvelope<LoanApplication>(loanApplication, context)
{
    Lineage = new MyLineageChain(),
    Intent  = new MyIntentHints("verify_income_for_underwriting")
};

// 3. Record transformations as the payload moves through the system
envelope.AppendLineageStep(new MyLineageStep(
    stepName:      "document_ingested",
    actorId:       "AF-LoanAgent",
    outputVersion: "1.0.0"));

// 4. Pass the envelope — not the raw payload — across boundaries
await documentParser.ParseAsync(envelope);

// 5. Audit summary for persistence — never persist the full envelope
var auditRecord = envelope.ToAuditSummary();

Envelope Anatomy

DataEnvelope<T>
├── EnvelopeId       — Unique ID for this envelope instance
├── EnvelopeVersion  — Schema version for forward compatibility
├── Payload          — Your domain data (T) — immutable by convention
├── Context          — IEnvelopeContext — situational awareness
├── Lineage          — ILineageChain — transformation history
├── Intent           — IIntentHints — advisory business purpose
└── Observability    — IObservabilityHooks — resource and trace metrics

Implementing the Interfaces

DivineTree.DCP ships interfaces and DataEnvelope<T> only. Your platform provides the implementations. This is intentional — the pattern is technology-agnostic.

Minimal IEnvelopeContext:

public sealed class MyContext : IEnvelopeContext
{
    public string CorrelationId { get; }
    public string WorkflowId   { get; }
    public string FacadeId     { get; }
    public string SchemaVersion => "1.0.0";
    public DateTime CreatedAt  { get; } = DateTime.UtcNow;
    public IReadOnlyDictionary<string, string> Properties { get; }
        = new Dictionary<string, string>();

    public MyContext(string correlationId, string workflowId, string facadeId)
    {
        CorrelationId = correlationId;
        WorkflowId    = workflowId;
        FacadeId      = facadeId;
    }
}

Minimal ILineageStep:

public sealed record MyLineageStep(
    string StepName,
    string ActorId,
    string OutputVersion,
    string? InputVersion = null) : ILineageStep
{
    public DateTime OccurredAt { get; } = DateTime.UtcNow;
    public IReadOnlyDictionary<string, string> Metadata { get; }
        = new Dictionary<string, string>();
}

Minimal ILineageChain:

public sealed class MyLineageChain : ILineageChain
{
    private readonly List<ILineageStep> _steps = new();
    public ILineageStep? Origin  => _steps.Count > 0 ? _steps[0]  : null;
    public ILineageStep? Latest  => _steps.Count > 0 ? _steps[^1] : null;
    public IReadOnlyList<ILineageStep> Steps => _steps.AsReadOnly();
    public int StepCount => _steps.Count;

    public void AppendStep(ILineageStep step)
    {
        ArgumentNullException.ThrowIfNull(step);
        _steps.Add(step);
    }

    public IReadOnlyList<ILineageStep> GetStepsByActor(string actorId) =>
        _steps.Where(s => s.ActorId.Equals(actorId, StringComparison.OrdinalIgnoreCase))
              .ToList().AsReadOnly();

    public IReadOnlyList<ILineageStep> GetStepsByName(string stepName) =>
        _steps.Where(s => s.StepName.Equals(stepName, StringComparison.OrdinalIgnoreCase))
              .ToList().AsReadOnly();
}

Lineage Step Naming Convention

Step names must be snake_case and describe the transformation, not the actor.

Correct Incorrect
document_parsed AzureDocumentParser
field_validated ValidationEngine
contract_rejected CL-ContractAgent
decision_rendered DecisionAgent

The actor is captured in ActorId. The step name describes what happened to the data.


Intent Is Always Advisory

IIntentHints.IsAdvisoryOnly must always return true. Intent hints describe business purpose — they never drive routing, conditional logic, or control flow.

// Correct — code makes decisions, intent describes purpose
if (riskScore > threshold)
    await hitlService.EscalateAsync(envelope);

// Wrong — intent driving control flow — never do this
if (envelope.Intent.PrimaryGoal == "high_risk_review")
    await hitlService.EscalateAsync(envelope);

Creation Responsibility

The domain component that originates a workflow creates the DataEnvelope<T>. Platform infrastructure — message buses, orchestrators, state stores — never creates envelopes on behalf of domain components.


Audit and Persistence

Only ToAuditSummary() should be persisted. The full envelope may contain PII in the payload.

// Correct — persist the audit summary only
await auditLogger.WriteAsync(envelope.ToAuditSummary());

// Wrong — payload may contain PII
await repository.SaveAsync(envelope);

NullLineageChain

NullLineageChain.Instance is the default Lineage value — a no-op singleton. All operations are no-ops. StepCount always returns 0. Use it when lineage tracking is not required.


Standard Observability Metric Keys

Key Unit Description
compute_ms milliseconds Total compute time
tokens_used count LLM tokens consumed
cost_usd USD Estimated cost
memory_bytes bytes Peak memory usage
payload_bytes bytes Serialised payload size
lineage_steps count Steps recorded — auto-incremented by AppendLineageStep

Cross-Language Support

The DCP pattern is language-agnostic. DivineTree.DCP is the C# / .NET 9 reference implementation.

Language Package Status
C# / .NET 9 DivineTree.DCP (this package) v1.0.0
Java com.divinetree:dcp Planned
Python divinetree-dcp Planned
Go github.com/DivineTreeDesigns/dcp Planned

Reference Implementation

MajdUAE — Sovereign Agentic Platform for UAE FDI Processing — is the reference implementation of DCP at production scale: 8 actor-agents, 9 entity-agents, 21 lineage steps, 3-tier HITL model.

Repository: github.com/DivineTreeDesigns/UAEAgentic


Design Principles

  1. The envelope travels with the payload. Never strip it at a service boundary.
  2. The payload is immutable by convention. Do not mutate T after envelope creation.
  3. Intent is always advisory. IsAdvisoryOnly is always true. No exceptions.
  4. Only ToAuditSummary() is persisted. The full envelope stays in memory.
  5. The domain creates the envelope. Infrastructure never creates envelopes.
  6. Lineage is append-only. Steps cannot be removed, reordered, or modified.

License

MIT — see LICENSE.


DivineTreeDesigns — Sovereign Confidential

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on DivineTree.DCP:

Package Downloads
DivineTree.ICP

The Intelligence Carrier Pattern (ICP) — a sovereign intelligence carrier for agentic orchestration systems. ICPEnvelope<TIntent> carries agentic goals, reasoning, and routing decisions across orchestration boundaries. Extends DivineTree.DCP — peer to DataEnvelope<T> for domain data. The C# .NET 9 reference implementation of the ICP pattern.

DivineTree.DCPVault

Sovereign Intelligence Accumulation Layer — Domain Corpus Vault for DCP Envelopes. Persists sanitised, PII-free vault records to accumulate a domain corpus for training and analytics.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 253 5/13/2026

v1.0.0 — Initial sovereign release.