feat(llm): add OpenAI adapter, entity archive policy, process chapters 5-7

Add OpenAIAdapter for the OpenAI chat completions API (apikey-chatgpt.txt
or OPENAI_API_KEY). Set default model to arcee-ai/trinity-large-preview:free
for the infospace pipeline and increase max_tokens from 4096 to 8192.

Reprocess chapter 05 with Trinity Large (was Gemini: 1 truncated entity,
now 19 complete entities). Process chapters 06 (Aurora Alpha, 10 entities)
and 07 (Trinity Large, 15 entities including regenerated violent-policy.md).
Canonical set now at 85 unique entities.

Add entity archive policy: entities are never silently deleted. Retired
entities move to output/entities/archive/ with a dated reason header.
New CLI option: --archive-entity <slug> --reason "...". The --list
output shows the archive count alongside the canonical set.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-11 23:39:44 +01:00
parent 880c1d1374
commit 41773f1320
68 changed files with 6500 additions and 136 deletions

View File

@@ -12,6 +12,7 @@ _PROVIDERS: Dict[str, str] = {
"openrouter": "markitect.llm.openrouter.OpenRouterAdapter",
"claude-code": "markitect.llm.claude_code.ClaudeCodeAdapter",
"gemini": "markitect.llm.gemini.GeminiAdapter",
"openai": "markitect.llm.openai.OpenAIAdapter",
}
@@ -25,10 +26,10 @@ def create_adapter(
"""Instantiate an :class:`LLMAdapter` for the given *provider*.
Args:
provider: ``"openrouter"``, ``"claude-code"``, or ``"gemini"``.
provider: ``"openrouter"``, ``"claude-code"``, ``"gemini"``, or ``"openai"``.
model: Model name (passed to the adapter constructor).
api_key: Explicit API key (OpenRouter / Gemini).
system_prompt: Optional system prompt (OpenRouter / Gemini).
api_key: Explicit API key (OpenRouter / Gemini / OpenAI).
system_prompt: Optional system prompt (OpenRouter / Gemini / OpenAI).
**kwargs: Extra keyword arguments forwarded to the adapter.
Returns:
@@ -51,7 +52,7 @@ def create_adapter(
mod = importlib.import_module(module_path)
cls = getattr(mod, class_name)
if provider in ("openrouter", "gemini"):
if provider in ("openrouter", "gemini", "openai"):
return cls(model=model, api_key=api_key, system_prompt=system_prompt, **kwargs)
elif provider == "claude-code":
return cls(model=model, **kwargs)