3.3 Declarative Programming Model
Editorial context, 2026-04-20: The questions, constraints, proposals, disagreements, and caveats below are reformulated from the saved research discussion. LLM recommendations remain attributed proposals, not decisions by the author or independently verified findings. Technical examples and quoted source passages retain their original wording.
declarative approach
The working interpretation is that this may fit the research direction better than making Haskell/Scala themselves the builder language.
The key shift is:
Humans and LLMs collaboratively construct a declarative program that describes the desired system, constraints, and allowed effects. A trusted engine interprets, validates, plans, and executes that program.
That gives you a clean separation:
human + LLM
│
│ create / modify
▼
declarative program
│
├─ goals
├─ facts / state
├─ constraints
├─ invariants
├─ capabilities
├─ effects
├─ policies
└─ composition rules
│
▼
compiler / planner / verifier
│
▼
execution engine
│
▼
worldThis is particularly compatible with the constraint/generativity proposal because the program can describe a space of valid executions, rather than one exact execution.
For example, instead of:
1. call model A
2. call tool B
3. if result...
4. ask human...the program could say something like:
goal:
resolve(case)
requires:
customer_identity_verified(case)
invariant:
refund_amount <= authorized_amount
effect refund(amount):
requires capability(financial_write)
requires human_approval if amount > 500
result:
resolved(case)
evidence attachedThe engine is free to determine how to satisfy this.
That freedom could include:
LLM generates hypotheses
another model evaluates them
human supplies missing information
database query provides evidence
planner chooses another route
runtime retries a failed operation
human approves an effectAs long as the resulting computation stays inside the declared constraints.
This gives you a useful duality:
program author:
constrains the solution space
engine:
explores the remaining solution spaceThat seems very close to what you’ve been looking for.
A SQL query is a simple precedent:
SELECT ...
FROM ...
WHERE ...The author specifies the result and constraints. The database chooses joins, indexes, ordering of operations, parallelization, etc.
The proposed system would extend that idea from data processing to heterogeneous computation:
Describe the valid computation; let the engine construct an execution.
The program should probably be a shared artifact
This is where LLMs become more interesting than ordinary code generators.
The recommendation is not to treat the LLM as:
prompt → generate program → executeonce.
Instead:
shared program
│
┌───────────────┼───────────────┐
│ │ │
human LLM verifier
│ │ │
amend goal propose rule reject
add constraint fill hole prove
approve effect generate plan explain
│ │ │
└───────────────┼───────────────┘
│
execute
│
observe
│
revise programSo the program is persistent state in its own right.
A human could say:
Don’t contact customers without approval.
The LLM translates that into a proposed program modification.
The system can show:
added constraint:
ContactCustomer(x)
requires Approval(CustomerCommunication)The human accepts it.
From then on it isn’t merely an instruction sitting somewhere in context. It is part of the executable semantics.
That distinction could be very important.
The third idea: don’t require a fixed workflow
This also deserves more emphasis than it currently gets.
research-direction.md already has verified self-extension:
agent proposes graph change
↓
compiler checks
↓
accepted
↓
runtime executesand asks whether an agent can safely modify its running program.
The proposal is to generalize that substantially.
There doesn’t even have to be an agent that owns the program.
Any authorized participant can propose:
new task
new participant
new branch
new hypothesis
new dependency
new operation
new invariant
new plan fragmentThe program itself is shared mutable state.
So the research question becomes:
Can coordination structure remain open-ended and dynamically constructed while every accepted change continues to satisfy global contracts?
That separates this from conventional workflow engines and is probably one of the hardest questions in the program.
Partial programs are probably necessary
Traditional programming assumes the program tells the computer how to compute something.
For human/LLM collaboration, the working interpretation is that you want incomplete declarative programs.
For example:
goal:
produce InvestmentMemo
requirements:
cite evidence
analyze downside
compare alternatives
unknown:
appropriate sources
analysis procedure
relevant alternativesThe unresolved parts are legitimate holes.
Then different participants can progressively refine the program:
Goal
↓
Goal + constraints
↓
Goal + decomposition
↓
Goal + candidate methods
↓
verified executable plan
↓
resultThis connects naturally to program synthesis.
The LLM isn’t necessarily generating the final program. It can participate in refinement:
where each step reduces the set of acceptable behaviors until execution becomes possible.
That also gives you a formal way to think about collaborative programming.
Three proposed declarative layers
The recommendation is not to make one giant DSL.
One surface language could contain three semantically distinct kinds of declarations.
First, what should become true:
goal
facts
queries
relationships
derived propertiesThis is SQL/Datalog/logic territory.
Second, what executions are acceptable:
invariants
temporal constraints
protocols
preconditions
postconditions
obligationsThis is specification / state-machine / temporal-logic territory.
Third, what may affect the world:
effects
capabilities
authority
approval
resource limitsThis is effect-system / capability / policy territory.
Then normal computation remains opaque:
generate_report(...)
classify(...)
optimize(...)
run_python(...)
ask_human(...)The declarative language constrains how those opaque computations participate.
The most important design choice
The proposal is to avoid making the DSL primarily a declarative workflow language.
For example:
A -> B -> C -> Dstill commits the author to orchestration.
The proposed more general language would describe:
initial conditions
desired conditions
available operations
constraints
invariants
authority
cost/preferencesand let the engine determine:
[ \text{current state}
\xrightarrow{\text{valid execution}}
\text{desired state} ]
Then a fixed workflow is simply one extreme:
only one valid executionwhile an open-ended LLM-assisted task might admit thousands.
That gives you one language capable of covering both.
The working interpretation is that this leads to a stronger framing of the project:
A declarative programming model for collaborative computation, where humans and generative models jointly construct and refine specifications of valid computation, while a trusted engine plans and executes within those specifications.
And the deepest primitive may therefore be neither agent nor workflow nor function.
It may be:
The DSL is how builders describe that set; humans and models refine it; the engine chooses and executes members of it.
Collaboration patterns as declarative constraints
The following retained passage comes from the framework research routes. It retains the proposal/review, delegation, and shared-reasoning examples together. The sibling comments explain their relation to the earlier model and their limits.
Collaboration patterns as declarative constraints, not workflow templates
Suppose the developer writes:
ProposalReview<ArchitectureDecision> {
proposer = AI
reviewer = Architect
committer = Architect
}A naïve framework might compile this into:
AI → human → AI → humana fixed workflow.
The working interpretation is that the related research work suggests a better interpretation.
It means:
AI may propose ArchitectureDecision
ArchitectureDecision cannot become committed
until:
Architect can inspect it
Architect has review authority
Architect explicitly commits itHow the participants arrive there remains open.
Now collaboration patterns become semantic constraints on valid collaboration.
That brings the two strands together:
collaboration pattern
↓
constraints on responsibilities,
authority and transitions
↓
many possible valid executionsThis could be quite powerful.
Likewise, Delegation could mean:
execution responsibility = AI
scope = X
success condition = Y
commit authority = Human
interruptible = truewithout prescribing how the AI executes.
And SharedReasoning might define:
Human may contribute Evidence / Judgment
AI may contribute Evidence / Hypothesis
either may Challenge
Conclusion requires Commitment(...)again without specifying the turns.
That begins to look like a genuine framework built from collaboration semantics.
Source of truth in the captured DSL article
The following closing section comes from the captured article “DSLs Enable Reliable Use of LLMs”. The preceding discussion of LLM roles during design and use is in the builder method note. The article’s final paragraph remains unchanged, including its missing final newline.
The DSL as the Source of Truth
There is a growing trend of treating prompts as the primary source of truth. A well-designed DSL fundamentally changes this dynamic. One of the key advantages I observe of working with DSLs is that the generated program itself often becomes the artifact that humans maintain. Because a DSL is dense, expressive, and largely free of incidental boilerplate, it captures the essential intent of the solution in a form that remains readable long after generation. If an LLM generates a Tickloom failure scenario from a natural language request, the resulting scenario is already expressed in the vocabulary of the domain. If the scenario needs to change next month, there is no need to recover the original prompt and regenerate everything. The DSL has enough context for LLM to know the intent and work with it. The enduring asset is not the prompt, but the DSL and the semantic model.
Library sources
- Wang et al. 2026, AgentSPEX: An Agent SPecification and EXecution Language (arXiv:2604.13346)