koder 0.4.4__tar.gz → 0.4.5__tar.gz

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.
Files changed (68) hide show
  1. {koder-0.4.4 → koder-0.4.5}/.claude/settings.local.json +4 -1
  2. {koder-0.4.4 → koder-0.4.5}/CLAUDE.md +6 -6
  3. {koder-0.4.4 → koder-0.4.5}/PKG-INFO +82 -3
  4. {koder-0.4.4 → koder-0.4.5}/README.md +81 -2
  5. {koder-0.4.4 → koder-0.4.5}/koder_agent/agentic/agent.py +46 -1
  6. koder-0.4.5/koder_agent/agentic/skill_guardrail.py +79 -0
  7. {koder-0.4.4 → koder-0.4.5}/koder_agent/config/models.py +13 -0
  8. {koder-0.4.4 → koder-0.4.5}/koder_agent/tools/__init__.py +19 -0
  9. {koder-0.4.4 → koder-0.4.5}/koder_agent/tools/engine.py +1 -0
  10. koder-0.4.5/koder_agent/tools/skill.py +403 -0
  11. koder-0.4.5/koder_agent/tools/skill_context.py +127 -0
  12. {koder-0.4.4 → koder-0.4.5}/koder_agent/utils/client.py +6 -6
  13. {koder-0.4.4 → koder-0.4.5}/koder_agent/utils/prompts.py +18 -11
  14. {koder-0.4.4 → koder-0.4.5}/pyproject.toml +1 -1
  15. koder-0.4.5/tests/fixtures/skills/large-skill/SKILL.md +106 -0
  16. koder-0.4.5/tests/fixtures/skills/large-skill/reference.md +24 -0
  17. koder-0.4.5/tests/fixtures/skills/medium-skill/SKILL.md +74 -0
  18. koder-0.4.5/tests/fixtures/skills/small-skill/SKILL.md +56 -0
  19. koder-0.4.5/tests/fixtures/skills/template-skill/SKILL.md +20 -0
  20. {koder-0.4.4 → koder-0.4.5}/tests/test_model_resolution.py +3 -5
  21. koder-0.4.5/tests/test_skill_loader.py +518 -0
  22. koder-0.4.5/tests/test_skill_restrictions.py +340 -0
  23. koder-0.4.5/tests/test_skill_token_efficiency.py +241 -0
  24. {koder-0.4.4 → koder-0.4.5}/uv.lock +1 -1
  25. {koder-0.4.4 → koder-0.4.5}/.github/dependabot.yml +0 -0
  26. {koder-0.4.4 → koder-0.4.5}/.gitignore +0 -0
  27. {koder-0.4.4 → koder-0.4.5}/AGENTS.md +0 -0
  28. {koder-0.4.4 → koder-0.4.5}/CONTRIBUTING.md +0 -0
  29. {koder-0.4.4 → koder-0.4.5}/GEMINI.md +0 -0
  30. {koder-0.4.4 → koder-0.4.5}/LICENSE +0 -0
  31. {koder-0.4.4 → koder-0.4.5}/koder_agent/__init__.py +0 -0
  32. {koder-0.4.4 → koder-0.4.5}/koder_agent/agentic/__init__.py +0 -0
  33. {koder-0.4.4 → koder-0.4.5}/koder_agent/agentic/approval_hooks.py +0 -0
  34. {koder-0.4.4 → koder-0.4.5}/koder_agent/agentic/hooks.py +0 -0
  35. {koder-0.4.4 → koder-0.4.5}/koder_agent/cli.py +0 -0
  36. {koder-0.4.4 → koder-0.4.5}/koder_agent/config/__init__.py +0 -0
  37. {koder-0.4.4 → koder-0.4.5}/koder_agent/config/cli_handler.py +0 -0
  38. {koder-0.4.4 → koder-0.4.5}/koder_agent/config/manager.py +0 -0
  39. {koder-0.4.4 → koder-0.4.5}/koder_agent/core/__init__.py +0 -0
  40. {koder-0.4.4 → koder-0.4.5}/koder_agent/core/commands.py +0 -0
  41. {koder-0.4.4 → koder-0.4.5}/koder_agent/core/interactive.py +0 -0
  42. {koder-0.4.4 → koder-0.4.5}/koder_agent/core/keyboard_listener.py +0 -0
  43. {koder-0.4.4 → koder-0.4.5}/koder_agent/core/scheduler.py +0 -0
  44. {koder-0.4.4 → koder-0.4.5}/koder_agent/core/security.py +0 -0
  45. {koder-0.4.4 → koder-0.4.5}/koder_agent/core/session.py +0 -0
  46. {koder-0.4.4 → koder-0.4.5}/koder_agent/core/status_line.py +0 -0
  47. {koder-0.4.4 → koder-0.4.5}/koder_agent/core/streaming_display.py +0 -0
  48. {koder-0.4.4 → koder-0.4.5}/koder_agent/core/usage_tracker.py +0 -0
  49. {koder-0.4.4 → koder-0.4.5}/koder_agent/mcp/__init__.py +0 -0
  50. {koder-0.4.4 → koder-0.4.5}/koder_agent/mcp/cli_handler.py +0 -0
  51. {koder-0.4.4 → koder-0.4.5}/koder_agent/mcp/server_config.py +0 -0
  52. {koder-0.4.4 → koder-0.4.5}/koder_agent/mcp/server_factory.py +0 -0
  53. {koder-0.4.4 → koder-0.4.5}/koder_agent/mcp/server_manager.py +0 -0
  54. {koder-0.4.4 → koder-0.4.5}/koder_agent/tools/file.py +0 -0
  55. {koder-0.4.4 → koder-0.4.5}/koder_agent/tools/search.py +0 -0
  56. {koder-0.4.4 → koder-0.4.5}/koder_agent/tools/shell.py +0 -0
  57. {koder-0.4.4 → koder-0.4.5}/koder_agent/tools/task.py +0 -0
  58. {koder-0.4.4 → koder-0.4.5}/koder_agent/tools/todo.py +0 -0
  59. {koder-0.4.4 → koder-0.4.5}/koder_agent/tools/web.py +0 -0
  60. {koder-0.4.4 → koder-0.4.5}/koder_agent/utils/__init__.py +0 -0
  61. {koder-0.4.4 → koder-0.4.5}/koder_agent/utils/model_info.py +0 -0
  62. {koder-0.4.4 → koder-0.4.5}/koder_agent/utils/queue.py +0 -0
  63. {koder-0.4.4 → koder-0.4.5}/koder_agent/utils/sessions.py +0 -0
  64. {koder-0.4.4 → koder-0.4.5}/koder_agent/utils/terminal_theme.py +0 -0
  65. {koder-0.4.4 → koder-0.4.5}/scripts/upgrade_dependency.py +0 -0
  66. {koder-0.4.4 → koder-0.4.5}/tests/test_file_tools.py +0 -0
  67. {koder-0.4.4 → koder-0.4.5}/tests/test_shell_background.py +0 -0
  68. {koder-0.4.4 → koder-0.4.5}/tests/test_web.py +0 -0
