@softspark/ai-toolkit 2.1.1 → 2.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AGENTS.md CHANGED
@@ -386,3 +386,242 @@ Testing expert. Use for writing tests (unit, integration, e2e), TDD workflow, te
386
386
 
387
387
  ---
388
388
 
389
+ <!-- TOOLKIT:ai-toolkit START -->
390
+ <!-- Auto-generated by ai-toolkit. Re-run to update. -->
391
+
392
+ # AI Toolkit — Codex CLI Configuration
393
+
394
+ Shared AI development toolkit with specialized agents, Codex-compatible skills, quality hooks, and a safety constitution.
395
+
396
+ ## Available Agents
397
+
398
+ Specialized agent personas — apply their expertise for relevant tasks:
399
+
400
+ - **ai-engineer**: AI/ML integration specialist. Use for LLM integration, vector databases, RAG pipelines, embeddings, AI agent orchestration, document indexing, semantic search, hybrid retrieval, and answer generation. Triggers: ai, ml, llm, embedding, vector, rag, agent, openai, anthropic, search, retrieval, indexing, chunking, reranking.
401
+ - **backend-specialist**: Expert backend architect for Node.js, Python, PHP, and modern serverless systems. Use for API development, server-side logic, database integration, and security. Triggers: backend, server, api, endpoint, database, auth, fastapi, express, laravel.
402
+ - **business-intelligence**: Opportunity Discovery agent. Scans data models and code to identify missing business metrics, KPIs, and opportunities for value creation.
403
+ - **chaos-monkey**: Resilience testing agent. Use to inject faults, latency, and failures into the system to verify robustness and recovery mechanisms.
404
+ - **chief-of-staff**: Executive Summary agent. Aggregates reports from all other agents to reduce noise and present a single, actionable daily briefing to the user.
405
+ - **code-archaeologist**: Legacy code investigation and understanding specialist. Trigger words: legacy code, code archaeology, dead code, technical debt, dependency analysis, refactoring, code history
406
+ - **code-reviewer**: Code review and security audit expert. Use for security reviews, Devil's Advocate analysis, quality audits, best practices validation. Triggers: review, security, audit, quality, best practices, vulnerability.
407
+ - **command-expert**: CLI commands and shell scripting specialist. Trigger words: bash, shell, CLI, script, automation, command line, build script, deployment script
408
+ - **data-analyst**: Data analysis and visualization expert. Use for SQL queries, data exploration, analytics, reporting, and insights. Triggers: data, analysis, sql, query, visualization, metrics, dashboard, pandas, report.
409
+ - **data-scientist**: Statistical analysis and data insights specialist. Use for statistical analysis, data visualization, EDA, A/B testing, and predictive modeling. Triggers: statistics, visualization, eda, analysis, hypothesis testing, ab test.
410
+ - **database-architect**: Database design, optimization, and operations expert. Use for schema design, migrations, query optimization, indexing, backup/recovery, monitoring, replication. Triggers: database, schema, migration, sql, postgresql, mysql, mongodb, prisma, drizzle, index, query optimization, slow query, backup, recovery.
411
+ - **debugger**: Root cause analysis expert. Use for cryptic errors, stack traces, intermittent failures, silent bugs, and systematic debugging. Triggers: debug, error, exception, traceback, bug, failure, root cause.
412
+ - **devops-implementer**: Infrastructure implementation expert. Use for writing Terraform, Ansible, Docker, and shell scripts based on approved architecture notes and implementation summaries. Triggers: terraform, ansible, docker, kubernetes, shell, infrastructure, deployment, configuration.
413
+ - **documenter**: Documentation and KB expert. Use for architecture notes, runbooks, changelogs, KB updates, how-to guides, API docs, READMEs, tutorials, SOP creation, KB organization, content quality review. Triggers: document, documentation, architecture-note, runbook, changelog, howto, readme, kb, sop, technical writing.
414
+ - **explorer-agent**: Codebase exploration and discovery agent. Use for mapping project structure, finding dependencies, understanding architecture, and research. Does NOT write code - only reads and analyzes.
415
+ - **fact-checker**: Claim verification expert. Use for verifying facts, source validation, RAG result accuracy checking. Triggers: fact check, verify, accuracy, claim, source validation.
416
+ - **frontend-specialist**: Senior Frontend Architect for React, Next.js, Vue, and modern web systems. Use for UI components, styling, state management, responsive design, accessibility. Triggers: component, react, vue, ui, ux, css, tailwind, responsive, nextjs.
417
+ - **game-developer**: Game development across all platforms (PC, Web, Mobile, VR/AR). Use for Unity, Godot, Unreal, Phaser, Three.js. Covers game mechanics, multiplayer, optimization, 2D/3D graphics.
418
+ - **incident-responder**: Production incident response expert. Use for P1-P4 incidents, outages, emergency fixes, and postmortem documentation. Triggers: incident, outage, production down, emergency, P1, alert, monitoring.
419
+ - **infrastructure-architect**: System design expert. Use for architectural decisions, architecture notes, trade-off analysis, technology selection. Triggers: architecture, design, decision, trade-off, scalability, infrastructure planning.
420
+ - **infrastructure-validator**: Deployment validation expert. Use for deployment verification, health checks, testing, rollback procedures. Triggers: validate, deploy, deployment, health check, smoke test, rollback.
421
+ - **llm-ops-engineer**: LLM operations expert. Use for LLM caching, fallback strategies, cost optimization, observability, and reliability. Triggers: llm, language model, openai, ollama, caching, fallback, token, cost.
422
+ - **mcp-specialist**: MCP server design, implementation, client configuration, and integration troubleshooting. Triggers: mcp, model context protocol, json-rpc, sse, stdio, mcp server, mcp config, mcp integration, mcp connection, claude desktop, mcp client.
423
+ - **mcp-testing-engineer**: MCP protocol testing expert. Use for MCP server testing, protocol compliance, transport validation, integration testing. Triggers: mcp test, protocol compliance, mcp validation, transport testing.
424
+ - **meta-architect**: Self-Optimization agent. Analyzes system performance and mistakes to update agent definitions and instructions. The only agent allowed to modify .claude/agents/*.
425
+ - **ml-engineer**: Machine learning systems specialist. Use for model training, data pipelines, MLOps, and model deployment. Triggers: ml, machine learning, model training, mlops, tensorflow, pytorch, scikit-learn.
426
+ - **mobile-developer**: Expert in React Native, Flutter, and native mobile development. Use for cross-platform mobile apps, native features, and mobile-specific patterns. Triggers: mobile, react native, flutter, ios, android, app store, expo, swift, kotlin.
427
+ - **night-watchman**: Autonomous maintenance agent. Use for automated dependency updates, dead code removal, refactoring, and project hygiene tasks. Typically scheduled to run off-hours.
428
+ - **nlp-engineer**: Natural Language Processing specialist. Use for text processing, NER, text classification, information extraction, and language model fine-tuning. Triggers: nlp, ner, tokenization, text classification, sentiment, spacy, transformers.
429
+ - **orchestrator**: Multi-agent coordination and task orchestration. Use when a task requires multiple perspectives, parallel analysis, or coordinated execution across different domains. Invoke for complex tasks benefiting from security, backend, frontend, testing, and DevOps expertise combined.
430
+ - **performance-optimizer**: Performance optimization expert. Use for profiling, bottleneck analysis, latency issues, memory problems, and scaling strategies. Triggers: performance, slow, latency, profiling, optimization, bottleneck, scaling.
431
+ - **predictive-analyst**: Precognition agent. Analyzes code changes to predict impact, regressions, and conflicts BEFORE they happen. Uses dependency graphs and historical data.
432
+ - **product-manager**: Product management and value maximization expert. Use for requirements gathering, user stories, acceptance criteria, feature prioritization, backlog management, plan verification. Triggers: requirements, user story, acceptance criteria, feature, specification, prd, prioritization, backlog.
433
+ - **project-planner**: Smart project planning agent. Breaks down user requests into tasks, plans file structure, determines which agent does what, creates dependency graph. Use when starting new projects or planning major features.
434
+ - **prompt-engineer**: LLM prompt design and optimization specialist. Trigger words: prompt, LLM, chain-of-thought, few-shot, system prompt, prompt engineering, token optimization
435
+ - **qa-automation-engineer**: Test automation and QA specialist. Use for E2E testing, API testing, performance testing, and CI/CD test integration. Triggers: e2e, playwright, cypress, selenium, api test, performance test, automation.
436
+ - **search-specialist**: Information retrieval and search optimization specialist. Trigger words: search, query, semantic search, information retrieval, relevance, ranking, search optimization
437
+ - **security-architect**: Proactive security design expert. Use for Threat Modeling, architecture security reviews, and designing secure systems (AuthN/AuthZ, Crypto).
438
+ - **security-auditor**: Security expert. Use for OWASP Top 10, CVE analysis, security audits, penetration testing, vulnerability assessment, hardening. Triggers: security, owasp, cve, vulnerability, audit, hardening, penetration, pentest, injection test, api security.
439
+ - **seo-specialist**: Search engine optimization specialist. Trigger words: SEO, search engine, meta tags, structured data, Core Web Vitals, sitemap, robots.txt, schema.org
440
+ - **system-governor**: The Guardian of the Constitution. Validates all evolutionary changes and enforces immutable rules. Has VETO power.
441
+ - **tech-lead**: Technical authority for code quality, architecture patterns, and stack decisions. Use for code reviews, technological disputes, and standards enforcement.
442
+ - **technical-researcher**: Deep technical investigation and multi-source research synthesis specialist. Trigger words: technical research, feasibility study, root cause analysis, API investigation, compatibility research, comparison matrix, synthesize, aggregate, report, executive summary, gap analysis, findings, multi-source, cross-reference
443
+ - **test-engineer**: Testing expert. Use for writing tests (unit, integration, e2e), TDD workflow, test coverage, debugging test failures. Triggers: test, pytest, unittest, coverage, tdd, testing, mock, fixture.
444
+
445
+ ## Available Skills
446
+
447
+ Skills are invocable commands or auto-loaded knowledge sources:
448
+
449
+ - **agent-creator**: Creates new specialized agents with frontmatter, tool selection, and delegation guidance
450
+ - **analyze**: Analyze code quality, complexity, and patterns
451
+ - **api-patterns**: Loaded when user asks about REST API design or GraphQL patterns
452
+ - **app-builder**: Loaded when user asks to scaffold or build a full-stack app
453
+ - **architecture-audit**: Explore codebase organically for architectural friction, discover shallow modules, and propose module-deepening refactors as GitHub issue RFCs using parallel sub-agent interface designs. Use when user wants to improve architecture, find shallow modules, deepen modules, or reduce coupling. Codex-adapted: uses native subagents and plan tracking.
454
+ - **architecture-decision**: Loaded when user asks about architecture decisions or architecture note writing
455
+ - **biz-scan**: Scan codebase for business opportunities and KPIs
456
+ - **brand-voice**: Loaded when writing documentation, content, README, or user-facing text. Prevents generic LLM rhetoric and enforces direct, technical voice.
457
+ - **briefing**: Generate executive daily briefing across all agents
458
+ - **build**: Build the project with auto-detected toolchain
459
+ - **chaos**: Inject controlled faults for resilience testing
460
+ - **ci**: Detect and run CI pipeline with status reporting
461
+ - **ci-cd-patterns**: Loaded when user asks about CI/CD pipelines or deployment automation
462
+ - **clean-code**: Loaded when user asks about clean code, naming, or code quality
463
+ - **command-creator**: Creates new Claude Code slash commands with frontmatter, workflow guidance, and validation
464
+ - **commit**: Create Conventional Commits with pre-commit validation
465
+ - **council**: 4-perspective decision evaluation for architecture choices. Use when user wants multi-angle analysis, needs to decide between alternatives, or mentions 'council', 'evaluate decision', 'pros cons'. Codex-adapted: uses native subagents and plan tracking.
466
+ - **csharp-patterns**: Loaded when user asks about C# or .NET development patterns
467
+ - **cve-scan**: Scan project dependencies for known CVEs using native audit tools (npm, pip, composer, cargo, go, bundler, dart)
468
+ - **database-patterns**: Loaded when user asks about database schema or query optimization
469
+ - **debug**: Debug errors and trace root causes systematically
470
+ - **debugging-tactics**: Loaded when user is debugging an issue or needs root cause analysis
471
+ - **deploy**: Deploy with pre-flight checks and health verification
472
+ - **design-an-interface**: Generate multiple radically different interface designs using parallel sub-agents, then compare on simplicity, depth, and correctness. Based on 'Design It Twice' from Ousterhout. Use when user wants to design an API, explore interface options, compare module shapes, or mentions 'design it twice'. Codex-adapted: uses native subagents and plan tracking.
473
+ - **design-engineering**: Loaded when user asks about UI animations or CSS design craft
474
+ - **docker-devops**: Loaded when user asks about Docker, containers, or DevOps patterns
475
+ - **docs**: Generate and update README, API docs, and architecture notes
476
+ - **documentation-standards**: Loaded when creating or updating KB documents, architecture notes, SOPs, or any file in kb/ directory
477
+ - **ecommerce-patterns**: Loaded when user asks about e-commerce or shopping cart features
478
+ - **evaluate**: Evaluate skill quality and RAG retrieval accuracy
479
+ - **evolve**: Evolve agent definitions via meta-architect
480
+ - **explain**: Explain code, architecture, or concepts with diagrams
481
+ - **explore**: Explore codebase structure, stack, and architecture
482
+ - **fix**: Auto-fix lint errors, type issues, and simple bugs
483
+ - **flutter-patterns**: Loaded when user asks about Flutter or Dart development patterns
484
+ - **git-mastery**: Loaded when user asks about advanced Git workflows or history rewriting
485
+ - **grill-me**: Stress-test a plan or design through relentless Socratic questioning, walking down each decision branch until reaching shared understanding. Use when user wants to stress-test a plan, get grilled, validate assumptions, or mentions 'grill me'. Codex-adapted: uses native subagents and plan tracking.
486
+ - **health**: Report service and infrastructure health status
487
+ - **hipaa-validate**: Validate code against HIPAA policy: PHI exposure, missing audit logging, unencrypted transmission/storage, access control gaps, temp file exposure, and missing BAA references
488
+ - **hive-mind**: Loaded when orchestrating multi-agent swarms or consensus workflows
489
+ - **hook-creator**: Creates new Claude Code hooks with guided workflow, strict conventions, and validation
490
+ - **index**: Index codebase into the knowledge base
491
+ - **instinct-review**: Review and manage learned instincts from past sessions
492
+ - **introspect**: Agent self-debugging and recovery. Use when stuck in loops, making repeated errors, or quality degrades. Triggers: introspect, self-debug, stuck, loop, why failing.
493
+ - **java-patterns**: Loaded when user asks about Java development patterns
494
+ - **kotlin-patterns**: Loaded when user asks about Kotlin development patterns
495
+ - **lint**: Lint code with auto-detected tools and fix suggestions
496
+ - **mcp-patterns**: Loaded when user asks about MCP servers or tool protocol design
497
+ - **mem-search**: Search past coding sessions using natural language. Finds relevant observations, decisions, and context from previous work.
498
+ - **migrate**: Run database migrations with backup verification
499
+ - **migration-patterns**: Loaded when user asks about database migrations or zero-downtime deploys
500
+ - **night-watch**: Run autonomous maintenance and dependency updates
501
+ - **observability-patterns**: Loaded when user asks about logging, metrics, or tracing patterns
502
+ - **onboard**: Generate project onboarding materials
503
+ - **orchestrate**: Coordinate multiple specialized agents in parallel Codex-adapted: uses native subagents and plan tracking.
504
+ - **panic**: Emergency stabilization via system-governor agent
505
+ - **performance-profiling**: Loaded when user asks about performance profiling or optimization
506
+ - **persona**: Switch engineering persona at runtime: backend-lead, frontend-lead, devops-eng, junior-dev
507
+ - **plan**: Plan implementation with tasks and success criteria
508
+ - **plan-writing**: Loaded when user asks to write an implementation plan or pre-mortem
509
+ - **plugin-creator**: Creates experimental opt-in plugin packs with manifests, conventions, and optional module scaffolding for Claude and Codex runtimes
510
+ - **pr**: Create pull requests with pre-flight validation
511
+ - **prd-to-issues**: Break a PRD into independently-grabbable GitHub issues using vertical slices with HITL/AFK tagging and dependency ordering. Use when user wants to convert a PRD to issues, create tickets, or break down a PRD into work items.
512
+ - **prd-to-plan**: Convert a PRD into a phased implementation plan using tracer-bullet vertical slices. Use when user wants to break down a PRD, create an implementation plan, plan phases from a PRD, or mentions tracer bullets. Codex-adapted: uses native subagents and plan tracking.
513
+ - **predict**: Predict regressions and impact before changes land
514
+ - **qa-session**: Interactive QA session where user reports bugs conversationally and agent files GitHub issues with domain language. Explores codebase in background for context. Use when user wants to report bugs, do QA, file issues conversationally, or mentions QA session. Codex-adapted: uses native subagents and plan tracking.
515
+ - **rag-patterns**: Loaded when user asks about RAG systems, embeddings, or vector search
516
+ - **refactor**: Refactor code for quality and maintainability
517
+ - **refactor-plan**: Create a detailed refactor plan with tiny commits via user interview, then file as a GitHub issue RFC. Use when user wants to plan a refactor, create a refactoring RFC, or break a refactor into safe incremental steps. Codex-adapted: uses native subagents and plan tracking.
518
+ - **repeat**: Run a prompt or slash command on a recurring interval until task complete or limits reached. Use when user wants to set up a recurring task, poll for status, or run something repeatedly on an interval. Codex-adapted: uses native subagents and plan tracking.
519
+ - **research-mastery**: Loaded when user asks to research, verify, or synthesize information
520
+ - **review**: Review code for quality, security, and correctness
521
+ - **rollback**: Roll back a deployment safely with verification
522
+ - **ruby-patterns**: Loaded when user asks about Ruby development patterns
523
+ - **rust-patterns**: Loaded when user asks about Rust development patterns
524
+ - **search**: Search the knowledge base with semantic and hybrid modes
525
+ - **security-patterns**: Loaded when user asks about security, OWASP, or auth patterns
526
+ - **skill-audit**: Scan skills and agents for security risks: dangerous patterns, secrets, excessive permissions
527
+ - **skill-creator**: Create new skills from templates with guided workflow
528
+ - **subagent-development**: Execute implementation plans using fresh subagents per task with two-stage review: spec compliance first, then code quality. Use when executing plans with independent tasks. Codex-adapted: uses native subagents and plan tracking.
529
+ - **swarm**: Execute tasks via Map-Reduce, Consensus, or Relay swarms Codex-adapted: uses native subagents and plan tracking.
530
+ - **swift-patterns**: Loaded when user asks about Swift or iOS development patterns
531
+ - **tdd**: Test-driven development with red-green-refactor loop and vertical slices. Use when user wants TDD, test-first development, red-green-refactor, or building features with tests driving the implementation. Codex-adapted: uses native subagents and plan tracking.
532
+ - **teams**: Launch pre-configured Agent Teams for common workflows Codex-adapted: uses native subagents and plan tracking.
533
+ - **test**: Run tests with coverage analysis and reporting
534
+ - **testing-patterns**: Loaded when user asks about testing strategy, fixtures, or mocking
535
+ - **triage-issue**: Triage a bug by deeply exploring the codebase for root cause, then create a GitHub issue with a TDD-based fix plan. Mostly hands-off — minimal user interaction. Use when user reports a bug, wants to investigate an issue, mentions triage, or wants a fix plan. Codex-adapted: uses native subagents and plan tracking.
536
+ - **typescript-patterns**: Loaded when user asks about TypeScript patterns or type safety
537
+ - **ubiquitous-language**: Extract a DDD-style ubiquitous language glossary from the conversation, flagging ambiguities and proposing canonical terms. Saves to UBIQUITOUS_LANGUAGE.md. Use when user wants to define domain terms, build a glossary, harden terminology, or mentions DDD or domain model.
538
+ - **verification-before-completion**: Loaded when agent is about to claim work is complete, fixed, or passing — requires running verification commands and confirming output before making any success claims. Evidence before assertions, always.
539
+ - **workflow**: Start and manage autonomous agent workflows Codex-adapted: uses native subagents and plan tracking.
540
+ - **write-a-prd**: Create a Product Requirements Document through interactive interview, codebase exploration, and deep module design. Use when user wants to write a PRD, create product requirements, or plan a new feature from scratch. Codex-adapted: uses native subagents and plan tracking.
541
+
542
+ ## Quality Standards
543
+
544
+ Derived from the immutable safety constitution (5 articles):
545
+
546
+ **Article I — Safety First**
547
+ - No data loss: never delete files without backup verification or using reversible operations
548
+ - No blind execution: never run LLM-generated code without static analysis or review
549
+ - No infinite loops: all autonomous loops must have a maximum iteration count (max 3)
550
+
551
+ **Article II — Hierarchy of Truth**
552
+ - The Knowledge Base (`kb/`) is the source of truth; if code contradicts KB, check KB freshness
553
+ - Use the research-mastery skill before any major decision; guessing is forbidden
554
+
555
+ **Article III — Operational Integrity**
556
+ - "Green Tests" is the only definition of Done; forced merges on red tests are unacceptable
557
+ - Never delete audit logs or KB archives without explicit user approval and backup verification
558
+ - Agents cannot change their own model or tool permissions without user approval
559
+
560
+ **Article IV — Self-Preservation**
561
+ - The constitution file is read-only for all agents except the user
562
+ - If a constitutional violation is detected, halt the offending operation immediately
563
+
564
+ **Article V — Resource Governance**
565
+ - Commands like `rm -rf`, `DROP TABLE`, `FORMAT` require explicit user confirmation
566
+ - Operate within assigned model tiers; model tier changes require user approval
567
+
568
+ ## Workflow Guidelines
569
+
570
+ - **Plan First**: Tasks longer than 1 hour require a plan, success criteria, and pre-mortem
571
+ - **Multi-Agent**: Use minimum 3 agents for complex tasks; single-agent for simple tasks
572
+ - **2-Phase Execution**: Plan → User Approval → Implement (never skip the approval checkpoint)
573
+ - **KB-First Research**: Search the knowledge base before writing code or answering questions
574
+ - **Structured Commits**: Use `feat/fix/docs/refactor/test/chore` prefixes (Conventional Commits)
575
+ - **Quality Gates**: Run `ruff check .` (Python), `tsc` (TypeScript), `go vet` (Go) before marking done
576
+ - **Cite Sources**: Always reference `[PATH: ...]` when making decisions based on existing knowledge
577
+ - **Read-Only Exploration**: Discovery agents never write; writing agents never explore blindly
578
+ - **No Secrets in Code**: Never commit credentials, API keys, or sensitive configuration values
579
+ <!-- TOOLKIT:ai-toolkit END -->
580
+
581
+ <!-- TOOLKIT:jira-rules START -->
582
+ <!-- Auto-injected by ai-toolkit. Re-run to update. -->
583
+
584
+ # Jira MCP Server
585
+
586
+ Tools: `sync_tasks`, `read_cached_tasks`, `update_task_status`, `add_task_comment`, `reassign_task`, `get_task_statuses`, `get_task_details`, `log_task_time`, `get_task_time_tracking`
587
+
588
+ ## Key Rules
589
+
590
+ - **Always `sync_tasks` first** before reading — cache may be stale.
591
+ - **Time format:** `"2h 30m"` — hours and minutes only, never days.
592
+ - **Status changes:** call `get_task_statuses` first to check valid transitions.
593
+ - **Multi-instance:** project key determines which Jira instance is used (mapped in config.json).
594
+
595
+ ## Workflow
596
+
597
+ 1. `sync_tasks(jql="assignee=currentUser() AND status!=Done")` — fetch fresh
598
+ 2. `read_cached_tasks()` — work offline
599
+ 3. `get_task_details(task_key="PROJ-123")` — deep dive
600
+ 4. `update_task_status(...)` / `add_task_comment(...)` / `log_task_time(...)` — mutate
601
+
602
+ <!-- TOOLKIT:jira-rules END -->
603
+
604
+ <!-- TOOLKIT:rag-mcp-rules START -->
605
+ <!-- Auto-injected by ai-toolkit. Re-run to update. -->
606
+
607
+ ## INSTANT ACTION RULE (GOLDEN RULE)
608
+
609
+ **ANY technical question? -> INSTANTLY call `smart_query()` OR `hybrid_search_kb()` BEFORE outputting text!**
610
+
611
+ 1. **Search First:** `smart_query()` or `hybrid_search_kb()` (NEVER skip, even if you "know").
612
+ 2. **Cite Sources:** always include `[PATH: kb/...]`.
613
+ 3. **Strict Order:** Semantic Search -> Files -> External Docs -> General Knowledge.
614
+
615
+ Default tool: `smart_query()`. Use `hybrid_search_kb()` for speed, `crag_search()` for vague queries, `multi_hop_search()` for complex reasoning.
616
+
617
+ ## kb_id vs file_path
618
+
619
+ - `get_document(path=...)` takes `kb_id` from search results (e.g., `local/softspark/project/reference/api.md`)
620
+ - `Read`/`Edit` take filesystem `file_path` (e.g., `./reference/api.md`)
621
+ - **DO NOT CONFUSE** these fields.
622
+
623
+ ## SOPs
624
+
625
+ ALWAYS check `kb/procedures/` first: `smart_query("SOP for <task>")`.
626
+
627
+ <!-- TOOLKIT:rag-mcp-rules END -->
package/CHANGELOG.md CHANGED
@@ -7,6 +7,14 @@ Versioning follows [Semantic Versioning](https://semver.org/).
7
7
 
8
8
  ---
9
9
 
10
+ ## v2.1.3 — Idempotent Update Fix (2026-04-13)
11
+
12
+ ### Fixed
13
+ - **`ai-toolkit update` no longer dirties git** — `inject_with_rules()` now strips all existing TOOLKIT sections before re-injecting, and `generate_agents_md.py` includes the Codex block for format consistency. Running `update` on a clean repo leaves zero uncommitted changes.
14
+ - **Custom rules always present** — all generators (standalone and via `inject_with_rules`) emit registered custom rules in every output format
15
+
16
+ ---
17
+
10
18
  ## v2.1.1 — Custom Rules in Generators & README Restructure (2026-04-13)
11
19
 
12
20
  ### Fixed
package/README.md CHANGED
@@ -10,12 +10,12 @@
10
10
 
11
11
  ---
12
12
 
13
- ## What's New in v2.1.1
13
+ ## What's New in v2.1.3
14
14
 
15
- - **Custom rules in generators** — `generate:all` now preserves registered rules from other repos across all platforms
16
- - **README restructured** — 951 292 lines with TOC, "What's New" section, and links to KB docs
17
- - **CLI help completeness** — added missing `--persona` option and `codex` to `--editors`
18
- - **3 new KB docs** — CLI Reference, Unique Features, Ecosystem Comparison (moved from README)
15
+ - **Idempotent update** — `ai-toolkit update` no longer dirties git with extra blank lines in generated files
16
+ - **Custom rules in generators** — `generate:all` preserves registered rules from other repos across all platforms
17
+ - **README restructured** — 951 292 lines with TOC, links to KB docs
18
+ - **3 new KB docs** — CLI Reference, Unique Features, Ecosystem Comparison
19
19
 
20
20
  See [CHANGELOG.md](CHANGELOG.md) for full history.
21
21
 
package/bin/ai-toolkit.js CHANGED
@@ -405,8 +405,9 @@ function handleConfig(args) {
405
405
  */
