# API Reference


## Functions


Utility functions


[add_highlight_keyword()](add_highlight_keyword.md#splam.add_highlight_keyword)  
Persist a custom keyword/phrase to highlight class mapping.

[add_user()](add_user.md#splam.add_user)  
Add or replace a user's salted password hash and role.

[attempt_login()](attempt_login.md#splam.attempt_login)  
Verify credentials subject to failed-attempt lockout.

[build_client()](build_client.md#splam.build_client)  
Return a chatlas client seeded with the admin-task notes for `services`.

[chat_available()](chat_available.md#splam.chat_available)  
Return True when the optional `chat` extra is installed.

[doc_columns()](doc_columns.md#splam.doc_columns)  
Return the man page width in columns that fills `width_px` of screen.

[doc_references()](doc_references.md#splam.doc_references)  
Return the URIs listed in the unit's `Documentation=` property.

[get_all_service_info()](get_all_service_info.md#splam.get_all_service_info)  
Return built-in SERVICE_INFO merged with user-saved overrides (overrides win).

[get_documentation()](get_documentation.md#splam.get_documentation)  
Return `systemctl help <service>`: the man pages named by Documentation=.

[get_logs()](get_logs.md#splam.get_logs)  
Return the last `lines` journalctl entries for `service`, newest first.

[get_role()](get_role.md#splam.get_role)  
Return a user's role, or `DEFAULT_ROLE` for records saved before roles existed.

[get_service_info()](get_service_info.md#splam.get_service_info)  
Return admin-task notes for a service, falling back to generic guidance.

[get_status()](get_status.md#splam.get_status)  
Return combined stdout/stderr of `systemctl status <service>`.

[highlight()](highlight.md#splam.highlight)  
Escape `text` and wrap known (and user-added) keywords in colored spans.

[highlight_term()](highlight_term.md#splam.highlight_term)  
Escape `text` and wrap case-insensitive matches of `term` in .

[list_services()](list_services.md#splam.list_services)  
Return sorted service names known to systemd that have admin-task notes.

[load_users()](load_users.md#splam.load_users)  
Load the credentials file, or an empty dict if it doesn't exist yet.

[lockout_remaining()](lockout_remaining.md#splam.lockout_remaining)  
Return whole seconds left on `username`'s lockout, or 0 if it isn't locked.

[record_action()](record_action.md#splam.record_action)  
Append a timestamped audit entry for a service control action.

[record_auth()](record_auth.md#splam.record_auth)  
Append a timestamped audit entry for a login or logout attempt.

[read_audit_log()](read_audit_log.md#splam.read_audit_log)  
Return the most recent audit entries, newest first, optionally filtered by service.

[read_only_tools()](read_only_tools.md#splam.read_only_tools)  
Return the read-only functions a chat client may call.

[redact()](redact.md#splam.redact)  
Replace anything secret-shaped in a shell command line with `[REDACTED]`.

[save_service_info()](save_service_info.md#splam.save_service_info)  
Persist a user-edited admin-task entry for `service`, overriding any built-in entry.

[system_prompt()](system_prompt.md#splam.system_prompt)  
Build a system prompt covering every service discussed so far.

[systemctl_action()](systemctl_action.md#splam.systemctl_action)  
Run `systemctl <action> <service>` and return the completed process.

[verify_user()](verify_user.md#splam.verify_user)  
Check a username/password pair against the stored hash.
