Files
ClawdDotNet/src/ClawdDotNet.Core/Tools/AgentToolContext.cs
T
RichardandClaude Opus 5.5 68e723a9c0 Kontrollpflicht der Leitung: Stichproben gegen das Audit (#693)
A lead looks at the runs of the agents it leads - held against the task and
against what the engine stamped, never by asking the agent.

- RunInspector (Core/Inspection): the mechanical check and first profile of
  the inspector foundation (#204). Flags failed runs, tool errors, refusals,
  unfinished calls, tasks answered with bookkeeping alone, and operations the
  agent names but never called in the run (the 2026-09-14 pattern).
- SpotChecks: picks runs per unit (rate, denser for new agents, new models and
  after a failure, daily cap), deterministic by run id; one task per lead.
- Escalation tool: spot_checks, inspect_run, check_done, propose_measure.
  Measures go to a human; nothing is carried out automatically. A security
  suspicion is its own case, not a personnel matter.
- Organisation view: settings per unit, recent checks, measures to decide.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 11:40:20 +02:00

88 lines
3.9 KiB
C#

using ClawdDotNet.Core.Memory;
using ClawdDotNet.Core.State;
using ClawdDotNet.Core.Tasks;
using Microsoft.Extensions.Logging;
namespace ClawdDotNet.Core.Tools;
public sealed record AgentToolContext(
string AgentId,
string InstanceId,
IReadOnlyDictionary<string, object?> ToolConfig,
IStateStore StateStore,
ILogger Logger,
CancellationToken CancellationToken,
string? WorkspacePath = null,
string? SharedWorkspacePath = null,
IAgentMessageRouter? MessageRouter = null,
IMemoryRepository? Memory = null,
ITaskRepository? Tasks = null,
/// <summary>
/// Wer an diesem Aufruf schon beteiligt ist. Werkzeuge, die einen anderen Agenten
/// beauftragen, reichen die Kette weiter — sonst kann die Engine einen Zyklus
/// nicht von einer neuen Delegation unterscheiden. Siehe <see cref="DelegationChain"/>.
/// </summary>
DelegationChain? Delegation = null
)
{
/// <summary>
/// Die Freigabestelle hat diesen Aufruf geprueft und zugelassen - als erlaubte Operation,
/// per Dauerfreigabe oder als einzeln freigegebener Vorschlag (#641). Ein Werkzeug darf
/// seine eigene Rechtepruefung dann auslassen; sonst wuerde ein freigegebenes ALTER eines
/// Agenten, der nur schreiben darf, erst nach der Freigabe am Werkzeug scheitern.
/// Ohne Freigabestelle bleibt es <c>false</c>, und das Werkzeug prueft selbst.
/// </summary>
public bool FreigabeGeprueft { get; init; }
/// <summary>
/// #683: The organisation at the time of the call. Tools that let an agent address
/// another — a task assignment, for instance — check the address book here, so it cannot
/// be walked around. <c>null</c> in tests and outside the engine: no structure, no limit.
/// </summary>
public Organisation.OrgChart? Organisation { get; init; }
/// <summary>
/// #715: The calling agent's trust tier, from its tools. Tools that let an agent write to
/// someone above it check the way up here. Standard in tests and outside the engine.
/// </summary>
/// <summary>#689: The desk for escalations, conflicts and decisions. <c>null</c> outside the engine.</summary>
public Cases.ICaseDesk? Cases { get; init; }
/// <summary>#687: Approvals a lead decides for the agents below it. <c>null</c> outside the engine.</summary>
public Staging.ILeadApprovals? Approvals { get; init; }
/// <summary>#698: The units' doctrines. <c>null</c> outside the engine.</summary>
public Organisation.IDoctrineStore? Doctrines { get; init; }
/// <summary>#693: The spot checks of a lead. <c>null</c> outside the engine.</summary>
public Inspection.ISpotChecks? SpotChecks { get; init; }
/// <summary>#654: Where code runs — never in the main process. Unavailable under Windows.</summary>
public Sandbox.ISandboxRunner? Sandbox { get; init; }
/// <summary>#717: Special budgets — set up by an approved request_budget.</summary>
public Budget.ISpecialBudgetRepository? SpecialBudgets { get; init; }
/// <summary>
/// #720: Which version of a shared file each agent read. Tools that replace files in a
/// shared workspace check it first. <c>null</c> in tests and outside the engine: no check.
/// </summary>
public Files.FileLedger? Files { get; init; }
/// <summary>
/// #719: The history of the workspaces. Tools that change a file keep the version before
/// and journal the change, with this call's agent and run. <c>null</c>: no history.
/// </summary>
public Files.FileHistory? History { get; init; }
/// <summary>#697: The run this call belongs to — for stamping where something came from.</summary>
public string? RunId { get; init; }
/// <summary>#697: The task that run works on, if it was started for one.</summary>
public string? RunTaskId { get; init; }
public global::ClawdDotNet.Core.Organisation.AgentTrust Trust { get; init; }
= global::ClawdDotNet.Core.Organisation.AgentTrust.Standard;
}