@@ -6,7 +6,10 @@
6
6
  "Bash(python -m py_compile:*)",
7
7
  "Bash(uv run pytest:*)",
8
8
  "mcp__plugin_claude-code-settings_exa__get_code_context_exa",
9
- "Bash(find:*)"
9
+ "Bash(find:*)",
10
+ "WebFetch(domain:www.anthropic.com)",
11
+ "Bash(uv run ruff check:*)",
12
+ "mcp__firecrawl__firecrawl_scrape"
10
13
  ],
11
14
  "deny": [],
12
15
  "ask": []
@@ -24,26 +24,26 @@ uv run koder --session my-session "Your prompt"
24
24
 
25
25
  ```bash
26
26
  # Code formatting
27
- black .
27
+ uv run black .
28
28
 
29
29
  # Linting with auto-fix
30
- ruff check --fix
30
+ uv run ruff check --fix
31
31
 
32
32
  # Error-only pylint check
33
- pylint koder_agent/ --disable=C,R,W --errors-only
33
+ uv run pylint koder_agent/ --disable=C,R,W --errors-only
34
34
  ```
35
35
 
36
36
  ### Testing
37
37
 
38
38
  ```bash
39
39
  # Run all tests
40
- pytest
40
+ uv run pytest
41
41
 
42
42
  # Run a single test file
43
- pytest tests/test_file_tools.py
43
+ uv run pytest tests/test_file_tools.py
44
44
 
45
45
  # Run with verbose output
46
- pytest -v
46
+ uv run pytest -v
47
47
  ```
