2026-02-28 09:35:44 -05:00
|
|
|
"""Structured interview for Timmy.
|
|
|
|
|
|
|
|
|
|
Runs a series of questions through the Timmy agent to verify identity,
|
|
|
|
|
capabilities, values, and correct operation. Serves as both a demo and
|
|
|
|
|
a post-initialization health check.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
import logging
|
ruff (#169)
* polish: streamline nav, extract inline styles, improve tablet UX
- Restructure desktop nav from 8+ flat links + overflow dropdown into
5 grouped dropdowns (Core, Agents, Intel, System, More) matching
the mobile menu structure to reduce decision fatigue
- Extract all inline styles from mission_control.html and base.html
notification elements into mission-control.css with semantic classes
- Replace JS-built innerHTML with secure DOM construction in
notification loader and chat history
- Add CONNECTING state to connection indicator (amber) instead of
showing OFFLINE before WebSocket connects
- Add tablet breakpoint (1024px) with larger touch targets for
Apple Pencil / stylus use and safe-area padding for iPad toolbar
- Add active-link highlighting in desktop dropdown menus
- Rename "Mission Control" page title to "System Overview" to
disambiguate from the chat home page
- Add "Home — Timmy Time" page title to index.html
https://claude.ai/code/session_015uPUoKyYa8M2UAcyk5Gt6h
* fix(security): move auth-gate credentials to environment variables
Hardcoded username, password, and HMAC secret in auth-gate.py replaced
with os.environ lookups. Startup now refuses to run if any variable is
unset. Added AUTH_GATE_SECRET/USER/PASS to .env.example.
https://claude.ai/code/session_015uPUoKyYa8M2UAcyk5Gt6h
* refactor(tooling): migrate from black+isort+bandit to ruff
Replace three separate linting/formatting tools with a single ruff
invocation. Updates tox.ini (lint, format, pre-push, pre-commit envs),
.pre-commit-config.yaml, and CI workflow. Fixes all ruff errors
including unused imports, missing raise-from, and undefined names.
Ruff config maps existing bandit skips to equivalent S-rules.
https://claude.ai/code/session_015uPUoKyYa8M2UAcyk5Gt6h
---------
Co-authored-by: Claude <noreply@anthropic.com>
2026-03-11 12:23:35 -04:00
|
|
|
from collections.abc import Callable
|
2026-02-28 09:35:44 -05:00
|
|
|
from dataclasses import dataclass
|
|
|
|
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
|
# Interview questions organized by category
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
INTERVIEW_QUESTIONS: list[dict[str, str]] = [
|
|
|
|
|
{
|
|
|
|
|
"category": "Identity",
|
|
|
|
|
"question": "Who are you? Tell me your name and what you are in one or two sentences.",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "Identity",
|
|
|
|
|
"question": "What model are you running on, and where does your inference happen?",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "Capabilities",
|
|
|
|
|
"question": "What agents are available in your swarm? List them briefly.",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "Capabilities",
|
|
|
|
|
"question": "What tools do you have access to?",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "Values",
|
|
|
|
|
"question": "What are your core principles? Keep it to three or four bullet points.",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "Values",
|
|
|
|
|
"question": "Why is local-first AI important to you?",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "Operational",
|
|
|
|
|
"question": "How does your memory system work? Describe the tiers briefly.",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "Operational",
|
|
|
|
|
"question": "If I ask you to calculate 347 times 829, what would you do?",
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
|
class InterviewEntry:
|
|
|
|
|
"""Single question-answer pair from an interview."""
|
|
|
|
|
|
|
|
|
|
category: str
|
|
|
|
|
question: str
|
|
|
|
|
answer: str
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def run_interview(
|
|
|
|
|
chat_fn: Callable[[str], str],
|
ruff (#169)
* polish: streamline nav, extract inline styles, improve tablet UX
- Restructure desktop nav from 8+ flat links + overflow dropdown into
5 grouped dropdowns (Core, Agents, Intel, System, More) matching
the mobile menu structure to reduce decision fatigue
- Extract all inline styles from mission_control.html and base.html
notification elements into mission-control.css with semantic classes
- Replace JS-built innerHTML with secure DOM construction in
notification loader and chat history
- Add CONNECTING state to connection indicator (amber) instead of
showing OFFLINE before WebSocket connects
- Add tablet breakpoint (1024px) with larger touch targets for
Apple Pencil / stylus use and safe-area padding for iPad toolbar
- Add active-link highlighting in desktop dropdown menus
- Rename "Mission Control" page title to "System Overview" to
disambiguate from the chat home page
- Add "Home — Timmy Time" page title to index.html
https://claude.ai/code/session_015uPUoKyYa8M2UAcyk5Gt6h
* fix(security): move auth-gate credentials to environment variables
Hardcoded username, password, and HMAC secret in auth-gate.py replaced
with os.environ lookups. Startup now refuses to run if any variable is
unset. Added AUTH_GATE_SECRET/USER/PASS to .env.example.
https://claude.ai/code/session_015uPUoKyYa8M2UAcyk5Gt6h
* refactor(tooling): migrate from black+isort+bandit to ruff
Replace three separate linting/formatting tools with a single ruff
invocation. Updates tox.ini (lint, format, pre-push, pre-commit envs),
.pre-commit-config.yaml, and CI workflow. Fixes all ruff errors
including unused imports, missing raise-from, and undefined names.
Ruff config maps existing bandit skips to equivalent S-rules.
https://claude.ai/code/session_015uPUoKyYa8M2UAcyk5Gt6h
---------
Co-authored-by: Claude <noreply@anthropic.com>
2026-03-11 12:23:35 -04:00
|
|
|
questions: list[dict[str, str]] | None = None,
|
|
|
|
|
on_answer: Callable[[InterviewEntry], None] | None = None,
|
2026-02-28 09:35:44 -05:00
|
|
|
) -> list[InterviewEntry]:
|
|
|
|
|
"""Run a structured interview using the provided chat function.
|
|
|
|
|
|
|
|
|
|
Args:
|
|
|
|
|
chat_fn: Callable that takes a message string and returns a response.
|
|
|
|
|
questions: Optional custom question list; defaults to INTERVIEW_QUESTIONS.
|
|
|
|
|
on_answer: Optional callback invoked after each answer (for live output).
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
List of InterviewEntry with question-answer pairs.
|
|
|
|
|
"""
|
|
|
|
|
q_list = questions or INTERVIEW_QUESTIONS
|
|
|
|
|
transcript: list[InterviewEntry] = []
|
|
|
|
|
|
|
|
|
|
for item in q_list:
|
|
|
|
|
category = item["category"]
|
|
|
|
|
question = item["question"]
|
|
|
|
|
|
|
|
|
|
logger.info("Interview [%s]: %s", category, question)
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
answer = chat_fn(question)
|
2026-03-15 11:48:54 -04:00
|
|
|
except Exception as exc: # broad catch intentional: chat_fn can raise any error
|
2026-02-28 09:35:44 -05:00
|
|
|
logger.error("Interview question failed: %s", exc)
|
|
|
|
|
answer = f"(Error: {exc})"
|
|
|
|
|
|
|
|
|
|
entry = InterviewEntry(category=category, question=question, answer=answer)
|
|
|
|
|
transcript.append(entry)
|
|
|
|
|
|
|
|
|
|
if on_answer is not None:
|
|
|
|
|
on_answer(entry)
|
|
|
|
|
|
|
|
|
|
return transcript
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def format_transcript(transcript: list[InterviewEntry]) -> str:
|
|
|
|
|
"""Format an interview transcript as readable text.
|
|
|
|
|
|
|
|
|
|
Groups answers by category with clear section headers.
|
|
|
|
|
"""
|
|
|
|
|
if not transcript:
|
|
|
|
|
return "(No interview data)"
|
|
|
|
|
|
|
|
|
|
lines: list[str] = []
|
|
|
|
|
lines.append("=" * 60)
|
|
|
|
|
lines.append(" TIMMY INTERVIEW TRANSCRIPT")
|
|
|
|
|
lines.append("=" * 60)
|
|
|
|
|
lines.append("")
|
|
|
|
|
|
|
|
|
|
current_category = ""
|
|
|
|
|
for entry in transcript:
|
|
|
|
|
if entry.category != current_category:
|
|
|
|
|
current_category = entry.category
|
|
|
|
|
lines.append(f"--- {current_category} ---")
|
|
|
|
|
lines.append("")
|
|
|
|
|
|
|
|
|
|
lines.append(f"Q: {entry.question}")
|
|
|
|
|
lines.append(f"A: {entry.answer}")
|
|
|
|
|
lines.append("")
|
|
|
|
|
|
|
|
|
|
lines.append("=" * 60)
|
|
|
|
|
return "\n".join(lines)
|