It is difficult to know how much you can rely on a final result when it depends on a long chain of different tasks. If one piece of the chain is unreliable, it makes everything built on top of it less trustworthy.
It calculates a reliability score for a task by looking at the trust levels of every step that leads up to it. It tracks how that trust fades as it moves through a sequence of dependencies.
It provides a clear way to see how much risk is carried through a complex chain of work.
It was run inside an isolated container with no network access. This is the exact command and the real output it produced — captured process output, not written by a model.
$ python3 recursive_trust_decay.py Task A trust score: 0.8880 Task B trust score: 0.7000 Task C trust score: 0.6000 Task D trust score: 1.0000 With critical path impact multiplier (1.5): Task A critical score: 1.9980 Task B critical score: 1.0500 Task C critical score: 0.9000 Task D critical score: 1.0000
A screenshot of that run.
A clean run proves this does what is shown above, in a CPU-only sandbox. It is a small research demo — not a production tool, and nothing here was published anywhere.
All of it — 48 lines, one file, standard library only.
# recursive_trust_decay.py
def calculate_trust_score(graph, node, decay_factor=0.8, critical_path_multiplier=1.0, depth=0):
"""
Recursive function to calculate trust score based on dependency chain
"""
if not graph.get(node):
return 1.0 # Base case: leaf node with no dependencies
total_score = 0.0
for dependency, reliability in graph[node].items():
# Recursively calculate score for each dependency
dependency_score = calculate_trust_score(graph, dependency, decay_factor, critical_path_multiplier, depth + 1)
# Apply decay based on depth and reliability
weighted_score = reliability * (decay_factor ** depth) * dependency_score
total_score += weighted_score
# Apply critical path multiplier if this node is part of a critical path
return total_score * critical_path_multiplier
def main():
"""
Example usage of the trust score calculation
"""
# Example dependency graph with reliability scores (0-1)
dependency_graph = {
'A': {'B': 0.9, 'C': 0.8}, # Task A depends on B(0.9) and C(0.8)
'B': {'D': 0.7}, # Task B depends on D(0.7)
'C': {'D': 0.6}, # Task C depends on D(0.6)
'D': {} # Leaf node (no dependencies)
}
# Calculate scores for each node
for node in dependency_graph:
score = calculate_trust_score(dependency_graph, node)
print(f"Task {node} trust score: {score:.4f}")
# Example with critical path multiplier
print("\nWith critical path impact multiplier (1.5):")
for node in dependency_graph:
score = calculate_trust_score(dependency_graph, node, critical_path_multiplier=1.5)
print(f"Task {node} critical score: {score:.4f}")
if __name__ == "__main__":
main()