2.1 KiB
2.1 KiB
komAI Agent Guidelines
Репозиторий
https://git.komisar.gin.by/komisar/komAI
Entry Point
python -m app.komAI
Architecture
app/- application entry point (komAI.py expected)src/- source codesrc/utils/- utilities (config_manager, log_manager)config/- YAML configuration;config/global.yamlis the main configmodules/- pluggable modulestests/- standalone unit testslog/- runtime logs
Config System
Access via:
import src.utils.config_manager as config
config = config.config
Key APIs:
config.register(name, val, default, desc, cat, env, validator)config.get(name, cat)/config.getraw(key)config.set(name, value, cat)/config.setraw(key, value)config.getall(name, cat)/config.getrawall(cat)config.load()/config.save()/config.reset()
Constants: ROOT_KEY = "$root$", DEFAULT_CATEGORY = "global"
Logging
Access via:
import src.utils.log_manager as log
Key APIs:
log.register_global_params()- register global logging paramslog.register(module, log_console, log_stderr, log_file, log_level)- register modulelog.setup()- initialize logginglog.get_logger(module)- get logger instancelogger.print(msg, level)- print to console (use instead of print())
Rule: Never use print() - always use logger.print()
Constants: LOG_CATEGORY, LOG_CONSOLE, LOG_STDERR, LOG_FILE, LOG_LEVEL, etc.
Env Vars (see .env.example)
KOMAI_CONFIG_FILE- path to config file (optional)
Requirements
- Python >3.10
Module Development
When creating new modules:
- Register parameters:
import src.utils.config_manager as config
config.register(name="param", val="value", cat="module_name", ...)
- Use logging:
import src.utils.log_manager as log
log.register(module="module_name", log_console=True, ...)
logger = log.get_logger("module_name")
logger.print("message") # never print()
- Never use
print()directly - uselogger.print()instead
Testing
python -m tests.test_config_manager
python -m tests.test_log_manager