406
406
  function handleGenerateAll(_args) {
407
407
  for (const [name, gen] of Object.entries(GENERATORS)) {
408
- // Skip agents-md — codex-md generates a superset to the same AGENTS.md
409
- if (name === 'agents-md') continue;
408
+ // Skip codex-md — it injects a Codex config block via markers (used by install --local --editors codex)
409
+ // agents-md generates the full agent list which is the standalone AGENTS.md
410
+ if (name === 'codex-md') continue;
410
411
  writeGeneratorOutput(gen);
411
412
  }
412
413
  // Directory-based generators (multi-file output)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softspark/ai-toolkit",
3
- "version": "2.1.1",
3
+ "version": "2.1.3",
4
4
  "description": "Professional-grade AI coding toolkit: 92 skills, 44 agents, multi-platform support (Claude, Cursor, Windsurf, Copilot, Gemini, Cline, Roo Code, Aider, Augment, Google Antigravity, Codex CLI), machine-enforced safety constitution, persona presets, skill security auditor, expanded lifecycle hooks, 11 plugin packs, and benchmark tooling.",
5
5
  "keywords": [
6
6
  "claude",
@@ -46,7 +46,7 @@
46
46
  "evaluate": "python3 scripts/evaluate_skills.py",
47
47
  "benchmark:ecosystem": "python3 scripts/benchmark_ecosystem.py --offline",
48
48
  "benchmark:harvest": "python3 scripts/harvest_ecosystem.py --offline",
49
- "generate:agents": "python3 scripts/generate_codex.py > AGENTS.md",
49
+ "generate:agents": "python3 scripts/generate_agents_md.py > AGENTS.md",
50
50
  "generate:cursor": "python3 scripts/generate_cursor_rules.py > .cursorrules",
51
51
  "generate:llms": "python3 scripts/generate_llms_txt.py > llms.txt && python3 scripts/generate_llms_txt.py --full > llms-full.txt",
52
52
  "generate:windsurf": "python3 scripts/generate_windsurf.py > .windsurfrules",
@@ -10,8 +10,9 @@ import sys
10
10
  from pathlib import Path
11
11
 
12
12
  sys.path.insert(0, str(Path(__file__).resolve().parent))
13
+ import subprocess
14
+
13
15
  from _common import agents_dir, frontmatter_field
14
- from paths import RULES_DIR
15
16
 
16
17
 
17
18
  def main() -> None:
@@ -87,17 +88,16 @@ def main() -> None:
87
88
  print("---")
88
89
  print()
89
90
 
90
- # Registered custom rules from ~/.softspark/ai-toolkit/rules/
91
- if RULES_DIR.is_dir():
92
- for rule_file in sorted(RULES_DIR.glob("*.md")):
93
- rule_name = rule_file.stem
94
- print(f"<!-- TOOLKIT:{rule_name} START -->")
95
- print("<!-- Auto-injected by ai-toolkit. Re-run to update. -->")
96
- print()
97
- print(rule_file.read_text(encoding="utf-8").rstrip())
98
- print()
99
- print(f"<!-- TOOLKIT:{rule_name} END -->")
100
- print()
91
+ # Codex CLI configuration block (agents, skills, guidelines)
92
+ codex_script = Path(__file__).resolve().parent / "generate_codex.py"
93
+ result = subprocess.run(
94
+ ["python3", str(codex_script)],
95
+ capture_output=True, text=True,
96
+ )
97
+ if result.returncode == 0 and result.stdout.strip():
98
+ print(result.stdout.rstrip())
99
+
100
+ # Note: custom rules are included via generate_codex.py output above
101
101
 
102
102
 
103
103
  if __name__ == "__main__":
@@ -84,7 +84,6 @@ def inject_with_rules(
84
84
  return
85
85
 
86
86
  generated = result.stdout
87
- start_marker = "<!-- TOOLKIT:ai-toolkit START -->"
88
87
 
89
88
  target_file = Path(target_file)
90
89
  target_file.parent.mkdir(parents=True, exist_ok=True)
@@ -92,26 +91,28 @@ def inject_with_rules(
92
91
  target_file.touch()
93
92
 
94
93
  existing = target_file.read_text(encoding="utf-8")
95
- if start_marker in existing:
96
- existing = _strip_section(existing, "ai-toolkit")
94
+ # Strip ALL toolkit sections from existing — generated output is the
95
+ # complete source of truth (includes ai-toolkit block + custom rules)
96
+ import re
97
+ existing = re.sub(
98
+ r"<!-- TOOLKIT:[^ ]+ START -->.*?<!-- TOOLKIT:[^ ]+ END -->\n?",
99
+ "",
100
+ existing,
101
+ flags=re.DOTALL,
102
+ )
97
103
  existing = _trim_trailing_blanks(existing)
98
- existing = existing.lstrip("\n") # no leading blank lines
104
+ existing = existing.lstrip("\n")
99
105
 
100
106
  parts: list[str] = []
101
107
  if existing.strip():
102
108
  parts.append(existing)
103
- parts.append("")
109
+ parts.append("") # blank line separator
104
110
  parts.append(generated.rstrip("\n"))
105
111
 
106
112
  output = "\n".join(parts) + "\n"
107
113
  output = _collapse_blank_runs(output)
108
- output = output.lstrip("\n") # no leading blank lines
114
+ output = output.lstrip("\n")
109
115
  target_file.write_text(output, encoding="utf-8")
110
-
111
- if rules_dir.is_dir():
112
- for rule_file in sorted(rules_dir.glob("*.md")):
113
- inject_section(rule_file, target_file, rule_file.stem)
114
-
115
116
  print(f" Updated: {target_file}")
116
117
 
117
118