adachsoft / file-summary-tool
file-summary-tool
Requires
- php: ^8.3
- adachsoft/ai-agent: ^0.12
- adachsoft/ai-agent-config-repository: ^0.6
- adachsoft/ai-agent-factory: ^0.1
- adachsoft/ai-file-tool: ^0.4
- adachsoft/ai-tool-call: ^2.0
- adachsoft/ai-tool-call-middleware: ^0.3
- adachsoft/collection: ^3.0
- adachsoft/file-tool-security-policy: ^1.0
- adachsoft/sandbox-contracts: ^0.1
Requires (Dev)
- adachsoft/php-code-style: ^0.7
- friendsofphp/php-cs-fixer: ^3.95
- phpstan/phpstan: ^2.2
- phpunit/phpunit: ^12.5
- rector/rector: ^2.3
- symplify/phpstan-rules: ^14.9
- vlucas/phpdotenv: ^5.6
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is not auto-updated.
Last update: 2026-10-01 10:44:38 UTC
README
file-summary-tool provides an SPI tool that returns a concise or detailed summary of one file inside a configured base directory. Small files can be returned directly without an AI request, while larger files are summarized by an isolated agent.
Installation
composer install
Configuration
Create a ConfigMap with these values:
base_path— existing directory used as the sandbox root.api_key— provider credential.provider_id— configured AI provider identifier.model_id— model identifier.allowed_files/forbidden_files— optional file path policy lists.allow_extensions/deny_extensions— optional extension policy lists.max_file_size_bytes— optional positive limit, default65536.timeout_seconds— optional positive timeout, default60.direct_read_threshold_bytes— optional non-negative threshold for returning file contents directly, default2048.cache_dir— optional directory for filesystem summary cache.cache_enabled— optional boolean that enables summary caching, defaulttrue.
The tool exposes a required path parameter and an optional detail_level parameter with the values concise and detailed. Paths are resolved through the sandbox contract, checked by the security policy, and read with text encoding only. Project context is not passed to the isolated agent. Markdown and PHP files use format-specific summary instructions, with a generic fallback for other file types.
Usage
use AdachSoft\FileSummaryTool\FileSummaryToolFactory;
use AdachSoft\AiToolCall\SPI\Collection\ConfigMap;
$tool = new FileSummaryToolFactory()->create(new ConfigMap([
'base_path' => __DIR__ . '/documents',
'api_key' => $apiKey,
'provider_id' => 'openai/responses',
'model_id' => 'gpt-4.1-mini',
'direct_read_threshold_bytes' => 2048,
'cache_enabled' => true,
]));
Development
composer test
composer stan
composer test:e2e
composer stan
composer cs:check
Release
See CHANGELOG.md for the release history.