zettelkasten.outline.gather¶
zettelkasten.outline.gather ¶
Outline GATHER helpers (deterministic bundle / section / spine machinery).
Moved verbatim from the former monolithic zettelkasten/outline.py as part
of the package split: the pure helpers that
:func:zettelkasten.outline.gather_outline_material composes into an
:class:~zettelkasten.outline.materials.OutlineMaterial. No LLM, no draft, no
persistence.
narrative_ordering ¶
narrative_ordering(bundles: list[ClaimBundle], edges: list[tuple[str, str, str]], *, year_of: Callable[[str], int | None] | None = None, salience_of: Callable[[str], float] | None = None) -> list[ClaimBundle]
Order a section's units foundations-first, counterclaims nested at target.
A pure function over the bundles and their (src_uid, relation, dst_uid)
structural edges. Ordering rules:
- Foundations first. Lineage edges (
depends-on/extends/derives-from/specializes/prerequisite-of/generalizes) establish a foundation→dependent partial order; a topological pass places every foundation before the units that build on it. - Chronological + salient within a tier. Among units with no ordering
edge between them, the earlier (by
year) comes first, then the more salient, then the uid — so the order is fully deterministic. Undated units sort last within their tier. - Counterclaims nested. A unit that contests another in-section unit
(
contradicts/responds-to/qualifies) is placed immediately after its target rather than floating to a tier of its own.
Cycles are broken safely (the smallest remaining unit by the tie-break key is
emitted). Units absent from bundles are ignored. year_of /
salience_of override the per-bundle attributes (handy for tests).
Source code in zettelkasten/outline/gather.py
667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 | |