48
48
 
49
49
  ## Architecture
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: koder
3
- Version: 0.4.4
3
+ Version: 0.4.5
4
4
  Summary: An intuitive AI coding assistant and interactive CLI tool that boosts developer productivity with intelligent automation and context-aware support.
5
5
  Project-URL: Homepage, https://github.com/feiskyer/koder
6
6
  Project-URL: Repository, https://github.com/feiskyer/koder
@@ -40,14 +40,15 @@ Description-Content-Type: text/markdown
40
40
 
41
41
  Koder is an experimental, universal AI coding assistant designed to explore how to build an advanced terminal-based AI coding assistant. Written entirely in Python, it serves as both a functional tool and a learning playground for AI agent development.
42
42
 
43
- **🎯 Project Status**: Under active vibe coding! This is a learning-focused project where we explore building AI coding agents.
43
+ **🎯 Project Status**: Alpha! This is a learning-focused project where we explore building AI coding agents.
44
44
 
45
45
  ## ✨ Features
46
46
 
47
47
  - **🤖 Universal AI Support**: Works with OpenAI, Anthropic, Google, GitHub Copilot, and 100+ providers via LiteLLM with intelligent auto-detection
48
48
  - **💾 Smart Context Management**: Persistent sessions with SQLite storage and automatic token-aware compression (50k token limit)
49
49
  - **🔄 Real-time Streaming**: Rich Live displays with intelligent terminal cleanup for responsive user experience
50
- - **🛠️ Comprehensive Toolset**: file operations, search, shell, task delegation and todos.
50
+ - **🛠️ Comprehensive Toolset**: file operations, search, shell, task delegation, todos, and skills
51
+ - **📚 Progressive Disclosure Skills**: Load specialized knowledge on-demand with 90%+ token savings
51
52
  - **🔌 MCP Integration**: Model Context Protocol support with stdio, SSE, and HTTP transports for extensible tool ecosystem
52
53
  - **🛡️ Enterprise Security**: SecurityGuard validation, output filtering, permission system, and input sanitization
53
54
  - **🎯 Zero Configuration**: Automatic provider detection with fallback defaults
@@ -350,6 +351,84 @@ mcp_servers:
350
351
  url: "http://localhost:9000/sse"
351
352
  ```
352
353
 
354
+ ### Skills
355
+
356
+ Skills provide specialized knowledge and guidance that Koder can load on-demand. This uses a **Progressive Disclosure** pattern to minimize token usage - only skill metadata is loaded at startup, with full content fetched when needed.
357
+
358
+ #### Skills Directory Structure
359
+
360
+ Skills are loaded from two locations (project skills take priority):
361
+
362
+ 1. **Project skills**: `.koder/skills/` in your current directory
363
+ 2. **User skills**: `~/.koder/skills/` for personal skills
364
+
365
+ Each skill lives in its own directory with a `SKILL.md` file:
366
+
367
+ ```
368
+ .koder/skills/
369
+ ├── api-design/
370
+ │ └── SKILL.md
371
+ ├── code-review/
372
+ │ ├── SKILL.md
373
+ │ └── checklist.md # Supplementary resource
374
+ └── testing/
375
+ └── SKILL.md
376
+ ```
377
+
378
+ #### Creating a Skill
379
+
380
+ Create a `SKILL.md` file with YAML frontmatter:
381
+
382
+ ```markdown
383
+ ---
384
+ name: api-design
385
+ description: Best practices for designing RESTful APIs
386
+ allowed_tools:
387
+ - read_file
388
+ - write_file
389
+ ---
390
+
391
+ # API Design Guidelines
392
+
393
+ ## RESTful Principles
394
+
395
+ Use nouns for resources, HTTP verbs for actions...
396
+
397
+ ## Versioning
398
+
399
+ Always version your APIs using URL path (`/v1/users`)...
400
+
401
+ ## Error Handling
402
+
403
+ Return consistent error responses with status codes...
404
+ ```
405
+
406
+ #### Frontmatter Fields
407
+
408
+ | Field | Required | Description |
409
+ |-------|----------|-------------|
410
+ | `name` | Yes | Unique skill identifier |
411
+ | `description` | Yes | Brief description (shown in metadata) |
412
+ | `allowed_tools` | No | Tools the skill recommends using |
413
+
414
+ #### How Skills Work
415
+
416
+ 1. **Startup**: Only skill names and descriptions are loaded (Level 1 - minimal tokens)
417
+ 2. **On-demand**: When Koder needs a skill, it calls `get_skill(name)` to load full content (Level 2)
418
+ 3. **Supplementary**: Skills can reference additional files that Koder reads with `read_file` (Level 3)
419
+
420
+ This progressive approach saves **90%+ tokens** compared to loading all skill content at startup.
421
+
422
+ #### Skills Configuration
423
+
424
+ ```yaml
425
+ # ~/.koder/config.yaml
426
+ skills:
427
+ enabled: true # Enable/disable skills (default: true)
428
+ project_skills_dir: ".koder/skills" # Project skills location
429
+ user_skills_dir: "~/.koder/skills" # User skills location
430
+ ```
431
+
353
432
  ### Example Configurations
354
433
 
355
434
  <details>
@@ -4,14 +4,15 @@
4
4
 
5
5
  Koder is an experimental, universal AI coding assistant designed to explore how to build an advanced terminal-based AI coding assistant. Written entirely in Python, it serves as both a functional tool and a learning playground for AI agent development.
6
6
 
7
- **🎯 Project Status**: Under active vibe coding! This is a learning-focused project where we explore building AI coding agents.
7
+ **🎯 Project Status**: Alpha! This is a learning-focused project where we explore building AI coding agents.
8
8
 
9
9
  ## ✨ Features
10
10
 
11
11
  - **🤖 Universal AI Support**: Works with OpenAI, Anthropic, Google, GitHub Copilot, and 100+ providers via LiteLLM with intelligent auto-detection
12
12
  - **💾 Smart Context Management**: Persistent sessions with SQLite storage and automatic token-aware compression (50k token limit)
13
13
  - **🔄 Real-time Streaming**: Rich Live displays with intelligent terminal cleanup for responsive user experience
14
- - **🛠️ Comprehensive Toolset**: file operations, search, shell, task delegation and todos.
14
+ - **🛠️ Comprehensive Toolset**: file operations, search, shell, task delegation, todos, and skills
15
+ - **📚 Progressive Disclosure Skills**: Load specialized knowledge on-demand with 90%+ token savings
15
16
  - **🔌 MCP Integration**: Model Context Protocol support with stdio, SSE, and HTTP transports for extensible tool ecosystem
16
17
  - **🛡️ Enterprise Security**: SecurityGuard validation, output filtering, permission system, and input sanitization
17
18
  - **🎯 Zero Configuration**: Automatic provider detection with fallback defaults
@@ -314,6 +315,84 @@ mcp_servers:
314
315
  url: "http://localhost:9000/sse"
315
316
  ```
316
317
 
318
+ ### Skills
319
+
320
+ Skills provide specialized knowledge and guidance that Koder can load on-demand. This uses a **Progressive Disclosure** pattern to minimize token usage - only skill metadata is loaded at startup, with full content fetched when needed.
321
+
322
+ #### Skills Directory Structure
323
+
324
+ Skills are loaded from two locations (project skills take priority):
325
+
326
+ 1. **Project skills**: `.koder/skills/` in your current directory
327
+ 2. **User skills**: `~/.koder/skills/` for personal skills
328
+
329
+ Each skill lives in its own directory with a `SKILL.md` file:
330
+
331
+ ```
332
+ .koder/skills/
333
+ ├── api-design/
334
+ │ └── SKILL.md
335
+ ├── code-review/
336
+ │ ├── SKILL.md
337
+ │ └── checklist.md # Supplementary resource
338
+ └── testing/
339
+ └── SKILL.md
340
+ ```
341
+
342
+ #### Creating a Skill
343
+
344
+ Create a `SKILL.md` file with YAML frontmatter:
345
+
346
+ ```markdown
347
+ ---
348
+ name: api-design
349
+ description: Best practices for designing RESTful APIs
350
+ allowed_tools:
351
+ - read_file
352
+ - write_file
353
+ ---
354
+
355
+ # API Design Guidelines
356
+
357
+ ## RESTful Principles
358
+
359
+ Use nouns for resources, HTTP verbs for actions...
360
+
361
+ ## Versioning
362
+
363
+ Always version your APIs using URL path (`/v1/users`)...
364
+
365
+ ## Error Handling
366
+
367
+ Return consistent error responses with status codes...
368
+ ```
369
+
370
+ #### Frontmatter Fields
371
+
372
+ | Field | Required | Description |
373
+ |-------|----------|-------------|
374
+ | `name` | Yes | Unique skill identifier |
375
+ | `description` | Yes | Brief description (shown in metadata) |
376
+ | `allowed_tools` | No | Tools the skill recommends using |
377
+
378
+ #### How Skills Work
379
+
380
+ 1. **Startup**: Only skill names and descriptions are loaded (Level 1 - minimal tokens)
381
+ 2. **On-demand**: When Koder needs a skill, it calls `get_skill(name)` to load full content (Level 2)
382
+ 3. **Supplementary**: Skills can reference additional files that Koder reads with `read_file` (Level 3)
383
+
384
+ This progressive approach saves **90%+ tokens** compared to loading all skill content at startup.
385
+
386
+ #### Skills Configuration
387
+
388
+ ```yaml
389
+ # ~/.koder/config.yaml
390
+ skills:
391
+ enabled: true # Enable/disable skills (default: true)
392
+ project_skills_dir: ".koder/skills" # Project skills location
393
+ user_skills_dir: "~/.koder/skills" # User skills location
394
+ ```
395
+
317
396
  ### Example Configurations
318
397
 
319
398
  <details>
@@ -2,6 +2,7 @@
2
2
 
3
3
  import logging
4
4
  import uuid
5
+ from pathlib import Path
5
6
 
6
7
  import backoff
7
8
  import litellm
@@ -12,9 +13,11 @@ from rich.console import Console
12
13
 
13
14
  from ..config import get_config
14
15
  from ..mcp import load_mcp_servers
16
+ from ..tools.skill import SkillLoader
15
17
  from ..utils.client import get_litellm_model_kwargs, get_model_name, is_native_openai_provider
16
18
  from ..utils.model_info import get_maximum_output_tokens
17
19
  from ..utils.prompts import KODER_SYSTEM_PROMPT
20
+ from .skill_guardrail import skill_restriction_guardrail
18
21
 
19
22
  console = Console()
20
23
  logger = logging.getLogger(__name__)
@@ -52,6 +55,42 @@ class RetryingLitellmModel(LitellmModel):
52
55
  yield chunk
53
56
 
54
57
 
58
+ def _get_skills_metadata(config) -> str:
59
+ """Load and return skills metadata from configured directories.
60
+
61
+ Priority: project skills directory > user skills directory.
62
+ Skills with the same name in project dir override user dir.
63
+ """
64
+ if not config.skills.enabled:
65
+ return "Skills are disabled."
66
+
67
+ all_skills = {}
68
+
69
+ # Load user skills first (lower priority)
70
+ user_dir = Path(config.skills.user_skills_dir).expanduser()
71
+ if user_dir.exists():
72
+ user_loader = SkillLoader(user_dir)
73
+ for skill in user_loader.discover_skills():
74
+ all_skills[skill.name] = skill
75
+
76
+ # Load project skills (higher priority - overrides user skills)
77
+ project_dir = Path(config.skills.project_skills_dir)
78
+ if project_dir.exists():
79
+ project_loader = SkillLoader(project_dir)
80
+ for skill in project_loader.discover_skills():
81
+ all_skills[skill.name] = skill
82
+
83
+ if not all_skills:
84
+ return "No skills are currently available."
85
+
86
+ lines = ["Available skills:", ""]
87
+ for skill in sorted(all_skills.values(), key=lambda s: s.name.lower()):
88
+ description = skill.description.strip()
89
+ lines.append(f"- {skill.name}: {description}")
90
+
91
+ return "\n".join(lines)
92
+
93
+
55
94
  async def create_dev_agent(tools) -> Agent:
56
95
  """Create the main development agent with MCP servers."""
57
96
  config = get_config()
@@ -80,13 +119,19 @@ async def create_dev_agent(tools) -> Agent:
80
119
  effort = None if config.model.reasoning_effort == "none" else config.model.reasoning_effort
81
120
  model_settings.reasoning = Reasoning(effort=effort, summary="detailed")
82
121
 
122
+ # Build system prompt with skills metadata (Progressive Disclosure Level 1)
123
+ skills_metadata = _get_skills_metadata(config)
124
+ system_prompt = KODER_SYSTEM_PROMPT.replace("{SKILLS_METADATA}", skills_metadata)
125
+
83
126
  dev_agent = Agent(
84
127
  name="Koder",
85
128
  model=model,
86
- instructions=KODER_SYSTEM_PROMPT,
129
+ instructions=system_prompt,
87
130
  tools=tools,
88
131
  mcp_servers=mcp_servers,
89
132
  model_settings=model_settings,
133
+ # Add skill-based tool restriction enforcement
134
+ input_guardrails=[skill_restriction_guardrail],
90
135
  )
91
136
 
92
137
  if "github_copilot" in model_name_str:
@@ -0,0 +1,79 @@
1
+ """Guardrail for enforcing skill-based tool restrictions.
2
+
3
+ This module provides a ToolInputGuardrail that intercepts tool calls and
4
+ rejects those not permitted by the currently active skill restrictions.
5
+
6
+ When a skill with `allowed_tools` is loaded via get_skill(), subsequent
7
+ tool calls are validated against the allowed list. Tools not in the list
8
+ are rejected with an informative message.
9
+ """
10
+
11
+ from agents import (
12
+ ToolGuardrailFunctionOutput,
13
+ ToolInputGuardrail,
14
+ ToolInputGuardrailData,
15
+ )
16
+
17
+ from ..tools.skill_context import get_active_restrictions
18
+
19
+
20
+ def skill_tool_restriction_guardrail(
21
+ data: ToolInputGuardrailData,
22
+ ) -> ToolGuardrailFunctionOutput:
23
+ """Guardrail that enforces skill-declared tool restrictions.
24
+
25
+ When a skill is loaded with `allowed_tools`, only those tools
26
+ (plus always-allowed tools like get_skill, todo_read, todo_write)
27
+ can be used.
28
+
29
+ Args:
30
+ data: The guardrail input data containing tool context
31
+
32
+ Returns:
33
+ ToolGuardrailFunctionOutput indicating whether to allow or reject
34
+ """
35
+ restrictions = get_active_restrictions()
36
+
37
+ # No active restrictions - allow all tools
38
+ if restrictions is None:
39
+ return ToolGuardrailFunctionOutput.allow()
40
+
41
+ # Guard against missing or empty tool_name (defensive coding)
42
+ tool_name = getattr(data.context, "tool_name", "") or ""
43
+ if not tool_name:
44
+ # Unknown tool - reject with clear message
45
+ return ToolGuardrailFunctionOutput.reject_content(
46
+ message="Unable to verify tool: tool name is missing or empty",
47
+ output_info={"error": "missing_tool_name"},
48
+ )
49
+
50
+ # Check if tool is allowed
51
+ if restrictions.is_tool_allowed(tool_name):
52
+ return ToolGuardrailFunctionOutput.allow()
53
+
54
+ # Tool is not allowed - reject with informative message
55
+ allowed_list = ", ".join(sorted(restrictions.allowed_tools))
56
+ skills_list = ", ".join(restrictions.loaded_skills)
57
+
58
+ message = (
59
+ f"Tool '{tool_name}' is not permitted while skill(s) [{skills_list}] "
60
+ f"are active with tool restrictions. "
61
+ f"Allowed tools: {allowed_list}. "
62
+ f"You can load a skill without restrictions to clear these limits."
63
+ )
64
+
65
+ return ToolGuardrailFunctionOutput.reject_content(
66
+ message=message,
67
+ output_info={
68
+ "blocked_tool": tool_name,
69
+ "active_skills": restrictions.loaded_skills,
70
+ "allowed_tools": list(restrictions.allowed_tools),
71
+ },
72
+ )
73
+
74
+
75
+ # Create the guardrail instance for use in agent configuration
76
+ skill_restriction_guardrail = ToolInputGuardrail(
77
+ guardrail_function=skill_tool_restriction_guardrail,
78
+ name="skill_tool_restrictions",
79
+ )
@@ -71,9 +71,22 @@ class MCPServerConfigYaml(BaseModel):
71
71
  blocked_tools: Optional[List[str]] = Field(default=None, description="Blocked tools blacklist")
72
72
 
73
73
 
74
+ class SkillsConfig(BaseModel):
75
+ """Skills configuration settings for progressive disclosure."""
76
+
77
+ enabled: bool = Field(default=True, description="Enable skills feature")
78
+ project_skills_dir: str = Field(
79
+ default=".koder/skills", description="Project-level skills directory"
80
+ )
81
+ user_skills_dir: str = Field(
82
+ default="~/.koder/skills", description="User-level skills directory"
83
+ )
84
+
85
+
74
86
  class KoderConfig(BaseModel):
75
87
  """Root configuration model for Koder CLI."""
76
88
 
77
89
  model: ModelConfig = Field(default_factory=ModelConfig)
78
90
  cli: CLIConfig = Field(default_factory=CLIConfig)
79
91
  mcp_servers: List[MCPServerConfigYaml] = Field(default_factory=list)
92
+ skills: SkillsConfig = Field(default_factory=SkillsConfig)
@@ -28,6 +28,14 @@ from .shell import (
28
28
  shell_kill,
29
29
  shell_output,
30
30
  )
31
+ from .skill import Skill, SkillLoader, SkillModel, get_skill
32
+ from .skill_context import (
33
+ SkillRestrictions,
34
+ add_skill_restrictions,
35
+ clear_restrictions,
36
+ get_active_restrictions,
37
+ has_active_restrictions,
38
+ )
31
39
  from .task import TaskDelegateModel, TaskModel, task_delegate
32
40
  from .todo import TodoModel, TodoWriteModel, todo_read, todo_write
33
41
  from .web import SearchModel, WebFetchModel, web_fetch, web_search
@@ -49,6 +57,7 @@ tool_engine.register(GrepModel)(grep_search)
49
57
  tool_engine.register(LSModel)(list_directory)
50
58
  # TODO tools are already registered via @function_tool decorator
51
59
  # Removing duplicate registration to avoid naming conflicts
60
+ tool_engine.register(SkillModel)(get_skill)
52
61
  tool_engine.register(WebFetchModel)(web_fetch)
53
62
  tool_engine.register(TaskDelegateModel)(task_delegate)
54
63
  tool_engine.register(GitModel)(git_command)
@@ -74,6 +83,7 @@ def get_all_tools() -> List[Tool]:
74
83
  todo_read,
75
84
  todo_write,
76
85
  task_delegate,
86
+ get_skill,
77
87
  ]
78
88
 
79
89
  # Filter to only include properly decorated tools
@@ -98,6 +108,14 @@ __all__ = [
98
108
  "WebFetchModel",
99
109
  "GlobModel",
100
110
  "GrepModel",
111
+ "Skill",
112
+ "SkillLoader",
113
+ "SkillModel",
114
+ "SkillRestrictions",
115
+ "add_skill_restrictions",
116
+ "clear_restrictions",
117
+ "get_active_restrictions",
118
+ "has_active_restrictions",
101
119
  "TodoModel",
102
120
  "TodoWriteModel",
103
121
  "TaskModel",
@@ -119,4 +137,5 @@ __all__ = [
119
137
  "todo_read",
120
138
  "todo_write",
121
139
  "task_delegate",
140
+ "get_skill",
122
141
  ]
@@ -119,6 +119,7 @@ class ToolEngine:
119
119
  "todo_write",
120
120
  "web_fetch",
121
121
  "task_delegate",
122
+ "get_skill",
122
123
  "git_command",
123
124
  }
124
125
  return name in allowed_tools