Tools
tools
echo AXMTools -- cross-package echo detection and intent retrieval.
Two read-only AXMTools in the spirit of ast_dead_code (see
axm_ast/tools/dead_code.py), sharing the corpus -> embed pipeline:
- :class:
EchoCodeTool(echo_code) walks the configured monorepo scope, embeds every public documented symbol, finds cross-package pairs whose promises (docstrings) are semantically close, applies the v7 anti-signals, and returns the surviving duplicate clusters plus the demoted parallel-API / boilerplate buckets. - :class:
EchoCheckTool(echo_check) embeds a free-form intention and retrieves the top-k nearest public symbols across the whole monorepo, each tagged with a location verdict (reuse canonical / reuse in place / promotable). It does the retrieval, never the use/extend/nothing decision -- that is left to the calling agent.
Both are registered under the axm.tools entry point, so each is reachable
as an MCP tool, an axm <name> CLI command, and a DAG tool_node for free
(one declaration, three surfaces).
CandidateEntry
Bases: TypedDict
A retrieved symbol matching an intention, with its location verdict.
The verdict is purely a location tag (AC3) -- it never encodes a
use/extend/nothing decision (AC4): a high score does not mean "use this",
only "this is the closest existing promise". promotable flags a
non-ingot candidate documented well enough to be worth canonicalising.
Source code in packages/axm-echo/src/axm_echo/tools.py
ClusterEntry
Bases: TypedDict
A cross-package echo cluster (connected component of duplicate pairs).
cluster_hash is the waiver address over the members' (package,
qualname); acknowledged is stamped when a live cluster is waived.
Both are added during the run, hence total=False.
Source code in packages/axm-echo/src/axm_echo/tools.py
EchoCheckTool
Bases: AXMTool
Retrieve the public symbols closest to a free-form intention.
Registered as echo_check via the axm.tools entry point. It embeds
the intention, retrieves the top-k nearest documented symbols across the
whole monorepo corpus (AC2), and tags each with a location verdict (AC3).
Retrieval is decoupled from the use/extend/nothing decision (AC4): the tool
returns ranked candidates + docstrings and leaves the call to the agent.
Source code in packages/axm-echo/src/axm_echo/tools.py
| Python | |
|---|---|
500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 | |
name
property
Return the tool name for registry lookup.
execute(*, intention='', backend='st', k=_CHECK_TOP_K, threshold=_CHECK_THRESHOLD, **kwargs)
Retrieve the top-k symbols closest to intention over the corpus.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
intention
|
str
|
Free-form description of the behaviour to implement. |
''
|
backend
|
Backend
|
Embedding backend -- |
'st'
|
k
|
int
|
Maximum number of candidates to return. |
_CHECK_TOP_K
|
threshold
|
float
|
Minimum cosine for a candidate to be retrieved. Below it the candidate is dropped, so a novel intention returns an empty list rather than a spurious match (AC4). |
_CHECK_THRESHOLD
|
Returns:
| Type | Description |
|---|---|
ToolResult
|
ToolResult with |
ToolResult
|
(ranked top-k, each carrying its docstrings and a location verdict). |
Source code in packages/axm-echo/src/axm_echo/tools.py
EchoCodeTool
Bases: AXMTool
Detect cross-package code echoes (intent-equivalent duplicates).
Registered as echo_code via the axm.tools entry point.
Source code in packages/axm-echo/src/axm_echo/tools.py
| Python | |
|---|---|
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 | |
name
property
Return the tool name for registry lookup.
execute(*, backend='st', threshold=PAIR_THRESHOLD, top_n=_DEFAULT_TOP_N, max_cluster_size=MAX_CLUSTER_SIZE, **kwargs)
Cluster cross-package echoes over the configured corpus.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
backend
|
Backend
|
Embedding backend -- |
'st'
|
threshold
|
float
|
Minimum cosine for a candidate pair. |
PAIR_THRESHOLD
|
top_n
|
int
|
Show at most this many of the nearest non-acknowledged clusters; the total count stays visible in the metadata. |
_DEFAULT_TOP_N
|
max_cluster_size
|
int
|
Reject components larger than this as union-find over-merges (structural conformity, not a duplicate echo). |
MAX_CLUSTER_SIZE
|
Returns:
| Type | Description |
|---|---|
ToolResult
|
ToolResult with the bounded |
ToolResult
|
|
ToolResult
|
pairs), the live/shown/actionable counts, and |
Source code in packages/axm-echo/src/axm_echo/tools.py
MemberEntry
Bases: TypedDict
A serialized symbol inside a cluster or a demoted pair.