MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / compact_command_call

Function compact_command_call

src/command_system/builtins.py:993–1017  ·  view source on GitHub ↗

Handle /compact command - compact conversation context. Args: args: Command arguments context: Command context Returns: LocalCommandResult

(args: str, context: CommandContext)

Source from the content-addressed store, hash-verified

991
992
993def compact_command_call(args: str, context: CommandContext) -> LocalCommandResult:
994 """
995 Handle /compact command - compact conversation context.
996
997 Args:
998 args: Command arguments
999 context: Command context
1000
1001 Returns:
1002 LocalCommandResult
1003 """
1004 # Run the async version in a new event loop
1005 try:
1006 loop = asyncio.get_running_loop()
1007 # If we're already in an async context, we can't use asyncio.run
1008 # Fall back to sync path
1009 return _sync_compact_fallback(context)
1010 except RuntimeError:
1011 # No running event loop — safe to use asyncio.run
1012 try:
1013 return asyncio.run(_compact_async(args, context))
1014 except Exception as e:
1015 import traceback
1016 traceback.print_exc()
1017 return _sync_compact_fallback(context)
1018
1019
1020def _sync_compact_fallback(context: CommandContext) -> LocalCommandResult:

Callers 1

execute_command_syncFunction · 0.85

Calls 3

_sync_compact_fallbackFunction · 0.85
_compact_asyncFunction · 0.85
runMethod · 0.45

Tested by

no test coverage detected