fischer-agentkit/tests/unit
chiguyong fef7ecea39 feat(skills): SkillHarness 激活前置条件 + 风险守卫学习
基于 SkillHarness 论文(arXiv:2606.20636)与 Agent Skills 综述
(arXiv:2602.12430)引入激活前置条件(preconditions)与来源标记
(provenance),并新增从失败轨迹学习风险守卫建议的能力。

变更内容:
- U1: SkillConfig 新增 v7 preconditions/provenance 字段(base.py)
- U2: build_skill_system_prompt 注入 preconditions 软检查段落
- U3: SkillLoader 三路径记录 provenance + entry_points 危险能力告警
- U4: 10 个业务 Skill YAML 补充 preconditions(2-4 条中文短句)
- U5: RiskGuardLearner 从失败轨迹学习风险守卫建议(人工审查,不自动应用)
- U6: CLI 命令 agentkit skill learn-risk-guards

关键决策:
- KTD1: preconditions 通过 system_prompt 注入(软检查),不做硬 LLM 调用
- KTD2: RiskGuardLearner 不自动应用,需人工审查(论文显示 75% 自动学习不安全)
- KTD3: provenance 为轻量字符串,不加 hash/签名(无合规需求)

测试:39 个新增单元测试全部通过,ruff 检查通过。
2026-06-24 13:56:37 +08:00
..
admin feat(admin): U7 — usage dashboard + quota enforcement 2026-06-21 17:23:20 +08:00
auth feat(admin): U6 — Skill & KB management endpoints + department binding 2026-06-21 16:19:51 +08:00
calendar feat(calendar): U7 Outlook sync via Microsoft Graph API 2026-06-23 23:49:24 +08:00
chat fix(routing): U1-U6 路由优化 + 修复方案 + 代码审查修复 2026-06-20 19:31:49 +08:00
cli feat(cli): U6 CLI 多 Agent 入口 + 辩论 Rich 渲染 2026-06-24 13:03:57 +08:00
core feat: hub-and-spoke experts, tiered tool injection, unified event model (U3/U7/U10) 2026-06-17 10:46:16 +08:00
evolution fix: resolve code review issues from deferred improvements 2026-06-11 13:49:02 +08:00
experts feat(experts): U2 协作契约执行 — 专家可见 + 主动通知 2026-06-24 13:54:38 +08:00
llm fix(review): U1 Redis quota enforcement — key construction + fail-closed + degradation recovery + async 2026-06-22 16:22:33 +08:00
memory fix(review): document-processing code review fixes — validation, tests, formatting 2026-06-23 20:21:19 +08:00
quality feat(router): optimize routing intelligence — ExecutionMode expansion, multi-candidate scoring, quality gate skill match 2026-06-15 22:43:13 +08:00
router refactor(router): replace CostAwareRouter with SimpleRouter and prompt-based tool calling 2026-06-16 03:31:05 +08:00
server feat(skills): distinguish agent templates from business skills in UI 2026-06-23 15:55:59 +08:00
skills fix: resolve code review issues from deferred improvements 2026-06-11 13:49:02 +08:00
tools feat(calendar): U3 agent calendar tool for ReAct integration 2026-06-23 21:56:08 +08:00
__init__.py feat: initial fischer-agentkit package with unified agent architecture 2026-06-04 22:24:06 +08:00
conftest.py feat(agentkit): v2 Phase 1 - ReAct/LLM Gateway/Skill/Server + review fixes 2026-06-05 23:32:16 +08:00
test_ab_tester.py feat(agentkit): Phase 4 enterprise production upgrade — 12 Implementation Units 2026-06-06 21:51:04 +08:00
test_agent_bus.py fix: resolve code review issues from deferred improvements 2026-06-11 13:49:02 +08:00
test_agent_pool.py feat(agentkit): v2 Phase 1 - ReAct/LLM Gateway/Skill/Server + review fixes 2026-06-05 23:32:16 +08:00
test_agent_tool.py feat(agentkit): v2 Phase 1 - ReAct/LLM Gateway/Skill/Server + review fixes 2026-06-05 23:32:16 +08:00
test_alignment_guard.py feat(marketplace): add Phase B/C - CostAwareRouter, OrganizationContext, AlignmentGuard, Soul Evolution, Auction, Server Integration 2026-06-10 19:09:02 +08:00
test_anthropic_provider.py feat(agentkit): Phase 4 enterprise production upgrade — 12 Implementation Units 2026-06-06 21:51:04 +08:00
test_ask_human_tool.py feat(tools): add AskHumanTool + token streaming in ReAct execute_stream 2026-06-07 23:40:43 +08:00
test_async_tasks.py feat(server): Phase D - async task system (TaskStore + BackgroundRunner + API) 2026-06-06 11:39:41 +08:00
test_auction.py fix(review): comprehensive P0-P2 code review fixes 2026-06-12 22:18:25 +08:00
test_auth.py feat(auth): U7-U10 会话管理 UI + admin API + 测试修复 2026-06-21 08:48:25 +08:00
test_base_agent.py feat(agentkit): Phase 4 enterprise production upgrade — 12 Implementation Units 2026-06-06 21:51:04 +08:00
test_base_agent_v2.py feat(agentkit): v2 Phase 1 - ReAct/LLM Gateway/Skill/Server + review fixes 2026-06-05 23:32:16 +08:00
test_bus_protocol.py fix: portal routing + response speed + IME input 2026-06-11 21:30:25 +08:00
test_business_skill_preconditions.py feat(skills): SkillHarness 激活前置条件 + 风险守卫学习 2026-06-24 13:56:37 +08:00
test_chat_memory_integration.py feat(tools): add ShellTool + WebSearchTool, memory system, onboarding wizard, chat mode 2026-06-09 01:06:45 +08:00
test_chat_routes.py feat: 企业级客户端-服务端架构 + 代码审查修复 2026-06-20 06:48:18 +08:00
test_chinese_providers.py feat(llm): U8 Chinese LLM providers - Wenxin, Doubao, Yuanbao 2026-06-06 22:46:53 +08:00
test_cli.py fix(config): unify config loading chain and protect ${VAR} references 2026-06-16 00:26:54 +08:00
test_cli_skill_learn_risk_guards.py feat(skills): SkillHarness 激活前置条件 + 风险守卫学习 2026-06-24 13:56:37 +08:00
test_compression_config.py feat: SQLite persistence, verification loop, spec-driven execution 2026-06-17 10:45:20 +08:00
test_compression_strategy.py feat(compression): U1 CompressionStrategy Protocol and create_compressor factory 2026-06-07 18:19:27 +08:00
test_config_driven.py feat(agentkit): Phase 4 enterprise production upgrade — 12 Implementation Units 2026-06-06 21:51:04 +08:00
test_config_sync.py feat: 企业级客户端-服务端架构 + 代码审查修复 2026-06-20 06:48:18 +08:00
test_context_compressor.py feat(agentkit): Phase 3 upgrade - persistence, memory, evolution, observability 2026-06-06 17:17:45 +08:00
test_contextual_retrieval.py feat(memory): U2 Contextual Retrieval - LLM-generated context prefixes for chunks 2026-06-06 22:19:02 +08:00
test_dispatcher.py feat(server): Phase B - auth, rate limiting, SSRF protection, handler whitelist 2026-06-05 23:37:36 +08:00
test_embedding_cache.py feat(agentkit): Phase 4 enterprise production upgrade — 12 Implementation Units 2026-06-06 21:51:04 +08:00
test_episodic_memory.py feat(agentkit): Phase 4 enterprise production upgrade — 12 Implementation Units 2026-06-06 21:51:04 +08:00
test_episodic_vector_search.py fix(security): resolve all P0/P1 findings from code review 2026-06-10 07:12:41 +08:00
test_evolution.py feat: initial fischer-agentkit package with unified agent architecture 2026-06-04 22:24:06 +08:00
test_evolution_api.py feat(agentkit): Phase 4 enterprise production upgrade — 12 Implementation Units 2026-06-06 21:51:04 +08:00
test_evolution_integration.py feat(evolution): Phase A - lifecycle hooks + EvolutionConfig 2026-06-06 12:05:56 +08:00
test_evolution_lifecycle.py feat(agentkit): Phase 4 enterprise production upgrade — 12 Implementation Units 2026-06-06 21:51:04 +08:00
test_evolution_store.py feat(agentkit): v2 Phase 1 - ReAct/LLM Gateway/Skill/Server + review fixes 2026-06-05 23:32:16 +08:00
test_evolution_store_persistent.py feat(agentkit): Phase 3 upgrade - persistence, memory, evolution, observability 2026-06-06 17:17:45 +08:00
test_execution_modes.py fix(review): document-processing code review fixes — validation, tests, formatting 2026-06-23 20:21:19 +08:00
test_fitness.py feat(evolution): U7 multi-objective fitness and extended strategy space 2026-06-06 22:42:54 +08:00
test_gateway_cache.py feat: P0 production hardening — LLM cache, semantic routing, state persistence 2026-06-14 15:16:00 +08:00
test_gemini_provider.py feat(agentkit): Phase 4 enterprise production upgrade — 12 Implementation Units 2026-06-06 21:51:04 +08:00
test_genetic_evolution.py feat(evolution): U6 GEPA genetic algorithm evolution framework 2026-06-06 22:38:55 +08:00
test_geo_pipeline.py feat(skills): U5 GEO Pipeline orchestration with DAG execution 2026-06-06 22:34:24 +08:00
test_goal_planner.py feat(phase1): implement core kernel and experience foundation (U1-U5) 2026-06-09 23:57:03 +08:00
test_handoff.py feat(agentkit): v2 Phase 1 - ReAct/LLM Gateway/Skill/Server + review fixes 2026-06-05 23:32:16 +08:00
test_headroom_compressor.py fix(agentkit): resolve all P0/P1/P2/P3 issues from code review 2026-06-07 22:05:18 +08:00
test_headroom_retrieve_tool.py feat(compression): U5 HeadroomRetrieveTool for CCR cache retrieval 2026-06-07 18:20:17 +08:00
test_http_rag_service.py feat(agentkit): Phase 4 enterprise production upgrade — 12 Implementation Units 2026-06-06 21:51:04 +08:00
test_intent_router.py feat(agentkit): v2 Phase 1 - ReAct/LLM Gateway/Skill/Server + review fixes 2026-06-05 23:32:16 +08:00
test_llm_cache.py feat: P0 production hardening — LLM cache, semantic routing, state persistence 2026-06-14 15:16:00 +08:00
test_llm_gateway.py feat(agentkit): Phase 4 enterprise production upgrade — 12 Implementation Units 2026-06-06 21:51:04 +08:00
test_llm_gateway_routes.py feat: 企业级客户端-服务端架构 + 代码审查修复 2026-06-20 06:48:18 +08:00
test_llm_protocol.py feat(agentkit): v2 Phase 1 - ReAct/LLM Gateway/Skill/Server + review fixes 2026-06-05 23:32:16 +08:00
test_llm_provider.py fix(routing): U1-U6 路由优化 + 修复方案 + 代码审查修复 2026-06-20 19:31:49 +08:00
test_llm_reflector.py fix(review): address P0+P1 findings from Tier 2 code review 2026-06-06 17:57:47 +08:00
test_llm_retry.py feat(agentkit): Phase 4 enterprise production upgrade — 12 Implementation Units 2026-06-06 21:51:04 +08:00
test_mcp_client.py feat(agentkit): v2 Phase 1 - ReAct/LLM Gateway/Skill/Server + review fixes 2026-06-05 23:32:16 +08:00
test_mcp_config.py feat(mcp): U2 MCP config system and MCPManager lifecycle 2026-06-07 17:25:07 +08:00
test_mcp_manager.py feat(mcp): U2 MCP config system and MCPManager lifecycle 2026-06-07 17:25:07 +08:00
test_mcp_server.py feat(agentkit): v2 Phase 1 - ReAct/LLM Gateway/Skill/Server + review fixes 2026-06-05 23:32:16 +08:00
test_mcp_transport.py fix(agentkit): resolve all P0/P1/P2/P3 issues from code review 2026-06-07 22:05:18 +08:00
test_memory_api.py feat(agentkit): Phase 4 enterprise production upgrade — 12 Implementation Units 2026-06-06 21:51:04 +08:00
test_memory_integration.py feat(agentkit): Phase 4 enterprise production upgrade — 12 Implementation Units 2026-06-06 21:51:04 +08:00
test_memory_profile.py feat(tools): add ShellTool + WebSearchTool, memory system, onboarding wizard, chat mode 2026-06-09 01:06:45 +08:00
test_memory_retriever.py feat(agentkit): v2 Phase 1 - ReAct/LLM Gateway/Skill/Server + review fixes 2026-06-05 23:32:16 +08:00
test_memory_system.py feat(agentkit): v2 Phase 1 - ReAct/LLM Gateway/Skill/Server + review fixes 2026-06-05 23:32:16 +08:00
test_memory_tool.py feat(tools): add ShellTool + WebSearchTool, memory system, onboarding wizard, chat mode 2026-06-09 01:06:45 +08:00
test_observability.py fix(review): address all 14 P2 advisory findings 2026-06-06 18:20:46 +08:00
test_onboarding.py feat(tools): add ShellTool + WebSearchTool, memory system, onboarding wizard, chat mode 2026-06-09 01:06:45 +08:00
test_orchestrator.py feat(core): U4 multi-agent Orchestrator with SharedWorkspace 2026-06-06 22:25:12 +08:00
test_orchestrator_adaptive.py feat(core): add Orchestrator adaptive task decomposition (U5) 2026-06-07 23:50:54 +08:00
test_orchestrator_bus.py feat(core): integrate MessageBus into Orchestrator and AgentPool (U7) 2026-06-08 00:03:40 +08:00
test_orchestrator_integration.py test(orchestrator): add multi-agent collaboration integration tests 2026-06-04 22:59:29 +08:00
test_org_context.py feat(marketplace): add Phase B/C - CostAwareRouter, OrganizationContext, AlignmentGuard, Soul Evolution, Auction, Server Integration 2026-06-10 19:09:02 +08:00
test_output_standardizer.py feat(agentkit): v2 Phase 1 - ReAct/LLM Gateway/Skill/Server + review fixes 2026-06-05 23:32:16 +08:00
test_permissions.py feat: 企业级客户端-服务端架构 + 代码审查修复 2026-06-20 06:48:18 +08:00
test_pipeline.py feat: initial fischer-agentkit package with unified agent architecture 2026-06-04 22:24:06 +08:00
test_pipeline_adversarial.py fix(pipeline): address code review findings for adversarial loop 2026-06-12 10:02:37 +08:00
test_pipeline_compensation.py feat(pipeline): U6 step-level retry with exponential backoff and saga compensation 2026-06-07 17:26:07 +08:00
test_pipeline_reflection.py feat(phase8): chat adaptive enhancements, pipeline reflection, search tools upgrade 2026-06-09 23:18:06 +08:00
test_pipeline_retry.py feat(pipeline): U6 step-level retry with exponential backoff and saga compensation 2026-06-07 17:26:07 +08:00
test_pipeline_state.py feat(pipeline): U5 state persistence with Redis hot + PG cold dual-write 2026-06-07 17:25:52 +08:00
test_plan_exec_engine.py feat(core): add ReWOO, Plan-and-Execute, Reflexion execution engines 2026-06-10 17:08:48 +08:00
test_prompt_optimizer.py feat(agentkit): Phase 4 enterprise production upgrade — 12 Implementation Units 2026-06-06 21:51:04 +08:00
test_prompt_section.py feat(agentkit): v2 Phase 1 - ReAct/LLM Gateway/Skill/Server + review fixes 2026-06-05 23:32:16 +08:00
test_prompt_template.py feat(agentkit): v2 Phase 1 - ReAct/LLM Gateway/Skill/Server + review fixes 2026-06-05 23:32:16 +08:00
test_protocol.py feat(agentkit): v2 Phase 1 - ReAct/LLM Gateway/Skill/Server + review fixes 2026-06-05 23:32:16 +08:00
test_quality_gate.py feat(agentkit): v2 Phase 1 - ReAct/LLM Gateway/Skill/Server + review fixes 2026-06-05 23:32:16 +08:00
test_query_transformer.py feat(memory): RAG pipeline optimization — 5 Implementation Units 2026-06-06 19:27:09 +08:00
test_rag_loop.py feat(memory): U1 RAG self-correction loop (CRAG) 2026-06-06 22:16:23 +08:00
test_ragas_evaluator.py feat(evaluation): U9 Ragas evaluation pipeline for RAG quality assessment 2026-06-06 22:49:27 +08:00
test_react_compression.py fix(agentkit): resolve all P0/P1/P2/P3 issues from code review 2026-06-07 22:05:18 +08:00
test_react_engine.py feat(agentkit): Phase 4 enterprise production upgrade — 12 Implementation Units 2026-06-06 21:51:04 +08:00
test_react_skill_mcp_integration.py feat(agentkit): Phase 3 upgrade - persistence, memory, evolution, observability 2026-06-06 17:17:45 +08:00
test_react_token_streaming.py feat(tools): add AskHumanTool + token streaming in ReAct execute_stream 2026-06-07 23:40:43 +08:00
test_reflexion_engine.py feat(core): add ReWOO, Plan-and-Execute, Reflexion execution engines 2026-06-10 17:08:48 +08:00
test_registry.py feat(agentkit): v2 Phase 1 - ReAct/LLM Gateway/Skill/Server + review fixes 2026-06-05 23:32:16 +08:00
test_remote_provider.py feat: 企业级客户端-服务端架构 + 代码审查修复 2026-06-20 06:48:18 +08:00
test_retrieval_config.py feat(memory): RAG pipeline optimization — 5 Implementation Units 2026-06-06 19:27:09 +08:00
test_retrieve_knowledge_tool.py feat(memory): RAG pipeline optimization — 5 Implementation Units 2026-06-06 19:27:09 +08:00
test_rewoo_engine.py fix(review): comprehensive P0-P2 code review fixes 2026-06-12 22:18:25 +08:00
test_risk_guard_learner.py feat(skills): SkillHarness 激活前置条件 + 风险守卫学习 2026-06-24 13:56:37 +08:00
test_schema_tools.py feat(tools): U3 built-in Python tools - WebCrawl, SchemaExtract, SchemaGenerate 2026-06-07 17:25:24 +08:00
test_server_config.py feat(agentkit): Phase 4 enterprise production upgrade — 12 Implementation Units 2026-06-06 21:51:04 +08:00
test_server_middleware.py fix(review): address P0+P1 findings from Tier 2 code review 2026-06-06 17:57:47 +08:00
test_server_routes.py feat(agentkit): Phase 4 enterprise production upgrade — 12 Implementation Units 2026-06-06 21:51:04 +08:00
test_session_manager.py feat: optimize chat response speed for sub-1s first token latency 2026-06-12 13:15:06 +08:00
test_session_models.py feat(session): add Session/Message models and SessionManager with InMemory/Redis stores 2026-06-07 22:43:14 +08:00
test_session_store.py feat(session): add Session/Message models and SessionManager with InMemory/Redis stores 2026-06-07 22:43:14 +08:00
test_shell_tool.py fix(tests): clean up test_shell_tool.py lint issues 2026-06-10 08:46:35 +08:00
test_skill_config.py fix(review): document-processing code review fixes — validation, tests, formatting 2026-06-23 20:21:19 +08:00
test_skill_config_preconditions.py feat(skills): SkillHarness 激活前置条件 + 风险守卫学习 2026-06-24 13:56:37 +08:00
test_skill_loader.py feat(agentkit): v2 Phase 1 - ReAct/LLM Gateway/Skill/Server + review fixes 2026-06-05 23:32:16 +08:00
test_skill_loader_provenance.py feat(skills): SkillHarness 激活前置条件 + 风险守卫学习 2026-06-24 13:56:37 +08:00
test_skill_md.py feat(agentkit): Phase 3 upgrade - persistence, memory, evolution, observability 2026-06-06 17:17:45 +08:00
test_skill_pipeline.py fix(review): address P0+P1 findings from Tier 2 code review 2026-06-06 17:57:47 +08:00
test_skill_registry.py feat(agentkit): v2 Phase 1 - ReAct/LLM Gateway/Skill/Server + review fixes 2026-06-05 23:32:16 +08:00
test_skill_system_prompt_preconditions.py feat(skills): SkillHarness 激活前置条件 + 风险守卫学习 2026-06-24 13:56:37 +08:00
test_soul_evolution.py fix: resolve code review issues from deferred improvements 2026-06-11 13:49:02 +08:00
test_stdio_transport.py fix(agentkit): resolve all P0/P1/P2/P3 issues from code review 2026-06-07 22:05:18 +08:00
test_streaming.py feat(streaming): Phase C - LLM streaming + ReAct events + SSE endpoint 2026-06-06 11:54:17 +08:00
test_task_store_redis.py fix(review): address all 14 P2 advisory findings 2026-06-06 18:20:46 +08:00
test_telemetry.py feat: SQLite persistence, verification loop, spec-driven execution 2026-06-17 10:45:20 +08:00
test_terminal_server.py feat: 企业级客户端-服务端架构 + 代码审查修复 2026-06-20 06:48:18 +08:00
test_terminal_whitelist.py feat: 企业级客户端-服务端架构 + 代码审查修复 2026-06-20 06:48:18 +08:00
test_tool_composition.py feat(tools): add MCPTool, SequentialChain, ParallelFanOut, DynamicSelector 2026-06-04 22:42:22 +08:00
test_tool_registry.py feat: initial fischer-agentkit package with unified agent architecture 2026-06-04 22:24:06 +08:00
test_trace_recorder.py feat(agentkit): Phase 3 upgrade - persistence, memory, evolution, observability 2026-06-06 17:17:45 +08:00
test_u8_geo_integration.py feat(agentkit): Phase 3 upgrade - persistence, memory, evolution, observability 2026-06-06 17:17:45 +08:00
test_unified_evolution_store.py feat: P0 production hardening — LLM cache, semantic routing, state persistence 2026-06-14 15:16:00 +08:00
test_usage_tracker.py feat: P0 production hardening — LLM cache, semantic routing, state persistence 2026-06-14 15:16:00 +08:00
test_web_crawl_tool.py feat(tools): U3 built-in Python tools - WebCrawl, SchemaExtract, SchemaGenerate 2026-06-07 17:25:24 +08:00
test_web_search_tool.py feat(tools): add ShellTool + WebSearchTool, memory system, onboarding wizard, chat mode 2026-06-09 01:06:45 +08:00
test_websocket.py feat(agentkit): Phase 4 enterprise production upgrade — 12 Implementation Units 2026-06-06 21:51:04 +08:00
test_working_memory.py feat(agentkit): v2 Phase 1 - ReAct/LLM Gateway/Skill/Server + review fixes 2026-06-05 23:32:16 +08:00