Reference v1.0.4

API Documentation

Complete reference for service interfaces, data models, WorkflowPipeline node types and Coclico 1.0.4 configuration.

Overview

This documentation covers all public Coclico interfaces. Current version: 1.0.4.

  • Main namespace: Coclico.Services
  • Models: Coclico.Models
  • ViewModels: Coclico.ViewModels
  • Framework: .NET 10, C# preview, WPF-UI 4.2

ICacheService

Thread-safe in-memory cache with per-entry TTL. Implemented by CacheService (singleton).

public interface ICacheService
{
    T? Get<T>(string key);
    void Set<T>(string key, T value, TimeSpan? ttl = null);
    bool TryGet<T>(string key, out T? value);
    void Invalidate(string key);
    void InvalidateAll();
}

IDynamicTracer

Real-time system telemetry. Implemented by DynamicTracerService (singleton).

public record TelemetrySnapshot(
    DateTimeOffset Timestamp,
    double CpuPercent,      // 0.0 – 100.0
    long RamUsedMb,
    long RamTotalMb,
    double NetworkInKbps,
    double NetworkOutKbps
);

IRollbackService

Snapshot management for AI patch rollback. Must be called before any File.WriteAllText triggered by AI.

public interface IRollbackService
{
    Task<Guid> CreateSnapshotAsync(string filePath, CancellationToken ct = default);
    Task RestoreAsync(Guid snapshotId, CancellationToken ct = default);
    IReadOnlyList<SnapshotInfo> GetSnapshots();
    Task PruneAsync(TimeSpan maxAge);
}

IOptimizationEngine

Autonomous optimization engine (Phase 2). Runs a 30-second cycle loop in the background.

public interface IOptimizationEngine
{
    Task StartAsync(CancellationToken ct);
    Task StopAsync();
    OptimizationResult? LastResult { get; }
    event Action<OptimizationResult>? CycleCompleted;
}

ISourceAnalyzer

Roslyn-based AST analysis of C# source (Phase 3.3). Computes CC, Halstead metrics and Maintainability Index per method.

public record MethodMetrics(
    string MethodName,
    int CyclomaticComplexity,   // CC alert threshold: > 10
    double HalsteadVolume,
    double HalsteadDifficulty,
    double HalsteadEffort,
    double MaintainabilityIndex  // 0–100, higher is better
);

IAuditLog

Append-only NDJSON audit journal including full AI decision context for LLM traceability.

ISecurityPolicy

Controls which operations Flow Chain nodes are allowed to perform. Non-suppressible hardcoded defaults cannot be overridden by configuration.

AppSettings

Main configuration model. Managed by SettingsService, persisted to %APPDATA%\Coclico\settings.json.

public class AppSettings
{
    public string Language { get; set; } = "en";
    public string Theme { get; set; } = "Dark";
    public string AccentColor { get; set; } = "#6366F1";
    public LaunchMode LaunchMode { get; set; } = LaunchMode.Manual;
    public bool AutoPatcherAuditOnly { get; set; } = true;
    public int AuditRetentionDays { get; set; } = 90;
    public bool UseVulkanAcceleration { get; set; } = true;
}

NodeType — 28 node types

Process (KillProcess, LaunchProcess, RestartService, StopService, StartService), Registry (SetRegistryValue, DeleteRegistryKey), Files (CreateDirectory, DeleteFile, MoveFile, CopyFile), Scripts (RunScript), Cleaning (CleanTemp, EmptyRecycleBin, FlushDns, ClearBrowserCache, ClearEventLogs, ClearPrefetch, ClearThumbnailCache, ClearWindowsErrorReports), Memory (FreeRam, SetWorkingSet), Network (PingHost, DisableNetworkAdapter, EnableNetworkAdapter), Control (Wait, Condition, Log, Notification).

ConditionOperator — 10 operators

Equals, NotEquals, GreaterThan, LessThan, GreaterOrEqual, LessOrEqual, Contains, NotContains, IsEmpty, IsNotEmpty.

OnErrorAction

  • ContinueNext (default) — log error, continue to next node
  • StopChain — stop execution immediately
  • SkipToEnd — skip intermediate nodes, execute only the last node

Deep Clean categories — 10

Windows Temp, Browser Cache, System Logs, Recycle Bin, User Temp, Thumbnail Cache, Windows Error Reports, Old Installers, DNS Cache (dnsapi.dll), Prefetch files.

Application sources — 8

Registry HKLM, Registry HKCU, Steam (libraryfolders.vdf), Epic Games (JSON manifests), GOG Galaxy (SQLite), Ubisoft Connect, EA App (XML manifests), Rockstar Games Launcher, Microsoft Store (AppX packages via PowerShell).

File structure

%APPDATA%\Coclico\
├── settings.json
├── security-policy.json
├── flow-chains\        # WorkflowPipeline definitions
├── audit\              # NDJSON audit log
├── logs\               # Serilog rolling daily (14 days)
├── rollback\           # IRollbackService snapshots
└── resource\model\
    └── IA-support-chat.gguf

Audit NDJSON format

Each line is an independent JSON object including timestamp, action type, AI context (model, prompt hash, response tokens, latency), and patch validation result (original CC, patched CC, Digital Twin approval).