Skip to content

Simplify LLM API key configuration#6

Merged
rejojer merged 2 commits into
devfrom
simplify-llm-api-key-config
Apr 7, 2026
Merged

Simplify LLM API key configuration#6
rejojer merged 2 commits into
devfrom
simplify-llm-api-key-config

Conversation

@rejojer
Copy link
Copy Markdown
Member

@rejojer rejojer commented Apr 7, 2026

Summary

  • Remove llm_api_key_env from config, hardcode reading LLM_API_KEY env var
  • Simplifies setup: users just set LLM_API_KEY in .env, no config field needed
  • Provider-specific env vars (OPENAI_API_KEY, ANTHROPIC_API_KEY, etc.) still work via LiteLLM auto-detection
  • okb init has one less interactive prompt

Test plan

  • All config tests pass (test_config.py 6/6)
  • Verified LLM_API_KEY works with OpenAI, Anthropic, and Gemini
  • Verified provider-specific env vars still work without LLM_API_KEY

rejojer added 2 commits April 8, 2026 06:14
- Hardcode reading LLM_API_KEY env var instead of indirecting through config
- Remove llm_api_key_env from DEFAULT_CONFIG, okb init prompts, and config.yaml
- Provider-specific env vars (OPENAI_API_KEY, etc.) still work via LiteLLM auto-detection
- One less config field, one less okb init step
@rejojer rejojer force-pushed the simplify-llm-api-key-config branch from c781a30 to 55444d3 Compare April 7, 2026 22:15
@rejojer
Copy link
Copy Markdown
Member Author

rejojer commented Apr 7, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

@rejojer rejojer merged commit 018342e into dev Apr 7, 2026
@rejojer rejojer deleted the simplify-llm-api-key-config branch April 7, 2026 22:24
KylinMountain added a commit that referenced this pull request May 24, 2026
Architectural review (4 parallel Opus auditors) found that the skill_runner
core was already generic, but the deck SURFACE was still fused to
Editorial Monocle. Fixed:

* validator: now takes optional `grammar` param (DeckGrammar TypedDict);
  skill-agnostic by default (only checks file present, parses, ≥5
  slides, self-contained). Third-party deck skills (guizang, swiss)
  now pass validation cleanly. Editorial-specific rules opt-in via
  `EDITORIAL_MONOCLE_GRAMMAR`. (finding #2)
* skills/openkb-deck-editorial/SKILL.md: declares its grammar +
  output_path_template under `od:` frontmatter — `run_skill` reads
  these and applies them post-run.
* run_skill: now honors frontmatter `od.mode`, `od.output_path_template`,
  `od.deck_grammar`. When mode=="deck" and template is set, the runner
  injects the path into intent, verifies the file exists post-run, and
  runs validate_deck with the skill's grammar. Validation result is
  returned via new SkillRunResult dataclass. (findings #4, #5)
* `openkb deck new --skill <name>`: CLI flag accepts any installed deck
  skill (default openkb-deck-editorial). guizang and swiss now usable
  from the scripted CLI, not only freeform chat. (finding #1)
* `/deck new --skill <name>` chat slash: same flag, parsed positionally
  alongside --critique. (finding #1)
* tests/test_read_kb_file.py: 13 new tests mirroring test_write_kb_file
  for the read-side allow-list. Pins refusal of `.openkb/config.yaml`,
  `.env`, `raw/`, `..` traversal, absolute paths. (finding #6)
* Generator deck branch: no longer calls validate_deck directly; just
  propagates run_deck_create's SkillRunResult.validation up. Validation
  is now a property of "this skill declared mode=deck", not of "this
  CLI path was taken".

Existing tests updated:
* tests/test_deck_validator.py: explicit grammar arg on Editorial-
  specific tests; added test_guizang_shape_passes_generic_mode +
  test_missing_cover_ignored_in_generic_mode to pin both modes.
* tests/test_deck_creator.py: mocks return SkillRunResult; new
  test_run_deck_create_honors_skill_name_override for --skill flag.
* tests/test_generator.py: deck dispatch test mocks SkillRunResult.

Below-threshold findings deferred:
* Generator if/else → registry (score 70) — works, just not extensible
  via plugin; future.
* Iteration backup in chat freeform path (score 75) — needs write_kb_file
  hook; separate change.
* run_skill / scan_local_skills / _handle_slash_critique direct tests
  (scores 60-70) — covered indirectly by integration; can add later.

Regression: 538 tests pass (was 523 pre-fix; net +15 = 13 new
read_kb_file tests + 2 new validator-mode tests).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant