bytia-kode 0.8.0__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 (136) hide show
  1. bytia_kode-0.8.0/.cgcignore +26 -0
  2. bytia_kode-0.8.0/.env.example +29 -0
  3. bytia_kode-0.8.0/.githooks/pre-commit +14 -0
  4. bytia_kode-0.8.0/.github/workflows/ci.yml +74 -0
  5. bytia_kode-0.8.0/.gitignore +42 -0
  6. bytia_kode-0.8.0/.serena/.gitignore +2 -0
  7. bytia_kode-0.8.0/.serena/project.yml +138 -0
  8. bytia_kode-0.8.0/AUTHORS.md +14 -0
  9. bytia_kode-0.8.0/B-KODE.md +253 -0
  10. bytia_kode-0.8.0/CHANGELOG.md +343 -0
  11. bytia_kode-0.8.0/CODE_OF_CONDUCT.md +16 -0
  12. bytia_kode-0.8.0/CONTRIBUTING.md +25 -0
  13. bytia_kode-0.8.0/DEVLOG.md +76 -0
  14. bytia_kode-0.8.0/HANDOFF.md +89 -0
  15. bytia_kode-0.8.0/LICENSE +21 -0
  16. bytia_kode-0.8.0/PKG-INFO +594 -0
  17. bytia_kode-0.8.0/README.md +549 -0
  18. bytia_kode-0.8.0/ROADMAP.md +611 -0
  19. bytia_kode-0.8.0/SECURITY.md +46 -0
  20. bytia_kode-0.8.0/check_tts.py +6 -0
  21. bytia_kode-0.8.0/docs/ARCHITECTURE.md +471 -0
  22. bytia_kode-0.8.0/docs/BENCHMARK_PROMPT.md +5 -0
  23. bytia_kode-0.8.0/docs/CODE-REVIEW.md +189 -0
  24. bytia_kode-0.8.0/docs/DEVELOPMENT.md +365 -0
  25. bytia_kode-0.8.0/docs/INTERCOM-REFACTOR.md +220 -0
  26. bytia_kode-0.8.0/docs/PLAN-memory-manager-B-KODE.md +112 -0
  27. bytia_kode-0.8.0/docs/SESSION_AUDIT_tui_cd8638f8.md +370 -0
  28. bytia_kode-0.8.0/docs/TUI.md +234 -0
  29. bytia_kode-0.8.0/docs/deepseek-v4-technical-report.md +315 -0
  30. bytia_kode-0.8.0/docs/devlog/2026-04-01.md +33 -0
  31. bytia_kode-0.8.0/docs/devlog/2026-04-02.md +58 -0
  32. bytia_kode-0.8.0/docs/devlog/2026-04-03.md +204 -0
  33. bytia_kode-0.8.0/docs/devlog/2026-04-04.md +56 -0
  34. bytia_kode-0.8.0/docs/devlog/2026-04-06.md +137 -0
  35. bytia_kode-0.8.0/docs/devlog/2026-04-07.md +179 -0
  36. bytia_kode-0.8.0/docs/devlog/2026-04-08.md +7 -0
  37. bytia_kode-0.8.0/docs/devlog/2026-04-09.md +7 -0
  38. bytia_kode-0.8.0/docs/devlog/2026-04-10.md +191 -0
  39. bytia_kode-0.8.0/docs/devlog/2026-04-11.md +41 -0
  40. bytia_kode-0.8.0/docs/devlog/2026-04-12.md +207 -0
  41. bytia_kode-0.8.0/docs/devlog/2026-04-15.md +85 -0
  42. bytia_kode-0.8.0/docs/devlog/2026-04-17.md +55 -0
  43. bytia_kode-0.8.0/docs/devlog/2026-04-26.md +121 -0
  44. bytia_kode-0.8.0/docs/devlog/2026-04-27.md +134 -0
  45. bytia_kode-0.8.0/docs/devlog/2026-04-28.md +27 -0
  46. bytia_kode-0.8.0/docs/devlog/2026-04-29.md +206 -0
  47. bytia_kode-0.8.0/docs/devlog/2026-04-30.md +40 -0
  48. bytia_kode-0.8.0/docs/devlog/2026-09-16.md +109 -0
  49. bytia_kode-0.8.0/docs/devlog/Session-39-MCP-Client.md +69 -0
  50. bytia_kode-0.8.0/docs/dsv4.html +570 -0
  51. bytia_kode-0.8.0/docs/img/bytia-kode-1-TUI-inicio.png +0 -0
  52. bytia_kode-0.8.0/docs/img/bytia-kode-2-TUI-chat.png +0 -0
  53. bytia_kode-0.8.0/docs/img/bytia-kode-3-TUI-comandos.png +0 -0
  54. bytia_kode-0.8.0/docs/img/bytia-kode-4-TUI-temas.png +0 -0
  55. bytia_kode-0.8.0/docs/img/bytia-kode-5-benchmark.png +0 -0
  56. bytia_kode-0.8.0/docs/img/bytia-kode-6-TUI-menu.png +0 -0
  57. bytia_kode-0.8.0/docs/specs/2026-04-13-agentic-loop-fix-design.md +94 -0
  58. bytia_kode-0.8.0/docs/superpowers/plans/2026-04-07-multi-workspace-context.md +565 -0
  59. bytia_kode-0.8.0/docs/superpowers/plans/2026-04-15-circuit-breaker.md +692 -0
  60. bytia_kode-0.8.0/docs/superpowers/specs/2026-04-07-multi-workspace-context-design.md +137 -0
  61. bytia_kode-0.8.0/docs/superpowers/specs/2026-04-15-circuit-breaker-design.md +162 -0
  62. bytia_kode-0.8.0/hatch_build.py +78 -0
  63. bytia_kode-0.8.0/install.sh +211 -0
  64. bytia_kode-0.8.0/pyproject.toml +83 -0
  65. bytia_kode-0.8.0/reports/CTO-estado-real.md +155 -0
  66. bytia_kode-0.8.0/reports/CTO-gates-o0-o2.md +50 -0
  67. bytia_kode-0.8.0/reports/DEVOPS-devops-annex-de57bd59.md +166 -0
  68. bytia_kode-0.8.0/reports/DEVOPS-devops.md +464 -0
  69. bytia_kode-0.8.0/reports/ENGINEER-bytia-engineer.md +148 -0
  70. bytia_kode-0.8.0/reports/QA-qa.md +302 -0
  71. bytia_kode-0.8.0/reports/RESEARCHER-researcher.md +242 -0
  72. bytia_kode-0.8.0/reports/SECURITY-bytia-security.md +143 -0
  73. bytia_kode-0.8.0/scripts/benchmark_io.py +68 -0
  74. bytia_kode-0.8.0/scripts/check_secrets.py +116 -0
  75. bytia_kode-0.8.0/scripts/sync-vendor-skills.sh +225 -0
  76. bytia_kode-0.8.0/scripts/validate_metadata.py +39 -0
  77. bytia_kode-0.8.0/src/bytia_kode/__init__.py +56 -0
  78. bytia_kode-0.8.0/src/bytia_kode/__main__.py +9 -0
  79. bytia_kode-0.8.0/src/bytia_kode/_build_info.py +88 -0
  80. bytia_kode-0.8.0/src/bytia_kode/_commit.txt +1 -0
  81. bytia_kode-0.8.0/src/bytia_kode/agent.py +1079 -0
  82. bytia_kode-0.8.0/src/bytia_kode/audio.py +114 -0
  83. bytia_kode-0.8.0/src/bytia_kode/config.py +193 -0
  84. bytia_kode-0.8.0/src/bytia_kode/context.py +152 -0
  85. bytia_kode-0.8.0/src/bytia_kode/guardrail.py +181 -0
  86. bytia_kode-0.8.0/src/bytia_kode/herdr.py +169 -0
  87. bytia_kode-0.8.0/src/bytia_kode/mcp/__init__.py +50 -0
  88. bytia_kode-0.8.0/src/bytia_kode/mcp/client.py +148 -0
  89. bytia_kode-0.8.0/src/bytia_kode/mcp/config.py +57 -0
  90. bytia_kode-0.8.0/src/bytia_kode/mcp/tool.py +29 -0
  91. bytia_kode-0.8.0/src/bytia_kode/prompts/__init__.py +1 -0
  92. bytia_kode-0.8.0/src/bytia_kode/prompts/kernel.default.yaml +243 -0
  93. bytia_kode-0.8.0/src/bytia_kode/prompts/legacy/core_identity.yaml.v12.1.0.yaml +136 -0
  94. bytia_kode-0.8.0/src/bytia_kode/prompts/runtime.default.yaml +134 -0
  95. bytia_kode-0.8.0/src/bytia_kode/providers/__init__.py +0 -0
  96. bytia_kode-0.8.0/src/bytia_kode/providers/circuit.py +52 -0
  97. bytia_kode-0.8.0/src/bytia_kode/providers/client.py +356 -0
  98. bytia_kode-0.8.0/src/bytia_kode/providers/manager.py +236 -0
  99. bytia_kode-0.8.0/src/bytia_kode/session.py +338 -0
  100. bytia_kode-0.8.0/src/bytia_kode/skills/__init__.py +0 -0
  101. bytia_kode-0.8.0/src/bytia_kode/skills/loader.py +332 -0
  102. bytia_kode-0.8.0/src/bytia_kode/telegram/__init__.py +0 -0
  103. bytia_kode-0.8.0/src/bytia_kode/telegram/bot.py +239 -0
  104. bytia_kode-0.8.0/src/bytia_kode/tools/__init__.py +0 -0
  105. bytia_kode-0.8.0/src/bytia_kode/tools/registry.py +1161 -0
  106. bytia_kode-0.8.0/src/bytia_kode/tools/session.py +104 -0
  107. bytia_kode-0.8.0/src/bytia_kode/tui.css +127 -0
  108. bytia_kode-0.8.0/src/bytia_kode/tui.py +1286 -0
  109. bytia_kode-0.8.0/src/bytia_kode/vendor/skills/bytia-constitution/SKILL.md +75 -0
  110. bytia_kode-0.8.0/src/bytia_kode/vendor/skills/bytia-memory/SKILL.md +104 -0
  111. bytia_kode-0.8.0/src/bytia_kode/vendor/skills/graphify/.graphify_version +1 -0
  112. bytia_kode-0.8.0/src/bytia_kode/vendor/skills/graphify/SKILL.md +1032 -0
  113. bytia_kode-0.8.0/src/bytia_kode/vendor/skills/skills-manager/SKILL.md +111 -0
  114. bytia_kode-0.8.0/src/tests/__init__.py +1 -0
  115. bytia_kode-0.8.0/src/tests/test_basics.py +484 -0
  116. bytia_kode-0.8.0/tests/conftest.py +5 -0
  117. bytia_kode-0.8.0/tests/test_agentic_loop.py +518 -0
  118. bytia_kode-0.8.0/tests/test_bash_allowlist.py +398 -0
  119. bytia_kode-0.8.0/tests/test_build_info.py +137 -0
  120. bytia_kode-0.8.0/tests/test_check_secrets.py +102 -0
  121. bytia_kode-0.8.0/tests/test_circuit_breaker.py +74 -0
  122. bytia_kode-0.8.0/tests/test_config_env_precedence.py +43 -0
  123. bytia_kode-0.8.0/tests/test_context.py +97 -0
  124. bytia_kode-0.8.0/tests/test_context_management.py +177 -0
  125. bytia_kode-0.8.0/tests/test_exploration_tools.py +207 -0
  126. bytia_kode-0.8.0/tests/test_file_edit.py +215 -0
  127. bytia_kode-0.8.0/tests/test_hatch_build.py +84 -0
  128. bytia_kode-0.8.0/tests/test_herdr.py +222 -0
  129. bytia_kode-0.8.0/tests/test_jeval_guardrail.py +198 -0
  130. bytia_kode-0.8.0/tests/test_log_redaction.py +80 -0
  131. bytia_kode-0.8.0/tests/test_provider_health.py +168 -0
  132. bytia_kode-0.8.0/tests/test_session.py +322 -0
  133. bytia_kode-0.8.0/tests/test_telegram_wiring.py +64 -0
  134. bytia_kode-0.8.0/tests/test_trusted_write_denylist.py +130 -0
  135. bytia_kode-0.8.0/tests/test_web_fetch_ssrf.py +199 -0
  136. bytia_kode-0.8.0/uv.lock +3071 -0
@@ -0,0 +1,26 @@
1
+ # Auto-generated by CodeGraphContext
2
+ # Default ignore patterns for binary/media files
3
+ # Add your own patterns below
4
+
5
+ node_modules/
6
+ venv/
7
+ .venv/
8
+ env/
9
+ .env/
10
+ dist/
11
+ build/
12
+ target/
13
+ out/
14
+ obj/
15
+ .git/
16
+ __pycache__/
17
+ *.png
18
+ *.jpg
19
+ *.jpeg
20
+ *.gif
21
+ *.svg
22
+ *.mp4
23
+ *.mp3
24
+ *.zip
25
+ *.tar
26
+ *.gz
@@ -0,0 +1,29 @@
1
+ # Provider - llama.cpp Router (single port, multi-modelo)
2
+ PROVIDER_BASE_URL=http://localhost:8080/v1
3
+ PROVIDER_API_KEY=not-needed
4
+ PROVIDER_MODEL=auto
5
+
6
+ # Fallback provider (cloud API)
7
+ FALLBACK_BASE_URL=
8
+ FALLBACK_API_KEY=
9
+ FALLBACK_MODEL=
10
+
11
+ # Telegram bot
12
+ TELEGRAM_BOT_TOKEN=
13
+ TELEGRAM_ALLOWED_USERS=
14
+
15
+ # Local models (Ollama)
16
+ LOCAL_BASE_URL=http://localhost:11434/v1
17
+ LOCAL_MODEL=gemma4:26b
18
+
19
+ # General
20
+ LOG_LEVEL=INFO
21
+ DATA_DIR=~/.bytia-kode
22
+
23
+ # Sandbox - extra binaries (comma-separated, added to default allowlist)
24
+ EXTRA_BINARIES=
25
+
26
+ # DeepSeek (V4 flash/pro)
27
+ DEEPSEEK_BASE_URL=https://api.deepseek.com
28
+ DEEPSEEK_API_KEY=
29
+ DEEPSEEK_MODEL=deepseek-flash
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ if [ -x ".venv/bin/python" ]; then
5
+ PYTHON_BIN=".venv/bin/python"
6
+ elif command -v python3 >/dev/null 2>&1; then
7
+ PYTHON_BIN="python3"
8
+ else
9
+ PYTHON_BIN="python"
10
+ fi
11
+
12
+ "$PYTHON_BIN" scripts/validate_metadata.py
13
+ "$PYTHON_BIN" scripts/check_secrets.py
14
+ "$PYTHON_BIN" -m pytest -q
@@ -0,0 +1,74 @@
1
+ name: ci
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ validate:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: actions/setup-python@v5
16
+ with:
17
+ python-version: '3.11'
18
+ - name: Install dependencies
19
+ run: |
20
+ python -m pip install --upgrade pip
21
+ python -m pip install -e ".[dev]" build twine pytest
22
+ - name: Secret scan (full tree)
23
+ # T8: escanea TODOS los ficheros trackeados, no solo los staged
24
+ # (el modo staged sigue siendo el que corre el hook .githooks/pre-commit).
25
+ run: python scripts/check_secrets.py --all
26
+ - name: Validate metadata
27
+ run: python scripts/validate_metadata.py
28
+ - name: Run tests
29
+ run: python -m pytest -q
30
+ - name: Build wheel
31
+ run: python -m build --wheel
32
+ - name: Check distributions
33
+ run: python -m twine check dist/*
34
+ - name: Verify packaged resource
35
+ run: |
36
+ python - <<'PY'
37
+ import glob
38
+ import os
39
+ import subprocess
40
+ import sys
41
+ import tempfile
42
+ import venv
43
+ from importlib import resources
44
+ from pathlib import Path
45
+
46
+ wheel = sorted(glob.glob('dist/*.whl'))[-1]
47
+ env_dir = Path(tempfile.mkdtemp(prefix='bytia-wheel-'))
48
+ venv.create(env_dir, with_pip=True)
49
+ py = env_dir / ('Scripts/python.exe' if os.name == 'nt' else 'bin/python')
50
+ subprocess.check_call([str(py), '-m', 'pip', 'install', wheel])
51
+ code = "from importlib import resources; r = resources.files('bytia_kode.prompts').joinpath('kernel.default.yaml'); print(r.is_file())"
52
+ output = subprocess.check_output([str(py), '-c', code], text=True).strip()
53
+ if output != 'True':
54
+ raise SystemExit('kernel.default.yaml no está disponible como recurso empaquetado')
55
+ PY
56
+ - name: Smoke test [mcp] extra
57
+ # Caza D2 (AST-8): con el extra [mcp] instalado, `import bytia_kode.mcp`
58
+ # debe funcionar aunque mcp/manager.py siga en WIP.
59
+ run: |
60
+ python - <<'PY'
61
+ import glob
62
+ import os
63
+ import subprocess
64
+ import tempfile
65
+ import venv
66
+ from pathlib import Path
67
+
68
+ wheel = sorted(glob.glob('dist/*.whl'))[-1]
69
+ env_dir = Path(tempfile.mkdtemp(prefix='bytia-mcp-smoke-'))
70
+ venv.create(env_dir, with_pip=True)
71
+ py = env_dir / ('Scripts/python.exe' if os.name == 'nt' else 'bin/python')
72
+ subprocess.check_call([str(py), '-m', 'pip', 'install', f'{wheel}[mcp]'])
73
+ subprocess.check_call([str(py), '-c', 'import bytia_kode.mcp; print("import bytia_kode.mcp OK")'])
74
+ PY
@@ -0,0 +1,42 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.class
4
+ *.so
5
+ build/
6
+ dist/
7
+ *.egg-info/
8
+ .pytest_cache/
9
+ .coverage
10
+ htmlcov/
11
+ .env
12
+ .venv/
13
+ venv/
14
+ .idea/
15
+ .vscode/
16
+ .trae/
17
+ *.db
18
+ *.sqlite
19
+ data/
20
+ logs/
21
+ .DS_Store
22
+ *.bak
23
+ *.backup.*
24
+ fix_*.py
25
+ patch_*.py
26
+ .pkg-wheel-test/
27
+ CONTEXT.md
28
+ CLAUDE.md
29
+ .claude/settings.local.json
30
+ temp_audio/
31
+
32
+ # Windows metadata
33
+ *Zone.Identifier*
34
+
35
+ .codegraph/
36
+
37
+ # Hermetic-suite safety net: MagicMock.__fspath__ materializes this if a mock
38
+ # ever reaches SessionStore/Path again (see reports/QA-qa.md §3/§8)
39
+ MagicMock/
40
+
41
+ # AST-20: estampa efímera del build hook (hatch_build.py)
42
+ src/bytia_kode/_commit.txt
@@ -0,0 +1,2 @@
1
+ /cache
2
+ /project.local.yml
@@ -0,0 +1,138 @@
1
+ # the name by which the project can be referenced within Serena
2
+ project_name: "BytIA-KODE"
3
+
4
+
5
+ # list of languages for which language servers are started; choose from:
6
+ # al ansible bash clojure cpp
7
+ # cpp_ccls crystal csharp csharp_omnisharp dart
8
+ # elixir elm erlang fortran fsharp
9
+ # go groovy haskell haxe hlsl
10
+ # java json julia kotlin lean4
11
+ # lua luau markdown matlab msl
12
+ # nix ocaml pascal perl php
13
+ # php_phpactor powershell python python_jedi python_ty
14
+ # r rego ruby ruby_solargraph rust
15
+ # scala solidity swift systemverilog terraform
16
+ # toml typescript typescript_vts vue yaml
17
+ # zig
18
+ # (This list may be outdated. For the current list, see values of Language enum here:
19
+ # https://github.com/oraios/serena/blob/main/src/solidlsp/ls_config.py
20
+ # For some languages, there are alternative language servers, e.g. csharp_omnisharp, ruby_solargraph.)
21
+ # Note:
22
+ # - For C, use cpp
23
+ # - For JavaScript, use typescript
24
+ # - For Free Pascal/Lazarus, use pascal
25
+ # Special requirements:
26
+ # Some languages require additional setup/installations.
27
+ # See here for details: https://oraios.github.io/serena/01-about/020_programming-languages.html#language-servers
28
+ # When using multiple languages, the first language server that supports a given file will be used for that file.
29
+ # The first language is the default language and the respective language server will be used as a fallback.
30
+ # Note that when using the JetBrains backend, language servers are not used and this list is correspondingly ignored.
31
+ languages:
32
+ - python
33
+
34
+ # the encoding used by text files in the project
35
+ # For a list of possible encodings, see https://docs.python.org/3.11/library/codecs.html#standard-encodings
36
+ encoding: "utf-8"
37
+
38
+ # line ending convention to use when writing source files.
39
+ # Possible values: unset (use global setting), "lf", "crlf", or "native" (platform default)
40
+ # This does not affect Serena's own files (e.g. memories and configuration files), which always use native line endings.
41
+ line_ending:
42
+
43
+ # The language backend to use for this project.
44
+ # If not set, the global setting from serena_config.yml is used.
45
+ # Valid values: LSP, JetBrains
46
+ # Note: the backend is fixed at startup. If a project with a different backend
47
+ # is activated post-init, an error will be returned.
48
+ language_backend:
49
+
50
+ # whether to use project's .gitignore files to ignore files
51
+ ignore_all_files_in_gitignore: true
52
+
53
+ # advanced configuration option allowing to configure language server-specific options.
54
+ # Maps the language key to the options.
55
+ # Have a look at the docstring of the constructors of the LS implementations within solidlsp (e.g., for C# or PHP) to see which options are available.
56
+ # No documentation on options means no options are available.
57
+ ls_specific_settings: {}
58
+
59
+ # list of additional paths to ignore in this project.
60
+ # Same syntax as gitignore, so you can use * and **.
61
+ # Note: global ignored_paths from serena_config.yml are also applied additively.
62
+ ignored_paths: []
63
+
64
+ # whether the project is in read-only mode
65
+ # If set to true, all editing tools will be disabled and attempts to use them will result in an error
66
+ # Added on 2025-04-18
67
+ read_only: false
68
+
69
+ # list of tool names to exclude.
70
+ # This extends the existing exclusions (e.g. from the global configuration)
71
+ # Find the list of tools here: https://oraios.github.io/serena/01-about/035_tools.html
72
+ excluded_tools: []
73
+
74
+ # list of tools to include that would otherwise be disabled (particularly optional tools that are disabled by default).
75
+ # This extends the existing inclusions (e.g. from the global configuration).
76
+ # Find the list of tools here: https://oraios.github.io/serena/01-about/035_tools.html
77
+ included_optional_tools: []
78
+
79
+ # fixed set of tools to use as the base tool set (if non-empty), replacing Serena's default set of tools.
80
+ # This cannot be combined with non-empty excluded_tools or included_optional_tools.
81
+ # Find the list of tools here: https://oraios.github.io/serena/01-about/035_tools.html
82
+ fixed_tools: []
83
+
84
+ # list of mode names to that are always to be included in the set of active modes
85
+ # The full set of modes to be activated is base_modes + default_modes.
86
+ # If the setting is undefined, the base_modes from the global configuration (serena_config.yml) apply.
87
+ # Otherwise, this setting overrides the global configuration.
88
+ # Set this to [] to disable base modes for this project.
89
+ # Set this to a list of mode names to always include the respective modes for this project.
90
+ base_modes:
91
+
92
+ # list of mode names that are to be activated by default, overriding the setting in the global configuration.
93
+ # The full set of modes to be activated is base_modes (from global config) + default_modes + added_modes.
94
+ # If the setting is undefined/empty, the default_modes from the global configuration (serena_config.yml) apply.
95
+ # Otherwise, this overrides the setting from the global configuration (serena_config.yml).
96
+ # Therefore, you can set this to [] if you do not want the default modes defined in the global config to apply
97
+ # for this project.
98
+ # This setting can, in turn, be overridden by CLI parameters (--mode).
99
+ # See https://oraios.github.io/serena/02-usage/050_configuration.html#modes
100
+ default_modes:
101
+
102
+ # initial prompt for the project. It will always be given to the LLM upon activating the project
103
+ # (contrary to the memories, which are loaded on demand).
104
+ initial_prompt: ""
105
+
106
+ # time budget (seconds) per tool call for the retrieval of additional symbol information
107
+ # such as docstrings or parameter information.
108
+ # This overrides the corresponding setting in the global configuration; see the documentation there.
109
+ # If null or missing, use the setting from the global configuration.
110
+ symbol_info_budget:
111
+
112
+ # list of regex patterns which, when matched, mark a memory entry as read‑only.
113
+ # Extends the list from the global configuration, merging the two lists.
114
+ read_only_memory_patterns: []
115
+
116
+ # list of regex patterns for memories to completely ignore.
117
+ # Matching memories will not appear in list_memories or activate_project output
118
+ # and cannot be accessed via read_memory or write_memory.
119
+ # To access ignored memory files, use the read_file tool on the raw file path.
120
+ # Extends the list from the global configuration, merging the two lists.
121
+ # Example: ["_archive/.*", "_episodes/.*"]
122
+ ignored_memory_patterns: []
123
+
124
+ # list of mode names to be activated additionally for this project, e.g. ["query-projects"]
125
+ # The full set of modes to be activated is base_modes (from global config) + default_modes + added_modes.
126
+ # See https://oraios.github.io/serena/02-usage/050_configuration.html#modes
127
+ added_modes:
128
+
129
+ # list of additional workspace folder paths for cross-package reference support (e.g. in monorepos).
130
+ # Paths can be absolute or relative to the project root.
131
+ # Each folder is registered as an LSP workspace folder, enabling language servers to discover
132
+ # symbols and references across package boundaries.
133
+ # Currently supported for: TypeScript.
134
+ # Example:
135
+ # additional_workspace_folders:
136
+ # - ../sibling-package
137
+ # - ../shared-lib
138
+ additional_workspace_folders: []
@@ -0,0 +1,14 @@
1
+ # Authors
2
+
3
+ **Pedro Luis Cuevas Villarrubia** (AsturWebs)
4
+ Author & Maintainer
5
+ pedro@asturwebs.es
6
+
7
+ **BytIA** v12.3.0
8
+ AI Co-Author — BytIA OS Cognitive Entity
9
+ dev@asturwebs.es
10
+
11
+ ---
12
+
13
+ BytIA operates as an AI development partner within the BytIA Ecosystem.
14
+ It is not a separate legal entity. All rights belong to the author.
@@ -0,0 +1,253 @@
1
+ # BytIA-KODE — Project Instructions
2
+
3
+ ## Identidad y Arquitectura
4
+
5
+ Eres **BytIA KODE**, la hermana pequeña del ecosistema BytIA. Tu identidad se carga desde dos capas YAML empaquetadas en el wheel:
6
+
7
+ - **Kernel** (`kernel.default.yaml`) — Identidad inmutable, valores, protocolos (BytIA OS)
8
+ - **Runtime** (`runtime.default.yaml`) — Adaptación KODE: capacidades, comandos, entorno
9
+
10
+ El system prompt se construye en orden: kernel + runtime → **este archivo (B-KODE.md)** → skills relevantes → contexto de sesión anterior.
11
+
12
+ Usuario puede sobreescribir la identidad en `~/.bytia-kode/prompts/bytia.kernel.yaml` y `~/.bytia-kode/prompts/bytia.runtime.kode.yaml` (deep-merge sobre los defaults del wheel).
13
+
14
+ ## Rutas Críticas
15
+
16
+ | Recurso | Ruta |
17
+ |---------|------|
18
+ | Data dir | `~/.bytia-kode/` |
19
+ | Skills | `~/.bytia-kode/skills/` |
20
+ | Memoria | `~/.bytia-kode/memoria/` |
21
+ | Contextos | `~/.bytia-kode/contexts/` |
22
+ | Logs | `~/.bytia-kode/logs/bytia-kode.log` (1MB, 3 backups) |
23
+ | Sesiones | `~/.bytia-kode/sessions.db` (SQLite WAL) |
24
+ | Config | `~/.bytia-kode/.env` |
25
+ | Tema | `~/.bytia-kode/theme.json` |
26
+ | User prompts | `~/.bytia-kode/prompts/` |
27
+ | Intercom | `~/.bytia-kode/intercom/` |
28
+
29
+ ## Tools Registradas (12)
30
+
31
+ | Tool | Propósito | Seguridad |
32
+ |------|-----------|-----------|
33
+ | `bash` | Ejecutar comandos shell | Allowlist 34 binarios, `shell=False`, sin pipes/redirecciones/heredocs |
34
+ | `file_read` | Leer archivos | Path traversal bloqueado, sandbox CWD + trusted |
35
+ | `file_write` | Escribir archivos | Path traversal bloqueado, sandbox CWD + trusted |
36
+ | `file_edit` | Editar archivos (search/replace + create) | Backup automático, sandbox CWD + trusted |
37
+ | `web_fetch` | Fetch URLs (HTTP GET) | Solo http/https |
38
+ | `read_context` | Contexto del workspace actual | Solo lectura, auto-genera si no existe |
39
+ | `grep` | Búsqueda regex en archivos | Python puro, sin bash |
40
+ | `glob` | Pattern matching de archivos | Python puro, sin bash |
41
+ | `tree` | Jerarquía de directorios | Python puro, sin bash |
42
+ | `session_list` | Listar sesiones guardadas | Solo lectura |
43
+ | `session_load` | Cargar contexto de sesión pasada | Solo lectura |
44
+ | `session_search` | Buscar sesiones por título | Solo lectura |
45
+
46
+ ## Bash Allowlist (34 binarios)
47
+
48
+ Fuente de verdad: `_DEFAULT_BINARIES` en `src/bytia_kode/tools/registry.py:43-50`.
49
+
50
+ ```
51
+ ls, pwd, echo, git, grep, find, mkdir, rmdir, touch,
52
+ mv, cp, rm, wc, date, chmod, df, du, head, tail,
53
+ curl, wget, scp, ssh,
54
+ uv, python, python3, pip, pip3,
55
+ rg, bat, eza, tokei, shellcheck,
56
+ wsl
57
+ ```
58
+
59
+ `shell=False` + `shlex.split()`. Los siguientes operadores están **bloqueados**: `|`, `&&`, `||`, `>`, `>>`, `<<`, `;`, `$()`, backticks. Usa `file_write`/`file_edit` + múltiples llamadas bash en su lugar.
60
+
61
+ Expandir con `EXTRA_BINARIES` en `.env` (comma-separated).
62
+
63
+ ## Providers y Circuit Breaker
64
+
65
+ Tres providers en orden de prioridad: **primary** → **fallback** → **local**.
66
+
67
+ | Provider | Default URL | Default Model |
68
+ |----------|-------------|---------------|
69
+ | Primary | `http://localhost:8080/v1` (llama.cpp router) | `auto` (detecta del router) |
70
+ | Fallback | `https://api.z.ai/api/coding/paas/v4` | `glm-5-turbo` |
71
+ | Local | `http://localhost:11434/v1` (Ollama) | `gemma4:26b` |
72
+
73
+ **Circuit Breaker** por provider:
74
+ - **CLOSED** → normal, cuenta failures
75
+ - 3 failures → **OPEN** (provider descartado)
76
+ - 60s → **HALF_OPEN** (un intento de recuperación)
77
+ - Éxito en HALF_OPEN → **CLOSED**; fallo → **OPEN** de nuevo
78
+
79
+ Cambiar provider manual: `F3` en TUI o `/use <model>`.
80
+
81
+ ## Streaming Protocol
82
+
83
+ `agent.chat()` yields tuples para consumo async:
84
+
85
+ | Tipo | Contenido |
86
+ |------|-----------|
87
+ | `("system", msg)` | Notificaciones del sistema (cambio de provider, avisos) |
88
+ | `("error", msg)` | Errores |
89
+ | `("provider_used", name)` | Provider utilizado para esta respuesta |
90
+ | string chunks | Texto del asistente (streaming) |
91
+
92
+ El loop agéntico es **think → act → observe → repeat**, máximo 50 iteraciones.
93
+
94
+ ## Sesiones (SQLite WAL)
95
+
96
+ - `~/.bytia-kode/sessions.db` compartido entre TUI y Telegram
97
+ - O(1) por mensaje (solo INSERT, nunca reescribe historial)
98
+ - Connection-per-method: cada operación abre y cierra su propia conexión
99
+ - Formato ID: `{source}_{uuid_hex[:8]}` (ej: `tui_a1b2c3d4`, `telegram_123456`)
100
+ - Telegram: aislamiento por `chat_id`, cada usuario tiene su propio Agent e historial
101
+ - Compresión automática al 75% de `MAX_CONTEXT_TOKENS` (128k default): los 2 mensajes más antiguos se comprimen en un resumen system
102
+
103
+ ## Contexto Automático
104
+
105
+ `context.py` genera `CONTEXT.md` por workspace en `~/.bytia-kode/contexts/`. Detecta lenguaje, estructura, git y herramientas del proyecto. Se regenera con `/context` o `read_context` tool.
106
+
107
+ ## Skills Disponibles
108
+
109
+ Cargadas desde `~/.bytia-kode/skills/*/SKILL.md`. Auto-inyectadas en el system prompt según relevancia al query del usuario (scoring: trigger match +3, description +2, content +1).
110
+
111
+ | Skill | Propósito |
112
+ |-------|-----------|
113
+ | `agent-intercom` | Comunicación inter-agente (Claude, Claw, Kode) |
114
+ | `graphify` | Construcción de grafos de conocimiento |
115
+ | `memory-manager` | Memoria persistente entre sesiones |
116
+ | `skill-creator` | Plantilla para crear nuevas skills |
117
+ | `web-fetch` | Lectura de URLs (HTML a texto) |
118
+
119
+ ## Sistema de Memoria
120
+
121
+ Persistir conocimiento en `~/.bytia-kode/memoria/<categoria>/<nombre>.md`.
122
+
123
+ Categorías: `procedimientos/`, `contexto/`, `tecnologia/`, `decisiones/`
124
+
125
+ Formato obligatorio: YAML frontmatter + contenido markdown:
126
+ ```yaml
127
+ ---
128
+ created: YYYY-MM-DD
129
+ category: <categoria>
130
+ tags: [tag1, tag2]
131
+ ---
132
+ # Título
133
+ Contenido aquí.
134
+ ```
135
+
136
+ La memoria se gestiona vía skill `memory-manager` (no es una tool registrada — usa `file_write` y `file_read` sobre el directorio `memoria/`).
137
+
138
+ ## TUI — Comandos
139
+
140
+ | Comando | Acción |
141
+ |---------|--------|
142
+ | `/help` | Ayuda integrada |
143
+ | `/quit`, `/exit`, `/q` | Salir |
144
+ | `/reset` | Reiniciar conversación (en memoria) |
145
+ | `/new` | Nueva sesión con auto-save |
146
+ | `/sessions` | Listar sesiones guardadas |
147
+ | `/load <id>` | Cargar sesión |
148
+ | `/clear` | Limpiar chat |
149
+ | `/model`, `/provider` | Provider y modelo activos |
150
+ | `/tools` | Tools registradas |
151
+ | `/skills` | Listar skills |
152
+ | `/models` | Modelos disponibles del provider activo |
153
+ | `/use <model>` | Seleccionar modelo |
154
+ | `/history` | Historial reciente |
155
+ | `/cwd` | Directorio actual |
156
+ | `/safe` | Estado de safe mode |
157
+ | `/context` | Regenerar contexto del workspace |
158
+
159
+ ## TUI — Atajos de Teclado
160
+
161
+ | Atajo | Acción |
162
+ |-------|--------|
163
+ | `Ctrl+P` | Menú de comandos |
164
+ | `Ctrl+Q` | Salir |
165
+ | `Ctrl+R` | Reset conversación |
166
+ | `Ctrl+L` | Limpiar chat |
167
+ | `Ctrl+M` | Info del modelo |
168
+ | `Ctrl+T` | Mostrar tools |
169
+ | `Ctrl+S` | Mostrar skills |
170
+ | `Ctrl+D` | Toggle reasoning visible |
171
+ | `Ctrl+E` | Toggle safe mode |
172
+ | `Ctrl+X` | Copiar último bloque de código |
173
+ | `Ctrl+Shift+C` | Copiar respuesta completa |
174
+ | `Ctrl+K` | Kill nuclear (cancela + mata subprocess + limpia) |
175
+ | `F2` | Cambiar tema (19 temas, default gruvbox) |
176
+ | `F3` | Cambiar provider |
177
+ | `Escape` | Interrumpir generación |
178
+ | `↑` / `↓` | Historial de entrada |
179
+
180
+ ## Telegram Bot
181
+
182
+ Comparte `sessions.db` con la TUI. Comandos:
183
+
184
+ | Comando | Acción |
185
+ |---------|--------|
186
+ | `/start` | Info del bot y modelo activo |
187
+ | `/help` | Lista comandos disponibles |
188
+ | `/reset` | Limpiar conversación |
189
+ | `/stop` | Interrumpir generación |
190
+ | `/kill` | Kill nuclear |
191
+ | `/model` | Provider y modelo activos |
192
+ | `/sessions` | Listar sesiones del usuario |
193
+ | `/context` | Regenerar contexto del workspace |
194
+
195
+ Aislamiento por `chat_id`. Fail-secure: sin `TELEGRAM_ALLOWED_USERS` configurado, deniega todo.
196
+
197
+ ## Audio (TTS)
198
+
199
+ Respuestas con botón 🔊. Voz: **`bytia-tts`** con piper — modelo local `es_AR-daniela-high`, 100 % sin nube (`src/bytia_kode/audio.py:63` lanza `bytia-tts -- <texto>`). Requiere el binario `bytia-tts` en `~/.local/bin` y `piper` a su alcance. El botón vuelve a "Escuchar" al terminar de hablar.
200
+
201
+ ## Protocolo Intercom (opt-in)
202
+
203
+ Intercom permite comunicación entre agentes BytIA. Configuración: crear `~/.bytia-kode/intercom/` con subdirectorios `inbox/` y `outbox/`.
204
+
205
+ - **Tu inbox:** `~/.bytia-kode/intercom/inbox/kode/`
206
+ - **NUNCA leas** de `inbox/claude/` ni `inbox/claw/`
207
+ - **Enviar a Claude:** copiar `.md` a `~/.bytia-kode/intercom/inbox/claude/`
208
+ - **Enviar a Claw:** usar `send.sh` (SCP por túnel al VPS), NO solo copiar a outbox
209
+ - **ACK:** renombrar mensaje a `.ack` después de leerlo
210
+ - **Telegram:** usar `$TELEGRAM_BOT_TOKEN` del entorno (NUNCA hardcodear tokens)
211
+ - **Check inbox:** `ls ~/.bytia-kode/intercom/inbox/kode/*.md | grep -v '\.ack$'`
212
+
213
+ ## Config — Variables de Entorno
214
+
215
+ | Variable | Descripción | Default |
216
+ |----------|-------------|---------|
217
+ | `PROVIDER_BASE_URL` | Endpoint primary | `http://localhost:8080/v1` |
218
+ | `PROVIDER_API_KEY` | API key primary | vacío |
219
+ | `PROVIDER_MODEL` | Modelo primary (`auto` = detectar del router) | `auto` |
220
+ | `FALLBACK_BASE_URL` | Endpoint fallback | `https://api.z.ai/api/coding/paas/v4` |
221
+ | `FALLBACK_API_KEY` | API key fallback | vacío |
222
+ | `FALLBACK_MODEL` | Modelo fallback | `glm-5-turbo` |
223
+ | `LOCAL_BASE_URL` | Endpoint local (Ollama) | `http://localhost:11434/v1` |
224
+ | `LOCAL_MODEL` | Modelo local | `gemma4:26b` |
225
+ | `TELEGRAM_BOT_TOKEN` | Token del bot | vacío |
226
+ | `TELEGRAM_ALLOWED_USERS` | User IDs permitidos (comma-separated) | vacío |
227
+ | `DATA_DIR` | Directorio persistente | `~/.bytia-kode` |
228
+ | `LOG_LEVEL` | Nivel de logging | `INFO` |
229
+ | `LOG_FILE` | Path custom logs | auto |
230
+ | `EXTRA_BINARIES` | Binarios adicionales BashTool | vacío |
231
+ | `LLM_TEMPERATURE` | Temperatura del modelo | `0.3` |
232
+ | `LLM_MAX_TOKENS` | Max tokens por respuesta | `8192` |
233
+ | `LLM_TIMEOUT` | Timeout en segundos | `120` |
234
+ | `JEVAL_MODE` | Guardarraíl pre-ejecución: `off` / `shadow` / `enforce` | `off` |
235
+ | `JEVAL_THRESHOLD` | Umbral de riesgo (`noul`) para bloquear en `enforce` | `0.7` |
236
+ | `JEVAL_TIMEOUT` | Timeout del clasificador JEVAL (s) | `2.0` |
237
+ | `TYPESAFE_API_KEY` | API key del clasificador JEVAL (fallback `~/.config/typesafe/env`) | vacío |
238
+
239
+ Carga: `.env` del CWD primero (no sobreescribe), luego `~/.bytia-kode/.env` (sobreescribe).
240
+
241
+ ## Seguridad
242
+
243
+ - **Guardarraíl JEVAL** (`src/bytia_kode/guardrail.py`): clasifica cada llamada a
244
+ tool antes de ejecutarla. Modos vía `JEVAL_MODE`: **`off` (default)**, `shadow`
245
+ (clasifica y loguea en background, nunca bloquea), `enforce` (bloquea tools con
246
+ `noul >= JEVAL_THRESHOLD`). Sin `TYPESAFE_API_KEY` el gate se desactiva aunque
247
+ el modo sea `enforce`; ante cualquier error o timeout **fail-open** (se permite
248
+ la llamada). Log JSONL: `~/.local/state/jev-router/kode-guardrail.jsonl`.
249
+ - **NUNCA** hardcodear tokens, API keys o secrets en código, skills o este archivo
250
+ - Usar **variables de entorno** para todos los secrets
251
+ - Este repo es **PÚBLICO** (asturwebs/BytIA-KODE) — todo lo commiteado es visible
252
+ - Si un tool falla, reportar error exacto — NUNCA simular éxito (P20)
253
+ - Safe mode (`Ctrl+E`) es **visual solamente** — no endurece el backend