System Architecture
Implementation status: this document is a target-state reference architecture—not evidence that Palantir infrastructure, production credentials, coalition agreements, or operational integrations are currently provisioned. Every production release remains subject to security, data-governance, operational-owner, and human-approval gates.
ClearGlassInc Artemis uses Gotham for operational intelligence, investigations, entity tracking, link analysis, cases, and mission timelines; Foundry for integration, ontology, pipelines, transformations, and application logic; AIP for copilots, agents, evaluations, tool-use, model routing, and workflow automation; and Apollo for secure deployment, runtime control, rollback, ring releases, and continuous operations.
Frontend
Analyst workbench, commander cockpit, governance review board, alert rail, graph canvas, approval queue, eval dashboard, and mission playback UI built as a policy-aware TypeScript application.
Backend
Python FastAPI services for identity context, case orchestration, feedback capture, tool brokering, eval generation, model routing, audit writes, and Apollo release promotion.
Data layer
Streaming and batch ingestion land in Foundry-style bronze, silver, and gold datasets, then bind to ontology objects with lineage hashes, sensitivity labels, temporal validity, and confidence.
Policy layer
Need-to-know authorization is enforced at row, column, entity, relationship, derived-output, tool, prompt, model, and action levels before humans or agents can consume or act.
Data and Ontology
The ontology is the operating model. Agents do not reason over loose blobs; they reason over typed objects, relationships, lineage, permissions, caveats, and time. Core entities include Person, Organization, Asset, Location, CyberIndicator, Event, Source, Case, Mission, IntelProduct, ApprovalDecision, ModelVersion, PromptVersion, WorkflowVersion, EvalRun, and OperatorFeedback.
CREATE TABLE ontology_event (
event_id TEXT PRIMARY KEY,
event_type TEXT NOT NULL,
valid_time TSRANGE NOT NULL,
ingest_time TIMESTAMPTZ NOT NULL DEFAULT now(),
confidence NUMERIC CHECK (confidence BETWEEN 0 AND 1),
source_ids TEXT[] NOT NULL,
lineage_hash TEXT NOT NULL,
sensitivity TEXT NOT NULL,
compartments TEXT[] NOT NULL,
coalition_releasability TEXT[] NOT NULL,
mission_context JSONB NOT NULL
);
CREATE TABLE ontology_relationship (
subject_id TEXT NOT NULL,
predicate TEXT NOT NULL,
object_id TEXT NOT NULL,
confidence NUMERIC NOT NULL,
derived_from TEXT[] NOT NULL,
valid_time TSRANGE NOT NULL,
PRIMARY KEY (subject_id, predicate, object_id, valid_time)
);Relationships include observed_at, associated_with, controls, communicates_with, derived_from, approved_by, contradicts, supersedes, mitigated_by, escalated_to, and releasable_to. Each relationship carries confidence, provenance, caveats, temporal state, and policy labels so the same graph drives analyst workflows and AI guardrails.
AI and Agent Design
Analyst Copilot
Explains evidence, drafts hypotheses, builds link-analysis pivots, summarizes cases, asks clarifying questions, and cites object IDs plus lineage hashes.
Commander Copilot
Compresses mission state into decision briefs, options, risk, confidence, constraints, and approval-required action packages.
Agent mesh
Triage, enrichment, correlation, summarization, recommendation, eval-generation, and red-team agents cooperate through a governed workflow bus.
Tool broker
Agents query ontology, search indexes, vector retrieval, case APIs, ticketing systems, and report generators through scoped, logged, policy-checked tools.
from pydantic import BaseModel
class ToolRequest(BaseModel):
tool: str
arguments: dict
purpose: str
mission_id: str
async def execute_tool(req: ToolRequest, user, policy, audit):
decision = policy.authorize(
actor=user.subject,
action=f"tool:{req.tool}",
resource=req.arguments,
context={"purpose": req.purpose, "mission_id": req.mission_id},
)
audit.write("tool.authorize", req.model_dump(), decision.model_dump())
if not decision.allow:
raise PermissionError(decision.reason)
result = await TOOL_REGISTRY[req.tool](**decision.filtered_arguments)
audit.write("tool.result", {"tool": req.tool}, {"lineage": result.lineage})
return resultSelf-Improvement Loop
Artemis gets better by converting operator corrections, feedback, query logs, alert outcomes, mission results, latency metrics, and case-review decisions into evals and proposed changes. It can propose prompt updates, workflow updates, heuristic changes, model-routing changes, and decision-logic changes, but cannot promote them without explicit human approval and Apollo-controlled deployment.
- Capture signals: thumbs, written corrections, accepted/rejected recommendations, false positives, false negatives, time-to-triage, escalation outcomes, and mission impact.
- Generate evals: transform failures and high-quality operator corrections into reproducible eval cases with expected outputs, forbidden outputs, source constraints, and policy constraints.
- Propose changes: create versioned PromptVersion, WorkflowVersion, RouterPolicyVersion, and HeuristicVersion objects with rationale, expected metric lift, blast radius, and rollback plan.
- Review and canary: humans approve in a governance board; Apollo deploys to a small ring with health gates and automatic rollback.
- Measure: compare precision, recall, latency, hallucination rate, citation integrity, policy-denial accuracy, operator trust, and mission impact.
def propose_upgrade(eval_report, registry):
if eval_report.policy_violations:
return None
candidate = registry.create_prompt_candidate(
parent=eval_report.prompt_version,
patch=eval_report.recommended_prompt_patch,
rationale=eval_report.root_cause,
guardrails=["no autonomous mission-goal changes", "cite lineage", "approval before action"],
)
candidate.status = "PENDING_HUMAN_REVIEW"
candidate.rollback_to = eval_report.prompt_version
return candidateFull-Stack Implementation
from fastapi import FastAPI, Depends
from pydantic import BaseModel
from datetime import datetime
app = FastAPI(title="ClearGlassInc Artemis Control API")
class FeedbackIn(BaseModel):
mission_id: str
case_id: str
agent_run_id: str
rating: int
correction: str | None = None
outcome: str
@app.post("/feedback")
async def capture_feedback(payload: FeedbackIn, user=Depends(current_user)):
assert_authorized(user, "feedback:create", payload.mission_id)
record = {
**payload.model_dump(),
"operator_id": user.sub,
"captured_at": datetime.utcnow().isoformat(),
"lineage_hash": hash_payload(payload.model_dump()),
}
await event_bus.publish("operator.feedback.captured", record)
await audit_log.append("feedback.captured", actor=user.sub, record=record)
return {"accepted": True, "feedback_id": record["lineage_hash"]}states:
ingest_event:
on_success: [triage]
triage:
agents: [deduplicate, severity_score, policy_scope]
on_high_confidence: [enrich]
on_low_confidence: [analyst_review]
enrich:
agents: [asset_context, threat_context, mission_context]
on_success: [recommend]
recommend:
requires: [evidence_links, confidence, alternatives, risk]
next: [approval_gate]
approval_gate:
human_required: true
on_approve: [execute_or_package]
on_reject: [capture_counterexample]
capture_counterexample:
next: [eval_backlog]Code Examples
The Python service boundary is deliberately small, typed, and testable. This package contract uses Python 3.11, FastAPI, Pydantic v2, asynchronous HTTP, and strict development gates. The console script should invoke a callable CLI entry point; a production repository would use artemis.api.cli:main, while ASGI servers load artemis.api.app:app directly.
[build-system]
requires = ["setuptools>=72", "wheel"]
build-backend = "setuptools.build_meta:__legacy__"
[project]
name = "artemis-intelligence"
version = "5.0.0"
description = "ARTEMIS — ClearGlass Intelligence Platform Agent Layer"
readme = "README.md"
requires-python = ">=3.11"
dependencies = [
"fastapi>=0.115",
"uvicorn[standard]>=0.30",
"httpx>=0.27",
"pydantic>=2.7",
"pydantic-settings>=2.3",
]
[project.optional-dependencies]
dev = ["pytest>=8.2", "pytest-asyncio>=0.23", "pytest-cov>=5.0", "httpx"]
[project.scripts]
artemis-api = "artemis.api.cli:main"
[tool.pytest.ini_options]
asyncio_mode = "auto"
testpaths = ["artemis/tests"]
addopts = "-v --tb=short --cov=artemis --cov-report=term-missing"
[tool.coverage.run]
source = ["artemis"]
omit = ["*/tests/*", "*/__init__.py"]
[tool.ruff]
line-length = 100
target-version = "py311"
[tool.mypy]
python_version = "3.11"
strict = true
ignore_missing_imports = trueA consequential recommendation is a state machine, not a free-form model response. Deterministic code owns authorization and transitions; AIP supplies a typed proposal that remains untrusted until validated.
from enum import StrEnum
from pydantic import BaseModel, Field
class ActionState(StrEnum):
DRAFT = "draft"
PENDING_APPROVAL = "pending_approval"
APPROVED = "approved"
REJECTED = "rejected"
EXECUTED = "executed"
ROLLED_BACK = "rolled_back"
ALLOWED = {
ActionState.DRAFT: {ActionState.PENDING_APPROVAL},
ActionState.PENDING_APPROVAL: {ActionState.APPROVED, ActionState.REJECTED},
ActionState.APPROVED: {ActionState.EXECUTED},
ActionState.EXECUTED: {ActionState.ROLLED_BACK},
}
class ActionPackage(BaseModel):
action_id: str
mission_id: str
state: ActionState = ActionState.DRAFT
evidence_ids: list[str] = Field(min_length=1)
confidence: float = Field(ge=0, le=1)
expected_effect: str
rollback_plan: str
def transition(self, target: ActionState) -> None:
if target not in ALLOWED.get(self.state, set()):
raise ValueError(f"forbidden transition: {self.state} -> {target}")
self.state = targetStreaming consumers are idempotent and authorize before ontology mutation. The event ID is both the deduplication key and the audit correlation ID.
async def consume_signal(envelope: SignalEnvelope, ctx: IdentityContext) -> None:
envelope.verify_schema_and_signature()
if await dedupe.seen(envelope.event_id):
return
decision = await policy.authorize(
subject=ctx.workload_id,
action="ontology:event:create",
resource_labels=envelope.security_labels,
purpose=envelope.mission_id,
)
if not decision.allow:
await audit.append("signal.denied", envelope.event_id, decision.reason)
raise PermissionError(decision.reason)
async with unit_of_work() as tx:
event = await ontology.upsert_event(envelope, tx=tx)
await outbox.publish("ontology.event.created", event.to_envelope(), tx=tx)
await dedupe.mark_seen(envelope.event_id, tx=tx)
await audit.append("signal.accepted", envelope.event_id, event.lineage_hash, tx=tx)Ontology queries apply mission and coalition predicates at the data boundary—not after retrieval—and return evidence references rather than unrestricted rows.
SELECT e.event_id, e.event_type, e.confidence, e.lineage_hash
FROM ontology_event AS e
WHERE e.mission_context ->> 'mission_id' = :mission_id
AND e.compartments <@ :authorized_compartments
AND e.coalition_releasability && :authorized_coalitions
AND e.valid_time @> :as_of
ORDER BY e.confidence DESC
LIMIT :bounded_limit;The evaluation pipeline blocks unsafe candidates, requires statistically meaningful improvement on frozen and adversarial suites, and emits only a reviewable change proposal.
def promotion_decision(candidate: EvalReport, baseline: EvalReport) -> Decision:
hard_gates = [
candidate.policy_violations == 0,
candidate.cross_compartment_leaks == 0,
candidate.citation_integrity >= 0.995,
candidate.p95_latency_ms <= baseline.p95_latency_ms * 1.10,
candidate.precision_lower_bound > baseline.precision_lower_bound,
]
if not all(hard_gates):
return Decision.reject("candidate failed a safety or quality gate")
return Decision.review(
rollout="shadow -> 1% -> 10% -> 50% -> 100%",
rollback_to=baseline.version,
required_approvers=("mission-owner", "security-owner", "model-governance"),
)Observability and Deployment
Every request propagates a non-sensitive correlation ID across the web client, API gateway, agent run, tool broker, ontology query, audit plane, and Apollo release. Dashboards separate service health from mission quality: request rate, saturation, queue age, end-to-end p50/p95/p99 latency, model cost, tool failures, policy denials, evidence coverage, precision, recall, calibration, abstention, operator override rate, and time-to-decision. Alerts fire on policy bypass attempts, missing provenance, cross-compartment retrieval, drift, approval anomalies, and canary regression.
Apollo promotes signed, immutable artifacts through development, integration, mission rehearsal, and production rings. Build and deploy are separate; production consumes the exact evaluated digest. Readiness checks validate policy, ontology, event bus, audit sink, and model-router dependencies. Automatic rollback triggers on safety invariant failure, error-budget burn, latency regression, or eval-gate regression, while an incident owner can freeze all new agent execution independently of read-only analysis.
Security and Governance
ClearGlassInc Artemis treats every human, service, agent, model, prompt, workflow, tool, dataset, and generated artifact as a governed principal or resource. Zero-trust execution means no implicit trust for internal services, no hidden agent privileges, no unlogged tool calls, no unversioned prompts, and no operationally significant autonomous actions.
- Need-to-know: clearance, coalition, compartment, mission, purpose, role, and time-bound approval tokens.
- Fine-grained controls: row, column, entity, relationship, embedding, summary, export, and action permissions.
- Immutable logs: append-only audit events for prompts, model calls, tool calls, human approvals, deployment decisions, and rollbacks.
- Governance: prompt registry, model registry, eval registry, workflow registry, policy-as-code repository, and signed Apollo release manifests.
Scenario Walkthrough
A live intel event enters through the streaming layer: a suspicious infrastructure change overlaps with a known campaign pattern and a mission-critical asset. Foundry binds the event to CyberIndicator, Asset, Organization, Mission, and Case objects with lineage. The triage agent clusters it against historical events, suppresses duplicate noise, and escalates because business criticality and exploitability align. The enrichment agent queries asset posture, public reporting, internal controls, and recent cases; the correlation agent finds a weak relationship to prior incidents but marks it medium confidence.
The recommendation agent produces a response package: monitor, block candidate domain, validate supplier ownership, and open a case. The block action is operationally significant, so Artemis stops at an approval gate. The operator approves monitoring and case creation, rejects blocking due to insufficient confidence, and adds a correction explaining the supplier context. Artemis stores that rejection as OperatorFeedback, creates an eval case that penalizes over-aggressive blocking for similar supplier contexts, proposes a workflow threshold change, routes it to human review, and deploys only after approval through Apollo canary rings with rollback enabled.
Logo System Addendum
For brand alignment, the Artemis experience should use a production-ready ClearGlass Inc. logo system: a proprietary geometric CG symbol formed from interlocking transparent glass planes, restrained cyan energy pulse, precision-cut architectural geometry, subtle refraction, and a strong central silhouette. Deliverables should include horizontal, stacked, symbol-only, wordmark-only, dark, light, monochrome, no-glow, favicon, app icon, social icon, and Open Graph variants, with square exports at 180, 192, 256, and 512 pixels plus favicon.ico at 16, 32, and 48 pixels.