Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/PeterLeeXX/Socrates
/ functions
Functions
105 in github.com/PeterLeeXX/Socrates
⨍
Functions
105
◇
Types & classes
13
↓ 25 callers
Method
execute
(self, command: str, timeout: int = 120, **kwargs)
socrates/tools/bash.py:71
↓ 19 callers
Method
add
(self, message: dict)
socrates/context.py:22
↓ 12 callers
Method
resolve_model
Resolve a registry model key into runtime LiteLLM settings.
socrates/config.py:75
↓ 6 callers
Function
load_session
Load a session. Returns (messages, model) or None.
socrates/session.py:55
↓ 6 callers
Method
run
Process one user turn - may involve multiple LLM calls for tool use.
socrates/agent.py:47
↓ 5 callers
Function
save_session
Save conversation to disk. Returns the session id.
socrates/session.py:34
↓ 4 callers
Method
compress
Snip tool outputs first, then summarize old turns if needed.
socrates/context.py:35
↓ 2 callers
Function
_apply_cli_overrides
(config: Config, args: argparse.Namespace)
socrates/cli.py:68
↓ 2 callers
Function
_handle_command
Handle slash commands. Returns True if command was recognized.
socrates/cli.py:173
↓ 2 callers
Function
_new_session_id
()
socrates/session.py:22
↓ 2 callers
Function
_normalize_session_id
(session_id: str | None)
socrates/session.py:13
↓ 2 callers
Method
_print_tool_header
Show a compact header for the tool being executed.
socrates/agent.py:163
↓ 2 callers
Method
_print_tool_result
Print tool output, truncated for display.
socrates/agent.py:181
↓ 2 callers
Method
_search_file
(fpath: str, regex)
socrates/tools/grep_tool.py:97
↓ 2 callers
Function
_session_path
(session_id: str)
socrates/session.py:26
↓ 2 callers
Method
_snip_tool_outputs
Truncate long tool results, keeping head + tail.
socrates/context.py:41
↓ 2 callers
Method
apply_config
Synchronize runtime objects with the current config.
socrates/agent.py:40
↓ 2 callers
Method
from_env
Build config from environment variables.
socrates/config.py:69
↓ 2 callers
Method
get_messages
(self)
socrates/context.py:25
↓ 2 callers
Function
get_tool_schemas
Get OpenAI-format tool schemas for all tools.
socrates/tools/__init__.py:22
↓ 2 callers
Function
list_sessions
List saved sessions with metadata.
socrates/session.py:65
↓ 2 callers
Function
main
()
socrates/cli.py:75
↓ 2 callers
Method
needs_compression
(self)
socrates/context.py:32
↓ 1 callers
Function
_check_dangerous
Return a warning string if the command looks destructive.
socrates/tools/bash.py:27
↓ 1 callers
Method
_execute_tool
Run a single tool call and add the result to context.
socrates/agent.py:112
↓ 1 callers
Method
_execute_tools_parallel
Run multiple tool calls concurrently using threads.
socrates/agent.py:136
↓ 1 callers
Function
_is_binary
Quick null-byte check.
socrates/tools/grep_tool.py:12
↓ 1 callers
Function
_is_binary
Quick check: if the first 512 bytes contain null bytes, it's binary.
socrates/tools/read_file.py:7
↓ 1 callers
Method
_non_streaming
Handle non-streaming responses.
socrates/llm.py:116
↓ 1 callers
Method
_streaming
Handle streaming responses, assembling tool calls from deltas.
socrates/llm.py:62
↓ 1 callers
Method
_summarize_old
Replace old messages with a compressed summary.
socrates/context.py:59
↓ 1 callers
Method
_track_usage
Best-effort token tracking for streaming responses.
socrates/llm.py:153
↓ 1 callers
Function
_unified_diff
Generate a compact unified diff.
socrates/tools/edit_file.py:11
↓ 1 callers
Function
_update_cwd
Track directory changes from cd commands.
socrates/tools/bash.py:35
↓ 1 callers
Method
_walk
Walk dir tree, skipping junk dirs and binary files.
socrates/tools/grep_tool.py:84
↓ 1 callers
Function
build_system_prompt
Generate system prompt with current environment context.
socrates/prompts/system.py:8
↓ 1 callers
Method
chat
Send messages to the LLM and yield response chunks. Yields dicts with keys: - {"type": "text", "content": "..."} for text
socrates/llm.py:29
↓ 1 callers
Method
count_tokens
Count tokens in a message list.
socrates/llm.py:173
↓ 1 callers
Function
parse_args
()
socrates/cli.py:26
↓ 1 callers
Method
reset
Clear everything except the system prompt.
socrates/context.py:89
↓ 1 callers
Method
to_schema
Convert to OpenAI function-calling schema.
socrates/tools/base.py:18
Method
__init__
(self, llm: LLMClient, max_tokens: int, compress_threshold: float = 0.7)
socrates/context.py:16
Method
__init__
(self, model: str, api_base: str | None = None, api_key: str | None = None)
socrates/llm.py:19
Method
__init__
(self, config: Config)
socrates/agent.py:22
Function
_newline
(event)
socrates/cli.py:130
Method
_run_one
(tc)
socrates/agent.py:142
Function
_short_model
Strip the provider prefix for display.
socrates/cli.py:21
Function
_submit
(event)
socrates/cli.py:126
Method
count_tokens
(self, messages)
tests/test_core.py:373
Method
execute
(self, file_path: str, content: str, **kwargs)
socrates/tools/write_file.py:29
Method
execute
(self, pattern: str, path: str = ".", **kwargs)
socrates/tools/glob_tool.py:30
Method
execute
( self, pattern: str, path: str = ".", include: str | None = None, **kwargs )
socrates/tools/grep_tool.py:47
Method
execute
Run the tool and return a string result.
socrates/tools/base.py:14
Method
execute
( self, file_path: str, old_string: str, new_string: str, replace_all: bool = False, **kwargs
socrates/tools/edit_file.py:57
Method
execute
(self, file_path: str, offset: int = 0, limit: int = 2000, **kwargs)
socrates/tools/read_file.py:44
Function
fake_save_session
(messages, model, name=None)
tests/test_core.py:135
Function
test_agent_apply_config_syncs_runtime
()
tests/test_core.py:108
Function
test_agent_resolves_default_config
()
tests/test_core.py:124
Function
test_all_tools_loaded
()
tests/test_core.py:155
Function
test_bash_fork_bomb_blocked
()
tests/test_core.py:464
Function
test_bash_mkfs_blocked
()
tests/test_core.py:459
Function
test_bash_timeout
()
tests/test_core.py:246
Function
test_bash_tool
()
tests/test_core.py:240
Function
test_binary_file_rejected
(tmp_path)
tests/test_core.py:349
Function
test_cd_tracking
(tmp_path)
tests/test_core.py:332
Function
test_config_defaults
()
tests/test_core.py:62
Function
test_config_rejects_unknown_model
()
tests/test_core.py:75
Function
test_config_resolve_registry_key
()
tests/test_core.py:85
Function
test_context_handles_none_content
Assistant messages with content=None should not crash compression.
tests/test_core.py:412
Function
test_context_snip_tool_outputs
Tool outputs longer than threshold should be truncated.
tests/test_core.py:368
Function
test_context_summarize_old
Old messages should be summarized when compress() is called.
tests/test_core.py:390
Function
test_dangerous_command_blocked
()
tests/test_core.py:313
Function
test_dangerous_curl_pipe_blocked
()
tests/test_core.py:319
Function
test_default_session_ids_do_not_collide
(tmp_path, monkeypatch)
tests/test_session.py:5
Function
test_edit_file
(tmp_path)
tests/test_core.py:191
Function
test_edit_file_diff_output
(tmp_path)
tests/test_core.py:200
Function
test_edit_file_not_found
()
tests/test_core.py:214
Function
test_edit_file_unique_check
(tmp_path)
tests/test_core.py:220
Function
test_edit_tracks_changes
(tmp_path)
tests/test_core.py:254
Function
test_gemini_resolves_model_and_context
()
tests/test_core.py:100
Function
test_glob_tool
()
tests/test_core.py:228
Function
test_grep_skips_pycache
Grep should not search inside __pycache__ directories.
tests/test_core.py:448
Function
test_grep_tool
()
tests/test_core.py:234
Function
test_import_socrates_does_not_print_botocore_warning
()
tests/test_core.py:34
Function
test_import_socrates_sets_quiet_litellm_default
()
tests/test_core.py:46
Function
test_list_sessions
()
tests/test_core.py:306
Function
test_model_registry_non_empty
()
tests/test_core.py:149
Function
test_package_init_can_run_as_file
()
tests/test_core.py:23
Function
test_public_api
()
tests/test_core.py:17
Function
test_qwen_uses_dashscope_key_not_openai
(monkeypatch)
tests/test_core.py:92
Function
test_read_file
(tmp_path)
tests/test_core.py:168
Function
test_read_file_not_found
()
tests/test_core.py:177
Function
test_read_file_with_offset_limit
(tmp_path)
tests/test_core.py:436
Function
test_safe_command_not_blocked
()
tests/test_core.py:325
Function
test_save_command_uses_model_key
(monkeypatch)
tests/test_core.py:130
Function
test_session_name_is_sanitized
()
tests/test_core.py:289
Function
test_session_not_found
()
tests/test_core.py:302
Function
test_session_save_load
()
tests/test_core.py:277
Function
test_text_file_not_rejected
(tmp_path)
tests/test_core.py:357
Function
test_tool_schemas
()
tests/test_core.py:159
next →
1–100 of 105, ranked by callers