SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2606.15359 · 2026

DiRecT: Safe Diffusion-Based Planning via Receding-Horizon Denoising

Navid Azizan, Zeyang Li, Paolo Giaretta

arXiv · PDF · Open in the Atlas

Code that ran

9 of 12 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 4 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 5 failures of our instrument; 3 no recorded run), measured 2026-11-23; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2606.15359.json · badge: /api/ran/2606.15359.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
azizanlab/DiRecT canonical (classifier label)
classifier basis: census
9 ran · 3 no recorded run
FunctionStatusWhere it lives
apply_conditioning Ran
ran; our contract draft was wrong, not the code
azizanlab/DiRecT/d3il/model.py
code served (permissive licence) · get_code("b3d593fb33f79ac5")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 3, dtype family float, shape (2, 5, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# x: tensor that will be indexed and have values assigned
# The function indexes x[:, t, action_dim:] where t comes from conditions.keys()
# and assigns val.clone() to it
# So x needs shape (batch_size, time_steps, feature_dim)
# with feature_dim > action_dim
batch_size = 2
time_steps = 5
action_dim = 2
feature_dim = 4  # must be > action_dim

x = torch.randn(batch_size, time_steps, feature_dim)

# conditions: dict mapping timestep t to a tensor val
# The function does x[:, t, action_dim:] = val.clone()
# So val should have shape (batch_size, feature_dim - action_dim)
condition_shape = (batch_size, feature_dim - action_dim)
conditions = {
    1: torch.randn(condition_shape),
    3: torch.randn(condition_shape),
}

ARGS = {
    "x": x,
    "conditions": conditions,
    "action_dim": action_dim,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (2, 5, 4) — shape (2, 5, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
apply_overrides Ran
ran; our contract draft was wrong, not the code
azizanlab/DiRecT/maze2d/config.py
code served (permissive licence) · get_code("67e0bf797f8c5a5e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Config. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import argparse
from dataclasses import dataclass, field
from typing import Any, Dict, List, Optional, Tuple

@dataclass
class DatasetConfig:
    env_name: str = 'maze2d-large-v1'
    horizon: int = 384
    normalizer: str = 'LimitsNormalizer'
    max_path_length: int = 40000
    max_n_episodes: int = 1200
    termination_penalty: float = 0.0
    preprocess_fns: List[str] = field(default_factory=lambda: ['maze2d_set_terminals'])

@dataclass
class DiffusionConfig:
    prediction_type: str = 'data'
    lr: float = 0.001
    scheduler_T_max: int = 10000
    noise_schedule_kwargs: Dict[str, Any] = field(default_factory=dict)
    antithetic_sampling: bool = False
    clip_denoised: bool = True
    dim: int = 32
    dim_mults: Tuple[int, ...] = (1, 4, 8)

@dataclass
class TrainConfig:
    accelerator: str = 'auto'
    devices: int = 1
    n_train_steps: int = 2000000
    gradient_accumulation_steps: int = 1
    log_every_n_steps: int = 10
    batch_size: int = 32
    num_workers: int = 0
    enable_checkpointing: bool = True
    ckpt_save_freq: int = 50000
    ema_decay: float = 0.995
    render_freq: int = 10000
    render_n_samples_per_condition: int = 5
    render_n_batches: int = 3
    compile_fullgraph: bool = False
    compile_dynamic: bool = False
    compile_disable: bool = False

@dataclass
class EvalConfig:
    num_random_repeats: int = 10
    device: str = 'cuda'
    use_float64: bool = True
    fixed_start: bool = True
    verbose_saving: bool = False
    save_generation: bool = False
    save_trajectories: bool = False
    batch_size: int = 1
    dynamics_path: Optional[str] = None
    weights_path: Optional[str] = None

@dataclass
class PolicyConfig:
    obstacle_type: str = 'broad'
    sampling_steps: int = 32
    time_discretization: str = 'uniform'
    time_discretization_kwargs: Dict[str, Any] = field(default_factory=lambda: {'prior_time_offset': 0.001})
    sampler_interpolation_coeff: float = 1.0
    env_objective: List[str] = field(default_factory=lambda: ['distance'])
    env_constraints: List[str] = field(default_factory=lambda: ['ellipses', 'dynamics', 'input_saturation'])
    proxy_objective_value_weight: float = 2.0
    proxy_constraint_penalty_weight: float = 0.1
    constraint_margin: float = 0.0
    policy_kwargs: Dict[str, Any] = field(default_factory=dict)

@dataclass
class Config:
    seed: int = 0
    log_folder: str = 'logs'
    exp_name: str = 'debug'
    overwrite: bool = True
    dataset: DatasetConfig = field(default_factory=DatasetConfig)
    diffusion: DiffusionConfig = field(default_factory=DiffusionConfig)
    train: TrainConfig = field(default_factory=TrainConfig)
    eval: EvalConfig = field(default_factory=EvalConfig)
    policy: PolicyConfig = field(default_factory=PolicyConfig)

cfg = Config()

namespace = argparse.Namespace(
    seed=42,
    exp_name='test_exp',
    log_folder='test_logs',
    overwrite=False,
    weights_path='/path/to/weights.pt',
    dynamics_path='/path/to/dynamics.pt',
    device='cpu',
    num_random_repeats=5,
    policy=None,
    obstacle_type='narrow',
    sampling_steps=16,
    batch_size=64,
    n_train_steps=1000000
)

ARGS = {
    'cfg': cfg,
    'args': namespace
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
yaml — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Config — a Config output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Config output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
check_violation Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
azizanlab/DiRecT/d3il/obstacles.py
code served (permissive licence) · get_code("74155c61aeefe6d1")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
import torch

torch.manual_seed(0)

# observation: should be array-like with at least 4 elements
# observation[2] is x coordinate, observation[3] is y coordinate
observation = np.array([0.1, 0.2, 0.5, 0.15], dtype=np.float32)

# constraint_name: string key for CONSTRAINT_SETS
constraint_name = 'novel'

ARGS = {
    'observation': observation,
    'constraint_name': constraint_name
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
cosine_beta_schedule Ran
ran, honoured the contract we drafted
azizanlab/DiRecT/maze2d/unet.py
code served (permissive licence) · get_code("7011797bad785f0e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 1, dtype family float, shape (10,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
import torch

torch.manual_seed(0)

ARGS = {
    "timesteps": 10,
    "s": 0.008,
    "dtype": torch.float32,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 1, dtype family float, shape (10,) — shape (10,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
count_constraints Ran
ran, honoured the contract we drafted
azizanlab/DiRecT/d3il/obstacles.py
code served (permissive licence) · get_code("9ed6876e93030387")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

from dataclasses import dataclass

@dataclass
class CircularObstacle:
    """Circular keep-out zone defined by center and radius."""
    center: tuple
    radius: float

@dataclass
class PlanarObstacle:
    """Half-plane constraint: slope * x + intercept - y >= 0 is the feasible side."""
    point_a: tuple
    point_b: tuple

    @property
    def slope(self):
        return (self.point_b[1] - self.point_a[1]) / (self.point_b[0] - self.point_a[0])

    @property
    def intercept(self):
        return self.point_b[1] - self.slope * self.point_b[0]

    def violated(self, x, y):
        return y > self.slope * x + self.intercept

PILLARS = [CircularObstacle(center=(0.5, -0.1), radius=0.03), CircularObstacle(center=(0.425, 0.08), radius=0.025), CircularObstacle(center=(0.575, 0.08), radius=0.025), CircularObstacle(center=(0.35, 0.26), radius=0.025), CircularObstacle(center=(0.5, 0.26), radius=0.025), CircularObstacle(center=(0.65, 0.26), radius=0.025)]

NOVEL_CIRCULAR = [CircularObstacle(center=(0.5, -0.1), radius=0.08)]

NOVEL_PLANAR = [PlanarObstacle(point_a=(0.8, -0.3), point_b=(0.575, 0.5)), PlanarObstacle(point_a=(0.2, -0.3), point_b=(0.425, 0.5))]

CONSTRAINT_SETS = {'novel': {'circular': PILLARS + NOVEL_CIRCULAR, 'planar': NOVEL_PLANAR}}

def count_constraints(constraint_name):
    if constraint_name == '' or constraint_name not in CONSTRAINT_SETS:
        return 0
    cs = CONSTRAINT_SETS[constraint_name]
    return len(cs['circular']) + len(cs['planar'])

ARGS = {
    'constraint_name': 'novel'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
pad_t_like_x Ran
ran; our contract draft was wrong, not the code
azizanlab/DiRecT/maze2d/diffusion.py
code served (permissive licence) · get_code("884297d5659039e2")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 4, dtype family float, shape (1, 1, 1, 1) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Create a small multidimensional tensor to serve as x
# Shape: (B=2, C=4, H=3, W=5) - a 4D tensor
x = torch.randn(2, 4, 3, 5, dtype=torch.float32)

# Test with different types of t
# Case 1: float scalar
t_float = 0.5

# Case 2: int scalar
t_int = 3

# Case 3: 1D tensor with batch dimension
t_tensor = torch.tensor([0.1, 0.2], dtype=torch.float32)

# Use the float case for the main ARGS
ARGS = {
    "t": t_float,
    "x": x,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (1, 1, 1, 1) — shape (1, 1, 1, 1) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
parse_args Ran
ran; our contract draft was wrong, not the code
azizanlab/DiRecT/maze2d/config.py
code served (permissive licence) · get_code("be2c8012ad7ef8bc")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Namespace. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import sys
from io import StringIO

# Mock sys.argv to simulate command-line arguments
sys.argv = [
    'script.py',
    '--config', 'configs/config.yaml',
    '--seed', '42',
    '--exp-name', 'test_experiment',
    '--log-folder', '/tmp/logs',
    '--overwrite',
    '--weights-path', '/tmp/weights.pt',
    '--dynamics-path', '/tmp/dynamics.pt',
    '--device', 'cpu',
    '--num-random-repeats', '5',
    '--policy', 'random',
    '--obstacle-type', 'circular',
    '--sampling-steps', '100',
    '--batch-size', '32',
    '--n-train-steps', '1000',
]

ARGS = {
    'description': 'Test argument parser'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Namespace — a Namespace output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Namespace output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
parse_maze Ran
ran, honoured the contract we drafted
azizanlab/DiRecT/maze2d/d4rl/maze_model.py
code served (permissive licence) · get_code("ea95f69594dd2e9c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 2, dtype family int, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

WALL = 10
EMPTY = 11
GOAL = 12

def parse_maze(maze_str):
    lines = maze_str.strip().split('\\')
    width, height = (len(lines), len(lines[0]))
    maze_arr = np.zeros((width, height), dtype=np.int32)
    for w in range(width):
        for h in range(height):
            tile = lines[w][h]
            if tile == '#':
                maze_arr[w][h] = WALL
            elif tile == 'G':
                maze_arr[w][h] = GOAL
            elif tile == ' ' or tile == 'O' or tile == '0':
                maze_arr[w][h] = EMPTY
            else:
                raise ValueError('Unknown tile type: %s' % tile)
    return maze_arr

maze_str = "# G \\ O 0 #"

ARGS = {
    "maze_str": maze_str
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family int, shape (2, 4) — shape (2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
to_np Ran
ran, honoured the contract we drafted
azizanlab/DiRecT/maze2d/unet.py
code served (permissive licence) · get_code("d5f32b4735abfc33")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# The function to_np takes a single parameter 'x' which can be Any type
# It checks if x is a torch tensor, and if so, detaches, moves to CPU, and converts to numpy
# Otherwise it just returns x as-is

# Test case 1: A torch tensor (the main use case)
tensor_input = torch.randn(2, 4)

# Test case 2: Could also be a numpy array or other type
numpy_input = np.array([[1, 2, 3], [4, 5, 6]])

# We need to provide one value for 'x' parameter
# Let's use the tensor case since that's what the function is designed to handle
ARGS = {
    "x": torch.randn(2, 4)
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
extract Not yet run
unverified (harvested, no recorded run)
azizanlab/DiRecT/maze2d/unet.py
code served (permissive licence) · get_code("7646c45e520c6b9b")
How it ran

no invocation recorded.

load_config Not yet run
unverified (harvested, no recorded run)
azizanlab/DiRecT/maze2d/config.py
code served (permissive licence) · get_code("54232f8ef1f294f5")
How it ran

no invocation recorded.

point_maze Not yet run
unverified (harvested, no recorded run)
azizanlab/DiRecT/maze2d/d4rl/maze_model.py
code served (permissive licence) · get_code("833ce25fac15ba58")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 0 later) and 10 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
apply_conditioning 9 other papers
9 dated earlier · 2 only as an assembly brick
2210.15629 (2022-10)
Language Control Diffusion: Efficiently Scaling through Space, Time, and Tasks
2305.18459 (2023-05)
Diffusion Model is an Effective Planner and Data Synthesizer for Multi-Task Reinforcement Learning
2405.04235 (2024-05)
LTLDoG: Satisfying Temporally-Extended Symbolic Constraints for Safe Diffusion-based Planning
and 6 more not named here
parse_maze 3 other papers
3 dated earlier
2004.07219 (2020-04)
D4RL: Datasets for Deep Data-Driven Reinforcement Learning
2211.09817 (2022-11)
On the Effect of Pre-training for Transformer in Different Modality on Offline Reinforcement Learning
2312.01473 (2023-12)
Regularity as Intrinsic Reward for Free Play

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Diffusion models have emerged as powerful tools for planning and control by learning multimodal distributions over actions and trajectories. Yet reliable inferencetime safety enforcement remains a key barrier to their deployment in safety-critical tasks. Existing approaches typically project each denoising iterate onto the feasible set, even though constraints are defined only on the final clean trajectory. Enforcing feasibility on noisy intermediate samples can therefore overconstrain the sampling dynamics, substantially degrading sample quality. To address this limitation, we introduce DiRecT (Diffusion-based planning via Receding-horizon denoising with Terminal constraints), a training-free algorithm for constrained sampling from diffusion models via stochastic optimal control (SOC). DiRecT enforces constraints only on the final clean sample, avoiding unnecessary restrictions on the intermediate denoising dynamics. Inspired by model predictive control, we derive a principled receding-horizon surrogate for the otherwise intractable constrained SOC formulation, yielding an efficient algorithm that cleanly separates stochastic denoising from constraint satisfaction, progressively steering samples toward feasible final trajectories without distorting the learned diffusion dynamics. Furthermore, DiRecT is highly flexible: it can leverage off-the-shelf or domain-specific optimizers, incorporate priors over environment dynamics, and optimize additional soft rewards. Extensive experiments on safe planning benchmarks demonstrate that DiRecT substantially improves deployment safety and task performance over existing diffusion-based planning baselines. Our code is available at https://github.com/azizanlab/DiRecT.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2606.15359")
get_code_for_paper("2606.15359")
have("2606.15359")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2606.15359.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2606.15359.svg)](https://syntology.ai/paper/2606.15359)

Connect an agent — have() is free.